Cross-platform Gtk3 app, menu bar unresponsive at first

Viewed 121

I'm writing a cross-platform Gtk3 application in C++. Lately I've been working on the integration with MacOS:

  • Gtkmm 3.24 obtained via Homebrew;
  • XCode 12.0;
  • MacOS Catalina 10.15.

I have derived my application class from Gtk::Application. The application object overrides the 'on_startup()' which calls the base class 'on_startup() and then uses a Gtk builder resource to construct a Gio::Menu object from an XML file, and then 'Gtk::Application::set_app_menu()' to install it:

MyApplication::on_startup()
{
  Gtk::Application::on_startup();

  // skipping details: ... Gtk builder reads Gio::Menu object from resource file ...
  set_app_menu( pMenu );
}

When I first launch my application:

  • the menu bar is unresponsive. The application menu appears next to the Apple menu in the bar at the top of the screen, but neither responds to mouse clicks;
  • except from the frozen menu bar, the application is functioning normally and its main window is responsive.

However, then:

  • click on any other open application's window, that application's menu bar appears;
  • click on my application's window to switch back to it, its menu bar returns and now works perfectly.

This is 100% reproducible (frozen at first, toggle away to another app and back and now the menu works).

I created another project in XCode and built the Gtkmm example "app_and_win_menus" and the example application behaves the exact same way.

So I think I'm really just looking for a workaround. I've been scouring the net for any information about this problem and saw others complaining generally about frozen menu bars on MacOS but none specific to Gtk (all other applications on this Mac work normally, it's only the apps that I build with Gtk+/Gtkmm 3.24 that exhibit this issue).

I realize this sounds a bit like a bug report and this may not be the place to bring it up, but I'm unsure where to go from here. Any information much appreciated.

0 Answers
Related