gtk: smoother editor-canvas resize
- call `on-size' on setting the canvas size, like Win32 and Cocoa, which mainly shows/hides auto-shown scrollbars more on time (e.g., DrRacket doesn't start with horizontal scrollbars that immediately disappear) - switch mouse tracking to "hint" mode, instead of catching every single mouse position - when queueing `on-size' methos in response to client-size changes, cancel and queued but undelivered calls; in the case of editor canvases, this doesn't really have an effect, due to the other `on-size' call Closes PR 11369, hopefully
This commit is contained in:
parent
8ae72bc29c
commit
85951bf665
|
@ -457,6 +457,7 @@
|
||||||
(reset-auto-scroll 0 0))
|
(reset-auto-scroll 0 0))
|
||||||
(on-size))
|
(on-size))
|
||||||
|
|
||||||
|
;; this `on-size' method is for `editor-canvas%', only:
|
||||||
(define/public (on-size) (void))
|
(define/public (on-size) (void))
|
||||||
|
|
||||||
(define/public (show-scrollbars h? v?)
|
(define/public (show-scrollbars h? v?)
|
||||||
|
|
|
@ -239,7 +239,7 @@
|
||||||
[ignored-name #f]
|
[ignored-name #f]
|
||||||
[gl-config #f])
|
[gl-config #f])
|
||||||
|
|
||||||
(inherit get-gtk set-size get-size get-client-size
|
(inherit get-gtk get-size get-client-size
|
||||||
get-top-win
|
get-top-win
|
||||||
set-auto-size
|
set-auto-size
|
||||||
adjust-client-delta infer-client-delta
|
adjust-client-delta infer-client-delta
|
||||||
|
@ -336,6 +336,10 @@
|
||||||
(list client-gtk))))])
|
(list client-gtk))))])
|
||||||
|
|
||||||
(set-size x y w h)
|
(set-size x y w h)
|
||||||
|
|
||||||
|
(define/override (set-size x y w h)
|
||||||
|
(super set-size x y w h)
|
||||||
|
(on-size))
|
||||||
|
|
||||||
(define dc (new dc% [canvas this] [transparent? (memq 'transparent style)]))
|
(define dc (new dc% [canvas this] [transparent? (memq 'transparent style)]))
|
||||||
|
|
||||||
|
@ -361,7 +365,7 @@
|
||||||
GDK_KEY_RELEASE_MASK
|
GDK_KEY_RELEASE_MASK
|
||||||
GDK_BUTTON_PRESS_MASK
|
GDK_BUTTON_PRESS_MASK
|
||||||
GDK_BUTTON_RELEASE_MASK
|
GDK_BUTTON_RELEASE_MASK
|
||||||
GDK_POINTER_MOTION_MASK
|
GDK_POINTER_MOTION_HINT_MASK
|
||||||
GDK_FOCUS_CHANGE_MASK
|
GDK_FOCUS_CHANGE_MASK
|
||||||
GDK_ENTER_NOTIFY_MASK
|
GDK_ENTER_NOTIFY_MASK
|
||||||
GDK_LEAVE_NOTIFY_MASK))
|
GDK_LEAVE_NOTIFY_MASK))
|
||||||
|
@ -486,6 +490,7 @@
|
||||||
(define/override (on-client-size w h)
|
(define/override (on-client-size w h)
|
||||||
(on-size))
|
(on-size))
|
||||||
|
|
||||||
|
;; this `on-size' method is for `editor-canvas%', only:
|
||||||
(define/public (on-size) (void))
|
(define/public (on-size) (void))
|
||||||
|
|
||||||
(define/public (show-scrollbars h? v?)
|
(define/public (show-scrollbars h? v?)
|
||||||
|
|
|
@ -36,13 +36,19 @@
|
||||||
|
|
||||||
(define/public (on-client-size w h) (void))
|
(define/public (on-client-size w h) (void))
|
||||||
|
|
||||||
|
(define client-size-key #f)
|
||||||
|
|
||||||
(define/public (save-client-size x y w h)
|
(define/public (save-client-size x y w h)
|
||||||
;; Called in the Gtk event-loop thread
|
;; Called in the Gtk event-loop thread
|
||||||
(set! client-x x)
|
(set! client-x x)
|
||||||
(set! client-y y)
|
(set! client-y y)
|
||||||
(queue-window-event this (lambda ()
|
(when client-size-key (set-box! client-size-key #f))
|
||||||
(internal-on-client-size w h)
|
(let ([key (box #t)])
|
||||||
(on-client-size w h))))
|
(set! client-size-key key)
|
||||||
|
(queue-window-event this (lambda ()
|
||||||
|
(when (unbox key)
|
||||||
|
(internal-on-client-size w h)
|
||||||
|
(on-client-size w h))))))
|
||||||
|
|
||||||
(define/public (internal-on-client-size w h)
|
(define/public (internal-on-client-size w h)
|
||||||
(void))
|
(void))
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
(connect-key-and-mouse gtk)
|
(connect-key-and-mouse gtk)
|
||||||
(gtk_widget_add_events gtk (bitwise-ior GDK_BUTTON_PRESS_MASK
|
(gtk_widget_add_events gtk (bitwise-ior GDK_BUTTON_PRESS_MASK
|
||||||
GDK_BUTTON_RELEASE_MASK
|
GDK_BUTTON_RELEASE_MASK
|
||||||
GDK_POINTER_MOTION_MASK
|
GDK_POINTER_MOTION_HINT_MASK
|
||||||
GDK_FOCUS_CHANGE_MASK
|
GDK_FOCUS_CHANGE_MASK
|
||||||
GDK_ENTER_NOTIFY_MASK
|
GDK_ENTER_NOTIFY_MASK
|
||||||
GDK_LEAVE_NOTIFY_MASK))
|
GDK_LEAVE_NOTIFY_MASK))
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
(MoveWindow combo-hwnd 0 0 (max 1 w) (- h 2) #t)))
|
(MoveWindow combo-hwnd 0 0 (max 1 w) (- h 2) #t)))
|
||||||
(on-size))
|
(on-size))
|
||||||
|
|
||||||
|
;; this `on-size' method is for `editor-canvas%', only:
|
||||||
(define/public (on-size) (void))
|
(define/public (on-size) (void))
|
||||||
|
|
||||||
;; The `queue-paint' and `paint-children' methods
|
;; The `queue-paint' and `paint-children' methods
|
||||||
|
|
Loading…
Reference in New Issue
Block a user