From b4ef9a09a9d9b76e2736941e8724160afdf6b0a6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 3 Sep 2011 10:06:20 -0600 Subject: [PATCH] cocoa: fix menu when two layers of dialogs are dismissed --- collects/mred/private/wx/cocoa/frame.rkt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index dc54e9d969..ef26252a88 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -86,6 +86,19 @@ (when wxb (let ([wx (->wx wxb)]) (when wx + ;; Sometimes, a sheet becomes the main window and the parent + ;; still thinks that the parent is the main window. Tell + ;; the parent otherwise. + (let ([p (send wx get-parent)]) + (when p + (let ([s (send p get-sheet)]) + (when (eq? s wx) + (let ([parent (send p get-cocoa)]) + (when (tell #:type _BOOL parent isMainWindow) + ;; The Cocoa docs say never to call this method directly, + ;; but we're trying to fix up a case where Cocoa seems + ;; to be confused: + (tellv parent resignMainWindow))))))) (set! front wx) (send wx install-wait-cursor) (send wx install-mb) @@ -344,7 +357,8 @@ (define/public (force-window-focus) (let ([next (get-app-front-window)]) (cond - [next (tellv next makeKeyWindow)] + [next + (tellv next makeKeyWindow)] [root-fake-frame ;; Make key focus shift to root frame: (let ([root-cocoa (send root-fake-frame get-cocoa)])