From: H.G.Muller Date: Thu, 30 Oct 2014 14:01:59 +0000 (+0100) Subject: Connect OSX Quit menu to ExitEvent X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=6acbc7c2c7d25c4a1fd6b40212cd7515333cfebd Connect OSX Quit menu to ExitEvent The Quit menu item provided by OSX was not equivalent to the original XBoard menu item, as it did not automatically call ExitEvent. (Which closing the window did.) This meant a hard kill, without saving settings or the last game, and not properly shutting down the engine(s). We now catch the OSX 'WillTerminate' event to perform these tasks. --- diff --git a/gtk/xboard.c b/gtk/xboard.c index a8afcb3..8a2b887 100644 --- a/gtk/xboard.c +++ b/gtk/xboard.c @@ -890,6 +890,7 @@ main (int argc, char **argv) snprintf(svgDir, MSG_SIZ, "%s/themes/default", dataDir); suppress = (argc == 1 || argc > 1 && argv[1][00] != '-'); // OSX sends signal even if name was already argv[1]! g_signal_connect(theApp, "NSApplicationOpenFile", G_CALLBACK(StartNewXBoard), NULL); + g_signal_connect(theApp, "NSApplicationWillTerminate", G_CALLBACK(ExitEvent), NULL); // we must call application ready before we can get the signal, // and supply a (dummy) menu bar before that, to avoid problems with dual apples in it gtkosx_application_set_menu_bar(theApp, GTK_MENU_SHELL(gtk_menu_bar_new()));