From 1e0d4128c17abf22333ee828ec86a83a36827bcf Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Thu, 29 Oct 2020 10:25:42 +0000 Subject: [PATCH] Fix #821: Un-full-screen doesn't work. Regression https://github.com/BestImageViewer/geeqie/issues/821 Implement a user-definable option for "Hide window in fullscreen", instead of a define. --- src/fullscreen.c | 14 ++++++++------ src/fullscreen.h | 1 - src/options.c | 1 + src/options.h | 1 + src/preferences.c | 6 ++++++ src/rcfile.c | 2 ++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/fullscreen.c b/src/fullscreen.c index 958bad27..a031b7b8 100644 --- a/src/fullscreen.c +++ b/src/fullscreen.c @@ -338,9 +338,10 @@ FullScreenData *fullscreen_start(GtkWidget *window, ImageWindow *imd, */ if (fs->same_region) { -#ifdef HIDE_WINDOW_IN_FULLSCREEN - gtk_widget_hide(fs->normal_window); -#endif + if (options->hide_window_in_fullscreen) + { + gtk_widget_hide(fs->normal_window); + } image_change_fd(fs->normal_imd, NULL, image_zoom_get(fs->normal_imd)); } @@ -360,9 +361,10 @@ void fullscreen_stop(FullScreenData *fs) if (fs->same_region) { image_move_from_image(fs->normal_imd, fs->imd); -#ifdef HIDE_WINDOW_IN_FULLSCREEN - gtk_widget_show(fs->normal_window); -#endif + if (options->hide_window_in_fullscreen) + { + gtk_widget_show(fs->normal_window); + } if (options->stereo.enable_fsmode) { image_stereo_set(fs->normal_imd, options->stereo.mode); diff --git a/src/fullscreen.h b/src/fullscreen.h index 1e9650f1..69d263d1 100644 --- a/src/fullscreen.h +++ b/src/fullscreen.h @@ -24,7 +24,6 @@ #define FULL_SCREEN_HIDE_MOUSE_DELAY 3000 #define FULL_SCREEN_BUSY_MOUSE_DELAY 200 -#define HIDE_WINDOW_IN_FULLSCREEN FullScreenData *fullscreen_start(GtkWidget *window, ImageWindow *imd, void (*stop_func)(FullScreenData *, gpointer), gpointer stop_data); diff --git a/src/options.c b/src/options.c index 2ea1f991..6bc13a94 100644 --- a/src/options.c +++ b/src/options.c @@ -91,6 +91,7 @@ ConfOptions *init_options(ConfOptions *options) options->marks_save = TRUE; options->with_rename = FALSE; options->collections_on_top = FALSE; + options->hide_window_in_fullscreen = TRUE; memset(&options->image.border_color, 0, sizeof(options->image.border_color)); memset(&options->image.alpha_color_1, 0, sizeof(options->image.alpha_color_1)); diff --git a/src/options.h b/src/options.h index 9de4ace5..85273045 100644 --- a/src/options.h +++ b/src/options.h @@ -73,6 +73,7 @@ struct _ConfOptions gboolean with_rename; gboolean collections_on_top; + gboolean hide_window_in_fullscreen; gchar *help_search_engine; diff --git a/src/preferences.c b/src/preferences.c index dab683f1..ccdb5f46 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -428,6 +428,7 @@ static void config_window_apply(void) options->marks_save = c_options->marks_save; options->with_rename = c_options->with_rename; options->collections_on_top = c_options->collections_on_top; + options->hide_window_in_fullscreen = c_options->hide_window_in_fullscreen; config_entry_to_option(help_search_engine_entry, &options->help_search_engine, NULL); options->read_metadata_in_idle = c_options->read_metadata_in_idle; @@ -3259,6 +3260,7 @@ static void config_tab_behavior(GtkWidget *notebook) GtkWidget *marks; GtkWidget *with_rename; GtkWidget *collections_on_top; + GtkWidget *hide_window_in_fullscreen; GtkWidget *checkbox; vbox = scrolled_notebook_page(notebook, _("Behavior")); @@ -3335,6 +3337,10 @@ static void config_tab_behavior(GtkWidget *notebook) options->collections_on_top, &c_options->collections_on_top); gtk_widget_set_tooltip_text(collections_on_top,"Open collections window on top"); + hide_window_in_fullscreen = pref_checkbox_new_int(group, _("Hide window in fullscreen"), + options->hide_window_in_fullscreen, &c_options->hide_window_in_fullscreen); + gtk_widget_set_tooltip_text(hide_window_in_fullscreen,"When alt-tabbing, prevent Geeqie window showing twice"); + pref_spin_new_int(group, _("Recent folder list maximum size"), NULL, 1, 50, 1, options->open_recent_list_maxsize, &c_options->open_recent_list_maxsize); diff --git a/src/rcfile.c b/src/rcfile.c index 2ae68738..0d3a03c5 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -353,6 +353,7 @@ static void write_global_attributes(GString *outstr, gint indent) WRITE_NL(); WRITE_BOOL(*options, with_rename); WRITE_NL(); WRITE_BOOL(*options, collections_on_top); + WRITE_NL(); WRITE_BOOL(*options, hide_window_in_fullscreen); /* File operations Options */ WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename); @@ -781,6 +782,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar ** if (READ_CHAR(*options, help_search_engine)) continue; if (READ_BOOL(*options, collections_on_top)) continue; + if (READ_BOOL(*options, hide_window_in_fullscreen)) continue; /* Properties dialog options */ if (READ_CHAR(*options, properties.tabs_order)) continue; -- 2.20.1