From 69f7e912d2bffd638123475ce0041e6188ab5f02 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 25 Jul 2011 09:57:50 -0400 Subject: [PATCH] cocoa: fix problems with sheets and focus Avoids a problem with the file dialog when a sheet is the current "main window" (Cocoa terminology); when the file dialog is closed, both the sheet owner and the sheet become the main window (in that order), so that when the sheet goes away, the sheet owner doesn't become the main window as it should. It seems like a Cocoa problem. The workaround is to hook into the callback that says a sheet went away. Closes PR 12073 --- collects/mred/private/wx/cocoa/frame.rkt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/collects/mred/private/wx/cocoa/frame.rkt b/collects/mred/private/wx/cocoa/frame.rkt index d623cd6353..37d5768db2 100644 --- a/collects/mred/private/wx/cocoa/frame.rkt +++ b/collects/mred/private/wx/cocoa/frame.rkt @@ -119,6 +119,13 @@ (let ([wx (->wx wxb)]) (when wx (send wx force-window-focus))))] + [-a _void (windowDidEndSheet: [_id notification]) + ;; In some cases, the window that has a sheet + ;; stays main even as its sheet becomes main, so + ;; we need to make the containing window become main + ;; when the sheet goes away. + (when (equal? self (tell app mainWindow)) + (tell self windowDidBecomeMain: notification))] [-a _void (toggleToolbarShown: [_id sender]) (when wxb (let ([wx (->wx wxb)])