annotate src/fullscreen.c @ 41:6281cc38e5ca

Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net> * bar_info.c, bar_sort.c: Update for new pref_toolbar_button args. * fullscreen.c, layout.c: Remove use of GDK_HINT_USER_SIZE as we never actually set these dimensions. Increase default size of main window. * layout_util.c: Use GTkToolbar for the main window toolbar. * pixbuf_util.[ch]: Add inline pixbufs for thumb and float icons. * rcfile.c: Add note to config file that it is autogenerated. * typedefs.h: Remove no longer used tooltip in LayoutWindow. * ui_misc.[ch]: pref_toolbar additions. * icons/icon_float.png, icons/icon_thumb.png: Icons in png format. * icons/icon_float.xpm, icons/icon_thumb.xpm: Remove xpm versions. * icons/Makefile.am: Add above icons to inline pixbuf list. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Wed, 27 Apr 2005 19:29:15 +0000
parents 17acca639a86
children 71e1ebee420e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
2 * GQview
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "gqview.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "fullscreen.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 FULLSCREEN_CURSOR_HIDDEN = 1 << 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 FULLSCREEN_CURSOR_NORMAL = 1 << 1,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 FULLSCREEN_CURSOR_BUSY = 1 << 2
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 * full screen functions
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 static void clear_mouse_cursor(GtkWidget *widget, gint state)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 if (!widget->window) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 if (state & FULLSCREEN_CURSOR_BUSY)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 GdkCursor *cursor;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 cursor = gdk_cursor_new(GDK_WATCH);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 gdk_window_set_cursor (widget->window, cursor);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 gdk_cursor_unref(cursor);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 else if (state & FULLSCREEN_CURSOR_NORMAL)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 gdk_window_set_cursor (widget->window, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 GdkCursor *cursor;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 GdkPixmap *p;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 p = gdk_bitmap_create_from_data(widget->window, "\0\0\0", 1, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 cursor = gdk_cursor_new_from_pixmap(p, p,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 &widget->style->fg[GTK_STATE_ACTIVE],
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 &widget->style->bg[GTK_STATE_ACTIVE],
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 0, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 gdk_window_set_cursor (widget->window, cursor);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 gdk_cursor_unref(cursor);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 g_object_unref(p);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 static gint fullscreen_hide_mouse_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 if (fs->hide_mouse_id == -1) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 fs->cursor_state &= ~FULLSCREEN_CURSOR_NORMAL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 if (!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY)) clear_mouse_cursor(fs->window, fs->cursor_state);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 fs->hide_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 static void fullscreen_hide_mouse_disable(FullScreenData *fs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 if (fs->hide_mouse_id != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 g_source_remove(fs->hide_mouse_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 fs->hide_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 static void fullscreen_hide_mouse_reset(FullScreenData *fs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 fullscreen_hide_mouse_disable(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 fs->hide_mouse_id = g_timeout_add(FULL_SCREEN_HIDE_MOUSE_DELAY, fullscreen_hide_mouse_cb, fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 static gint fullscreen_mouse_moved(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 if (!(fs->cursor_state & FULLSCREEN_CURSOR_NORMAL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 fs->cursor_state |= FULLSCREEN_CURSOR_NORMAL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 if (!(fs->cursor_state & FULLSCREEN_CURSOR_BUSY)) clear_mouse_cursor(fs->window, fs->cursor_state);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 fullscreen_hide_mouse_reset(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 static void fullscreen_busy_mouse_disable(FullScreenData *fs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 if (fs->busy_mouse_id != -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 g_source_remove(fs->busy_mouse_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 fs->busy_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 static void fullscreen_mouse_set_busy(FullScreenData *fs, gint busy)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 fullscreen_busy_mouse_disable(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 if ((fs->cursor_state & FULLSCREEN_CURSOR_BUSY) == (busy)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 if (busy)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 fs->cursor_state |= FULLSCREEN_CURSOR_BUSY;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 fs->cursor_state &= ~FULLSCREEN_CURSOR_BUSY;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 clear_mouse_cursor(fs->window, fs->cursor_state);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 static gboolean fullscreen_mouse_set_busy_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 fs->busy_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 fullscreen_mouse_set_busy(fs, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 static void fullscreen_mouse_set_busy_idle(FullScreenData *fs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 if (fs->busy_mouse_id == -1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 fs->busy_mouse_id = g_timeout_add(FULL_SCREEN_BUSY_MOUSE_DELAY,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 fullscreen_mouse_set_busy_cb, fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 static void fullscreen_image_update_cb(ImageWindow *imd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 if (fs->imd->il &&
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
162 fs->imd->il->pixbuf != image_get_pixbuf(fs->imd))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 fullscreen_mouse_set_busy_idle(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 static void fullscreen_image_complete_cb(ImageWindow *imd, gint preload, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 if (!preload) fullscreen_mouse_set_busy(fs, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 #define XSCREENSAVER_BINARY "xscreensaver-command"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 #define XSCREENSAVER_COMMAND "xscreensaver-command -deactivate >&- 2>&- &"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 static void fullscreen_saver_deactivate(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 static gint checked = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 static gint found = FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 if (!checked)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 checked = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 found = file_in_path(XSCREENSAVER_BINARY);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 if (found)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 system (XSCREENSAVER_COMMAND);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 static gboolean fullscreen_saver_block_cb(gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 if (fullscreen_disable_saver)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 fullscreen_saver_deactivate();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 static gint fullscreen_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 FullScreenData *fs = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 fullscreen_stop(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 FullScreenData *fullscreen_start(GtkWidget *window, ImageWindow *imd,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 void (*stop_func)(FullScreenData *, gpointer), gpointer stop_data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 FullScreenData *fs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 gint same;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 gint x, y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 gint w, h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 GdkGeometry geometry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 if (!window || !imd) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 fs = g_new0(FullScreenData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 fs->hide_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 fs->busy_mouse_id = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 fs->cursor_state = FULLSCREEN_CURSOR_HIDDEN;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 fs->normal_window = window;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232 fs->normal_imd = imd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 fs->stop_func = stop_func;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 fs->stop_data = stop_data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 if (debug) printf("full screen requests screen %d\n", fullscreen_screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 fullscreen_prefs_get_geometry(fullscreen_screen, window, &x, &y, &w, &h,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 &screen, &same);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 fs->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 gtk_window_set_wmclass(GTK_WINDOW(fs->window), "fullscreen", "GQview");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 /* this requests no decorations, if you still have them complain to the window manager author(s) */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245 gtk_window_set_decorated(GTK_WINDOW(fs->window), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 if (fullscreen_screen < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 /* If we want control of the window size and position this is not what we want.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 * GQview needs control of which monitor(s) to use for full screen.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 gtk_window_fullscreen(GTK_WINDOW(fs->window));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 else if (fullscreen_above)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 /* request to be above other windows */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 gtk_window_set_keep_above(GTK_WINDOW(fs->window), TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 gtk_window_set_resizable(GTK_WINDOW(fs->window), FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 gtk_window_set_screen(GTK_WINDOW(fs->window), screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 gtk_container_set_border_width(GTK_CONTAINER(fs->window), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264 g_signal_connect(G_OBJECT(fs->window), "delete_event",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 G_CALLBACK(fullscreen_delete_cb), fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 gtk_window_set_title(GTK_WINDOW(fs->window), _("GQview full screen"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 geometry.min_width = w;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 geometry.min_height = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 geometry.max_width = w;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 geometry.max_height = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 geometry.base_width = w;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 geometry.base_height = h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 geometry.win_gravity = GDK_GRAVITY_STATIC;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 /* By setting USER_POS and USER_SIZE, most window managers will
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 * not request positioning of the full screen window (for example twm).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 * In addition, setting gravity to STATIC will result in the
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 * decorations of twm to not effect the requested window position,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 * the decorations will simply be off screen, except in multi monitor setups :-/
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 gtk_window_set_geometry_hints(GTK_WINDOW(fs->window), fs->window, &geometry,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE |
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 GDK_HINT_WIN_GRAVITY |
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 23
diff changeset
286 GDK_HINT_USER_POS);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 gtk_window_set_default_size(GTK_WINDOW(fs->window), w, h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 gtk_window_move(GTK_WINDOW(fs->window), x, y);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 fs->imd = image_new(FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 gtk_container_add(GTK_CONTAINER(fs->window), fs->imd->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 /* set background to black */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296 if (BLACK_BACKGROUND)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 image_background_set_black(fs->imd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 image_set_delay_flip(fs->imd, fullscreen_clean_flip);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 image_auto_refresh(fs->imd, fs->normal_imd->auto_refresh_interval);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304 if (fullscreen_clean_flip)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 image_set_update_func(fs->imd, fullscreen_image_update_cb, fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 image_set_complete_func(fs->imd, fullscreen_image_complete_cb, fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 gtk_widget_show(fs->imd->widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 image_change_from_image(fs->imd, fs->normal_imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
313
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 gtk_widget_show(fs->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 /* for hiding the mouse */
23
17acca639a86 ##### Note: GQview CVS on sourceforge is not always up to date, please use #####
gqview
parents: 9
diff changeset
317 g_signal_connect(G_OBJECT(fs->imd->pr), "motion_notify_event",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 G_CALLBACK(fullscreen_mouse_moved), fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 clear_mouse_cursor(fs->window, fs->cursor_state);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321 /* set timer to block screen saver */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 fs->saver_block_id = g_timeout_add(60 * 1000, fullscreen_saver_block_cb, fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 /* hide normal window
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 * FIXME: properly restore this window on show
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 #ifdef HIDE_WINDOW_IN_FULLSCREEN
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 gtk_widget_hide(fs->normal_window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 image_change_path(fs->normal_imd, NULL, image_zoom_get(fs->normal_imd));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 return fs;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 void fullscreen_stop(FullScreenData *fs)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 if (!fs) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 g_source_remove(fs->saver_block_id);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 fullscreen_hide_mouse_disable(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 fullscreen_busy_mouse_disable(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 gdk_keyboard_ungrab(GDK_CURRENT_TIME);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 image_change_from_image(fs->normal_imd, fs->imd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 #ifdef HIDE_WINDOW_IN_FULLSCREEN
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 gtk_widget_show(fs->normal_window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 if (fs->stop_func) fs->stop_func(fs, fs->stop_data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 gtk_widget_destroy(fs->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 g_free(fs);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 * full screen preferences and utils
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 *----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 GList *fullscreen_prefs_list(void)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 GdkDisplay *display;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 gint number;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 gint i;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 display = gdk_display_get_default();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 number = gdk_display_get_n_screens(display);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 for (i = 0; i < number ; i++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 gint monitors;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 gint j;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379 screen = gdk_display_get_screen(display, i);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 monitors = gdk_screen_get_n_monitors(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 for (j = -1; j < monitors; j++)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 ScreenData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 GdkRectangle rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 gchar *subname;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 name = gdk_screen_make_display_name(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 if (j < 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393 rect.x = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 rect.y = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 rect.width = gdk_screen_get_width(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 rect.height = gdk_screen_get_height(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 subname = g_strdup(_("Full size"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 gdk_screen_get_monitor_geometry(screen, j, &rect);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 subname = g_strdup_printf("%s %d", _("Monitor"), j + 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 sd = g_new0(ScreenData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 sd->number = (i+1) * 100 + j + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 sd->description = g_strdup_printf("%s %s, %s", _("Screen"), name, subname);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408 sd->x = rect.x;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
409 sd->y = rect.y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 sd->width = rect.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 sd->height = rect.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 if (debug) printf("Screen %d %30s %4d,%4d (%4dx%4d)\n",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 sd->number, sd->description, sd->x, sd->y, sd->width, sd->height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 list = g_list_append(list, sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 g_free(name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 g_free(subname);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
422
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 return list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 void fullscreen_prefs_list_free(GList *list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 ScreenData *sd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 g_free(sd->description);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 g_free(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 ScreenData *fullscreen_prefs_list_find(GList *list, gint screen)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 ScreenData *sd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 if (sd->number == screen) return sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 /* screen is interpreted as such:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 * -1 window manager determines size and position, fallback is (1) active monitor
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 * 0 full size of screen containing widget
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 * 1 size of monitor containing widget
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 * 100 full size of screen 1 (screen, monitor counts start at 1)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 * 101 size of monitor 1 on screen 1
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 * 203 size of monitor 3 on screen 2
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
466 * returns:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 * dest_screen: screen to place widget [use gtk_window_set_screen()]
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 * same_region: the returned region will overlap the current location of widget.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 void fullscreen_prefs_get_geometry(gint screen, GtkWidget *widget, gint *x, gint *y, gint *width, gint *height,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 GdkScreen **dest_screen, gint *same_region)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 ScreenData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
476 list = fullscreen_prefs_list();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 if (screen >= 100)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 sd = fullscreen_prefs_list_find(list, screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 sd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 if (screen < 0) screen = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 if (sd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 GdkDisplay *display;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 display = gdk_display_get_default();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 n = sd->number / 100 - 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 if (n >= 0 && n < gdk_display_get_n_screens(display))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 screen = gdk_display_get_screen(display, n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 screen = gdk_display_get_default_screen(display);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504 if (x) *x = sd->x;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505 if (y) *y = sd->y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 if (width) *width = sd->width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507 if (height) *height = sd->height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 if (dest_screen) *dest_screen = screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 if (same_region) *same_region = (!widget || !widget->window ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 (screen == gtk_widget_get_screen(widget) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 (sd->number%100 == 0 ||
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 sd->number%100 == gdk_screen_get_monitor_at_window(screen, widget->window)+1)));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 else if (screen != 1 || !widget || !widget->window)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 if (widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 screen = gtk_widget_get_screen(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 screen = gdk_screen_get_default();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 if (x) *x = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 if (y) *y = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 if (width) *width = gdk_screen_get_width(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 if (height) *height = gdk_screen_get_height(screen);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 if (dest_screen) *dest_screen = screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 if (same_region) *same_region = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540 gint monitor;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 GdkRectangle rect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 screen = gtk_widget_get_screen(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 monitor = gdk_screen_get_monitor_at_window(screen, widget->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
546 gdk_screen_get_monitor_geometry(screen, monitor, &rect);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 if (x) *x = rect.x;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 if (y) *y = rect.y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 if (width) *width = rect.width;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 if (height) *height = rect.height;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 if (dest_screen) *dest_screen = screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 if (same_region) *same_region = TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 fullscreen_prefs_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 gint fullscreen_prefs_find_screen_for_widget(GtkWidget *widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 GdkScreen *screen;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 gint monitor;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 if (!widget || !widget->window) return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 screen = gtk_widget_get_screen(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 monitor = gdk_screen_get_monitor_at_window(screen, widget->window);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 n = (gdk_screen_get_number(screen)+1) * 100 + monitor + 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 if (debug || TRUE) printf("Screen appears to be %d\n", n);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 return n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 FS_MENU_COLUMN_NAME = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 FS_MENU_COLUMN_VALUE
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 #define BUTTON_ABOVE_KEY "button_above"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 static void fullscreen_prefs_selection_cb(GtkWidget *combo, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 gint *value = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 GtkWidget *button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 if (!value) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 store = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596 gtk_tree_model_get(store, &iter, FS_MENU_COLUMN_VALUE, value, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 button = g_object_get_data(G_OBJECT(combo), BUTTON_ABOVE_KEY);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599 if (button)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
601 gtk_widget_set_sensitive(button, *value != -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605 static void fullscreen_prefs_selection_add(GtkListStore *store, const gchar *text, gint value)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 gtk_list_store_set(store, &iter, FS_MENU_COLUMN_NAME, text,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 FS_MENU_COLUMN_VALUE, value, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
614 GtkWidget *fullscreen_prefs_selection_new(const gchar *text, gint *screen_value, gint *above_value)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 GtkWidget *combo;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 GtkWidget *button = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624 gint current = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627 if (!screen_value) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
630 hbox = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 if (text) pref_label_new(hbox, text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640 "text", FS_MENU_COLUMN_NAME, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 if (above_value)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644 button = pref_checkbox_new_int(vbox, _("Stay above other windows"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 *above_value, above_value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 gtk_widget_set_sensitive(button, *screen_value != -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648 g_object_set_data(G_OBJECT(combo), BUTTON_ABOVE_KEY, button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
651 fullscreen_prefs_selection_add(store, _("Determined by Window Manager"), -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 fullscreen_prefs_selection_add(store, _("Active screen"), 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 if (*screen_value == 0) current = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654 fullscreen_prefs_selection_add(store, _("Active monitor"), 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 if (*screen_value == 1) current = 2;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 n = 3;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 list = fullscreen_prefs_list();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
661 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 ScreenData *sd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
663
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 fullscreen_prefs_selection_add(store, sd->description, sd->number);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665 if (*screen_value == sd->number) current = n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 fullscreen_prefs_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
671
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675 gtk_widget_show(combo);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 g_signal_connect(G_OBJECT(combo), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 G_CALLBACK(fullscreen_prefs_selection_cb), screen_value);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
680 return vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682