File: 0003-Fix-832-Geeqie-remembers-desktop.patch

package info (click to toggle)
geeqie 1%3A1.6-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 17,112 kB
  • sloc: ansic: 103,819; xml: 12,121; cpp: 2,087; sh: 1,056; makefile: 601; awk: 160; perl: 140
file content (157 lines) | stat: -rw-r--r-- 5,948 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
From: Colin Clark <colin.clark@cclark.uk>
Date: Sun, 13 Dec 2020 10:54:33 +0000
Subject: Fix #832: Geeqie remembers desktop

https://github.com/BestImageViewer/geeqie/issues/832

An additional option to remember window workspaces in
Edit/Preferences/Windows.
The default is "off".
---
 doc/docbook/GuideOptionsWindow.xml | 12 ++++++++++++
 src/layout.c                       | 28 +++++++++++++++++-----------
 src/options.c                      |  1 +
 src/options.h                      |  1 +
 src/preferences.c                  |  5 +++++
 src/rcfile.c                       |  2 ++
 6 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/doc/docbook/GuideOptionsWindow.xml b/doc/docbook/GuideOptionsWindow.xml
index ce0f97b..04c4708 100644
--- a/doc/docbook/GuideOptionsWindow.xml
+++ b/doc/docbook/GuideOptionsWindow.xml
@@ -37,6 +37,18 @@
         </listitem>
       </varlistentry>
     </variablelist>
+    <variablelist>
+      <varlistentry>
+        <term>
+          <guilabel>Remember window workspace</guilabel>
+        </term>
+        <listitem>
+          <para>
+            Remember which workspace a window was displayed in.
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
     <variablelist>
       <varlistentry>
         <term>
diff --git a/src/layout.c b/src/layout.c
index 685e200..7a0e1b8 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -2412,12 +2412,15 @@ void layout_sync_options_with_current_state(LayoutWindow *lw)
 #if GTK_CHECK_VERSION(3,10,0)
 	GdkDisplay *display;
 
-	display = gdk_display_get_default();
-
-	if (GDK_IS_X11_DISPLAY(display))
+	if (options->save_window_workspace)
 		{
-		window = gtk_widget_get_window(GTK_WIDGET(lw->window));
-		lw->options.workspace = gdk_x11_window_get_desktop(window);
+		display = gdk_display_get_default();
+
+		if (GDK_IS_X11_DISPLAY(display))
+			{
+			window = gtk_widget_get_window(GTK_WIDGET(lw->window));
+			lw->options.workspace = gdk_x11_window_get_desktop(window);
+			}
 		}
 #endif
 #endif
@@ -2535,14 +2538,17 @@ static gboolean move_window_to_workspace_cb(gpointer data)
 	GdkWindow *window;
 	GdkDisplay *display;
 
-	display = gdk_display_get_default();
-
-	if (GDK_IS_X11_DISPLAY(display))
+	if (options->save_window_workspace)
 		{
-		if (lw->options.workspace != -1)
+		display = gdk_display_get_default();
+
+		if (GDK_IS_X11_DISPLAY(display))
 			{
-			window = gtk_widget_get_window(GTK_WIDGET(lw->window));
-			gdk_x11_window_move_to_desktop(window, lw->options.workspace);
+			if (lw->options.workspace != -1)
+				{
+				window = gtk_widget_get_window(GTK_WIDGET(lw->window));
+				gdk_x11_window_move_to_desktop(window, lw->options.workspace);
+				}
 			}
 		}
 #endif
diff --git a/src/options.c b/src/options.c
index a112d07..c0dbeca 100644
--- a/src/options.c
+++ b/src/options.c
@@ -64,6 +64,7 @@ ConfOptions *init_options(ConfOptions *options)
 
 	options->save_window_positions = TRUE;
 	options->use_saved_window_positions_for_new_windows = FALSE;
+	options->save_window_workspace = FALSE;
 	options->tools_restore_state = TRUE;
 	options->save_dialog_window_positions = FALSE;
 	options->show_window_ids = FALSE;
diff --git a/src/options.h b/src/options.h
index 8527304..a5d5cf8 100644
--- a/src/options.h
+++ b/src/options.h
@@ -62,6 +62,7 @@ struct _ConfOptions
 
 	gboolean save_window_positions;
 	gboolean use_saved_window_positions_for_new_windows;
+	gboolean save_window_workspace;
 	gboolean tools_restore_state;
 	gboolean save_dialog_window_positions;
 	gboolean show_window_ids;
diff --git a/src/preferences.c b/src/preferences.c
index ccdb5f4..6ba5f1c 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -269,6 +269,7 @@ static void config_window_apply(void)
 	options->tools_restore_state = c_options->tools_restore_state;
 	options->save_window_positions = c_options->save_window_positions;
 	options->use_saved_window_positions_for_new_windows = c_options->use_saved_window_positions_for_new_windows;
+	options->save_window_workspace = c_options->save_window_workspace;
 	options->save_dialog_window_positions = c_options->save_dialog_window_positions;
 	options->show_window_ids = c_options->show_window_ids;
 	options->image.scroll_reset_method = c_options->image.scroll_reset_method;
@@ -2292,6 +2293,10 @@ static void config_tab_windows(GtkWidget *notebook)
 				       options->use_saved_window_positions_for_new_windows, &c_options->use_saved_window_positions_for_new_windows);
 	pref_checkbox_link_sensitivity(ct_button, button);
 
+	button = pref_checkbox_new_int(group, _("Remember window workspace"),
+			      options->save_window_workspace, &c_options->save_window_workspace);
+	pref_checkbox_link_sensitivity(ct_button, button);
+
 	pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"),
 			      options->tools_restore_state, &c_options->tools_restore_state);
 
diff --git a/src/rcfile.c b/src/rcfile.c
index 9fd5aca..21984b5 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -340,6 +340,7 @@ static void write_global_attributes(GString *outstr, gint indent)
 
 	WRITE_NL(); WRITE_BOOL(*options, save_window_positions);
 	WRITE_NL(); WRITE_BOOL(*options, use_saved_window_positions_for_new_windows);
+	WRITE_NL(); WRITE_BOOL(*options, save_window_workspace);
 	WRITE_NL(); WRITE_BOOL(*options, tools_restore_state);
 	WRITE_NL(); WRITE_BOOL(*options, save_dialog_window_positions);
 	WRITE_NL(); WRITE_BOOL(*options, show_window_ids);
@@ -770,6 +771,7 @@ static gboolean load_global_params(const gchar **attribute_names, const gchar **
 
 		if (READ_BOOL(*options, save_window_positions)) continue;
 		if (READ_BOOL(*options, use_saved_window_positions_for_new_windows)) continue;
+		if (READ_BOOL(*options, save_window_workspace)) continue;
 		if (READ_BOOL(*options, tools_restore_state)) continue;
 		if (READ_BOOL(*options, save_dialog_window_positions)) continue;
 		if (READ_BOOL(*options, show_window_ids)) continue;