From 6acbc7c2c7d25c4a1fd6b40212cd7515333cfebd Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 30 Oct 2014 15:01:59 +0100 Subject: [PATCH] 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. --- gtk/xboard.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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())); -- 1.7.0.4