diff --git a/pkgs/gui-pkgs/gui-doc/scribblings/gui/system-menu-funcs.scrbl b/pkgs/gui-pkgs/gui-doc/scribblings/gui/system-menu-funcs.scrbl index 9436a4d3df..c331b1832b 100644 --- a/pkgs/gui-pkgs/gui-doc/scribblings/gui/system-menu-funcs.scrbl +++ b/pkgs/gui-pkgs/gui-doc/scribblings/gui/system-menu-funcs.scrbl @@ -67,10 +67,10 @@ When the current eventspace is the initial eventspace, this procedure The default handler queues a callback to the @method[window<%> on-drop-file] method of the most-recently activated frame in the main eventspace (see -@racket[get-top-level-edit-target-window]), if +@racket[get-top-level-edit-target-window]), if any such frame exists and if drag-and-drop is enabled for that frame. Otherwise, it saves the filename and re-queues the handler event when the application - file handler is later changed. + file handler is later changed or when a frame becomes active. On Windows, when the application is @italic{not} running and user double-clicks an application-handled file or drags a file onto the application's icon, diff --git a/pkgs/gui-pkgs/gui-lib/mred/private/app.rkt b/pkgs/gui-pkgs/gui-lib/mred/private/app.rkt index c4a66e66ce..e70d76a5a7 100644 --- a/pkgs/gui-pkgs/gui-lib/mred/private/app.rkt +++ b/pkgs/gui-pkgs/gui-lib/mred/private/app.rkt @@ -117,7 +117,9 @@ (lambda () (if (send af accept-drag?) (send af on-drop-file f) (set! saved-files (cons f saved-files)))))) - (set! saved-files (cons f saved-files))))))) + (begin + (add-active-frame-callback! requeue-saved-files) + (set! saved-files (cons f saved-files)))))))) (define (requeue-saved-files) (as-entry diff --git a/pkgs/gui-pkgs/gui-lib/mred/private/wxtop.rkt b/pkgs/gui-pkgs/gui-lib/mred/private/wxtop.rkt index 090cc0bba0..4587579279 100644 --- a/pkgs/gui-pkgs/gui-lib/mred/private/wxtop.rkt +++ b/pkgs/gui-pkgs/gui-lib/mred/private/wxtop.rkt @@ -13,7 +13,8 @@ "wxcontainer.rkt") (provide (protect-out active-main-frame - set-root-menu-wx-frame!) + set-root-menu-wx-frame! + add-active-frame-callback!) get-display-size get-display-left-top-inset get-display-count @@ -24,6 +25,10 @@ ;; Weak boxed: (define active-main-frame (make-weak-box #f)) + + (define active-frame-callbacks null) + (define (add-active-frame-callback! cb) + (set! active-frame-callbacks (cons cb active-frame-callbacks))) (define root-menu-wx-frame #f) (define (set-root-menu-wx-frame! f) @@ -633,7 +638,10 @@ (when (and (wx:main-eventspace? (get-eventspace)) (not (eq? this root-menu-wx-frame)) (not floating-window?)) - (set! active-main-frame (make-weak-box this)))) + (set! active-main-frame (make-weak-box this)) + (let ([cbs (reverse active-frame-callbacks)]) + (set! active-frame-callbacks null) + (for ([cb (in-list cbs)]) (cb))))) ;; Send refresh to subwindows that need it (set! activate-refresh-wins (filter weak-box-value activate-refresh-wins)) (for-each (lambda (b)