modial dialog don't disable mouse motion, enter, and leave events
Closes PR 11599 This is an API change relative to gr1, but it seems sensible, and it makes enter and leave events more reliable and easier to implement. original commit: f1e13a7921d7a8890376773f2705feb02bb165e8
This commit is contained in:
parent
08dbf9be69
commit
8744d5c5b5
|
@ -675,7 +675,7 @@
|
||||||
(dispatch-on-event e #f))
|
(dispatch-on-event e #f))
|
||||||
(define/public (dispatch-on-event e just-pre?)
|
(define/public (dispatch-on-event e just-pre?)
|
||||||
(cond
|
(cond
|
||||||
[(other-modal? this) #t]
|
[(other-modal? this e) #t]
|
||||||
[(call-pre-on-event this e) #t]
|
[(call-pre-on-event this e) #t]
|
||||||
[just-pre? block-all-mouse-events?]
|
[just-pre? block-all-mouse-events?]
|
||||||
[else (when enabled? (on-event e)) #t]))
|
[else (when enabled? (on-event e)) #t]))
|
||||||
|
|
|
@ -462,8 +462,17 @@
|
||||||
(hash-map (eventspace-frames-hash e)
|
(hash-map (eventspace-frames-hash e)
|
||||||
(lambda (k v) k)))
|
(lambda (k v) k)))
|
||||||
|
|
||||||
(define (other-modal? win)
|
(define (other-modal? win [e #f])
|
||||||
;; called in atomic mode in eventspace's thread
|
;; called in atomic mode in eventspace's thread
|
||||||
|
(and
|
||||||
|
;; deliver mouse-motion events even if a modal window
|
||||||
|
;; is open
|
||||||
|
(or (not e)
|
||||||
|
(not (or (send e leaving?)
|
||||||
|
(send e entering?)
|
||||||
|
(send e moving?))))
|
||||||
|
;; for any other kind of mouse or key event, deliver only
|
||||||
|
;; if no model dialog is open
|
||||||
(let ([es (send win get-eventspace)])
|
(let ([es (send win get-eventspace)])
|
||||||
(or (positive? (eventspace-external-modal es))
|
(or (positive? (eventspace-external-modal es))
|
||||||
(let loop ([frames (get-top-level-windows es)])
|
(let loop ([frames (get-top-level-windows es)])
|
||||||
|
@ -472,7 +481,7 @@
|
||||||
(case status
|
(case status
|
||||||
[(#f) (loop (cdr frames))]
|
[(#f) (loop (cdr frames))]
|
||||||
[(same) #f]
|
[(same) #f]
|
||||||
[(other) #t])))))))
|
[(other) #t]))))))))
|
||||||
|
|
||||||
(define (eventspace-adjust-external-modal! es amt)
|
(define (eventspace-adjust-external-modal! es amt)
|
||||||
(atomically
|
(atomically
|
||||||
|
|
|
@ -581,7 +581,7 @@
|
||||||
(define/public (dispatch-on-event e just-pre?)
|
(define/public (dispatch-on-event e just-pre?)
|
||||||
(pre-event-refresh)
|
(pre-event-refresh)
|
||||||
(cond
|
(cond
|
||||||
[(other-modal? this) #t]
|
[(other-modal? this e) #t]
|
||||||
[(call-pre-on-event this e) #t]
|
[(call-pre-on-event this e) #t]
|
||||||
[just-pre? #f]
|
[just-pre? #f]
|
||||||
[else (when enabled? (on-event e)) #t]))
|
[else (when enabled? (on-event e)) #t]))
|
||||||
|
|
|
@ -637,7 +637,7 @@
|
||||||
(dispatch-on-event e #f))
|
(dispatch-on-event e #f))
|
||||||
(define/public (dispatch-on-event e just-pre?)
|
(define/public (dispatch-on-event e just-pre?)
|
||||||
(cond
|
(cond
|
||||||
[(other-modal? this) #t]
|
[(other-modal? this e) #t]
|
||||||
[(call-pre-on-event this e) #t]
|
[(call-pre-on-event this e) #t]
|
||||||
[just-pre? #f]
|
[just-pre? #f]
|
||||||
[else (when (is-enabled-to-root?) (on-event e)) #t]))
|
[else (when (is-enabled-to-root?) (on-event e)) #t]))
|
||||||
|
|
|
@ -4,11 +4,8 @@
|
||||||
@defclass/title[dialog% object% (top-level-window<%>)]{
|
@defclass/title[dialog% object% (top-level-window<%>)]{
|
||||||
|
|
||||||
A dialog is a top-level window that is @defterm{modal}: while the
|
A dialog is a top-level window that is @defterm{modal}: while the
|
||||||
dialog is shown, all other top-level windows in the dialog's
|
dialog is shown, key and mouse press/release events are disabled for
|
||||||
eventspace are disabled.
|
all other top-level windows in the dialog's eventspace.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@defconstructor[([label label-string?]
|
@defconstructor[([label label-string?]
|
||||||
[parent (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c) #f]
|
[parent (or/c (is-a?/c frame%) (is-a?/c dialog%) false/c) #f]
|
||||||
|
|
|
@ -809,11 +809,11 @@ An @deftech{eventspace} is a context for processing GUI
|
||||||
handle events while the dialog is shown. (See also
|
handle events while the dialog is shown. (See also
|
||||||
@secref["espacethreads"] for information about threads and modal
|
@secref["espacethreads"] for information about threads and modal
|
||||||
dialogs.) Furthermore, when a modal dialog is shown, the system
|
dialogs.) Furthermore, when a modal dialog is shown, the system
|
||||||
disables all other top-level windows in the dialog's eventspace, but
|
disables key and mouse press/release events to other top-level
|
||||||
|
windows in the dialog's eventspace, but
|
||||||
windows in other eventspaces are unaffected by the modal dialog.
|
windows in other eventspaces are unaffected by the modal dialog.
|
||||||
(Disabling a window prevents mouse and keyboard events from reaching
|
(Mouse motion, enter, and leave events are still delivered to
|
||||||
the window, but other kinds of events, such as update events, are
|
all windows when a modal dialog is shown.)
|
||||||
still delivered.)
|
|
||||||
|
|
||||||
|
|
||||||
@subsection{Event Types and Priorities}
|
@subsection{Event Types and Priorities}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user