editor<%>: request incremental GC on key & mouse events

This commit is contained in:
Matthew Flatt 2015-12-19 11:54:50 -07:00
parent 446df9e047
commit d170a8ff31
3 changed files with 15 additions and 2 deletions

View File

@ -464,6 +464,7 @@
(case (and (positive? wheel-amt)
code)
[(wheel-up wheel-down)
(collect-garbage 'incremental)
(when (and allow-y-scroll?
(not fake-y-scroll?))
(let-boxes ([x 0]
@ -478,6 +479,7 @@
0)])
(do-scroll x y #t x old-y))))]
[(wheel-left wheel-right)
(collect-garbage 'incremental)
(when (and allow-x-scroll?
(not fake-x-scroll?))
(let-boxes ([x 0]

View File

@ -249,6 +249,11 @@
(def/override (on-event [mouse-event% event])
(when s-admin
(when (and (not (send event moving?))
(not (send event entering?))
(not (send event leaving?)))
;; Request incremental mode to improve interactivity:
(collect-garbage 'incremental))
(let-values ([(dc x y scrollx scrolly)
;; first, find clicked-on snip:
(let ([x (send event get-x)]
@ -404,6 +409,8 @@
(def/override (on-char [key-event% event])
(when s-admin
;; Request incremental mode to improve interactivity:
(collect-garbage 'incremental)
(let-boxes ([scrollx 0.0]
[scrolly 0.0]
[dc #f])

View File

@ -452,7 +452,9 @@
(when (and (not (send event moving?))
(not (send event entering?))
(not (send event leaving?)))
(end-streaks '(except-key-sequence cursor delayed)))
(end-streaks '(except-key-sequence cursor delayed))
;; Request incremental mode to improve interactivity:
(collect-garbage 'incremental))
(let-values ([(dc x y scrollx scrolly)
;; first, find clicked-on snip:
(let ([x (send event get-x)]
@ -600,7 +602,9 @@
(not (eq? 'control code))
(not (eq? 'menu code))
(not (equal? code #\nul)))
(hide-cursor))
(hide-cursor)
;; Request incremental mode to improve interactivity:
(collect-garbage 'incremental))
(on-local-char event)))))
(def/override (on-default-char [key-event% event])