From c6677d8292c6b552a63bdc5e21e07c402bf64b10 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 30 Oct 2010 09:21:26 -0500 Subject: [PATCH] Add hidden option for enabling non-modal dialogs. --- gtk/src/gtk_config.cpp | 6 ++++++ gtk/src/gtk_config.h | 1 + gtk/src/gtk_s9xwindow.cpp | 5 +++-- gtk/src/gtk_s9xwindow.h | 3 +-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gtk/src/gtk_config.cpp b/gtk/src/gtk_config.cpp index ee8c3531..8ec6b70e 100644 --- a/gtk/src/gtk_config.cpp +++ b/gtk/src/gtk_config.cpp @@ -172,6 +172,7 @@ Snes9xConfig::load_defaults (void) netplay_last_rom [0] = '\0'; netplay_last_host [0] = '\0'; netplay_last_port = 6096; + modal_dialogs = 1; #ifdef USE_OPENGL bilinear_filter = 0; @@ -307,6 +308,7 @@ Snes9xConfig::save_config_file (void) xml_out_int (xml, "fullscreen", fullscreen); xml_out_int (xml, "ui_visible", ui_visible); xml_out_int (xml, "statusbar_visible", statusbar_visible); + xml_out_int (xml, "modal_dialogs", modal_dialogs); xml_out_float (xml, "ntsc_hue", ntsc_setup.hue); xml_out_float (xml, "ntsc_saturation", ntsc_setup.saturation); @@ -661,6 +663,10 @@ Snes9xConfig::set_option (const char *name, const char *value) { strncpy (export_directory, value, PATH_MAX); } + else if (!strcasecmp (name, "modal_dialogs")) + { + modal_dialogs = atoi (value) ? 1 : 0; + } else if (!strcasecmp (name, "window_width")) { window_width = atoi (value); diff --git a/gtk/src/gtk_config.h b/gtk/src/gtk_config.h index 2217d128..e3d49858 100644 --- a/gtk/src/gtk_config.h +++ b/gtk/src/gtk_config.h @@ -123,6 +123,7 @@ class Snes9xConfig int pause_emulation_on_switch; int num_threads; unsigned char screensaver_needs_reset; + int modal_dialogs; int pointer_is_visible; struct timeval pointer_timestamp; diff --git a/gtk/src/gtk_s9xwindow.cpp b/gtk/src/gtk_s9xwindow.cpp index be23be4e..3a458099 100644 --- a/gtk/src/gtk_s9xwindow.cpp +++ b/gtk/src/gtk_s9xwindow.cpp @@ -1846,7 +1846,7 @@ Snes9xWindow::toggle_ui (void) void Snes9xWindow::pause_from_focus_change (void) { - sys_pause++; + sys_pause += config->modal_dialogs; propagate_pause_state (); @@ -1856,7 +1856,8 @@ Snes9xWindow::pause_from_focus_change (void) void Snes9xWindow::unpause_from_focus_change (void) { - sys_pause--; + if (--sys_pause < 0) + sys_pause = 0; propagate_pause_state (); return; diff --git a/gtk/src/gtk_s9xwindow.h b/gtk/src/gtk_s9xwindow.h index 2be2e875..c67c3e79 100644 --- a/gtk/src/gtk_s9xwindow.h +++ b/gtk/src/gtk_s9xwindow.h @@ -68,8 +68,7 @@ class Snes9xWindow : public GtkBuilderWindow void expose (GdkEventExpose *event); Snes9xConfig *config; - unsigned char user_pause; - unsigned char sys_pause; + int user_pause, sys_pause; int last_width, last_height; int mouse_region_x, mouse_region_y; int mouse_region_width, mouse_region_height;