Skip to content

Instantly share code, notes, and snippets.

@samm-git
Last active January 9, 2020 23:53
Show Gist options
  • Save samm-git/9e0e35fa6f4650a6def873239bbeaea5 to your computer and use it in GitHub Desktop.
Save samm-git/9e0e35fa6f4650a6def873239bbeaea5 to your computer and use it in GitHub Desktop.
gui.c.patch
--- app/gui/gui.c 2020-01-10 00:49:12.000000000 +0100
+++ app/gui/gui.c 2020-01-10 00:49:56.000000000 +0100
@@ -628,63 +628,6 @@
gimp_action_history_init (gimp);
-#ifdef GDK_WINDOWING_QUARTZ
- {
- GtkosxApplication *osx_app;
- GtkWidget *menu;
- GtkWidget *item;
-
- [[NSUserDefaults standardUserDefaults] setObject:@"NO"
- forKey:@"NSTreatUnknownArgumentsAsOpen"];
-
- osx_app = gtkosx_application_get ();
-
- menu = gimp_ui_manager_get_widget (image_ui_manager,
- "/image-menubar");
- if (GTK_IS_MENU_ITEM (menu))
- menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
-
- /* do not activate OSX menu if tests are running */
- if (!getenv("GIMP_TESTING_ABS_TOP_SRCDIR"))
- gtkosx_application_set_menu_bar (osx_app, GTK_MENU_SHELL (menu));
-
- gtkosx_application_set_use_quartz_accelerators (osx_app, FALSE);
-
- gui_add_to_app_menu (image_ui_manager, osx_app,
- "/image-menubar/Help/dialogs-about", 0);
- gui_add_to_app_menu (image_ui_manager, osx_app,
- "/image-menubar/Help/dialogs-search-action", 1);
-
-#define PREFERENCES "/image-menubar/Edit/Preferences/"
-
- gui_add_to_app_menu (image_ui_manager, osx_app,
- PREFERENCES "dialogs-preferences", 3);
- gui_add_to_app_menu (image_ui_manager, osx_app,
- PREFERENCES "dialogs-input-devices", 4);
- gui_add_to_app_menu (image_ui_manager, osx_app,
- PREFERENCES "dialogs-keyboard-shortcuts", 5);
- gui_add_to_app_menu (image_ui_manager, osx_app,
- PREFERENCES "dialogs-module-dialog", 6);
- gui_add_to_app_menu (image_ui_manager, osx_app,
- PREFERENCES "plug-in-unit-editor", 7);
-
-#undef PREFERENCES
-
- item = gtk_separator_menu_item_new ();
- gtkosx_application_insert_app_menu_item (osx_app, item, 8);
-
- item = gimp_ui_manager_get_widget (image_ui_manager,
- "/image-menubar/File/file-quit");
- gtk_widget_hide (item);
-
- g_signal_connect (osx_app, "NSApplicationBlockTermination",
- G_CALLBACK (gui_quartz_quit_callback),
- image_ui_manager);
-
- gtkosx_application_ready (osx_app);
- }
-#endif /* GDK_WINDOWING_QUARTZ */
-
g_signal_connect_object (gui_config, "notify::single-window-mode",
G_CALLBACK (gui_single_window_mode_notify),
ui_configurer, 0);
@@ -724,6 +667,64 @@
/* move keyboard focus to the display */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+ #ifdef GDK_WINDOWING_QUARTZ
+ {
+ GtkosxApplication *osx_app;
+ GtkWidget *menu;
+ GtkWidget *item;
+
+ [[NSUserDefaults standardUserDefaults] setObject:@"NO"
+ forKey:@"NSTreatUnknownArgumentsAsOpen"];
+
+ osx_app = gtkosx_application_get ();
+
+ menu = gimp_ui_manager_get_widget (image_ui_manager,
+ "/image-menubar");
+ gtk_widget_set_parent(menu, toplevel);
+
+ if (GTK_IS_MENU_ITEM (menu))
+ menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
+
+ /* do not activate OSX menu if tests are running */
+ if (!getenv("GIMP_TESTING_ABS_TOP_SRCDIR"))
+ gtkosx_application_set_menu_bar (osx_app, GTK_MENU_SHELL (menu));
+
+ gtkosx_application_set_use_quartz_accelerators (osx_app, FALSE);
+
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ "/image-menubar/Help/dialogs-about", 0);
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ "/image-menubar/Help/dialogs-search-action", 1);
+
+ #define PREFERENCES "/image-menubar/Edit/Preferences/"
+
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ PREFERENCES "dialogs-preferences", 3);
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ PREFERENCES "dialogs-input-devices", 4);
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ PREFERENCES "dialogs-keyboard-shortcuts", 5);
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ PREFERENCES "dialogs-module-dialog", 6);
+ gui_add_to_app_menu (image_ui_manager, osx_app,
+ PREFERENCES "plug-in-unit-editor", 7);
+
+ #undef PREFERENCES
+
+ item = gtk_separator_menu_item_new ();
+ gtkosx_application_insert_app_menu_item (osx_app, item, 8);
+
+ item = gimp_ui_manager_get_widget (image_ui_manager,
+ "/image-menubar/File/file-quit");
+ gtk_widget_hide (item);
+
+ g_signal_connect (osx_app, "NSApplicationBlockTermination",
+ G_CALLBACK (gui_quartz_quit_callback),
+ image_ui_manager);
+
+ gtkosx_application_ready (osx_app);
+ }
+ #endif /* GDK_WINDOWING_QUARTZ */
gtk_window_present (GTK_WINDOW (toplevel));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment