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
This commit is contained in:
Matthew Flatt 2011-07-25 09:57:50 -04:00
parent b0ea1efc9e
commit 69f7e912d2

View File

@ -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)])