File: | _build/../libvnck/vnckprop.c |
Warning: | line 2063, column 15 This statement is never executed |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * Copyright (C) 2007 Vincent Untz |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
16 | * |
17 | * Authors: |
18 | * Vincent Untz <vuntz@gnome.org> |
19 | * |
20 | * Some of this code is based on code from gnome-panel/panel-force-quit.c |
21 | * This part of the code was written by Mark McLoughlin <mark@skynet.ie> and |
22 | * copyrighted by Sun. Sun (through Glynn Foster <glynn.foster@sun.com>) |
23 | * agreed to relicense it from the GPL to the LGPL. |
24 | */ |
25 | |
26 | /* TODO: |
27 | * uncomment code that prints the workspace layout when API is public. |
28 | * uncomment code for vnck_class_group_get_icon_is_fallback() when API is done |
29 | * |
30 | * add --list-screen |
31 | */ |
32 | #include <config.h> |
33 | |
34 | #include <stdlib.h> |
35 | #include <string.h> |
36 | #include <X11/Xlib.h> |
37 | #include <X11/keysym.h> |
38 | #include <X11/extensions/XInput2.h> |
39 | |
40 | #include <ctk/ctk.h> |
41 | #include <cdk/cdkx.h> |
42 | |
43 | #include <glib/gi18n.h> |
44 | |
45 | #include <libvnck/libvnck.h> |
46 | |
47 | enum { |
48 | INVALID_MODE, |
49 | SCREEN_READ_MODE, |
50 | SCREEN_LIST_MODE, |
51 | SCREEN_WRITE_MODE, |
52 | WORKSPACE_READ_MODE, |
53 | WORKSPACE_LIST_MODE, |
54 | WORKSPACE_WRITE_MODE, |
55 | APPLICATION_READ_MODE, |
56 | APPLICATION_LIST_MODE, |
57 | CLASS_GROUP_READ_MODE, |
58 | CLASS_GROUP_LIST_MODE, |
59 | WINDOW_READ_MODE, |
60 | WINDOW_WRITE_MODE |
61 | } mode = INVALID_MODE; |
62 | |
63 | gboolean option_xid = FALSE(0); |
64 | gboolean option_application = FALSE(0); |
65 | gboolean option_class_group = FALSE(0); |
66 | gboolean option_workspace = FALSE(0); |
67 | gboolean option_screen = FALSE(0); |
68 | |
69 | gboolean get_from_user = TRUE(!(0)); |
70 | VnckWindow *got_from_user = NULL((void*)0); |
71 | |
72 | gulong xid = 0; |
73 | gulong interact_app_xid = 0; |
74 | char *interact_class_group = NULL((void*)0); |
75 | int interact_space = -1; |
76 | int interact_screen = -1; |
77 | |
78 | gboolean list = FALSE(0); |
79 | gboolean list_workspaces = FALSE(0); |
80 | |
81 | int set_n_workspaces = -1; |
82 | int set_workspace_rows = 0; |
83 | int set_workspace_cols = 0; |
84 | gboolean set_show_desktop = FALSE(0); |
85 | gboolean set_unshow_desktop = FALSE(0); |
86 | int set_viewport_x = -1; |
87 | int set_viewport_y = -1; |
88 | |
89 | gboolean set_activate = FALSE(0); |
90 | char *set_change_name = NULL((void*)0); |
91 | |
92 | gboolean set_minimize = FALSE(0); |
93 | gboolean set_unminimize = FALSE(0); |
94 | gboolean set_maximize = FALSE(0); |
95 | gboolean set_unmaximize = FALSE(0); |
96 | gboolean set_maximize_horizontally = FALSE(0); |
97 | gboolean set_unmaximize_horizontally = FALSE(0); |
98 | gboolean set_maximize_vertically = FALSE(0); |
99 | gboolean set_unmaximize_vertically = FALSE(0); |
100 | gboolean set_keyboard_move = FALSE(0); |
101 | gboolean set_keyboard_resize = FALSE(0); |
102 | gboolean set_close = FALSE(0); |
103 | |
104 | gboolean set_fullscreen = FALSE(0); |
105 | gboolean set_unfullscreen = FALSE(0); |
106 | gboolean set_make_above = FALSE(0); |
107 | gboolean set_unmake_above = FALSE(0); |
108 | gboolean set_make_below = FALSE(0); |
109 | gboolean set_unmake_below = FALSE(0); |
110 | gboolean set_shade = FALSE(0); |
111 | gboolean set_unshade = FALSE(0); |
112 | gboolean set_stick = FALSE(0); |
113 | gboolean set_unstick = FALSE(0); |
114 | gboolean set_skip_pager = FALSE(0); |
115 | gboolean set_unskip_pager = FALSE(0); |
116 | gboolean set_skip_tasklist = FALSE(0); |
117 | gboolean set_unskip_tasklist = FALSE(0); |
118 | gboolean set_pin = FALSE(0); |
119 | gboolean set_unpin = FALSE(0); |
120 | int set_workspace = -1; |
121 | int set_x = G_MAXINT2147483647; |
122 | int set_y = G_MAXINT2147483647; |
123 | int set_width = -1; |
124 | int set_height = -1; |
125 | char *set_window_type = NULL((void*)0); |
126 | VnckWindowType set_window_type_t = VNCK_WINDOW_NORMAL; |
127 | |
128 | static gboolean |
129 | option_parse (const char *option_name, |
130 | const char *value, |
131 | gpointer data, |
132 | GError **error); |
133 | |
134 | static GOptionEntry main_entries[] = { |
135 | { "window", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
136 | N_("X window ID of the window to examine or modify")("X window ID of the window to examine or modify"), N_("XID")("XID") }, |
137 | { "application", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
138 | /* Translators: A group leader is the window that is the "owner" of a |
139 | * group of windows, ie: if you have multiple windows in one |
140 | * application, one window has some information about the application |
141 | * (like the application name). */ |
142 | N_("X window ID of the group leader of an application to examine")("X window ID of the group leader of an application to examine" ), |
143 | N_("XID")("XID") }, |
144 | { "class", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
145 | /* Translators: A class is like a "family". E.g., all gvim windows |
146 | * are of the same class. */ |
147 | N_("Class resource of the class group to examine")("Class resource of the class group to examine"), N_("CLASS")("CLASS") }, |
148 | { "workspace", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
149 | N_("NUMBER of the workspace to examine or modify")("NUMBER of the workspace to examine or modify"), N_("NUMBER")("NUMBER") }, |
150 | { "screen", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
151 | N_("NUMBER of the screen to examine or modify")("NUMBER of the screen to examine or modify"), N_("NUMBER")("NUMBER") }, |
152 | { "xid", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, option_parse, |
153 | N_("Alias of --window")("Alias of --window"), N_("XID")("XID") }, |
154 | { NULL((void*)0) } |
155 | }; |
156 | |
157 | static GOptionEntry list_entries[] = { |
158 | { "list", 0, 0, G_OPTION_ARG_NONE, &list, |
159 | /* Translators: A class is like a "family". E.g., all gvim windows |
160 | * are of the same class. */ |
161 | N_("List windows of the application/class group/workspace/screen (output format: \"XID: Window Name\")")("List windows of the application/class group/workspace/screen (output format: \"XID: Window Name\")" ), NULL((void*)0) }, |
162 | { "list-workspaces", 0, 0, G_OPTION_ARG_NONE, &list_workspaces, |
163 | N_("List workspaces of the screen (output format: \"Number: Workspace Name\")")("List workspaces of the screen (output format: \"Number: Workspace Name\")" ), NULL((void*)0) }, |
164 | { NULL((void*)0) } |
165 | }; |
166 | |
167 | static GOptionEntry screen_entries[] = { |
168 | { "set-n-workspaces", 0, 0, G_OPTION_ARG_INT, &set_n_workspaces, |
169 | N_("Change the number of workspaces of the screen to NUMBER")("Change the number of workspaces of the screen to NUMBER"), N_("NUMBER")("NUMBER") }, |
170 | { "set-workspace-rows", 0, 0, G_OPTION_ARG_INT, &set_workspace_rows, |
171 | N_("Change the workspace layout of the screen to use NUMBER rows")("Change the workspace layout of the screen to use NUMBER rows" ), N_("NUMBER")("NUMBER") }, |
172 | { "set-workspace-columns", 0, 0, G_OPTION_ARG_INT, &set_workspace_cols, |
173 | N_("Change the workspace layout of the screen to use NUMBER columns")("Change the workspace layout of the screen to use NUMBER columns" ), N_("NUMBER")("NUMBER") }, |
174 | { "show-desktop", 0, 0, G_OPTION_ARG_NONE, &set_show_desktop, |
175 | N_("Show the desktop")("Show the desktop"), NULL((void*)0) }, |
176 | { "unshow-desktop", 0, 0, G_OPTION_ARG_NONE, &set_unshow_desktop, |
177 | N_("Stop showing the desktop")("Stop showing the desktop"), NULL((void*)0) }, |
178 | { "move-viewport-x", 0, 0, G_OPTION_ARG_INT, &set_viewport_x, |
179 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
180 | * can be used to implement workspaces (e.g. compiz is an example); |
181 | * however it is not just the current workspace. */ |
182 | N_("Move the viewport of the current workspace to X coordinate X")("Move the viewport of the current workspace to X coordinate X" ), N_("X")("X") }, |
183 | { "move-viewport-y", 0, 0, G_OPTION_ARG_INT, &set_viewport_y, |
184 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
185 | * can be used to implement workspaces (e.g. compiz is an example); |
186 | * however it is not just the current workspace. */ |
187 | N_("Move the viewport of the current workspace to Y coordinate Y")("Move the viewport of the current workspace to Y coordinate Y" ), N_("Y")("Y") }, |
188 | { NULL((void*)0) } |
189 | }; |
190 | |
191 | static GOptionEntry window_entries[] = { |
192 | { "minimize", 0, 0, G_OPTION_ARG_NONE, &set_minimize, |
193 | N_("Minimize the window")("Minimize the window"), NULL((void*)0) }, |
194 | { "unminimize", 0, 0, G_OPTION_ARG_NONE, &set_unminimize, |
195 | N_("Unminimize the window")("Unminimize the window"), NULL((void*)0) }, |
196 | { "maximize", 0, 0, G_OPTION_ARG_NONE, &set_maximize, |
197 | N_("Maximize the window")("Maximize the window"), NULL((void*)0) }, |
198 | { "unmaximize", 0, 0, G_OPTION_ARG_NONE, &set_unmaximize, |
199 | N_("Unmaximize the window")("Unmaximize the window"), NULL((void*)0) }, |
200 | { "maximize-horizontally", 0, 0, G_OPTION_ARG_NONE, &set_maximize_horizontally, |
201 | N_("Maximize horizontally the window")("Maximize horizontally the window"), NULL((void*)0) }, |
202 | { "unmaximize-horizontally", 0, 0, G_OPTION_ARG_NONE, &set_unmaximize_horizontally, |
203 | N_("Unmaximize horizontally the window")("Unmaximize horizontally the window"), NULL((void*)0) }, |
204 | { "maximize-vertically", 0, 0, G_OPTION_ARG_NONE, &set_maximize_vertically, |
205 | N_("Maximize vertically the window")("Maximize vertically the window"), NULL((void*)0) }, |
206 | { "unmaximize-vertically", 0, 0, G_OPTION_ARG_NONE, &set_unmaximize_vertically, |
207 | N_("Unmaximize vertically the window")("Unmaximize vertically the window"), NULL((void*)0) }, |
208 | { "keyboard-move", 0, 0, G_OPTION_ARG_NONE, &set_keyboard_move, |
209 | N_("Start moving the window via the keyboard")("Start moving the window via the keyboard"), NULL((void*)0) }, |
210 | { "keyboard-resize", 0, 0, G_OPTION_ARG_NONE, &set_keyboard_resize, |
211 | N_("Start resizing the window via the keyboard")("Start resizing the window via the keyboard"), NULL((void*)0) }, |
212 | { "activate", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &set_activate, |
213 | N_("Activate the window")("Activate the window"), NULL((void*)0) }, |
214 | { "close", 0, 0, G_OPTION_ARG_NONE, &set_close, |
215 | N_("Close the window")("Close the window"), NULL((void*)0) }, |
216 | |
217 | { "make-fullscreen", 0, 0, G_OPTION_ARG_NONE, &set_fullscreen, |
218 | N_("Make the window fullscreen")("Make the window fullscreen"), NULL((void*)0) }, |
219 | { "unmake-fullscreen", 0, 0, G_OPTION_ARG_NONE, &set_unfullscreen, |
220 | N_("Make the window quit fullscreen mode")("Make the window quit fullscreen mode"), NULL((void*)0) }, |
221 | { "make-above", 0, 0, G_OPTION_ARG_NONE, &set_make_above, |
222 | N_("Make the window always on top")("Make the window always on top"), NULL((void*)0) }, |
223 | { "unmake-above", 0, 0, G_OPTION_ARG_NONE, &set_unmake_above, |
224 | N_("Make the window not always on top")("Make the window not always on top"), NULL((void*)0) }, |
225 | { "make-below", 0, 0, G_OPTION_ARG_NONE, &set_make_below, |
226 | N_("Make the window below other windows")("Make the window below other windows"), NULL((void*)0) }, |
227 | { "unmake-below", 0, 0, G_OPTION_ARG_NONE, &set_unmake_below, |
228 | N_("Make the window not below other windows")("Make the window not below other windows"), NULL((void*)0) }, |
229 | { "shade", 0, 0, G_OPTION_ARG_NONE, &set_shade, |
230 | N_("Shade the window")("Shade the window"), NULL((void*)0) }, |
231 | { "unshade", 0, 0, G_OPTION_ARG_NONE, &set_unshade, |
232 | N_("Unshade the window")("Unshade the window"), NULL((void*)0) }, |
233 | { "stick", 0, 0, G_OPTION_ARG_NONE, &set_stick, |
234 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
235 | * can be used to implement workspaces (e.g. compiz is an example); |
236 | * however it is not just the current workspace. */ |
237 | N_("Make the window have a fixed position in the viewport")("Make the window have a fixed position in the viewport"), NULL((void*)0) }, |
238 | { "unstick", 0, 0, G_OPTION_ARG_NONE, &set_unstick, |
239 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
240 | * can be used to implement workspaces (e.g. compiz is an example); |
241 | * however it is not just the current workspace. */ |
242 | N_("Make the window not have a fixed position in the viewport")("Make the window not have a fixed position in the viewport"), NULL((void*)0) }, |
243 | { "skip-pager", 0, 0, G_OPTION_ARG_NONE, &set_skip_pager, |
244 | /* Translators: A pager is the technical term for the workspace |
245 | * switcher. It's a representation of all workspaces with windows |
246 | * inside it. Please make sure that the translation is in sync with |
247 | * gnome-panel, where this term is also used in translatable strings |
248 | */ |
249 | N_("Make the window not appear in pagers")("Make the window not appear in pagers"), NULL((void*)0) }, |
250 | { "unskip-pager", 0, 0, G_OPTION_ARG_NONE, &set_unskip_pager, |
251 | /* Translators: A pager is the technical term for the workspace |
252 | * switcher. It's a representation of all workspaces with windows |
253 | * inside it. Please make sure that the translation is in sync with |
254 | * gnome-panel, where this term is also used in translatable strings |
255 | */ |
256 | N_("Make the window appear in pagers")("Make the window appear in pagers"), NULL((void*)0) }, |
257 | { "skip-tasklist", 0, 0, G_OPTION_ARG_NONE, &set_skip_tasklist, |
258 | /* Translators: "tasklist" is the list of running applications (the |
259 | * window list) */ |
260 | N_("Make the window not appear in tasklists")("Make the window not appear in tasklists"), NULL((void*)0) }, |
261 | { "unskip-tasklist", 0, 0, G_OPTION_ARG_NONE, &set_unskip_tasklist, |
262 | /* Translators: "tasklist" is the list of running applications (the |
263 | * window list) */ |
264 | N_("Make the window appear in tasklists")("Make the window appear in tasklists"), NULL((void*)0) }, |
265 | { "pin", 0, 0, G_OPTION_ARG_NONE, &set_pin, |
266 | N_("Make the window visible on all workspaces")("Make the window visible on all workspaces"), NULL((void*)0) }, |
267 | { "unpin", 0, 0, G_OPTION_ARG_NONE, &set_unpin, |
268 | N_("Make the window visible on the current workspace only")("Make the window visible on the current workspace only"), NULL((void*)0) }, |
269 | { "set-workspace", 0, 0, G_OPTION_ARG_INT, &set_workspace, |
270 | N_("Move the window to workspace NUMBER (first workspace is 0)")("Move the window to workspace NUMBER (first workspace is 0)" ), N_("NUMBER")("NUMBER") }, |
271 | { "set-x", 0, 0, G_OPTION_ARG_INT, &set_x, |
272 | N_("Change the X coordinate of the window to X")("Change the X coordinate of the window to X"), N_("X")("X") }, |
273 | { "set-y", 0, 0, G_OPTION_ARG_INT, &set_y, |
274 | N_("Change the Y coordinate of the window to Y")("Change the Y coordinate of the window to Y"), N_("Y")("Y") }, |
275 | { "set-width", 0, 0, G_OPTION_ARG_INT, &set_width, |
276 | N_("Change the width of the window to WIDTH")("Change the width of the window to WIDTH"), N_("WIDTH")("WIDTH") }, |
277 | { "set-height", 0, 0, G_OPTION_ARG_INT, &set_height, |
278 | N_("Change the height of the window to HEIGHT")("Change the height of the window to HEIGHT"), N_("HEIGHT")("HEIGHT") }, |
279 | { "set-window-type", 0, 0, G_OPTION_ARG_STRING, &set_window_type, |
280 | /* Translators: do not translate "normal, desktop, dock..." */ |
281 | N_("Change the type of the window to TYPE (valid values: normal, desktop, dock, dialog, toolbar, menu, utility, splash)")("Change the type of the window to TYPE (valid values: normal, desktop, dock, dialog, toolbar, menu, utility, splash)" ), N_("TYPE")("TYPE") }, |
282 | { NULL((void*)0) } |
283 | }; |
284 | |
285 | static GOptionEntry space_entries[] = { |
286 | { "change-name", 0, 0, G_OPTION_ARG_STRING, &set_change_name, |
287 | N_("Change the name of the workspace to NAME")("Change the name of the workspace to NAME"), N_("NAME")("NAME") }, |
288 | { "activate", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, &set_activate, |
289 | N_("Activate the workspace")("Activate the workspace"), NULL((void*)0) }, |
290 | { NULL((void*)0) } |
291 | }; |
292 | |
293 | static void clean_up (void); |
294 | |
295 | /* this part is mostly stolen from xutils.c */ |
296 | typedef struct |
297 | { |
298 | Window window; |
299 | Atom timestamp_prop_atom; |
300 | } TimeStampInfo; |
301 | |
302 | static Boolint |
303 | timestamp_predicate (Display *display G_GNUC_UNUSED__attribute__ ((__unused__)), |
304 | XEvent *xevent, |
305 | XPointer arg) |
306 | { |
307 | TimeStampInfo *info = (TimeStampInfo *)arg; |
308 | |
309 | if (xevent->type == PropertyNotify28 && |
310 | xevent->xproperty.window == info->window && |
311 | xevent->xproperty.atom == info->timestamp_prop_atom) |
312 | return True1; |
313 | |
314 | return False0; |
315 | } |
316 | |
317 | static guint32 |
318 | get_xserver_timestamp (VnckScreen *screen) |
319 | { |
320 | Display *display; |
321 | int number; |
322 | Screen *xscreen; |
323 | TimeStampInfo info; |
324 | unsigned char c = 'a'; |
325 | XEvent xevent; |
326 | |
327 | display = CDK_DISPLAY_XDISPLAY (cdk_display_get_default ())(cdk_x11_display_get_xdisplay (cdk_display_get_default ())); |
328 | number = vnck_screen_get_number (screen); |
329 | xscreen = ScreenOfDisplay (display, number)(&((_XPrivDisplay)(display))->screens[number]); |
330 | |
331 | info.window = XCreateSimpleWindow (display, |
332 | RootWindowOfScreen (xscreen)((xscreen)->root), |
333 | 0, 0, 10, 10, 0, |
334 | WhitePixel (display, number)((&((_XPrivDisplay)(display))->screens[number])->white_pixel ), |
335 | WhitePixel (display, number)((&((_XPrivDisplay)(display))->screens[number])->white_pixel )); |
336 | info.timestamp_prop_atom = XInternAtom (display, "_TIMESTAMP_PROP", |
337 | FALSE(0)); |
338 | |
339 | XSelectInput (display, info.window, PropertyChangeMask(1L<<22)); |
340 | |
341 | XChangeProperty (display, info.window, |
342 | info.timestamp_prop_atom, info.timestamp_prop_atom, |
343 | 8, PropModeReplace0, &c, 1); |
344 | |
345 | XIfEvent (display, &xevent, |
346 | timestamp_predicate, (XPointer)&info); |
347 | |
348 | XDestroyWindow (display, info.window); |
349 | |
350 | XSync (display, False0); |
351 | |
352 | return xevent.xproperty.time; |
353 | } |
354 | /* end of stolen code */ |
355 | |
356 | static gboolean |
357 | option_parse (const char *option_name, |
358 | const char *value, |
359 | gpointer data G_GNUC_UNUSED__attribute__ ((__unused__)), |
360 | GError **error) |
361 | { |
362 | char *end; |
363 | |
364 | /* skip "--" */ |
365 | option_name += 2; |
366 | |
367 | if (strcmp (option_name, "window") == 0 || strcmp (option_name, "xid") == 0) |
368 | { |
369 | gulong xid_buf; |
370 | |
371 | option_xid = TRUE(!(0)); |
372 | |
373 | if (value) |
374 | { |
375 | get_from_user = FALSE(0); |
376 | |
377 | xid_buf = strtoul (value, &end, 10); |
378 | if (end && end[0] == '\0') |
379 | xid = xid_buf; |
380 | else |
381 | { |
382 | g_set_error (error, G_OPTION_ERROR(g_option_error_quark ()), G_OPTION_ERROR_FAILED, |
383 | _("Invalid value \"%s\" for --%s")gettext ("Invalid value \"%s\" for --%s"), |
384 | value, option_name); |
385 | return FALSE(0); |
386 | } |
387 | } |
388 | |
389 | return TRUE(!(0)); |
390 | } |
391 | else if (strcmp (option_name, "application") == 0) |
392 | { |
393 | gulong xid_buf; |
394 | |
395 | option_application = TRUE(!(0)); |
396 | |
397 | if (value) |
398 | { |
399 | get_from_user = FALSE(0); |
400 | |
401 | xid_buf = strtoul (value, &end, 10); |
402 | if (end && end[0] == '\0') |
403 | interact_app_xid = xid_buf; |
404 | else |
405 | { |
406 | g_set_error (error, G_OPTION_ERROR(g_option_error_quark ()), G_OPTION_ERROR_FAILED, |
407 | _("Invalid value \"%s\" for --%s")gettext ("Invalid value \"%s\" for --%s"), |
408 | value, option_name); |
409 | return FALSE(0); |
410 | } |
411 | } |
412 | |
413 | return TRUE(!(0)); |
414 | } |
415 | else if (strcmp (option_name, "class") == 0) |
416 | { |
417 | option_class_group = TRUE(!(0)); |
418 | |
419 | if (value) |
420 | { |
421 | get_from_user = FALSE(0); |
422 | |
423 | interact_class_group = g_strdup (value)g_strdup_inline (value); |
424 | } |
425 | |
426 | return TRUE(!(0)); |
427 | } |
428 | else if (strcmp (option_name, "workspace") == 0) |
429 | { |
430 | option_workspace = TRUE(!(0)); |
431 | get_from_user = FALSE(0); |
432 | |
433 | if (value) |
434 | { |
435 | int space_buf; |
436 | |
437 | space_buf = strtol (value, &end, 10); |
438 | |
439 | if (end && end[0] == '\0') |
440 | interact_space = space_buf; |
441 | else |
442 | { |
443 | g_set_error (error, G_OPTION_ERROR(g_option_error_quark ()), G_OPTION_ERROR_FAILED, |
444 | _("Invalid value \"%s\" for --%s")gettext ("Invalid value \"%s\" for --%s"), |
445 | value, option_name); |
446 | return FALSE(0); |
447 | } |
448 | } |
449 | |
450 | return TRUE(!(0)); |
451 | } |
452 | else if (strcmp (option_name, "screen") == 0) |
453 | { |
454 | option_screen = TRUE(!(0)); |
455 | get_from_user = FALSE(0); |
456 | |
457 | if (value) |
458 | { |
459 | int screen_buf; |
460 | |
461 | screen_buf = strtol (value, &end, 10); |
462 | |
463 | if (end && end[0] == '\0') |
464 | interact_screen = screen_buf; |
465 | else |
466 | { |
467 | g_set_error (error, G_OPTION_ERROR(g_option_error_quark ()), G_OPTION_ERROR_FAILED, |
468 | _("Invalid value \"%s\" for --%s")gettext ("Invalid value \"%s\" for --%s"), |
469 | value, option_name); |
470 | return FALSE(0); |
471 | } |
472 | } |
473 | |
474 | return TRUE(!(0)); |
475 | } |
476 | else |
477 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 477, ((const char*) (__func__)), ((void*)0)); } while (0); |
478 | |
479 | return FALSE(0); |
480 | } |
481 | |
482 | static gboolean |
483 | set_mode (int new_mode, |
484 | const char *option, |
485 | gboolean use_list) |
486 | { |
487 | switch (mode) |
488 | { |
489 | case INVALID_MODE: |
490 | if (use_list) |
491 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 491, ((const char*) (__func__)), ((void*)0)); } while (0); |
492 | |
493 | mode = new_mode; |
494 | break; |
495 | case SCREEN_READ_MODE: |
496 | if (new_mode == SCREEN_READ_MODE || new_mode == SCREEN_WRITE_MODE) |
497 | mode = new_mode; |
498 | else if (use_list) |
499 | mode = SCREEN_LIST_MODE; |
500 | else |
501 | { |
502 | g_printerr (_("Conflicting options are present: screen %d should "gettext ("Conflicting options are present: screen %d should " "be interacted with, but --%s has been used\n") |
503 | "be interacted with, but --%s has been used\n")gettext ("Conflicting options are present: screen %d should " "be interacted with, but --%s has been used\n"), |
504 | interact_screen, option); |
505 | return FALSE(0); |
506 | } |
507 | break; |
508 | case SCREEN_LIST_MODE: |
509 | if (new_mode != SCREEN_LIST_MODE) |
510 | { |
511 | g_printerr (_("Conflicting options are present: windows or "gettext ("Conflicting options are present: windows or " "workspaces of screen %d should be listed, " "but --%s has been used\n") |
512 | "workspaces of screen %d should be listed, "gettext ("Conflicting options are present: windows or " "workspaces of screen %d should be listed, " "but --%s has been used\n") |
513 | "but --%s has been used\n")gettext ("Conflicting options are present: windows or " "workspaces of screen %d should be listed, " "but --%s has been used\n"), |
514 | interact_screen, option); |
515 | return FALSE(0); |
516 | } |
517 | break; |
518 | case SCREEN_WRITE_MODE: |
519 | if (new_mode != SCREEN_WRITE_MODE) |
520 | { |
521 | g_printerr (_("Conflicting options are present: screen %d should "gettext ("Conflicting options are present: screen %d should " "be interacted with, but --%s has been used\n") |
522 | "be interacted with, but --%s has been used\n")gettext ("Conflicting options are present: screen %d should " "be interacted with, but --%s has been used\n"), |
523 | interact_screen, option); |
524 | return FALSE(0); |
525 | } |
526 | break; |
527 | case WORKSPACE_READ_MODE: |
528 | if (new_mode == WORKSPACE_READ_MODE || new_mode == WORKSPACE_WRITE_MODE) |
529 | mode = new_mode; |
530 | else if (use_list) |
531 | mode = WORKSPACE_LIST_MODE; |
532 | else |
533 | { |
534 | g_printerr (_("Conflicting options are present: workspace %d "gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n") |
535 | "should be interacted with, but --%s has been "gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n") |
536 | "used\n")gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n"), |
537 | interact_space, option); |
538 | return FALSE(0); |
539 | } |
540 | break; |
541 | case WORKSPACE_LIST_MODE: |
542 | if (new_mode != WORKSPACE_LIST_MODE) |
543 | { |
544 | g_printerr (_("Conflicting options are present: windows of "gettext ("Conflicting options are present: windows of " "workspace %d should be listed, but --%s has been " "used\n") |
545 | "workspace %d should be listed, but --%s has been "gettext ("Conflicting options are present: windows of " "workspace %d should be listed, but --%s has been " "used\n") |
546 | "used\n")gettext ("Conflicting options are present: windows of " "workspace %d should be listed, but --%s has been " "used\n"), |
547 | interact_space, option); |
548 | return FALSE(0); |
549 | } |
550 | break; |
551 | case WORKSPACE_WRITE_MODE: |
552 | if (new_mode != WORKSPACE_WRITE_MODE) |
553 | { |
554 | g_printerr (_("Conflicting options are present: workspace %d "gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n") |
555 | "should be interacted with, but --%s has been "gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n") |
556 | "used\n")gettext ("Conflicting options are present: workspace %d " "should be interacted with, but --%s has been " "used\n"), |
557 | interact_space, option); |
558 | return FALSE(0); |
559 | } |
560 | break; |
561 | case APPLICATION_READ_MODE: |
562 | if (use_list) |
563 | mode = APPLICATION_LIST_MODE; |
564 | else if (new_mode != APPLICATION_READ_MODE) |
565 | { |
566 | g_printerr (_("Conflicting options are present: an application "gettext ("Conflicting options are present: an application " "should be interacted with, but --%s has been " "used\n") |
567 | "should be interacted with, but --%s has been "gettext ("Conflicting options are present: an application " "should be interacted with, but --%s has been " "used\n") |
568 | "used\n")gettext ("Conflicting options are present: an application " "should be interacted with, but --%s has been " "used\n"), |
569 | option); |
570 | return FALSE(0); |
571 | } |
572 | break; |
573 | case APPLICATION_LIST_MODE: |
574 | if (new_mode != APPLICATION_LIST_MODE) |
575 | { |
576 | g_printerr (_("Conflicting options are present: windows of an "gettext ("Conflicting options are present: windows of an " "application should be listed, but --%s has been " "used\n") |
577 | "application should be listed, but --%s has been "gettext ("Conflicting options are present: windows of an " "application should be listed, but --%s has been " "used\n") |
578 | "used\n")gettext ("Conflicting options are present: windows of an " "application should be listed, but --%s has been " "used\n"), |
579 | option); |
580 | return FALSE(0); |
581 | } |
582 | break; |
583 | case CLASS_GROUP_READ_MODE: |
584 | if (use_list) |
585 | mode = CLASS_GROUP_LIST_MODE; |
586 | else if (new_mode != CLASS_GROUP_READ_MODE) |
587 | { |
588 | /* Translators: A class is like a "family". E.g., all gvim windows |
589 | * are of the same class. */ |
590 | g_printerr (_("Conflicting options are present: class group "gettext ("Conflicting options are present: class group " "\"%s\" should be interacted with, but --%s has " "been used\n") |
591 | "\"%s\" should be interacted with, but --%s has "gettext ("Conflicting options are present: class group " "\"%s\" should be interacted with, but --%s has " "been used\n") |
592 | "been used\n")gettext ("Conflicting options are present: class group " "\"%s\" should be interacted with, but --%s has " "been used\n"), |
593 | interact_class_group, option); |
594 | return FALSE(0); |
595 | } |
596 | break; |
597 | case CLASS_GROUP_LIST_MODE: |
598 | if (new_mode != CLASS_GROUP_LIST_MODE) |
599 | { |
600 | /* Translators: A class is like a "family". E.g., all gvim windows |
601 | * are of the same class. */ |
602 | g_printerr (_("Conflicting options are present: windows of class "gettext ("Conflicting options are present: windows of class " "group \"%s\" should be listed, but --%s has " "been used\n" ) |
603 | "group \"%s\" should be listed, but --%s has "gettext ("Conflicting options are present: windows of class " "group \"%s\" should be listed, but --%s has " "been used\n" ) |
604 | "been used\n")gettext ("Conflicting options are present: windows of class " "group \"%s\" should be listed, but --%s has " "been used\n" ), |
605 | interact_class_group, option); |
606 | return FALSE(0); |
607 | } |
608 | break; |
609 | case WINDOW_READ_MODE: |
610 | if (new_mode == WINDOW_READ_MODE || new_mode == WINDOW_WRITE_MODE) |
611 | mode = new_mode; |
612 | else |
613 | { |
614 | g_printerr (_("Conflicting options are present: a window should "gettext ("Conflicting options are present: a window should " "be interacted with, but --%s has been used\n" ) |
615 | "be interacted with, but --%s has been used\n")gettext ("Conflicting options are present: a window should " "be interacted with, but --%s has been used\n" ), |
616 | option); |
617 | return FALSE(0); |
618 | } |
619 | break; |
620 | case WINDOW_WRITE_MODE: |
621 | if (new_mode != WINDOW_WRITE_MODE) |
622 | { |
623 | g_printerr (_("Conflicting options are present: a window should "gettext ("Conflicting options are present: a window should " "be interacted with, but --%s has been used\n" ) |
624 | "be interacted with, but --%s has been used\n")gettext ("Conflicting options are present: a window should " "be interacted with, but --%s has been used\n" ), |
625 | option); |
626 | return FALSE(0); |
627 | } |
628 | break; |
629 | default: |
630 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 630, ((const char*) (__func__)), ((void*)0)); } while (0); |
631 | } |
632 | |
633 | return TRUE(!(0)); |
634 | } |
635 | |
636 | static gboolean |
637 | validate_options (void) |
638 | { |
639 | #define CHECK_DUAL_OPTIONS(shortvar, mode)if (set_shortvar && set_unshortvar) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n"), "shortvar" , "un""shortvar"); return (0); } if (set_shortvar) { if (!set_mode (mode, "shortvar", (0))) return (0); } if (set_unshortvar) { if (!set_mode (mode, "un""shortvar", (0))) return (0); } \ |
640 | if (set_##shortvar && set_un##shortvar) \ |
641 | { \ |
642 | g_printerr (_("Conflicting options are present: --%s and --%s\n")gettext ("Conflicting options are present: --%s and --%s\n"),\ |
643 | #shortvar, "un"#shortvar); \ |
644 | return FALSE(0); \ |
645 | } \ |
646 | if (set_##shortvar) \ |
647 | { \ |
648 | if (!set_mode (mode, #shortvar, FALSE(0))) \ |
649 | return FALSE(0); \ |
650 | } \ |
651 | if (set_un##shortvar) \ |
652 | { \ |
653 | if (!set_mode (mode, "un"#shortvar, FALSE(0))) \ |
654 | return FALSE(0); \ |
655 | } |
656 | |
657 | #define CHECK_BOOL(shortvar, name, mode)if (set_shortvar) { if (!set_mode (mode, name, (0))) return ( 0); } \ |
658 | if (set_##shortvar) \ |
659 | { \ |
660 | if (!set_mode (mode, name, FALSE(0))) \ |
661 | return FALSE(0); \ |
662 | } |
663 | |
664 | #define CHECK_BOOL_REAL(var, name, mode)if (var) { if (!set_mode (mode, name, (0))) return (0); } \ |
665 | if (var) \ |
666 | { \ |
667 | if (!set_mode (mode, name, FALSE(0))) \ |
668 | return FALSE(0); \ |
669 | } |
670 | |
671 | #define CHECK_INT(var, name, mode)if (var != 2147483647) { if (!set_mode (mode, name, (0))) return (0); } \ |
672 | if (var != G_MAXINT2147483647) \ |
673 | { \ |
674 | if (!set_mode (mode, name, FALSE(0))) \ |
675 | return FALSE(0); \ |
676 | } |
677 | |
678 | #define CHECK_POSITIVE_STRICT_INT(var, name, mode)if (var != -1 && var <= 0) { g_printerr (gettext ( "Invalid argument \"%d\" for --%s: the argument must be strictly positive\n" ), var, name); return (0); } if (var != -1) { if (!set_mode ( mode, name, (0))) return (0); } \ |
679 | if (var != -1 && var <= 0) \ |
680 | { \ |
681 | g_printerr (_("Invalid argument \"%d\" for --%s: the argument must be strictly positive\n")gettext ("Invalid argument \"%d\" for --%s: the argument must be strictly positive\n" ), \ |
682 | var, name); \ |
683 | return FALSE(0); \ |
684 | } \ |
685 | if (var != -1) \ |
686 | { \ |
687 | if (!set_mode (mode, name, FALSE(0))) \ |
688 | return FALSE(0); \ |
689 | } |
690 | |
691 | #define CHECK_POSITIVE_INT(var, name, mode)if (var != -1 && var < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), var, name); return (0); } if (var != -1) { if (!set_mode ( mode, name, (0))) return (0); } \ |
692 | if (var != -1 && var < 0) \ |
693 | { \ |
694 | g_printerr (_("Invalid argument \"%d\" for --%s: the argument must be positive\n")gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), \ |
695 | var, name); \ |
696 | return FALSE(0); \ |
697 | } \ |
698 | if (var != -1) \ |
699 | { \ |
700 | if (!set_mode (mode, name, FALSE(0))) \ |
701 | return FALSE(0); \ |
702 | } |
703 | |
704 | if (option_xid) |
705 | mode = WINDOW_READ_MODE; |
706 | if (option_application) |
707 | if (!set_mode (APPLICATION_READ_MODE, "application", FALSE(0))) |
708 | return FALSE(0); |
709 | if (option_class_group) |
710 | if (!set_mode (CLASS_GROUP_READ_MODE, "class", FALSE(0))) |
711 | return FALSE(0); |
712 | if (option_workspace) |
713 | if (!set_mode (WORKSPACE_READ_MODE, "workspace", FALSE(0))) |
714 | return FALSE(0); |
715 | if (option_screen) |
716 | if (!set_mode (SCREEN_READ_MODE, "screen", FALSE(0))) |
717 | return FALSE(0); |
718 | |
719 | CHECK_BOOL_REAL (list_workspaces, "list-workspaces", SCREEN_LIST_MODE)if (list_workspaces) { if (!set_mode (SCREEN_LIST_MODE, "list-workspaces" , (0))) return (0); } |
720 | |
721 | if (list && list_workspaces) |
722 | { |
723 | g_printerr (_("Conflicting options are present: --%s and --%s\n")gettext ("Conflicting options are present: --%s and --%s\n"), |
724 | "list", "list-workspaces"); |
725 | return FALSE(0); |
726 | } |
727 | |
728 | /* if there's just --list, then we list windows of the default screen */ |
729 | if (list && mode == INVALID_MODE) |
730 | mode = SCREEN_LIST_MODE; |
731 | else if (list) |
732 | if (!set_mode (INVALID_MODE, "list", TRUE(!(0)))) |
733 | return FALSE(0); |
734 | |
735 | CHECK_POSITIVE_STRICT_INT (set_n_workspaces, "set-n-workspaces",if (set_n_workspaces != -1 && set_n_workspaces <= 0 ) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be strictly positive\n" ), set_n_workspaces, "set-n-workspaces"); return (0); } if (set_n_workspaces != -1) { if (!set_mode (SCREEN_WRITE_MODE, "set-n-workspaces" , (0))) return (0); } |
736 | SCREEN_WRITE_MODE)if (set_n_workspaces != -1 && set_n_workspaces <= 0 ) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be strictly positive\n" ), set_n_workspaces, "set-n-workspaces"); return (0); } if (set_n_workspaces != -1) { if (!set_mode (SCREEN_WRITE_MODE, "set-n-workspaces" , (0))) return (0); } |
737 | if (set_workspace_rows > 0) |
738 | if (!set_mode (SCREEN_WRITE_MODE, "set-workspace-rows", FALSE(0))) |
739 | return FALSE(0); |
740 | if (set_workspace_cols > 0) |
741 | if (!set_mode (SCREEN_WRITE_MODE, "set-workspace-columns", FALSE(0))) |
742 | return FALSE(0); |
743 | CHECK_DUAL_OPTIONS (show_desktop, SCREEN_WRITE_MODE)if (set_show_desktop && set_unshow_desktop) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n" ), "show_desktop", "un""show_desktop"); return (0); } if (set_show_desktop ) { if (!set_mode (SCREEN_WRITE_MODE, "show_desktop", (0))) return (0); } if (set_unshow_desktop) { if (!set_mode (SCREEN_WRITE_MODE , "un""show_desktop", (0))) return (0); } |
744 | CHECK_POSITIVE_INT (set_viewport_x, "move-viewport-x", SCREEN_WRITE_MODE)if (set_viewport_x != -1 && set_viewport_x < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), set_viewport_x, "move-viewport-x"); return (0); } if (set_viewport_x != -1) { if (!set_mode (SCREEN_WRITE_MODE, "move-viewport-x" , (0))) return (0); } |
745 | CHECK_POSITIVE_INT (set_viewport_y, "move-viewport-y", SCREEN_WRITE_MODE)if (set_viewport_y != -1 && set_viewport_y < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), set_viewport_y, "move-viewport-y"); return (0); } if (set_viewport_y != -1) { if (!set_mode (SCREEN_WRITE_MODE, "move-viewport-y" , (0))) return (0); } |
746 | |
747 | /* screen options can work by assuming it's on the default screen */ |
748 | if (mode == SCREEN_READ_MODE || mode == SCREEN_LIST_MODE || |
749 | mode == SCREEN_WRITE_MODE) |
750 | { |
751 | get_from_user = FALSE(0); |
752 | option_screen = TRUE(!(0)); |
753 | } |
754 | |
755 | /* no command line option specifying the mode => the user will choose a |
756 | * window */ |
757 | if (mode == INVALID_MODE) |
758 | mode = WINDOW_READ_MODE; |
759 | |
760 | if (set_change_name != NULL((void*)0)) |
761 | if (!set_mode (WORKSPACE_WRITE_MODE, "change-name", FALSE(0))) |
762 | return FALSE(0); |
763 | |
764 | CHECK_DUAL_OPTIONS (minimize, WINDOW_WRITE_MODE)if (set_minimize && set_unminimize) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n"), "minimize" , "un""minimize"); return (0); } if (set_minimize) { if (!set_mode (WINDOW_WRITE_MODE, "minimize", (0))) return (0); } if (set_unminimize ) { if (!set_mode (WINDOW_WRITE_MODE, "un""minimize", (0))) return (0); } |
765 | CHECK_DUAL_OPTIONS (maximize, WINDOW_WRITE_MODE)if (set_maximize && set_unmaximize) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n"), "maximize" , "un""maximize"); return (0); } if (set_maximize) { if (!set_mode (WINDOW_WRITE_MODE, "maximize", (0))) return (0); } if (set_unmaximize ) { if (!set_mode (WINDOW_WRITE_MODE, "un""maximize", (0))) return (0); } |
766 | CHECK_DUAL_OPTIONS (maximize_horizontally, WINDOW_WRITE_MODE)if (set_maximize_horizontally && set_unmaximize_horizontally ) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n" ), "maximize_horizontally", "un""maximize_horizontally"); return (0); } if (set_maximize_horizontally) { if (!set_mode (WINDOW_WRITE_MODE , "maximize_horizontally", (0))) return (0); } if (set_unmaximize_horizontally ) { if (!set_mode (WINDOW_WRITE_MODE, "un""maximize_horizontally" , (0))) return (0); } |
767 | CHECK_DUAL_OPTIONS (maximize_vertically, WINDOW_WRITE_MODE)if (set_maximize_vertically && set_unmaximize_vertically ) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n" ), "maximize_vertically", "un""maximize_vertically"); return ( 0); } if (set_maximize_vertically) { if (!set_mode (WINDOW_WRITE_MODE , "maximize_vertically", (0))) return (0); } if (set_unmaximize_vertically ) { if (!set_mode (WINDOW_WRITE_MODE, "un""maximize_vertically" , (0))) return (0); } |
768 | if (set_keyboard_move && set_keyboard_resize) |
769 | { |
770 | g_printerr (_("Conflicting options are present: --%s and --%s\n")gettext ("Conflicting options are present: --%s and --%s\n"), |
771 | "keyboard-move", "keyboard-resize"); |
772 | return FALSE(0); |
773 | } |
774 | CHECK_BOOL (keyboard_move, "keyboard-move", WINDOW_WRITE_MODE)if (set_keyboard_move) { if (!set_mode (WINDOW_WRITE_MODE, "keyboard-move" , (0))) return (0); } |
775 | CHECK_BOOL (keyboard_resize, "keyboard-resize", WINDOW_WRITE_MODE)if (set_keyboard_resize) { if (!set_mode (WINDOW_WRITE_MODE, "keyboard-resize" , (0))) return (0); } |
776 | CHECK_BOOL (close, "close", WINDOW_WRITE_MODE)if (set_close) { if (!set_mode (WINDOW_WRITE_MODE, "close", ( 0))) return (0); } |
777 | |
778 | CHECK_DUAL_OPTIONS (fullscreen, WINDOW_WRITE_MODE)if (set_fullscreen && set_unfullscreen) { g_printerr ( gettext ("Conflicting options are present: --%s and --%s\n"), "fullscreen", "un""fullscreen"); return (0); } if (set_fullscreen ) { if (!set_mode (WINDOW_WRITE_MODE, "fullscreen", (0))) return (0); } if (set_unfullscreen) { if (!set_mode (WINDOW_WRITE_MODE , "un""fullscreen", (0))) return (0); } |
779 | CHECK_DUAL_OPTIONS (make_above, WINDOW_WRITE_MODE)if (set_make_above && set_unmake_above) { g_printerr ( gettext ("Conflicting options are present: --%s and --%s\n"), "make_above", "un""make_above"); return (0); } if (set_make_above ) { if (!set_mode (WINDOW_WRITE_MODE, "make_above", (0))) return (0); } if (set_unmake_above) { if (!set_mode (WINDOW_WRITE_MODE , "un""make_above", (0))) return (0); } |
780 | CHECK_DUAL_OPTIONS (make_below, WINDOW_WRITE_MODE)if (set_make_below && set_unmake_below) { g_printerr ( gettext ("Conflicting options are present: --%s and --%s\n"), "make_below", "un""make_below"); return (0); } if (set_make_below ) { if (!set_mode (WINDOW_WRITE_MODE, "make_below", (0))) return (0); } if (set_unmake_below) { if (!set_mode (WINDOW_WRITE_MODE , "un""make_below", (0))) return (0); } |
781 | CHECK_DUAL_OPTIONS (shade, WINDOW_WRITE_MODE)if (set_shade && set_unshade) { g_printerr (gettext ( "Conflicting options are present: --%s and --%s\n"), "shade", "un""shade"); return (0); } if (set_shade) { if (!set_mode ( WINDOW_WRITE_MODE, "shade", (0))) return (0); } if (set_unshade ) { if (!set_mode (WINDOW_WRITE_MODE, "un""shade", (0))) return (0); } |
782 | CHECK_DUAL_OPTIONS (stick, WINDOW_WRITE_MODE)if (set_stick && set_unstick) { g_printerr (gettext ( "Conflicting options are present: --%s and --%s\n"), "stick", "un""stick"); return (0); } if (set_stick) { if (!set_mode ( WINDOW_WRITE_MODE, "stick", (0))) return (0); } if (set_unstick ) { if (!set_mode (WINDOW_WRITE_MODE, "un""stick", (0))) return (0); } |
783 | CHECK_DUAL_OPTIONS (skip_pager, WINDOW_WRITE_MODE)if (set_skip_pager && set_unskip_pager) { g_printerr ( gettext ("Conflicting options are present: --%s and --%s\n"), "skip_pager", "un""skip_pager"); return (0); } if (set_skip_pager ) { if (!set_mode (WINDOW_WRITE_MODE, "skip_pager", (0))) return (0); } if (set_unskip_pager) { if (!set_mode (WINDOW_WRITE_MODE , "un""skip_pager", (0))) return (0); } |
784 | CHECK_DUAL_OPTIONS (skip_tasklist, WINDOW_WRITE_MODE)if (set_skip_tasklist && set_unskip_tasklist) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n" ), "skip_tasklist", "un""skip_tasklist"); return (0); } if (set_skip_tasklist ) { if (!set_mode (WINDOW_WRITE_MODE, "skip_tasklist", (0))) return (0); } if (set_unskip_tasklist) { if (!set_mode (WINDOW_WRITE_MODE , "un""skip_tasklist", (0))) return (0); } |
785 | CHECK_DUAL_OPTIONS (pin, WINDOW_WRITE_MODE)if (set_pin && set_unpin) { g_printerr (gettext ("Conflicting options are present: --%s and --%s\n" ), "pin", "un""pin"); return (0); } if (set_pin) { if (!set_mode (WINDOW_WRITE_MODE, "pin", (0))) return (0); } if (set_unpin ) { if (!set_mode (WINDOW_WRITE_MODE, "un""pin", (0))) return (0); } |
786 | |
787 | if ((set_pin || set_unpin) && set_workspace != -1) |
788 | { |
789 | g_printerr (_("Conflicting options are present: --%s or --%s, "gettext ("Conflicting options are present: --%s or --%s, " "and --%s\n" ) |
790 | "and --%s\n")gettext ("Conflicting options are present: --%s or --%s, " "and --%s\n" ), |
791 | "pin", "unpin", "set-workspace"); |
792 | return FALSE(0); |
793 | } |
794 | |
795 | CHECK_POSITIVE_INT (set_workspace, "set-workspace", WINDOW_WRITE_MODE)if (set_workspace != -1 && set_workspace < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), set_workspace, "set-workspace"); return (0); } if (set_workspace != -1) { if (!set_mode (WINDOW_WRITE_MODE, "set-workspace", ( 0))) return (0); } |
796 | CHECK_INT (set_x, "set-x", WINDOW_WRITE_MODE)if (set_x != 2147483647) { if (!set_mode (WINDOW_WRITE_MODE, "set-x" , (0))) return (0); } |
797 | CHECK_INT (set_y, "set-y", WINDOW_WRITE_MODE)if (set_y != 2147483647) { if (!set_mode (WINDOW_WRITE_MODE, "set-y" , (0))) return (0); } |
798 | CHECK_POSITIVE_INT (set_width, "set-width", WINDOW_WRITE_MODE)if (set_width != -1 && set_width < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), set_width, "set-width"); return (0); } if (set_width != -1 ) { if (!set_mode (WINDOW_WRITE_MODE, "set-width", (0))) return (0); } |
799 | CHECK_POSITIVE_INT (set_height, "set-height", WINDOW_WRITE_MODE)if (set_height != -1 && set_height < 0) { g_printerr (gettext ("Invalid argument \"%d\" for --%s: the argument must be positive\n" ), set_height, "set-height"); return (0); } if (set_height != -1) { if (!set_mode (WINDOW_WRITE_MODE, "set-height", (0))) return (0); } |
800 | |
801 | if (set_window_type != NULL((void*)0)) |
802 | { |
803 | if (strcmp (set_window_type, "normal") == 0) |
804 | set_window_type_t = VNCK_WINDOW_NORMAL; |
805 | else if (strcmp (set_window_type, "desktop") == 0) |
806 | set_window_type_t = VNCK_WINDOW_DESKTOP; |
807 | else if (strcmp (set_window_type, "dock") == 0) |
808 | set_window_type_t = VNCK_WINDOW_DOCK; |
809 | else if (strcmp (set_window_type, "dialog") == 0) |
810 | set_window_type_t = VNCK_WINDOW_DIALOG; |
811 | else if (strcmp (set_window_type, "toolbar") == 0) |
812 | set_window_type_t = VNCK_WINDOW_TOOLBAR; |
813 | else if (strcmp (set_window_type, "menu") == 0) |
814 | set_window_type_t = VNCK_WINDOW_MENU; |
815 | else if (strcmp (set_window_type, "utility") == 0) |
816 | set_window_type_t = VNCK_WINDOW_UTILITY; |
817 | else if (strcmp (set_window_type, "splash") == 0) |
818 | set_window_type_t = VNCK_WINDOW_SPLASHSCREEN; |
819 | else |
820 | { |
821 | g_printerr (_("Invalid argument \"%s\" for --%s, valid values are: "gettext ("Invalid argument \"%s\" for --%s, valid values are: " "%s\n") |
822 | "%s\n")gettext ("Invalid argument \"%s\" for --%s, valid values are: " "%s\n"), |
823 | set_window_type, "set-window-type", |
824 | "normal, desktop, dock, dialog, toolbar, menu, utility, " |
825 | "splash"); |
826 | } |
827 | |
828 | if (!set_mode (WINDOW_WRITE_MODE, "set-window-type", FALSE(0))) |
829 | return FALSE(0); |
830 | } |
831 | |
832 | if (set_activate) |
833 | { |
834 | if (mode == WORKSPACE_READ_MODE || mode == WORKSPACE_WRITE_MODE) |
835 | set_mode (WORKSPACE_WRITE_MODE, "activate", FALSE(0)); |
836 | else if (mode == WINDOW_READ_MODE || mode == WINDOW_WRITE_MODE) |
837 | set_mode (WINDOW_WRITE_MODE, "activate", FALSE(0)); |
838 | else |
839 | return set_mode (INVALID_MODE, "activate", FALSE(0)); |
840 | } |
841 | |
842 | return TRUE(!(0)); |
843 | } |
844 | |
845 | static void |
846 | update_screen (VnckScreen *screen) |
847 | { |
848 | if (set_n_workspaces > 0) |
849 | vnck_screen_change_workspace_count (screen, set_n_workspaces); |
850 | |
851 | if (set_workspace_rows > 0 || set_workspace_cols > 0) |
852 | { |
853 | int token; |
854 | |
855 | token = vnck_screen_try_set_workspace_layout (screen, 0, |
856 | set_workspace_rows, |
857 | set_workspace_cols); |
858 | if (token) |
859 | vnck_screen_release_workspace_layout (screen, token); |
860 | else |
861 | g_printerr (_("Cannot change the workspace layout on the screen: "gettext ("Cannot change the workspace layout on the screen: " "the layout is already owned\n") |
862 | "the layout is already owned\n")gettext ("Cannot change the workspace layout on the screen: " "the layout is already owned\n")); |
863 | } |
864 | |
865 | if (set_show_desktop) |
866 | vnck_screen_toggle_showing_desktop (screen, TRUE(!(0))); |
867 | else if (set_unshow_desktop) |
868 | vnck_screen_toggle_showing_desktop (screen, FALSE(0)); |
869 | |
870 | if (set_viewport_x != -1 || set_viewport_y != -1) |
871 | { |
872 | VnckWorkspace *active_space; |
873 | |
874 | active_space = vnck_screen_get_active_workspace (screen); |
875 | |
876 | if (active_space != NULL((void*)0)) |
877 | { |
878 | if (vnck_workspace_is_virtual (active_space)) |
879 | { |
880 | int viewport_x; |
881 | int viewport_y; |
882 | |
883 | if (set_viewport_x != -1) |
884 | viewport_x = set_viewport_x; |
885 | else |
886 | viewport_x = vnck_workspace_get_viewport_x (active_space); |
887 | |
888 | if (set_viewport_y != -1) |
889 | viewport_y = set_viewport_y; |
890 | else |
891 | viewport_y = vnck_workspace_get_viewport_y (active_space); |
892 | |
893 | vnck_screen_move_viewport (screen, viewport_x, viewport_y); |
894 | } |
895 | else |
896 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
897 | * can be used to implement workspaces (e.g. compiz is an example); |
898 | * however it is not just the current workspace. */ |
899 | g_printerr (_("Viewport cannot be moved: "gettext ("Viewport cannot be moved: " "the current workspace does not contain a viewport\n" ) |
900 | "the current workspace does not contain a viewport\n")gettext ("Viewport cannot be moved: " "the current workspace does not contain a viewport\n" )); |
901 | } |
902 | else |
903 | /* Translators: 'viewport' is kind of the viewable area. A viewport |
904 | * can be used to implement workspaces (e.g. compiz is an example); |
905 | * however it is not just the current workspace. */ |
906 | g_printerr (_("Viewport cannot be moved: "gettext ("Viewport cannot be moved: " "there is no current workspace\n" ) |
907 | "there is no current workspace\n")gettext ("Viewport cannot be moved: " "there is no current workspace\n" )); |
908 | } |
909 | } |
910 | |
911 | static void |
912 | update_workspace (VnckWorkspace *space) |
913 | { |
914 | unsigned int timestamp; |
915 | |
916 | timestamp = get_xserver_timestamp (vnck_workspace_get_screen (space)); |
917 | |
918 | if (set_activate) |
919 | vnck_workspace_activate (space, timestamp); |
920 | |
921 | if (set_change_name) |
922 | vnck_workspace_change_name (space, set_change_name); |
923 | } |
924 | |
925 | |
926 | static void |
927 | update_window (VnckWindow *window) |
928 | { |
929 | VnckWindowActions actions; |
930 | VnckWindowMoveResizeMask geometry_mask; |
931 | unsigned int timestamp; |
932 | |
933 | actions = vnck_window_get_actions (window); |
934 | timestamp = get_xserver_timestamp (vnck_window_get_screen (window)); |
935 | |
936 | #define SET_PROPERTY(name, action)if (set_name) { if (actions & action) vnck_window_name (window ); else g_printerr (gettext ("Action not allowed\n")); } \ |
937 | if (set_##name) \ |
938 | { \ |
939 | if (actions & action) \ |
940 | vnck_window_##name (window); \ |
941 | else \ |
942 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
943 | } |
944 | |
945 | #define SET_PROPERTY_TIMESTAMP(name, action)if (set_name) { if (actions & action) vnck_window_name (window , timestamp); else g_printerr (gettext ("Action not allowed\n" )); } \ |
946 | if (set_##name) \ |
947 | { \ |
948 | if (actions & action) \ |
949 | vnck_window_##name (window, timestamp); \ |
950 | else \ |
951 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
952 | } |
953 | |
954 | #define SET_PROPERTY_DUAL(name, action1, action2)if (set_name) { if (actions & action1) vnck_window_name ( window); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unname) { if (actions & action2) vnck_window_unname (window); else g_printerr (gettext ("Action not allowed\n")) ; } \ |
955 | if (set_##name) \ |
956 | { \ |
957 | if (actions & action1) \ |
958 | vnck_window_##name (window); \ |
959 | else \ |
960 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
961 | } \ |
962 | else if (set_un##name) \ |
963 | { \ |
964 | if (actions & action2) \ |
965 | vnck_window_un##name (window); \ |
966 | else \ |
967 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
968 | } |
969 | |
970 | /* FIXME: why do we have dual & boolean API. This is not consistent! */ |
971 | #define SET_PROPERTY_BOOLEAN(name, action1, action2)if (set_name) { if (actions & action1) vnck_window_set_name (window, (!(0))); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unname) { if (actions & action2) vnck_window_set_name (window, (0)); else g_printerr (gettext ("Action not allowed\n" )); } \ |
972 | if (set_##name) \ |
973 | { \ |
974 | if (actions & action1) \ |
975 | vnck_window_set_##name (window, TRUE(!(0))); \ |
976 | else \ |
977 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
978 | } \ |
979 | else if (set_un##name) \ |
980 | { \ |
981 | if (actions & action2) \ |
982 | vnck_window_set_##name (window, FALSE(0)); \ |
983 | else \ |
984 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
985 | } |
986 | |
987 | #define SET_GEOMETRY(param, unset, action, change)if (set_param != unset) { if (actions & action) geometry_mask |= change; else g_printerr (gettext ("Action not allowed\n") ); } \ |
988 | if (set_##param != unset) \ |
989 | { \ |
990 | if (actions & action) \ |
991 | geometry_mask |= change; \ |
992 | else \ |
993 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); \ |
994 | } |
995 | |
996 | SET_PROPERTY (minimize, VNCK_WINDOW_ACTION_MINIMIZE)if (set_minimize) { if (actions & VNCK_WINDOW_ACTION_MINIMIZE ) vnck_window_minimize (window); else g_printerr (gettext ("Action not allowed\n" )); } |
997 | SET_PROPERTY_TIMESTAMP (unminimize, VNCK_WINDOW_ACTION_UNMINIMIZE)if (set_unminimize) { if (actions & VNCK_WINDOW_ACTION_UNMINIMIZE ) vnck_window_unminimize (window, timestamp); else g_printerr (gettext ("Action not allowed\n")); } |
998 | |
999 | SET_PROPERTY_DUAL (maximize,if (set_maximize) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE ) vnck_window_maximize (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unmaximize) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE ) vnck_window_unmaximize (window); else g_printerr (gettext ( "Action not allowed\n")); } |
1000 | VNCK_WINDOW_ACTION_MAXIMIZE,if (set_maximize) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE ) vnck_window_maximize (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unmaximize) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE ) vnck_window_unmaximize (window); else g_printerr (gettext ( "Action not allowed\n")); } |
1001 | VNCK_WINDOW_ACTION_UNMAXIMIZE)if (set_maximize) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE ) vnck_window_maximize (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unmaximize) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE ) vnck_window_unmaximize (window); else g_printerr (gettext ( "Action not allowed\n")); } |
1002 | SET_PROPERTY_DUAL (maximize_horizontally,if (set_maximize_horizontally) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY ) vnck_window_maximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unmaximize_horizontally ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY ) vnck_window_unmaximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } |
1003 | VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY,if (set_maximize_horizontally) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY ) vnck_window_maximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unmaximize_horizontally ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY ) vnck_window_unmaximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } |
1004 | VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY)if (set_maximize_horizontally) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY ) vnck_window_maximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unmaximize_horizontally ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY ) vnck_window_unmaximize_horizontally (window); else g_printerr (gettext ("Action not allowed\n")); } |
1005 | SET_PROPERTY_DUAL (maximize_vertically,if (set_maximize_vertically) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY ) vnck_window_maximize_vertically (window); else g_printerr ( gettext ("Action not allowed\n")); } else if (set_unmaximize_vertically ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY ) vnck_window_unmaximize_vertically (window); else g_printerr (gettext ("Action not allowed\n")); } |
1006 | VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY,if (set_maximize_vertically) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY ) vnck_window_maximize_vertically (window); else g_printerr ( gettext ("Action not allowed\n")); } else if (set_unmaximize_vertically ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY ) vnck_window_unmaximize_vertically (window); else g_printerr (gettext ("Action not allowed\n")); } |
1007 | VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY)if (set_maximize_vertically) { if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY ) vnck_window_maximize_vertically (window); else g_printerr ( gettext ("Action not allowed\n")); } else if (set_unmaximize_vertically ) { if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY ) vnck_window_unmaximize_vertically (window); else g_printerr (gettext ("Action not allowed\n")); } |
1008 | |
1009 | SET_PROPERTY_BOOLEAN (fullscreen,if (set_fullscreen) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN ) vnck_window_set_fullscreen (window, (!(0))); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unfullscreen ) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN) vnck_window_set_fullscreen (window, (0)); else g_printerr (gettext ("Action not allowed\n" )); } |
1010 | VNCK_WINDOW_ACTION_FULLSCREEN,if (set_fullscreen) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN ) vnck_window_set_fullscreen (window, (!(0))); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unfullscreen ) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN) vnck_window_set_fullscreen (window, (0)); else g_printerr (gettext ("Action not allowed\n" )); } |
1011 | VNCK_WINDOW_ACTION_FULLSCREEN)if (set_fullscreen) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN ) vnck_window_set_fullscreen (window, (!(0))); else g_printerr (gettext ("Action not allowed\n")); } else if (set_unfullscreen ) { if (actions & VNCK_WINDOW_ACTION_FULLSCREEN) vnck_window_set_fullscreen (window, (0)); else g_printerr (gettext ("Action not allowed\n" )); } |
1012 | SET_PROPERTY_DUAL (make_above,if (set_make_above) { if (actions & VNCK_WINDOW_ACTION_ABOVE ) vnck_window_make_above (window); else g_printerr (gettext ( "Action not allowed\n")); } else if (set_unmake_above) { if ( actions & VNCK_WINDOW_ACTION_ABOVE) vnck_window_unmake_above (window); else g_printerr (gettext ("Action not allowed\n")) ; } |
1013 | VNCK_WINDOW_ACTION_ABOVE, VNCK_WINDOW_ACTION_ABOVE)if (set_make_above) { if (actions & VNCK_WINDOW_ACTION_ABOVE ) vnck_window_make_above (window); else g_printerr (gettext ( "Action not allowed\n")); } else if (set_unmake_above) { if ( actions & VNCK_WINDOW_ACTION_ABOVE) vnck_window_unmake_above (window); else g_printerr (gettext ("Action not allowed\n")) ; } |
1014 | SET_PROPERTY_DUAL (make_below,if (set_make_below) { if (actions & VNCK_WINDOW_ACTION_BELOW ) vnck_window_make_below (window); else g_printerr (gettext ( "Action not allowed\n")); } else if (set_unmake_below) { if ( actions & VNCK_WINDOW_ACTION_BELOW) vnck_window_unmake_below (window); else g_printerr (gettext ("Action not allowed\n")) ; } |
1015 | VNCK_WINDOW_ACTION_BELOW, VNCK_WINDOW_ACTION_BELOW)if (set_make_below) { if (actions & VNCK_WINDOW_ACTION_BELOW ) vnck_window_make_below (window); else g_printerr (gettext ( "Action not allowed\n")); } else if (set_unmake_below) { if ( actions & VNCK_WINDOW_ACTION_BELOW) vnck_window_unmake_below (window); else g_printerr (gettext ("Action not allowed\n")) ; } |
1016 | SET_PROPERTY_DUAL (shade,if (set_shade) { if (actions & VNCK_WINDOW_ACTION_SHADE) vnck_window_shade (window); else g_printerr (gettext ("Action not allowed\n")) ; } else if (set_unshade) { if (actions & VNCK_WINDOW_ACTION_UNSHADE ) vnck_window_unshade (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1017 | VNCK_WINDOW_ACTION_SHADE, VNCK_WINDOW_ACTION_UNSHADE)if (set_shade) { if (actions & VNCK_WINDOW_ACTION_SHADE) vnck_window_shade (window); else g_printerr (gettext ("Action not allowed\n")) ; } else if (set_unshade) { if (actions & VNCK_WINDOW_ACTION_UNSHADE ) vnck_window_unshade (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1018 | SET_PROPERTY_DUAL (stick,if (set_stick) { if (actions & VNCK_WINDOW_ACTION_STICK) vnck_window_stick (window); else g_printerr (gettext ("Action not allowed\n")) ; } else if (set_unstick) { if (actions & VNCK_WINDOW_ACTION_UNSTICK ) vnck_window_unstick (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1019 | VNCK_WINDOW_ACTION_STICK, VNCK_WINDOW_ACTION_UNSTICK)if (set_stick) { if (actions & VNCK_WINDOW_ACTION_STICK) vnck_window_stick (window); else g_printerr (gettext ("Action not allowed\n")) ; } else if (set_unstick) { if (actions & VNCK_WINDOW_ACTION_UNSTICK ) vnck_window_unstick (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1020 | SET_PROPERTY_BOOLEAN (skip_pager, actions, actions)if (set_skip_pager) { if (actions & actions) vnck_window_set_skip_pager (window, (!(0))); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unskip_pager) { if (actions & actions) vnck_window_set_skip_pager (window, (0)); else g_printerr (gettext ("Action not allowed\n")); } |
1021 | SET_PROPERTY_BOOLEAN (skip_tasklist, actions, actions)if (set_skip_tasklist) { if (actions & actions) vnck_window_set_skip_tasklist (window, (!(0))); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unskip_tasklist) { if (actions & actions ) vnck_window_set_skip_tasklist (window, (0)); else g_printerr (gettext ("Action not allowed\n")); } |
1022 | SET_PROPERTY_DUAL (pin,if (set_pin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_pin (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unpin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_unpin (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1023 | VNCK_WINDOW_ACTION_CHANGE_WORKSPACE,if (set_pin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_pin (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unpin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_unpin (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1024 | VNCK_WINDOW_ACTION_CHANGE_WORKSPACE)if (set_pin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_pin (window); else g_printerr (gettext ("Action not allowed\n" )); } else if (set_unpin) { if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE ) vnck_window_unpin (window); else g_printerr (gettext ("Action not allowed\n" )); } |
1025 | |
1026 | if (set_workspace != -1) |
1027 | { |
1028 | if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) |
1029 | { |
1030 | VnckScreen *screen; |
1031 | VnckWorkspace *space; |
1032 | |
1033 | screen = vnck_window_get_screen (window); |
1034 | space = vnck_screen_get_workspace (screen, set_workspace); |
1035 | if (space) |
1036 | vnck_window_move_to_workspace (window, space); |
1037 | else |
1038 | g_printerr (_("Window cannot be moved to workspace %d: "gettext ("Window cannot be moved to workspace %d: " "the workspace does not exist\n" ) |
1039 | "the workspace does not exist\n")gettext ("Window cannot be moved to workspace %d: " "the workspace does not exist\n" ), set_workspace); |
1040 | } |
1041 | else |
1042 | g_printerr (_("Action not allowed\n")gettext ("Action not allowed\n")); |
1043 | } |
1044 | |
1045 | /* do activation after the workspace change */ |
1046 | if (set_activate) |
1047 | { |
1048 | VnckScreen *screen; |
1049 | VnckWorkspace *space; |
1050 | |
1051 | screen = vnck_window_get_screen (window); |
1052 | space = vnck_window_get_workspace (window); |
1053 | if (space != NULL((void*)0)) |
1054 | { |
1055 | VnckWorkspace *active_space; |
1056 | |
1057 | active_space = vnck_screen_get_active_workspace (screen); |
1058 | if (space != active_space) |
1059 | vnck_workspace_activate (space, timestamp); |
1060 | } |
1061 | |
1062 | vnck_window_activate_transient (window, timestamp); |
1063 | } |
1064 | |
1065 | geometry_mask = 0; |
1066 | SET_GEOMETRY (x, G_MAXINT, VNCK_WINDOW_ACTION_MOVE, VNCK_WINDOW_CHANGE_X)if (set_x != 2147483647) { if (actions & VNCK_WINDOW_ACTION_MOVE ) geometry_mask |= VNCK_WINDOW_CHANGE_X; else g_printerr (gettext ("Action not allowed\n")); } |
1067 | SET_GEOMETRY (y, G_MAXINT, VNCK_WINDOW_ACTION_MOVE, VNCK_WINDOW_CHANGE_Y)if (set_y != 2147483647) { if (actions & VNCK_WINDOW_ACTION_MOVE ) geometry_mask |= VNCK_WINDOW_CHANGE_Y; else g_printerr (gettext ("Action not allowed\n")); } |
1068 | SET_GEOMETRY (width, -1, VNCK_WINDOW_ACTION_RESIZE, VNCK_WINDOW_CHANGE_WIDTH)if (set_width != -1) { if (actions & VNCK_WINDOW_ACTION_RESIZE ) geometry_mask |= VNCK_WINDOW_CHANGE_WIDTH; else g_printerr ( gettext ("Action not allowed\n")); } |
1069 | SET_GEOMETRY (height, -1, VNCK_WINDOW_ACTION_RESIZE, VNCK_WINDOW_CHANGE_HEIGHT)if (set_height != -1) { if (actions & VNCK_WINDOW_ACTION_RESIZE ) geometry_mask |= VNCK_WINDOW_CHANGE_HEIGHT; else g_printerr (gettext ("Action not allowed\n")); } |
1070 | |
1071 | if (geometry_mask != 0) |
1072 | vnck_window_set_geometry (window, |
1073 | VNCK_WINDOW_GRAVITY_CURRENT, geometry_mask, |
1074 | set_x, set_y, set_width, set_height); |
1075 | |
1076 | if (set_window_type != NULL((void*)0)) |
1077 | vnck_window_set_window_type (window, set_window_type_t); |
1078 | |
1079 | /* interactive actions at the end */ |
1080 | SET_PROPERTY (keyboard_move, VNCK_WINDOW_ACTION_MOVE)if (set_keyboard_move) { if (actions & VNCK_WINDOW_ACTION_MOVE ) vnck_window_keyboard_move (window); else g_printerr (gettext ("Action not allowed\n")); } |
1081 | /* FIXME: hack: we should rename the API */ |
1082 | #define vnck_window_keyboard_resizevnck_window_keyboard_size vnck_window_keyboard_size |
1083 | SET_PROPERTY (keyboard_resize, VNCK_WINDOW_ACTION_RESIZE)if (set_keyboard_resize) { if (actions & VNCK_WINDOW_ACTION_RESIZE ) vnck_window_keyboard_size (window); else g_printerr (gettext ("Action not allowed\n")); } |
1084 | SET_PROPERTY_TIMESTAMP (close, VNCK_WINDOW_ACTION_CLOSE)if (set_close) { if (actions & VNCK_WINDOW_ACTION_CLOSE) vnck_window_close (window, timestamp); else g_printerr (gettext ("Action not allowed\n" )); } |
1085 | } |
1086 | |
1087 | static void |
1088 | list_windows (GList *windows) |
1089 | { |
1090 | GList *l; |
1091 | const char *buf; |
1092 | VnckWindow *window = NULL((void*)0); |
1093 | |
1094 | for (l = windows; l; l = l->next) |
1095 | { |
1096 | window = VNCK_WINDOW (l->data)((((VnckWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((l->data)), ((vnck_window_get_type ())))))); |
1097 | |
1098 | if (vnck_window_has_name (window)) |
1099 | buf = vnck_window_get_name (window); |
1100 | else |
1101 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1102 | buf = _("<name unset>")gettext ("<name unset>"); |
1103 | |
1104 | /* Translators: %lu is a window number and %s a window name */ |
1105 | g_print (_("%lu: %s\n")gettext ("%lu: %s\n"), vnck_window_get_xid (window), buf); |
1106 | } |
1107 | } |
1108 | |
1109 | static void |
1110 | list_screen (VnckScreen *screen) |
1111 | { |
1112 | if (list_workspaces) |
1113 | { |
1114 | GList *spaces; |
1115 | GList *l; |
1116 | VnckWorkspace *space = NULL((void*)0); |
1117 | |
1118 | spaces = vnck_screen_get_workspaces (screen); |
1119 | |
1120 | for (l = spaces; l; l = l->next) |
1121 | { |
1122 | space = VNCK_WORKSPACE (l->data)((((VnckWorkspace*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((l->data)), ((vnck_workspace_get_type ())))))); |
1123 | |
1124 | /* Translators: %d is a workspace number and %s a workspace name */ |
1125 | g_print (_("%d: %s\n")gettext ("%d: %s\n"), |
1126 | vnck_workspace_get_number (space), |
1127 | vnck_workspace_get_name (space)); |
1128 | } |
1129 | } |
1130 | else |
1131 | list_windows (vnck_screen_get_windows (screen)); |
1132 | } |
1133 | |
1134 | static void |
1135 | list_workspace (VnckWorkspace *space) |
1136 | { |
1137 | GList *all_windows; |
1138 | GList *l; |
1139 | GList *space_windows = NULL((void*)0); |
1140 | VnckWindow *window = NULL((void*)0); |
1141 | |
1142 | all_windows = vnck_screen_get_windows (vnck_workspace_get_screen (space)); |
1143 | |
1144 | for (l = all_windows; l; l = l->next) |
1145 | { |
1146 | window = VNCK_WINDOW (l->data)((((VnckWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((l->data)), ((vnck_window_get_type ())))))); |
1147 | |
1148 | if (vnck_window_get_workspace (window) != NULL((void*)0) && |
1149 | vnck_window_get_workspace (window) != space) |
1150 | continue; |
1151 | |
1152 | space_windows = g_list_prepend (space_windows, window); |
1153 | } |
1154 | |
1155 | space_windows = g_list_reverse (space_windows); |
1156 | |
1157 | list_windows (space_windows); |
1158 | |
1159 | g_list_free (space_windows); |
1160 | } |
1161 | |
1162 | static void |
1163 | list_class_group (VnckClassGroup *class_group) |
1164 | { |
1165 | list_windows (vnck_class_group_get_windows (class_group)); |
1166 | } |
1167 | |
1168 | static void |
1169 | list_application (VnckApplication *app) |
1170 | { |
1171 | list_windows (vnck_application_get_windows (app)); |
1172 | } |
1173 | |
1174 | static void |
1175 | print_screen (VnckScreen *screen) |
1176 | { |
1177 | VnckWorkspace *space; |
1178 | VnckWindow *window; |
1179 | const char *buf; |
1180 | char *free_buf; |
1181 | #if 0 |
1182 | VnckLayoutOrientation orientation; |
1183 | int rows; |
1184 | int columns; |
1185 | #endif |
1186 | |
1187 | g_print (_("Screen Number: %d\n")gettext ("Screen Number: %d\n"), vnck_screen_get_number (screen)); |
1188 | |
1189 | g_print (_("Geometry (width, height): %d, %d\n")gettext ("Geometry (width, height): %d, %d\n"), |
1190 | vnck_screen_get_width (screen), |
1191 | vnck_screen_get_height (screen)); |
1192 | |
1193 | g_print (_("Number of Workspaces: %d\n")gettext ("Number of Workspaces: %d\n"), |
1194 | vnck_screen_get_workspace_count (screen)); |
1195 | |
1196 | #if 0 |
1197 | vnck_screen_get_workspace_layout (screen, &orientation, &rows, &columns, |
1198 | NULL((void*)0)); |
1199 | g_print (_("Workspace Layout (rows, columns, orientation): "gettext ("Workspace Layout (rows, columns, orientation): " "%d, %d, %s\n" ) |
1200 | "%d, %d, %s\n")gettext ("Workspace Layout (rows, columns, orientation): " "%d, %d, %s\n" ), |
1201 | rows, columns, |
1202 | orientation == VNCK_LAYOUT_ORIENTATION_VERTICAL ? "vertical" : |
1203 | "horizontal"); |
1204 | #endif |
1205 | |
1206 | if (vnck_screen_get_window_manager_name (screen) != NULL((void*)0)) |
1207 | buf = vnck_screen_get_window_manager_name (screen); |
1208 | else |
1209 | buf = _("<no EWMH-compliant window manager>")gettext ("<no EWMH-compliant window manager>"); |
1210 | g_print (_("Window Manager: %s\n")gettext ("Window Manager: %s\n"), buf); |
1211 | |
1212 | space = vnck_screen_get_active_workspace (screen); |
1213 | if (space) |
1214 | /* Translators: %d is a workspace number and %s a workspace name */ |
1215 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1216 | vnck_workspace_get_number (space), |
1217 | vnck_workspace_get_name (space)); |
1218 | else |
1219 | /* Translators: "none" here means "no workspace" */ |
1220 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1221 | g_print (_("Active Workspace: %s\n")gettext ("Active Workspace: %s\n"), free_buf); |
1222 | g_free (free_buf); |
1223 | |
1224 | window = vnck_screen_get_active_window (screen); |
1225 | if (window) |
1226 | { |
1227 | char *name; |
1228 | |
1229 | if (vnck_window_has_name (window)) |
1230 | name = g_strdup_printf (_("\"%s\"")gettext ("\"%s\""), vnck_window_get_name (window)); |
1231 | else |
1232 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1233 | name = g_strdup (_("<name unset>"))g_strdup_inline (gettext ("<name unset>")); |
1234 | |
1235 | /* Translators: %lu is a window identifier (number) and %s a window name */ |
1236 | free_buf = g_strdup_printf (_("%lu (%s)")gettext ("%lu (%s)"), |
1237 | vnck_window_get_xid (window), name); |
1238 | g_free (name); |
1239 | } |
1240 | else |
1241 | /* Translators: "none" here means "no window" */ |
1242 | free_buf = g_strdup (C_("window", "none"))g_strdup_inline (g_dpgettext (((void*)0), "window" "\004" "none" , strlen ("window") + 1)); |
1243 | g_print (_("Active Window: %s\n")gettext ("Active Window: %s\n"), free_buf); |
1244 | g_free (free_buf); |
1245 | |
1246 | g_print (_("Showing the desktop: %s\n")gettext ("Showing the desktop: %s\n"), |
1247 | vnck_screen_get_showing_desktop (screen) ? |
1248 | _("true")gettext ("true") : _("false")gettext ("false")); |
1249 | } |
1250 | |
1251 | static void |
1252 | print_workspace (VnckWorkspace *space) |
1253 | { |
1254 | VnckScreen *screen; |
1255 | VnckWorkspace *neighbor; |
1256 | const char *buf; |
1257 | char *free_buf; |
1258 | |
1259 | g_print (_("Workspace Name: %s\n")gettext ("Workspace Name: %s\n"), vnck_workspace_get_name (space)); |
1260 | g_print (_("Workspace Number: %d\n")gettext ("Workspace Number: %d\n"), vnck_workspace_get_number (space)); |
1261 | |
1262 | screen = vnck_workspace_get_screen (space); |
1263 | if (vnck_screen_get_window_manager_name (screen) != NULL((void*)0)) |
1264 | buf = vnck_screen_get_window_manager_name (screen); |
1265 | else |
1266 | buf = _("<no EWMH-compliant window manager>")gettext ("<no EWMH-compliant window manager>"); |
1267 | g_print (_("On Screen: %d (Window Manager: %s)\n")gettext ("On Screen: %d (Window Manager: %s)\n"), |
1268 | vnck_screen_get_number (screen), buf); |
1269 | |
1270 | g_print (_("Geometry (width, height): %d, %d\n")gettext ("Geometry (width, height): %d, %d\n"), |
1271 | vnck_workspace_get_width (space), |
1272 | vnck_workspace_get_height (space)); |
1273 | |
1274 | if (vnck_workspace_is_virtual (space)) |
1275 | free_buf = g_strdup_printf ("%d, %d", |
1276 | vnck_workspace_get_viewport_x (space), |
1277 | vnck_workspace_get_viewport_y (space)); |
1278 | else |
1279 | /* Translators: 'viewport' is kind of the viewable area. A viewport can be |
1280 | * used to implement workspaces (e.g. compiz is an example); however it is |
1281 | * not just the current workspace. */ |
1282 | free_buf = g_strdup (_("<no viewport>"))g_strdup_inline (gettext ("<no viewport>")); |
1283 | /* Translators: 'viewport' is kind of the viewable area. A viewport can be |
1284 | * used to implement workspaces (e.g. compiz is an example); however it is |
1285 | * not just the current workspace. */ |
1286 | g_print (_("Viewport position (x, y): %s\n")gettext ("Viewport position (x, y): %s\n"), free_buf); |
1287 | g_free (free_buf); |
1288 | |
1289 | g_print (_("Position in Layout (row, column): %d, %d\n")gettext ("Position in Layout (row, column): %d, %d\n"), |
1290 | vnck_workspace_get_layout_row (space), |
1291 | vnck_workspace_get_layout_column (space)); |
1292 | |
1293 | neighbor = vnck_workspace_get_neighbor (space, VNCK_MOTION_LEFT); |
1294 | if (neighbor) |
1295 | /* Translators: %d is a workspace number and %s a workspace name */ |
1296 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1297 | vnck_workspace_get_number (neighbor), |
1298 | vnck_workspace_get_name (neighbor)); |
1299 | else |
1300 | /* Translators: "none" here means "no workspace" */ |
1301 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1302 | g_print (_("Left Neighbor: %s\n")gettext ("Left Neighbor: %s\n"), free_buf); |
1303 | g_free (free_buf); |
1304 | |
1305 | neighbor = vnck_workspace_get_neighbor (space, VNCK_MOTION_RIGHT); |
1306 | if (neighbor) |
1307 | /* Translators: %d is a workspace number and %s a workspace name */ |
1308 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1309 | vnck_workspace_get_number (neighbor), |
1310 | vnck_workspace_get_name (neighbor)); |
1311 | else |
1312 | /* Translators: "none" here means "no workspace" */ |
1313 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1314 | g_print (_("Right Neighbor: %s\n")gettext ("Right Neighbor: %s\n"), free_buf); |
1315 | g_free (free_buf); |
1316 | |
1317 | neighbor = vnck_workspace_get_neighbor (space, VNCK_MOTION_UP); |
1318 | if (neighbor) |
1319 | /* Translators: %d is a workspace number and %s a workspace name */ |
1320 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1321 | vnck_workspace_get_number (neighbor), |
1322 | vnck_workspace_get_name (neighbor)); |
1323 | else |
1324 | /* Translators: "none" here means "no workspace" */ |
1325 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1326 | g_print (_("Top Neighbor: %s\n")gettext ("Top Neighbor: %s\n"), free_buf); |
1327 | g_free (free_buf); |
1328 | |
1329 | neighbor = vnck_workspace_get_neighbor (space, VNCK_MOTION_DOWN); |
1330 | if (neighbor) |
1331 | /* Translators: %d is a workspace number and %s a workspace name */ |
1332 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1333 | vnck_workspace_get_number (neighbor), |
1334 | vnck_workspace_get_name (neighbor)); |
1335 | else |
1336 | /* Translators: "none" here means "no workspace" */ |
1337 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1338 | g_print (_("Bottom Neighbor: %s\n")gettext ("Bottom Neighbor: %s\n"), free_buf); |
1339 | g_free (free_buf); |
1340 | } |
1341 | |
1342 | static void |
1343 | print_class_group (VnckClassGroup *class_group) |
1344 | { |
1345 | GList *windows; |
1346 | |
1347 | windows = vnck_class_group_get_windows (class_group); |
1348 | |
1349 | /* Translators: A class is like a "family". E.g., all gvim windows are of the |
1350 | * same class. */ |
1351 | g_print (_("Class Group ID: %s\n")gettext ("Class Group ID: %s\n"), |
1352 | vnck_class_group_get_id (class_group)); |
1353 | /* Translators: A class is like a "family". E.g., all gvim windows are of the |
1354 | * same class. */ |
1355 | g_print (_("Class Group Name: %s\n")gettext ("Class Group Name: %s\n"), vnck_class_group_get_name (class_group)); |
1356 | |
1357 | /* TODO: missing API */ |
1358 | #if 0 |
1359 | if (!vnck_class_group_get_icon_is_fallback (class_group)) |
1360 | /* Translators: 'set' in the sense of "something has been set". */ |
1361 | buf = _("set")gettext ("set"); |
1362 | else |
1363 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1364 | buf = _("<unset>")gettext ("<unset>"); |
1365 | g_print (_("Icons: %s\n")gettext ("Icons: %s\n"), buf); |
1366 | #endif |
1367 | |
1368 | g_print (_("Number of Windows: %d\n")gettext ("Number of Windows: %d\n"), g_list_length (windows)); |
1369 | } |
1370 | |
1371 | static void |
1372 | print_application (VnckApplication *app) |
1373 | { |
1374 | const char *buf; |
1375 | char *free_buf; |
1376 | GList *windows; |
1377 | |
1378 | windows = vnck_application_get_windows (app); |
1379 | |
1380 | g_print (_("Name: %s\n")gettext ("Name: %s\n"), vnck_application_get_name (app)); |
1381 | g_print (_("Icon Name: %s\n")gettext ("Icon Name: %s\n"), vnck_application_get_icon_name (app)); |
1382 | |
1383 | if (!vnck_application_get_icon_is_fallback (app)) |
1384 | /* Translators: 'set' in the sense of "something has been set". */ |
1385 | buf = _("set")gettext ("set"); |
1386 | else |
1387 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1388 | buf = _("<unset>")gettext ("<unset>"); |
1389 | g_print (_("Icons: %s\n")gettext ("Icons: %s\n"), buf); |
1390 | |
1391 | if (vnck_application_get_pid (app) != 0) |
1392 | free_buf = g_strdup_printf ("%d", vnck_application_get_pid (app)); |
1393 | else |
1394 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1395 | free_buf = g_strdup (_("<unset>"))g_strdup_inline (gettext ("<unset>")); |
1396 | g_print (_("PID: %s\n")gettext ("PID: %s\n"), free_buf); |
1397 | g_free (free_buf); |
1398 | |
1399 | if (vnck_application_get_startup_id (app) != NULL((void*)0)) |
1400 | buf = vnck_application_get_startup_id (app); |
1401 | else |
1402 | /* Translators: "none" here means "no startup ID" */ |
1403 | buf = C_("startupID", "none")g_dpgettext (((void*)0), "startupID" "\004" "none", strlen ("startupID" ) + 1); |
1404 | g_print (_("Startup ID: %s\n")gettext ("Startup ID: %s\n"), buf); |
1405 | |
1406 | g_print (_("Number of Windows: %d\n")gettext ("Number of Windows: %d\n"), g_list_length (windows)); |
1407 | } |
1408 | |
1409 | static void |
1410 | print_window (VnckWindow *window) |
1411 | { |
1412 | VnckWindowType type; |
1413 | int x, y, w, h; |
1414 | VnckClassGroup *class_group; |
1415 | VnckWorkspace *space; |
1416 | VnckScreen *screen; |
1417 | VnckWindowActions actions; |
1418 | const char *buf; |
1419 | char *free_buf; |
1420 | |
1421 | if (vnck_window_has_name (window)) |
1422 | buf = vnck_window_get_name (window); |
1423 | else |
1424 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1425 | buf = _("<unset>")gettext ("<unset>"); |
1426 | g_print (_("Name: %s\n")gettext ("Name: %s\n"), buf); |
1427 | |
1428 | if (vnck_window_has_icon_name (window)) |
1429 | buf = vnck_window_get_icon_name (window); |
1430 | else |
1431 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1432 | buf = _("<unset>")gettext ("<unset>"); |
1433 | /* Translators: note that "Icon" here has a specific window |
1434 | * management-related meaning. It means minimized. */ |
1435 | g_print (_("Icon Name: %s\n")gettext ("Icon Name: %s\n"), buf); |
1436 | |
1437 | if (!vnck_window_get_icon_is_fallback (window)) |
1438 | /* Translators: 'set' in the sense of "something has been set". */ |
1439 | buf = _("set")gettext ("set"); |
1440 | else |
1441 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1442 | buf = _("<unset>")gettext ("<unset>"); |
1443 | g_print (_("Icons: %s\n")gettext ("Icons: %s\n"), buf); |
1444 | |
1445 | space = vnck_window_get_workspace (window); |
1446 | if (space) |
1447 | /* Translators: %d is a workspace number and %s a workspace name */ |
1448 | free_buf = g_strdup_printf (_("%d (\"%s\")")gettext ("%d (\"%s\")"), |
1449 | vnck_workspace_get_number (space), |
1450 | vnck_workspace_get_name (space)); |
1451 | else if (vnck_window_is_pinned (window)) |
1452 | free_buf = g_strdup (_("all workspaces"))g_strdup_inline (gettext ("all workspaces")); |
1453 | else |
1454 | /* Translators: "none" here means "no workspace" */ |
1455 | free_buf = g_strdup (C_("workspace", "none"))g_strdup_inline (g_dpgettext (((void*)0), "workspace" "\004" "none" , strlen ("workspace") + 1)); |
1456 | g_print (_("On Workspace: %s\n")gettext ("On Workspace: %s\n"), free_buf); |
1457 | g_free (free_buf); |
1458 | |
1459 | screen = vnck_window_get_screen (window); |
1460 | if (vnck_screen_get_window_manager_name (screen) != NULL((void*)0)) |
1461 | buf = vnck_screen_get_window_manager_name (screen); |
1462 | else |
1463 | buf = _("<no EWMH-compliant window manager>")gettext ("<no EWMH-compliant window manager>"); |
1464 | g_print (_("On Screen: %d (Window Manager: %s)\n")gettext ("On Screen: %d (Window Manager: %s)\n"), |
1465 | vnck_screen_get_number (screen), buf); |
1466 | |
1467 | type = vnck_window_get_window_type (window); |
1468 | switch (type) |
1469 | { |
1470 | case VNCK_WINDOW_NORMAL: |
1471 | buf = _("normal window")gettext ("normal window"); |
1472 | break; |
1473 | case VNCK_WINDOW_DESKTOP: |
1474 | buf = _("desktop")gettext ("desktop"); |
1475 | break; |
1476 | case VNCK_WINDOW_DOCK: |
1477 | buf = _("dock or panel")gettext ("dock or panel"); |
1478 | break; |
1479 | case VNCK_WINDOW_DIALOG: |
1480 | buf = _("dialog window")gettext ("dialog window"); |
1481 | break; |
1482 | case VNCK_WINDOW_TOOLBAR: |
1483 | buf = _("tearoff toolbar")gettext ("tearoff toolbar"); |
1484 | break; |
1485 | case VNCK_WINDOW_MENU: |
1486 | buf = _("tearoff menu")gettext ("tearoff menu"); |
1487 | break; |
1488 | case VNCK_WINDOW_UTILITY: |
1489 | buf = _("utility window")gettext ("utility window"); |
1490 | break; |
1491 | case VNCK_WINDOW_SPLASHSCREEN: |
1492 | buf = _("splash screen")gettext ("splash screen"); |
1493 | break; |
1494 | default: |
1495 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 1495, ((const char*) (__func__)), ((void*)0)); } while (0); |
1496 | } |
1497 | g_print (_("Window Type: %s\n")gettext ("Window Type: %s\n"), buf); |
1498 | |
1499 | vnck_window_get_geometry (window, &x, &y, &w, &h); |
1500 | g_print (_("Geometry (x, y, width, height): %d, %d, %d, %d\n")gettext ("Geometry (x, y, width, height): %d, %d, %d, %d\n"), x, y, w, h); |
1501 | |
1502 | class_group = vnck_window_get_class_group (window); |
1503 | if (strcmp (vnck_class_group_get_id (class_group), "")) |
1504 | buf = vnck_class_group_get_id (class_group); |
1505 | else |
1506 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1507 | buf = _("<unset>")gettext ("<unset>"); |
1508 | /* Translators: A class is like a "family". E.g., all gvim windows are of the |
1509 | * same class. */ |
1510 | g_print (_("Class Group ID: %s\n")gettext ("Class Group ID: %s\n"), buf); |
1511 | |
1512 | if (g_strcmp0 (vnck_window_get_class_instance_name (window), "")) |
1513 | buf = vnck_window_get_class_instance_name (window); |
1514 | else |
1515 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1516 | buf = _("<unset>")gettext ("<unset>"); |
1517 | /* Translators: A class is like a "family". E.g., all gvim windows are of the |
1518 | * same class. The class instance is a way to differentiate windows belonging |
1519 | * to the same class group. */ |
1520 | g_print (_("Class Instance: %s\n")gettext ("Class Instance: %s\n"), buf); |
1521 | |
1522 | g_print (_("XID: %lu\n")gettext ("XID: %lu\n"), vnck_window_get_xid (window)); |
1523 | |
1524 | if (vnck_window_get_pid (window) != 0) |
1525 | free_buf = g_strdup_printf ("%d", vnck_window_get_pid (window)); |
1526 | else |
1527 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1528 | free_buf = g_strdup (_("<unset>"))g_strdup_inline (gettext ("<unset>")); |
1529 | g_print (_("PID: %s\n")gettext ("PID: %s\n"), free_buf); |
1530 | g_free (free_buf); |
1531 | |
1532 | if (vnck_window_get_session_id (window)) |
1533 | buf = vnck_window_get_session_id (window); |
1534 | else |
1535 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1536 | buf = _("<unset>")gettext ("<unset>"); |
1537 | g_print (_("Session ID: %s\n")gettext ("Session ID: %s\n"), buf); |
1538 | |
1539 | if (vnck_window_get_role (window)) |
1540 | buf = vnck_window_get_role (window); |
1541 | else |
1542 | /* Translators: 'unset' in the sense of "something has not been set". */ |
1543 | buf = _("<unset>")gettext ("<unset>"); |
1544 | g_print (_("Role: %s\n")gettext ("Role: %s\n"), buf); |
1545 | |
1546 | if (vnck_window_get_group_leader (window) != vnck_window_get_xid (window)) |
1547 | /* Translators: A group leader is the window that is the "owner" of a group |
1548 | * of windows, ie: if you have multiple windows in one application, one |
1549 | * window has some information about the application (like the application |
1550 | * name). */ |
1551 | g_print (_("Group Leader: %lu\n")gettext ("Group Leader: %lu\n"), vnck_window_get_group_leader (window)); |
1552 | //FIXME: else print something? |
1553 | |
1554 | if (vnck_window_get_transient (window)) |
1555 | /* Translators: A window can be transient for another window: it means it's |
1556 | * on top of it */ |
1557 | g_print (_("Transient for: %lu\n")gettext ("Transient for: %lu\n"), |
1558 | vnck_window_get_xid (vnck_window_get_transient (window))); |
1559 | //FIXME: else print something? |
1560 | |
1561 | #define PRINT_LIST_ITEM(func, string)if (func (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", string); g_free (free_buf); free_buf = tmp; } \ |
1562 | if (func (window)) \ |
1563 | { \ |
1564 | char *tmp; \ |
1565 | \ |
1566 | /* Translators: we're building a list of items here. \ |
1567 | * For example, the result is "a, b". \ |
1568 | * In this case, the first string is "a", the second \ |
1569 | * string is ", " and the third string is "b". \ |
1570 | * We can then use this information here to also \ |
1571 | * recursively build longer lists, like "a, b, c, d" */ \ |
1572 | tmp = g_strdup_printf (_("%1$s%2$s%3$s")gettext ("%1$s%2$s%3$s"), \ |
1573 | free_buf ? free_buf : "", \ |
1574 | /* Translators: see comment for "%1$s%2$s%3$s" in order \ |
1575 | * to properly translate this */ \ |
1576 | free_buf ? _(", ")gettext (", ") : "", \ |
1577 | string); \ |
1578 | g_free (free_buf); \ |
1579 | free_buf = tmp; \ |
1580 | } |
1581 | free_buf = NULL((void*)0); |
1582 | PRINT_LIST_ITEM (vnck_window_is_minimized, _("minimized"))if (vnck_window_is_minimized (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("minimized")); g_free (free_buf ); free_buf = tmp; }; |
1583 | PRINT_LIST_ITEM (vnck_window_is_maximized, _("maximized"))if (vnck_window_is_maximized (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximized")); g_free (free_buf ); free_buf = tmp; }; |
1584 | if (!vnck_window_is_maximized (window)) |
1585 | { |
1586 | PRINT_LIST_ITEM (vnck_window_is_maximized_horizontally,if (vnck_window_is_maximized_horizontally (window)) { char *tmp ; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximized horizontally" )); g_free (free_buf); free_buf = tmp; } |
1587 | _("maximized horizontally"))if (vnck_window_is_maximized_horizontally (window)) { char *tmp ; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximized horizontally" )); g_free (free_buf); free_buf = tmp; }; |
1588 | PRINT_LIST_ITEM (vnck_window_is_maximized_vertically,if (vnck_window_is_maximized_vertically (window)) { char *tmp ; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximized vertically" )); g_free (free_buf); free_buf = tmp; } |
1589 | _("maximized vertically"))if (vnck_window_is_maximized_vertically (window)) { char *tmp ; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximized vertically" )); g_free (free_buf); free_buf = tmp; }; |
1590 | } |
1591 | PRINT_LIST_ITEM (vnck_window_is_shaded, _("shaded"))if (vnck_window_is_shaded (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("shaded")); g_free (free_buf ); free_buf = tmp; }; |
1592 | PRINT_LIST_ITEM (vnck_window_is_pinned, _("pinned"))if (vnck_window_is_pinned (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("pinned")); g_free (free_buf ); free_buf = tmp; }; |
1593 | PRINT_LIST_ITEM (vnck_window_is_sticky, _("sticky"))if (vnck_window_is_sticky (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("sticky")); g_free (free_buf ); free_buf = tmp; }; |
1594 | PRINT_LIST_ITEM (vnck_window_is_above, _("above"))if (vnck_window_is_above (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("above")); g_free (free_buf) ; free_buf = tmp; }; |
1595 | PRINT_LIST_ITEM (vnck_window_is_below, _("below"))if (vnck_window_is_below (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("below")); g_free (free_buf) ; free_buf = tmp; }; |
1596 | PRINT_LIST_ITEM (vnck_window_is_fullscreen, _("fullscreen"))if (vnck_window_is_fullscreen (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("fullscreen")); g_free (free_buf ); free_buf = tmp; }; |
1597 | PRINT_LIST_ITEM (vnck_window_needs_attention, _("needs attention"))if (vnck_window_needs_attention (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("needs attention")); g_free ( free_buf); free_buf = tmp; }; |
1598 | /* Translators: A pager is the technical term for the workspace switcher. |
1599 | * It's a representation of all workspaces with windows inside it. |
1600 | * Please make sure that the translation is in sync with gnome-panel, |
1601 | * where this term is also used in translatable strings */ |
1602 | PRINT_LIST_ITEM (vnck_window_is_skip_pager, _("skip pager"))if (vnck_window_is_skip_pager (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("skip pager")); g_free (free_buf ); free_buf = tmp; }; |
1603 | /* Translators: "tasklist" is the list of running applications (the window |
1604 | * list) */ |
1605 | PRINT_LIST_ITEM (vnck_window_is_skip_tasklist, _("skip tasklist"))if (vnck_window_is_skip_tasklist (window)) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("skip tasklist" )); g_free (free_buf); free_buf = tmp; }; |
1606 | if (!free_buf) |
1607 | free_buf = g_strdup (_("normal"))g_strdup_inline (gettext ("normal")); |
1608 | g_print (_("State: %s\n")gettext ("State: %s\n"), free_buf); |
1609 | g_free (free_buf); |
1610 | |
1611 | #define PRINT_FLAGS_ITEM(bitmask, flag, string)if (bitmask & flag) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", string); g_free (free_buf); free_buf = tmp; } \ |
1612 | if (bitmask & flag) \ |
1613 | { \ |
1614 | char *tmp; \ |
1615 | \ |
1616 | /* Translators: we're building a list of items here. \ |
1617 | * The end result is something like "a, b, c" \ |
1618 | * In this case, the first string is "a, b", the second \ |
1619 | * string is ", " and the third string is "c" */ \ |
1620 | tmp = g_strdup_printf (_("%1$s%2$s%3$s")gettext ("%1$s%2$s%3$s"), \ |
1621 | free_buf ? free_buf : "", \ |
1622 | free_buf ? _(", ")gettext (", ") : "", \ |
1623 | string); \ |
1624 | g_free (free_buf); \ |
1625 | free_buf = tmp; \ |
1626 | } |
1627 | free_buf = NULL((void*)0); |
1628 | actions = vnck_window_get_actions (window); |
1629 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_MOVE, _("move"))if (actions & VNCK_WINDOW_ACTION_MOVE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("move")); g_free (free_buf); free_buf = tmp; }; |
1630 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_RESIZE, _("resize"))if (actions & VNCK_WINDOW_ACTION_RESIZE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("resize")); g_free (free_buf); free_buf = tmp; }; |
1631 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_SHADE, _("shade"))if (actions & VNCK_WINDOW_ACTION_SHADE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("shade")); g_free (free_buf); free_buf = tmp; }; |
1632 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNSHADE, _("unshade"))if (actions & VNCK_WINDOW_ACTION_UNSHADE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unshade")); g_free (free_buf); free_buf = tmp; }; |
1633 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_STICK, _("stick"))if (actions & VNCK_WINDOW_ACTION_STICK) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("stick")); g_free (free_buf); free_buf = tmp; }; |
1634 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNSTICK, _("unstick"))if (actions & VNCK_WINDOW_ACTION_UNSTICK) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unstick")); g_free (free_buf); free_buf = tmp; }; |
1635 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY,if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximize horizontally" )); g_free (free_buf); free_buf = tmp; } |
1636 | _("maximize horizontally"))if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_HORIZONTALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximize horizontally" )); g_free (free_buf); free_buf = tmp; }; |
1637 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY,if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s") , free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmaximize horizontally")); g_free (free_buf); free_buf = tmp ; } |
1638 | _("unmaximize horizontally"))if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_HORIZONTALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s") , free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmaximize horizontally")); g_free (free_buf); free_buf = tmp ; }; |
1639 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY,if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximize vertically" )); g_free (free_buf); free_buf = tmp; } |
1640 | _("maximize vertically"))if (actions & VNCK_WINDOW_ACTION_MAXIMIZE_VERTICALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximize vertically" )); g_free (free_buf); free_buf = tmp; }; |
1641 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY,if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmaximize vertically" )); g_free (free_buf); free_buf = tmp; } |
1642 | _("unmaximize vertically"))if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE_VERTICALLY) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmaximize vertically" )); g_free (free_buf); free_buf = tmp; }; |
1643 | /* we're calling PRINT_FLAGS_ITEM() three times for l10n reasons */ |
1644 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_CHANGE_WORKSPACE,if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("change workspace" )); g_free (free_buf); free_buf = tmp; } |
1645 | _("change workspace"))if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("change workspace" )); g_free (free_buf); free_buf = tmp; }; |
1646 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_CHANGE_WORKSPACE,if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("pin" )); g_free (free_buf); free_buf = tmp; } |
1647 | _("pin"))if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("pin" )); g_free (free_buf); free_buf = tmp; }; |
1648 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_CHANGE_WORKSPACE,if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unpin" )); g_free (free_buf); free_buf = tmp; } |
1649 | _("unpin"))if (actions & VNCK_WINDOW_ACTION_CHANGE_WORKSPACE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unpin" )); g_free (free_buf); free_buf = tmp; }; |
1650 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_MINIMIZE, _("minimize"))if (actions & VNCK_WINDOW_ACTION_MINIMIZE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("minimize")); g_free (free_buf); free_buf = tmp; }; |
1651 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNMINIMIZE, _("unminimize"))if (actions & VNCK_WINDOW_ACTION_UNMINIMIZE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unminimize") ); g_free (free_buf); free_buf = tmp; }; |
1652 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_MAXIMIZE, _("maximize"))if (actions & VNCK_WINDOW_ACTION_MAXIMIZE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("maximize")); g_free (free_buf); free_buf = tmp; }; |
1653 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_UNMAXIMIZE, _("unmaximize"))if (actions & VNCK_WINDOW_ACTION_UNMAXIMIZE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmaximize") ); g_free (free_buf); free_buf = tmp; }; |
1654 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_FULLSCREEN,if (actions & VNCK_WINDOW_ACTION_FULLSCREEN) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("change fullscreen mode" )); g_free (free_buf); free_buf = tmp; } |
1655 | _("change fullscreen mode"))if (actions & VNCK_WINDOW_ACTION_FULLSCREEN) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("change fullscreen mode" )); g_free (free_buf); free_buf = tmp; }; |
1656 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_CLOSE, _("close"))if (actions & VNCK_WINDOW_ACTION_CLOSE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("close")); g_free (free_buf); free_buf = tmp; }; |
1657 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_ABOVE,if (actions & VNCK_WINDOW_ACTION_ABOVE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("make above") ); g_free (free_buf); free_buf = tmp; } |
1658 | _("make above"))if (actions & VNCK_WINDOW_ACTION_ABOVE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("make above") ); g_free (free_buf); free_buf = tmp; }; |
1659 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_ABOVE,if (actions & VNCK_WINDOW_ACTION_ABOVE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmake above" )); g_free (free_buf); free_buf = tmp; } |
1660 | _("unmake above"))if (actions & VNCK_WINDOW_ACTION_ABOVE) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmake above" )); g_free (free_buf); free_buf = tmp; }; |
1661 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_BELOW,if (actions & VNCK_WINDOW_ACTION_BELOW) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("make below") ); g_free (free_buf); free_buf = tmp; } |
1662 | _("make below"))if (actions & VNCK_WINDOW_ACTION_BELOW) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("make below") ); g_free (free_buf); free_buf = tmp; }; |
1663 | PRINT_FLAGS_ITEM (actions, VNCK_WINDOW_ACTION_BELOW,if (actions & VNCK_WINDOW_ACTION_BELOW) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmake below" )); g_free (free_buf); free_buf = tmp; } |
1664 | _("unmake below"))if (actions & VNCK_WINDOW_ACTION_BELOW) { char *tmp; tmp = g_strdup_printf (gettext ("%1$s%2$s%3$s"), free_buf ? free_buf : "", free_buf ? gettext (", ") : "", gettext ("unmake below" )); g_free (free_buf); free_buf = tmp; }; |
1665 | if (!free_buf) |
1666 | free_buf = g_strdup (_("no action possible"))g_strdup_inline (gettext ("no action possible")); |
1667 | g_print (_("Possible Actions: %s\n")gettext ("Possible Actions: %s\n"), free_buf); |
1668 | g_free (free_buf); |
1669 | |
1670 | } |
1671 | |
1672 | static gboolean |
1673 | wm_state_set (Display *display, |
1674 | Window window) |
1675 | { |
1676 | CdkDisplay *cdk_display; |
1677 | Atom wm_state; |
1678 | gulong nitems; |
1679 | gulong bytes_after; |
1680 | gulong *prop; |
1681 | Atom ret_type = None0L; |
1682 | int ret_format; |
1683 | int err, result; |
1684 | |
1685 | cdk_display = cdk_x11_lookup_xdisplay (display); |
1686 | g_assert (cdk_display != NULL)do { if (cdk_display != ((void*)0)) ; else g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c", 1686, ((const char*) (__func__ )), "cdk_display != NULL"); } while (0); |
1687 | |
1688 | wm_state = cdk_x11_get_xatom_by_name ("WM_STATE"); |
1689 | |
1690 | cdk_x11_display_error_trap_push (cdk_display); |
1691 | result = XGetWindowProperty (display, |
1692 | window, |
1693 | wm_state, |
1694 | 0, G_MAXLONG9223372036854775807L, |
1695 | False0, wm_state, &ret_type, &ret_format, &nitems, |
1696 | &bytes_after, (gpointer) &prop); |
1697 | err = cdk_x11_display_error_trap_pop (cdk_display); |
1698 | if (err != Success0 || |
1699 | result != Success0) |
1700 | return FALSE(0); |
1701 | |
1702 | XFree (prop); |
1703 | |
1704 | if (ret_type != wm_state) |
1705 | return FALSE(0); |
1706 | |
1707 | return TRUE(!(0)); |
1708 | } |
1709 | |
1710 | static VnckWindow * |
1711 | find_managed_window (Display *display, |
1712 | Window window) |
1713 | { |
1714 | CdkDisplay *cdk_display; |
1715 | Window root; |
1716 | Window parent; |
1717 | Window *kids = NULL((void*)0); |
1718 | VnckWindow *retval; |
1719 | guint i, nkids; |
1720 | int result; |
1721 | |
1722 | if (wm_state_set (display, window)) |
1723 | return vnck_window_get (window); |
1724 | |
1725 | cdk_display = cdk_x11_lookup_xdisplay (display); |
1726 | g_assert (cdk_display != NULL)do { if (cdk_display != ((void*)0)) ; else g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c", 1726, ((const char*) (__func__ )), "cdk_display != NULL"); } while (0); |
1727 | |
1728 | cdk_x11_display_error_trap_push (cdk_display); |
1729 | result = XQueryTree (display, window, &root, &parent, &kids, &nkids); |
1730 | if (cdk_x11_display_error_trap_pop (cdk_display) || !result) |
1731 | return NULL((void*)0); |
1732 | |
1733 | retval = NULL((void*)0); |
1734 | |
1735 | for (i = 0; i < nkids; i++) |
1736 | { |
1737 | if (wm_state_set (display, kids [i])) |
1738 | { |
1739 | retval = vnck_window_get (kids [i]); |
1740 | break; |
1741 | } |
1742 | |
1743 | retval = find_managed_window (display, kids [i]); |
1744 | if (retval != NULL((void*)0)) |
1745 | break; |
1746 | } |
1747 | |
1748 | if (kids) |
1749 | XFree (kids); |
1750 | |
1751 | return retval; |
1752 | } |
1753 | |
1754 | static void |
1755 | handle_button_press_event (Display *dpy, XIDeviceEvent *event) |
1756 | { |
1757 | if (event->child == None0L) |
1758 | return; |
1759 | |
1760 | got_from_user = find_managed_window (dpy, event->child); |
1761 | } |
1762 | |
1763 | static CdkFilterReturn |
1764 | target_filter (CdkXEvent *cdk_xevent, |
1765 | CdkEvent *cdk_event G_GNUC_UNUSED__attribute__ ((__unused__)), |
1766 | gpointer data G_GNUC_UNUSED__attribute__ ((__unused__))) |
1767 | { |
1768 | XEvent *xevent = (XEvent *) cdk_xevent; |
1769 | XGenericEventCookie *cookie = &xevent->xcookie; |
1770 | |
1771 | /* Use XI2 to read the event data */ |
1772 | if (cookie->type == GenericEvent35) |
1773 | { |
1774 | XIDeviceEvent *event = cookie->data; |
1775 | |
1776 | if (!event) |
1777 | return CDK_FILTER_CONTINUE; |
1778 | |
1779 | switch (event->evtype) |
1780 | { |
1781 | case XI_ButtonPress4: |
1782 | handle_button_press_event (cookie->display, event); |
1783 | clean_up (); |
1784 | return CDK_FILTER_REMOVE; |
1785 | case XI_KeyPress2: |
1786 | if (event->detail == XKeysymToKeycode (cookie->display, XK_Escape0xff1b)) |
1787 | { |
1788 | clean_up (); |
1789 | return CDK_FILTER_REMOVE; |
1790 | } |
1791 | break; |
1792 | default: |
1793 | break; |
1794 | } |
1795 | } |
1796 | |
1797 | return CDK_FILTER_CONTINUE; |
1798 | } |
1799 | |
1800 | static void |
1801 | prepare (CdkSeat *seat G_GNUC_UNUSED__attribute__ ((__unused__)), |
1802 | CdkWindow *window, |
1803 | gpointer user_data G_GNUC_UNUSED__attribute__ ((__unused__))) |
1804 | { |
1805 | cdk_window_show_unraised (window); |
1806 | } |
1807 | |
1808 | static gboolean |
1809 | get_target (gpointer data G_GNUC_UNUSED__attribute__ ((__unused__))) |
1810 | { |
1811 | CdkWindow *root; |
1812 | CdkDisplay *display; |
1813 | CdkSeat *seat; |
1814 | CdkCursor *cross; |
1815 | CdkSeatCapabilities caps; |
1816 | CdkGrabStatus status; |
1817 | |
1818 | root = cdk_get_default_root_window (); |
1819 | display = cdk_display_get_default (); |
1820 | seat = cdk_display_get_default_seat (display); |
1821 | cross = cdk_cursor_new_for_display (display, CDK_CROSS); |
1822 | caps = CDK_SEAT_CAPABILITY_POINTER | CDK_SEAT_CAPABILITY_KEYBOARD; |
1823 | |
1824 | cdk_window_add_filter (root, (CdkFilterFunc) target_filter, NULL((void*)0)); |
1825 | |
1826 | status = cdk_seat_grab (seat, root, caps, TRUE(!(0)), cross, NULL((void*)0), prepare, NULL((void*)0)); |
1827 | g_object_unref (cross); |
1828 | |
1829 | if (status != CDK_GRAB_SUCCESS) |
1830 | { |
1831 | g_warning ("Seat grab failed."); |
1832 | clean_up (); |
1833 | return FALSE(0); |
1834 | } |
1835 | |
1836 | cdk_display_flush (display); |
1837 | |
1838 | return FALSE(0); |
1839 | } |
1840 | |
1841 | static void |
1842 | clean_up (void) |
1843 | { |
1844 | CdkWindow *root; |
1845 | CdkDisplay *display; |
1846 | CdkSeat *seat; |
1847 | |
1848 | root = cdk_get_default_root_window (); |
1849 | display = cdk_display_get_default (); |
1850 | seat = cdk_display_get_default_seat (display); |
1851 | |
1852 | cdk_window_remove_filter (root, (CdkFilterFunc) target_filter, NULL((void*)0)); |
1853 | cdk_seat_ungrab (seat); |
1854 | |
1855 | ctk_main_quit (); |
1856 | } |
1857 | |
1858 | int |
1859 | main (int argc, char **argv) |
1860 | { |
1861 | GOptionContext *ctxt; |
1862 | GOptionGroup *group; |
1863 | GError *error; |
1864 | VnckScreen *screen; |
1865 | |
1866 | bindtextdomain (GETTEXT_PACKAGE"libvnck-3.0", VNCK_LOCALEDIR"/usr/local/share/locale"); |
1867 | bind_textdomain_codeset (GETTEXT_PACKAGE"libvnck-3.0", "UTF-8"); |
1868 | textdomain (GETTEXT_PACKAGE"libvnck-3.0"); |
1869 | |
1870 | cdk_set_allowed_backends ("x11"); |
1871 | |
1872 | ctxt = g_option_context_new (NULL((void*)0)); |
1873 | g_option_context_set_translation_domain (ctxt, GETTEXT_PACKAGE"libvnck-3.0"); |
1874 | |
1875 | g_option_context_set_summary (ctxt, |
1876 | N_("Print or modify the properties of a "("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" ) |
1877 | "screen/workspace/window, or interact with "("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" ) |
1878 | "it, following the EWMH specification.\n"("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" ) |
1879 | "For information about this specification, "("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" ) |
1880 | "see:\n\t"("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" ) |
1881 | "http://freedesktop.org/wiki/Specifications/wm-spec")("Print or modify the properties of a " "screen/workspace/window, or interact with " "it, following the EWMH specification.\n" "For information about this specification, " "see:\n\t" "http://freedesktop.org/wiki/Specifications/wm-spec" )); |
1882 | |
1883 | g_option_context_add_main_entries (ctxt, main_entries, GETTEXT_PACKAGE"libvnck-3.0"); |
1884 | |
1885 | group = g_option_group_new ("list", |
1886 | N_("Options to list windows or workspaces")("Options to list windows or workspaces"), |
1887 | N_("Show options to list windows or workspaces")("Show options to list windows or workspaces"), |
1888 | NULL((void*)0), NULL((void*)0)); |
1889 | g_option_group_add_entries (group, list_entries); |
1890 | g_option_group_set_translation_domain (group, GETTEXT_PACKAGE"libvnck-3.0"); |
1891 | g_option_context_add_group (ctxt, group); |
1892 | |
1893 | group = g_option_group_new ("window", |
1894 | N_("Options to modify properties of a window")("Options to modify properties of a window"), |
1895 | N_("Show options to modify properties of a window")("Show options to modify properties of a window"), |
1896 | NULL((void*)0), NULL((void*)0)); |
1897 | g_option_group_add_entries (group, window_entries); |
1898 | g_option_group_set_translation_domain (group, GETTEXT_PACKAGE"libvnck-3.0"); |
1899 | g_option_context_add_group (ctxt, group); |
1900 | |
1901 | group = g_option_group_new ("workspace", |
1902 | N_("Options to modify properties of a workspace")("Options to modify properties of a workspace"), |
1903 | N_("Show options to modify properties of a workspace")("Show options to modify properties of a workspace"), |
1904 | NULL((void*)0), NULL((void*)0)); |
1905 | g_option_group_add_entries (group, space_entries); |
1906 | g_option_group_set_translation_domain (group, GETTEXT_PACKAGE"libvnck-3.0"); |
1907 | g_option_context_add_group (ctxt, group); |
1908 | |
1909 | group = g_option_group_new ("screen", |
1910 | N_("Options to modify properties of a screen")("Options to modify properties of a screen"), |
1911 | N_("Show options to modify properties of a screen")("Show options to modify properties of a screen"), |
1912 | NULL((void*)0), NULL((void*)0)); |
1913 | g_option_group_add_entries (group, screen_entries); |
1914 | g_option_group_set_translation_domain (group, GETTEXT_PACKAGE"libvnck-3.0"); |
1915 | g_option_context_add_group (ctxt, group); |
1916 | |
1917 | g_option_context_add_group (ctxt, ctk_get_option_group (TRUE(!(0)))); |
1918 | |
1919 | error = NULL((void*)0); |
1920 | if (!g_option_context_parse (ctxt, &argc, &argv, &error)) |
1921 | { |
1922 | g_printerr (_("Error while parsing arguments: %s\n")gettext ("Error while parsing arguments: %s\n"), error->message); |
1923 | g_option_context_free (ctxt); |
1924 | g_error_free (error); |
1925 | return 1; |
1926 | } |
1927 | |
1928 | g_option_context_free (ctxt); |
1929 | ctxt = NULL((void*)0); |
1930 | |
1931 | if (!validate_options ()) |
1932 | return 1; |
1933 | |
1934 | ctk_init (&argc, &argv); |
1935 | |
1936 | vnck_set_client_type (VNCK_CLIENT_TYPE_PAGER); |
1937 | |
1938 | if ((option_screen && interact_screen < 0) || !option_screen) |
1939 | screen = vnck_screen_get_default (); |
1940 | else |
1941 | { |
1942 | screen = vnck_screen_get (interact_screen); |
1943 | if (!screen) |
1944 | { |
1945 | g_printerr (_("Cannot interact with screen %d: "gettext ("Cannot interact with screen %d: " "the screen does not exist\n" ) |
1946 | "the screen does not exist\n")gettext ("Cannot interact with screen %d: " "the screen does not exist\n" ), interact_screen); |
1947 | return 0; |
1948 | } |
1949 | } |
1950 | |
1951 | /* because we don't respond to signals at the moment */ |
1952 | vnck_screen_force_update (screen); |
1953 | |
1954 | if (option_workspace && interact_space < 0) |
1955 | { |
1956 | VnckWorkspace *space; |
1957 | space = vnck_screen_get_active_workspace (screen); |
1958 | if (space == NULL((void*)0)) |
1959 | interact_space = 0; |
1960 | else |
1961 | interact_space = vnck_workspace_get_number (space); |
1962 | } |
1963 | |
1964 | if (get_from_user) |
1965 | { |
1966 | g_idle_add (get_target, NULL((void*)0)); |
1967 | |
1968 | ctk_main (); |
1969 | |
1970 | if (!got_from_user) |
1971 | return 0; |
1972 | } |
1973 | |
1974 | if (mode == SCREEN_READ_MODE) |
1975 | print_screen (screen); |
1976 | else if (mode == SCREEN_LIST_MODE) |
1977 | list_screen (screen); |
1978 | else if (mode == SCREEN_WRITE_MODE) |
1979 | update_screen (screen); |
1980 | else if (mode == WORKSPACE_READ_MODE || mode == WORKSPACE_LIST_MODE || |
1981 | mode == WORKSPACE_WRITE_MODE) |
1982 | { |
1983 | VnckWorkspace *space; |
1984 | |
1985 | g_assert (interact_space != -1)do { if (interact_space != -1) ; else g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c", 1985, ((const char*) (__func__ )), "interact_space != -1"); } while (0); |
1986 | |
1987 | space = vnck_screen_get_workspace (screen, interact_space); |
1988 | |
1989 | if (space) |
1990 | { |
1991 | if (mode == WORKSPACE_READ_MODE) |
1992 | print_workspace (space); |
1993 | else if (mode == WORKSPACE_LIST_MODE) |
1994 | list_workspace (space); |
1995 | else if (mode == WORKSPACE_WRITE_MODE) |
1996 | update_workspace (space); |
1997 | else |
1998 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 1998, ((const char*) (__func__)), ((void*)0)); } while (0); |
1999 | } |
2000 | else |
2001 | g_printerr (_("Cannot interact with workspace %d: "gettext ("Cannot interact with workspace %d: " "the workspace cannot be found\n" ) |
2002 | "the workspace cannot be found\n")gettext ("Cannot interact with workspace %d: " "the workspace cannot be found\n" ), interact_space); |
2003 | } |
2004 | else if (mode == CLASS_GROUP_READ_MODE || mode == CLASS_GROUP_LIST_MODE) |
2005 | { |
2006 | VnckClassGroup *class_group; |
2007 | |
2008 | if (got_from_user) |
2009 | class_group = vnck_window_get_class_group (got_from_user); |
2010 | else |
2011 | class_group = vnck_class_group_get (interact_class_group); |
2012 | |
2013 | if (class_group) |
2014 | { |
2015 | if (mode == CLASS_GROUP_READ_MODE) |
2016 | print_class_group (class_group); |
2017 | else if (mode == CLASS_GROUP_LIST_MODE) |
2018 | list_class_group (class_group); |
2019 | else |
2020 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 2020, ((const char*) (__func__)), ((void*)0)); } while (0); |
2021 | } |
2022 | else |
2023 | /* Translators: A class is like a "family". E.g., all gvim windows are |
2024 | * of the same class. */ |
2025 | g_printerr (_("Cannot interact with class group \"%s\": "gettext ("Cannot interact with class group \"%s\": " "the class group cannot be found\n" ) |
2026 | "the class group cannot be found\n")gettext ("Cannot interact with class group \"%s\": " "the class group cannot be found\n" ), |
2027 | interact_class_group); |
2028 | } |
2029 | else if (mode == APPLICATION_READ_MODE || mode == APPLICATION_LIST_MODE) |
2030 | { |
2031 | VnckApplication *app; |
2032 | |
2033 | if (got_from_user) |
2034 | app = vnck_window_get_application (got_from_user); |
2035 | else |
2036 | app = vnck_application_get (interact_app_xid); |
2037 | |
2038 | if (app) |
2039 | { |
2040 | if (mode == APPLICATION_READ_MODE) |
2041 | print_application (app); |
2042 | else if (mode == APPLICATION_LIST_MODE) |
2043 | list_application (app); |
2044 | else |
2045 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 2045, ((const char*) (__func__)), ((void*)0)); } while (0); |
2046 | } |
2047 | else |
2048 | g_printerr (_("Cannot interact with application having its group "gettext ("Cannot interact with application having its group " "leader with XID %lu: the application cannot be found\n") |
2049 | "leader with XID %lu: the application cannot be found\n")gettext ("Cannot interact with application having its group " "leader with XID %lu: the application cannot be found\n"), |
2050 | interact_app_xid); |
2051 | } |
2052 | else |
2053 | { |
2054 | VnckWindow *window; |
2055 | |
2056 | if (got_from_user) |
2057 | window = got_from_user; |
2058 | else |
2059 | window = vnck_window_get (xid); |
2060 | |
2061 | if (window) |
2062 | { |
2063 | if (mode == WINDOW_WRITE_MODE) |
This statement is never executed | |
2064 | update_window (window); |
2065 | else if (mode == WINDOW_READ_MODE) |
2066 | print_window (window); |
2067 | else |
2068 | g_assert_not_reached ()do { g_assertion_message_expr ("Vnck", "../libvnck/vnckprop.c" , 2068, ((const char*) (__func__)), ((void*)0)); } while (0); |
2069 | } |
2070 | else |
2071 | g_printerr (_("Cannot interact with window with XID %lu: "gettext ("Cannot interact with window with XID %lu: " "the window cannot be found\n" ) |
2072 | "the window cannot be found\n")gettext ("Cannot interact with window with XID %lu: " "the window cannot be found\n" ), xid); |
2073 | } |
2074 | |
2075 | return 0; |
2076 | } |