GNOME Bugzilla – Bug 698334
Mac top-of-screen menu not working properly
Last modified: 2014-01-24 15:53:15 UTC
This pertains to version 2.0.1 of gtk-mac-integration in its 64-bit version (i.e. the gtkosx_application* functions). gtk-mac-integration lets you populate the Mac's screen-top menu based on menus defined within GTK. That's good, but the screen-top menu doesn't work right in two respects. Since these pproblems are probably closely related I'm filing them as one bug. 1) Latency of response of GTK app: when you select (for example) /Window/Minimize from the top menu nothing happens... until you waggle the mouse; then the GTK app gets the signal. 2) When you open an additional window in the GTK app, this window appears in the listing under the top-level Window menu. So far so good. But when you close the additional window, its entry in the Window is not removed, and if you click on that entry the application segfaults. These problems are apparent with the sample app, test-integration, that is supplied with the gtk-mac-integration package. In case it's relevant: I'm seeing this behavior on OS X 10.6.8, using gtk-quartz built from the 2.24.17 source package using Apple's gcc 4.2.1.
I can replicate both issues.
The delay is caused by the need to put the menu's action on the idle queue to get it processed. The main loop then proceeds to one more iteration before processing the idle queue, and then blocks in poll() until it gets an event from quartz:
+ Trace 231877
The solution is to call g_context_wakeup() in GNSMenuItem activate:, but I need to figure out how to get the context.
*** Bug 700975 has been marked as a duplicate of this bug. ***
And the persistence in the windows menu comes from 1ad25dfb, which was intended to fix bug 647108. In that change Kris moved the [autoreleasepool drain] from gdk_event_check() to gdk_event_dispatch(). As a guess this keeps the NSWindow in memory just long enough that NSApp doesn't see that it's to be destroyed. One work-around would be to call [NSApp removeWindowsItem: nswindow] in gdk_window_impl_quartz_finalize(). Created quartz bug 701571 to track fix.
I've committed a change for the delay problem: It just puts a GDK_NOTHING event to unblock the mainloop so that it will process the idle event with the action callback.
This part of the 701571 problem is also fixed and released in 3.10.0
*** Bug 669276 has been marked as a duplicate of this bug. ***