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.
This commit is contained in:
parent
e64c99f7a3
commit
f1e13a7921
|
@ -675,7 +675,7 @@
|
|||
(dispatch-on-event e #f))
|
||||
(define/public (dispatch-on-event e just-pre?)
|
||||
(cond
|
||||
[(other-modal? this) #t]
|
||||
[(other-modal? this e) #t]
|
||||
[(call-pre-on-event this e) #t]
|
||||
[just-pre? block-all-mouse-events?]
|
||||
[else (when enabled? (on-event e)) #t]))
|
||||
|
|
|
@ -462,17 +462,26 @@
|
|||
(hash-map (eventspace-frames-hash e)
|
||||
(lambda (k v) k)))
|
||||
|
||||
(define (other-modal? win)
|
||||
(define (other-modal? win [e #f])
|
||||
;; called in atomic mode in eventspace's thread
|
||||
(let ([es (send win get-eventspace)])
|
||||
(or (positive? (eventspace-external-modal es))
|
||||
(let loop ([frames (get-top-level-windows es)])
|
||||
(and (pair? frames)
|
||||
(let ([status (send (car frames) frame-relative-dialog-status win)])
|
||||
(case status
|
||||
[(#f) (loop (cdr frames))]
|
||||
[(same) #f]
|
||||
[(other) #t])))))))
|
||||
(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)])
|
||||
(or (positive? (eventspace-external-modal es))
|
||||
(let loop ([frames (get-top-level-windows es)])
|
||||
(and (pair? frames)
|
||||
(let ([status (send (car frames) frame-relative-dialog-status win)])
|
||||
(case status
|
||||
[(#f) (loop (cdr frames))]
|
||||
[(same) #f]
|
||||
[(other) #t]))))))))
|
||||
|
||||
(define (eventspace-adjust-external-modal! es amt)
|
||||
(atomically
|
||||
|
|
|
@ -581,7 +581,7 @@
|
|||
(define/public (dispatch-on-event e just-pre?)
|
||||
(pre-event-refresh)
|
||||
(cond
|
||||
[(other-modal? this) #t]
|
||||
[(other-modal? this e) #t]
|
||||
[(call-pre-on-event this e) #t]
|
||||
[just-pre? #f]
|
||||
[else (when enabled? (on-event e)) #t]))
|
||||
|
|
|
@ -637,7 +637,7 @@
|
|||
(dispatch-on-event e #f))
|
||||
(define/public (dispatch-on-event e just-pre?)
|
||||
(cond
|
||||
[(other-modal? this) #t]
|
||||
[(other-modal? this e) #t]
|
||||
[(call-pre-on-event this e) #t]
|
||||
[just-pre? #f]
|
||||
[else (when (is-enabled-to-root?) (on-event e)) #t]))
|
||||
|
|
|
@ -4,11 +4,8 @@
|
|||
@defclass/title[dialog% object% (top-level-window<%>)]{
|
||||
|
||||
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
|
||||
eventspace are disabled.
|
||||
|
||||
|
||||
|
||||
dialog is shown, key and mouse press/release events are disabled for
|
||||
all other top-level windows in the dialog's eventspace.
|
||||
|
||||
@defconstructor[([label label-string?]
|
||||
[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
|
||||
@secref["espacethreads"] for information about threads and modal
|
||||
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.
|
||||
(Disabling a window prevents mouse and keyboard events from reaching
|
||||
the window, but other kinds of events, such as update events, are
|
||||
still delivered.)
|
||||
(Mouse motion, enter, and leave events are still delivered to
|
||||
all windows when a modal dialog is shown.)
|
||||
|
||||
|
||||
@subsection{Event Types and Priorities}
|
||||
|
|
Loading…
Reference in New Issue
Block a user