Merge pull request #151 from mjbudd77/master
Changed GTK GUI shutdown order of execution so that the main window c…
This commit is contained in:
commit
9cd4b59cb3
|
@ -1451,8 +1451,11 @@ void openSoundConfig (void)
|
|||
return;
|
||||
}
|
||||
|
||||
void quit (void)
|
||||
static void mainMenuQuitCB(
|
||||
GtkMenuItem *menuitem,
|
||||
gpointer user_data)
|
||||
{
|
||||
printf("Main Menu Quit\n");
|
||||
// Set gui run flag to false to allow main gui loop
|
||||
// to exit normally.
|
||||
gtk_gui_run = false;
|
||||
|
@ -1474,6 +1477,30 @@ void quit (void)
|
|||
// exit (0);
|
||||
}
|
||||
|
||||
static gboolean deleteMainWindowCB(
|
||||
GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
printf("Delete Main Window Requested...\n");
|
||||
|
||||
gtk_gui_run = false;
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static gboolean destroyMainWindowCB(
|
||||
GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
printf("Destroy Main Window\n");
|
||||
|
||||
gtk_gui_run = false;
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
const char *Authors[] = {
|
||||
"Linux/SDL Developers:",
|
||||
" Lukas Sabota //punkrockguy318", " Soules", " Bryan Cain", " radsaq",
|
||||
|
@ -2612,7 +2639,7 @@ static GtkWidget *CreateMenubar (GtkWidget * window)
|
|||
//-File --> Quit ------------------
|
||||
item = gtk_menu_item_new_with_label ("Quit");
|
||||
|
||||
g_signal_connect (item, "activate", G_CALLBACK (quit), NULL);
|
||||
g_signal_connect (item, "activate", G_CALLBACK (mainMenuQuitCB), NULL);
|
||||
|
||||
gtk_widget_add_accelerator (item, "activate", accel_group,
|
||||
GDK_KEY_q, GDK_CONTROL_MASK,
|
||||
|
@ -3683,8 +3710,8 @@ int InitGTKSubsystem (int argc, char **argv)
|
|||
G_CALLBACK (handleMouseClick), NULL);
|
||||
|
||||
// signal handlers
|
||||
g_signal_connect (MainWindow, "delete-event", quit, NULL);
|
||||
g_signal_connect (MainWindow, "destroy-event", quit, NULL);
|
||||
g_signal_connect (MainWindow, "delete-event", G_CALLBACK(deleteMainWindowCB), NULL);
|
||||
g_signal_connect (MainWindow, "destroy-event", G_CALLBACK(destroyMainWindowCB), NULL);
|
||||
|
||||
g_signal_connect (evbox, "configure-event",
|
||||
G_CALLBACK (handle_resize), NULL);
|
||||
|
|
|
@ -59,7 +59,6 @@ void setStateMenuItem( int i );
|
|||
|
||||
void openVideoConfig();
|
||||
void openSoundConfig();
|
||||
void quit ();
|
||||
void openAbout ();
|
||||
|
||||
void emuReset ();
|
||||
|
|
|
@ -948,6 +948,20 @@ int main(int argc, char *argv[])
|
|||
FCEUI_Kill();
|
||||
SDL_Quit();
|
||||
|
||||
#ifdef _GTK
|
||||
usleep(50000);
|
||||
if ( MainWindow != NULL )
|
||||
{
|
||||
printf("Destroying GUI Window...\n");
|
||||
gtk_widget_destroy( MainWindow ); MainWindow = NULL;
|
||||
}
|
||||
usleep(50000);
|
||||
while(gtk_events_pending())
|
||||
{
|
||||
//printf("Processing the last of the events...\n");
|
||||
gtk_main_iteration_do(FALSE);
|
||||
}
|
||||
#endif
|
||||
// LoadGame() checks for an IP and if it finds one begins a network session
|
||||
// clear the NetworkIP field so this doesn't happen unintentionally
|
||||
g_config->setOption ("SDL.NetworkIP", "");
|
||||
|
|
Loading…
Reference in New Issue