mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make sure Subsurface receives Quit / Command-Q callback on Mac
As usual, things work slightly different on Mac. Quartz delivers some (but not all) accelerator notifications differently. Command-Q and Subsurface->Quit now work on Mac as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1afe36840d
commit
1ae4b80027
3 changed files with 11 additions and 1 deletions
|
@ -49,6 +49,7 @@ extern const char *subsurface_USB_name(void);
|
|||
extern const char *subsurface_icon_name(void);
|
||||
extern void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||
GtkWidget *vbox, GtkUIManager *ui_manager);
|
||||
extern void quit(GtkWidget *w, gpointer data);
|
||||
|
||||
extern visible_cols_t visible_cols;
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ static void on_destroy(GtkWidget* w, gpointer data)
|
|||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void quit(GtkWidget *w, gpointer data)
|
||||
void quit(GtkWidget *w, gpointer data)
|
||||
{
|
||||
/* Make sure to flush any modified dive data */
|
||||
update_dive(NULL);
|
||||
|
|
9
macos.c
9
macos.c
|
@ -104,6 +104,12 @@ const char *subsurface_default_filename()
|
|||
}
|
||||
}
|
||||
|
||||
static void show_main_window(GtkWidget *w, gpointer data)
|
||||
{
|
||||
gtk_widget_show(main_window);
|
||||
gtk_window_present(GTK_WINDOW(main_window));
|
||||
}
|
||||
|
||||
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||
GtkWidget *vbox, GtkUIManager *ui_manager)
|
||||
{
|
||||
|
@ -141,5 +147,8 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|||
gtk_osxapplication_insert_app_menu_item (osx_app, sep, 3);
|
||||
|
||||
gtk_osxapplication_set_use_quartz_accelerators(osx_app, TRUE);
|
||||
g_signal_connect(osx_app,"NSApplicationDidBecomeActive",G_CALLBACK(show_main_window),NULL);
|
||||
g_signal_connect(osx_app,"NSApplicationWillTerminate",G_CALLBACK(quit),NULL);
|
||||
|
||||
gtk_osxapplication_ready(osx_app);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue