gtk: fix button enable when mouse is over button

original commit: 49903be78fb4b0d9ad297b2b792775bf1d9762d9
This commit is contained in:
Matthew Flatt 2011-04-15 16:54:22 -06:00
parent 2d275e014c
commit 2273e70c10

View File

@ -300,11 +300,12 @@
(if crossing? (if crossing?
(GdkEventCrossing-type event) (GdkEventCrossing-type event)
(GdkEventButton-type event)))]) (GdkEventButton-type event)))])
(unless (or (= type GDK_2BUTTON_PRESS)
(= type GDK_3BUTTON_PRESS))
(let ([wx (gtk->wx gtk)]) (let ([wx (gtk->wx gtk)])
(and (and
wx wx
(if (or (= type GDK_2BUTTON_PRESS)
(= type GDK_3BUTTON_PRESS))
#t
(let* ([modifiers (if motion? (let* ([modifiers (if motion?
(GdkEventMotion-state event) (GdkEventMotion-state event)
(if crossing? (if crossing?
@ -365,7 +366,16 @@
(constrained-reply (send wx get-eventspace) (constrained-reply (send wx get-eventspace)
(lambda () (or (send wx dispatch-on-event m #t) (lambda () (or (send wx dispatch-on-event m #t)
(send wx internal-pre-on-event gtk m))) (send wx internal-pre-on-event gtk m)))
#t)))))))) #t
#:fail-result
;; an enter event is synthesized when a button is
;; enabled and the mouse is over the button, and the
;; event is not dispatched via the eventspace; leave
;; events are perhaps similarly synthesized, so allow
;; them, too
(if (or (eq? type 'enter) (eq? type 'leave))
#f
#t)))))))))
;; ---------------------------------------- ;; ----------------------------------------