Merge lp:~noskcaj/ubuntu/trusty/xfwm4/merge into lp:ubuntu/trusty/xfwm4
- Trusty (14.04)
- merge
- Merge into trusty
Proposed by
Jackson Doak
Status: | Merged | ||||
---|---|---|---|---|---|
Merge reported by: | Dmitry Shachnev | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~noskcaj/ubuntu/trusty/xfwm4/merge | ||||
Merge into: | lp:ubuntu/trusty/xfwm4 | ||||
Diff against target: |
4137 lines (+77/-3988) 8 files modified
.pc/8563.patch/src/client.c (+0/-3926) .pc/applied-patches (+0/-1) debian/changelog (+19/-0) debian/patches/0001-fix-fullscreen-qt4-behavior-bug-8563.patch (+50/-0) debian/patches/8563.patch (+0/-50) debian/patches/series (+1/-1) debian/rules (+1/-0) src/client.c (+6/-10) |
||||
To merge this branch: | bzr merge lp:~noskcaj/ubuntu/trusty/xfwm4/merge | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dmitry Shachnev | Approve | ||
Ubuntu branches | Pending | ||
Review via email: mp+208941@code.launchpad.net |
Commit message
Description of the change
Merge from debian (no real changes)
Add build flags to enable xubuntu seamless greeter to desktop transition.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed directory '.pc/8563.patch' |
2 | === removed directory '.pc/8563.patch/src' |
3 | === removed file '.pc/8563.patch/src/client.c' |
4 | --- .pc/8563.patch/src/client.c 2013-12-03 15:24:16 +0000 |
5 | +++ .pc/8563.patch/src/client.c 1970-01-01 00:00:00 +0000 |
6 | @@ -1,3926 +0,0 @@ |
7 | -/* $Id$ |
8 | - |
9 | - This program is free software; you can redistribute it and/or modify |
10 | - it under the terms of the GNU General Public License as published by |
11 | - the Free Software Foundation; either version 2, or (at your option) |
12 | - any later version. |
13 | - |
14 | - This program is distributed in the hope that it will be useful, |
15 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | - GNU General Public License for more details. |
18 | - |
19 | - You should have received a copy of the GNU General Public License |
20 | - along with this program; if not, write to the Free Software |
21 | - Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston, |
22 | - MA 02110-1301, USA. |
23 | - |
24 | - |
25 | - oroborus - (c) 2001 Ken Lynch |
26 | - xfwm4 - (c) 2002-2011 Olivier Fourdan |
27 | - |
28 | - */ |
29 | - |
30 | -#ifdef HAVE_CONFIG_H |
31 | -#include "config.h" |
32 | -#endif |
33 | - |
34 | -#include <sys/types.h> |
35 | -#include <signal.h> |
36 | -#include <unistd.h> |
37 | -#include <errno.h> |
38 | - |
39 | -#include <X11/X.h> |
40 | -#include <X11/Xlib.h> |
41 | -#include <X11/Xutil.h> |
42 | -#include <X11/Xatom.h> |
43 | -#include <X11/extensions/shape.h> |
44 | - |
45 | -#include <glib.h> |
46 | -#include <gdk/gdk.h> |
47 | -#include <gdk/gdkx.h> |
48 | -#include <gtk/gtk.h> |
49 | -#include <libxfce4util/libxfce4util.h> |
50 | - |
51 | -#include "client.h" |
52 | -#include "compositor.h" |
53 | -#include "focus.h" |
54 | -#include "frame.h" |
55 | -#include "hints.h" |
56 | -#include "icons.h" |
57 | -#include "misc.h" |
58 | -#include "moveresize.h" |
59 | -#include "mypixmap.h" |
60 | -#include "mywindow.h" |
61 | -#include "netwm.h" |
62 | -#include "placement.h" |
63 | -#include "screen.h" |
64 | -#include "session.h" |
65 | -#include "settings.h" |
66 | -#include "stacking.h" |
67 | -#include "startup_notification.h" |
68 | -#include "transients.h" |
69 | -#include "workspaces.h" |
70 | -#include "xsync.h" |
71 | -#include "event_filter.h" |
72 | - |
73 | -/* Event mask definition */ |
74 | - |
75 | -#define POINTER_EVENT_MASK \ |
76 | - ButtonPressMask|\ |
77 | - ButtonReleaseMask |
78 | - |
79 | -#define FRAME_EVENT_MASK \ |
80 | - SubstructureNotifyMask|\ |
81 | - SubstructureRedirectMask|\ |
82 | - PointerMotionMask|\ |
83 | - ButtonMotionMask|\ |
84 | - FocusChangeMask|\ |
85 | - EnterWindowMask|\ |
86 | - PropertyChangeMask |
87 | - |
88 | -#define CLIENT_EVENT_MASK \ |
89 | - StructureNotifyMask|\ |
90 | - FocusChangeMask|\ |
91 | - PropertyChangeMask |
92 | - |
93 | -#define BUTTON_EVENT_MASK \ |
94 | - EnterWindowMask|\ |
95 | - LeaveWindowMask |
96 | - |
97 | -/* Useful macros */ |
98 | -#define START_ICONIC(c) \ |
99 | - ((c->wmhints) && \ |
100 | - (c->wmhints->initial_state == IconicState) && \ |
101 | - !clientIsTransientOrModal (c)) |
102 | - |
103 | -#define OPACITY_SET_STEP (guint) 0x16000000 |
104 | -#define OPACITY_SET_MIN (guint) 0x40000000 |
105 | - |
106 | -typedef struct _ButtonPressData ButtonPressData; |
107 | -struct _ButtonPressData |
108 | -{ |
109 | - int b; |
110 | - Client *c; |
111 | -}; |
112 | - |
113 | -/* Forward decl */ |
114 | -static void |
115 | -clientUpdateIconPix (Client *c); |
116 | -static gboolean |
117 | -clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *, tilePositionType tile); |
118 | - |
119 | -Display * |
120 | -clientGetXDisplay (Client *c) |
121 | -{ |
122 | - g_return_val_if_fail (c, NULL); |
123 | - |
124 | - return myScreenGetXDisplay (c->screen_info); |
125 | -} |
126 | - |
127 | -void |
128 | -clientInstallColormaps (Client *c) |
129 | -{ |
130 | - XWindowAttributes attr; |
131 | - gboolean installed; |
132 | - int i; |
133 | - |
134 | - g_return_if_fail (c != NULL); |
135 | - TRACE ("entering clientInstallColormaps"); |
136 | - |
137 | - installed = FALSE; |
138 | - if (c->ncmap) |
139 | - { |
140 | - for (i = c->ncmap - 1; i >= 0; i--) |
141 | - { |
142 | - XGetWindowAttributes (clientGetXDisplay (c), c->cmap_windows[i], &attr); |
143 | - XInstallColormap (clientGetXDisplay (c), attr.colormap); |
144 | - if (c->cmap_windows[i] == c->window) |
145 | - { |
146 | - installed = TRUE; |
147 | - } |
148 | - } |
149 | - } |
150 | - if ((!installed) && (c->cmap)) |
151 | - { |
152 | - XInstallColormap (clientGetXDisplay (c), c->cmap); |
153 | - } |
154 | -} |
155 | - |
156 | -void |
157 | -clientUpdateColormaps (Client *c) |
158 | -{ |
159 | - g_return_if_fail (c != NULL); |
160 | - TRACE ("entering clientUpdateColormaps"); |
161 | - |
162 | - if (c->ncmap) |
163 | - { |
164 | - XFree (c->cmap_windows); |
165 | - c->ncmap = 0; |
166 | - } |
167 | - if (!XGetWMColormapWindows (clientGetXDisplay (c), c->window, &c->cmap_windows, &c->ncmap)) |
168 | - { |
169 | - c->cmap_windows = NULL; |
170 | - c->ncmap = 0; |
171 | - } |
172 | -} |
173 | - |
174 | -static gchar* |
175 | -clientCreateTitleName (Client *c, gchar *name, gchar *hostname) |
176 | -{ |
177 | - ScreenInfo *screen_info; |
178 | - DisplayInfo *display_info; |
179 | - gchar *title; |
180 | - |
181 | - g_return_val_if_fail (c != NULL, NULL); |
182 | - TRACE ("entering clientCreateTitleName"); |
183 | - |
184 | - screen_info = c->screen_info; |
185 | - display_info = screen_info->display_info; |
186 | - |
187 | - if (strlen (hostname) && (display_info->hostname) && (g_ascii_strcasecmp (display_info->hostname, hostname))) |
188 | - { |
189 | - /* TRANSLATORS: "(on %s)" is like "running on" the name of the other host */ |
190 | - title = g_strdup_printf (_("%s (on %s)"), name, hostname); |
191 | - } |
192 | - else |
193 | - { |
194 | - title = g_strdup (name); |
195 | - } |
196 | - |
197 | - return title; |
198 | -} |
199 | - |
200 | -void |
201 | -clientUpdateName (Client *c) |
202 | -{ |
203 | - ScreenInfo *screen_info; |
204 | - DisplayInfo *display_info; |
205 | - gchar *hostname; |
206 | - gchar *wm_name; |
207 | - gchar *name; |
208 | - gboolean refresh; |
209 | - |
210 | - g_return_if_fail (c != NULL); |
211 | - TRACE ("entering clientUpdateName"); |
212 | - |
213 | - screen_info = c->screen_info; |
214 | - display_info = screen_info->display_info; |
215 | - |
216 | - getWindowName (display_info, c->window, &wm_name); |
217 | - getWindowHostname (display_info, c->window, &hostname); |
218 | - refresh = FALSE; |
219 | - |
220 | - /* Update hostname too, as it's used when terminating a client */ |
221 | - if (hostname) |
222 | - { |
223 | - if (c->hostname) |
224 | - { |
225 | - g_free (c->hostname); |
226 | - } |
227 | - c->hostname = hostname; |
228 | - } |
229 | - |
230 | - if (wm_name) |
231 | - { |
232 | - name = clientCreateTitleName (c, wm_name, hostname); |
233 | - g_free (wm_name); |
234 | - if (c->name) |
235 | - { |
236 | - if (strcmp (name, c->name)) |
237 | - { |
238 | - refresh = TRUE; |
239 | - FLAG_SET (c->flags, CLIENT_FLAG_NAME_CHANGED); |
240 | - } |
241 | - g_free (c->name); |
242 | - } |
243 | - c->name = name; |
244 | - } |
245 | - |
246 | - if (refresh) |
247 | - { |
248 | - frameQueueDraw (c, TRUE); |
249 | - } |
250 | -} |
251 | - |
252 | -void |
253 | -clientUpdateAllFrames (ScreenInfo *screen_info, int mask) |
254 | -{ |
255 | - Client *c; |
256 | - XWindowChanges wc; |
257 | - guint i; |
258 | - |
259 | - g_return_if_fail (screen_info != NULL); |
260 | - |
261 | - TRACE ("entering clientRedrawAllFrames"); |
262 | - for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++) |
263 | - { |
264 | - unsigned long configure_flags = 0L; |
265 | - |
266 | - if (mask & UPDATE_BUTTON_GRABS) |
267 | - { |
268 | - clientUngrabButtons (c); |
269 | - clientGrabButtons (c); |
270 | - clientGrabMouseButton (c); |
271 | - } |
272 | - if (mask & UPDATE_CACHE) |
273 | - { |
274 | - clientUpdateIconPix (c); |
275 | - } |
276 | - if (mask & UPDATE_GRAVITY) |
277 | - { |
278 | - clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y); |
279 | - clientCoordGravitate (c, c->gravity, APPLY, &c->x, &c->y); |
280 | - setNetFrameExtents (screen_info->display_info, |
281 | - c->window, |
282 | - frameTop (c), |
283 | - frameLeft (c), |
284 | - frameRight (c), |
285 | - frameBottom (c)); |
286 | - configure_flags |= CFG_FORCE_REDRAW; |
287 | - mask &= ~UPDATE_FRAME; |
288 | - } |
289 | - if (mask & UPDATE_MAXIMIZE) |
290 | - { |
291 | - unsigned long maximization_flags = 0L; |
292 | - |
293 | - /* Recompute size and position of maximized windows */ |
294 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT)) |
295 | - { |
296 | - maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED; |
297 | - |
298 | - /* Force an update by clearing the internal flags */ |
299 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT); |
300 | - clientToggleMaximized (c, maximization_flags, FALSE); |
301 | - |
302 | - configure_flags |= CFG_FORCE_REDRAW; |
303 | - mask &= ~UPDATE_FRAME; |
304 | - } |
305 | - } |
306 | - if (configure_flags != 0L) |
307 | - { |
308 | - wc.x = c->x; |
309 | - wc.y = c->y; |
310 | - wc.width = c->width; |
311 | - wc.height = c->height; |
312 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, configure_flags); |
313 | - } |
314 | - if (mask & UPDATE_FRAME) |
315 | - { |
316 | - frameQueueDraw (c, TRUE); |
317 | - } |
318 | - |
319 | - } |
320 | -} |
321 | - |
322 | -void |
323 | -clientGrabButtons (Client *c) |
324 | -{ |
325 | - ScreenInfo *screen_info; |
326 | - |
327 | - g_return_if_fail (c != NULL); |
328 | - TRACE ("entering clientGrabButtons"); |
329 | - TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window); |
330 | - |
331 | - screen_info = c->screen_info; |
332 | - if (screen_info->params->easy_click) |
333 | - { |
334 | - grabButton(clientGetXDisplay (c), AnyButton, screen_info->params->easy_click, c->window); |
335 | - } |
336 | -} |
337 | - |
338 | -void |
339 | -clientUngrabButtons (Client *c) |
340 | -{ |
341 | - g_return_if_fail (c != NULL); |
342 | - TRACE ("entering clientUngrabButtons"); |
343 | - TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window); |
344 | - |
345 | - XUngrabButton (clientGetXDisplay (c), AnyButton, AnyModifier, c->window); |
346 | -} |
347 | - |
348 | -static gboolean |
349 | -urgent_cb (gpointer data) |
350 | -{ |
351 | - Client *c; |
352 | - ScreenInfo *screen_info; |
353 | - |
354 | - c = (Client *) data; |
355 | - g_return_val_if_fail (c != NULL, FALSE); |
356 | - TRACE ("entering urgent_cb, iteration %i", c->blink_iterations); |
357 | - screen_info = c->screen_info; |
358 | - |
359 | - if (c != clientGetFocus ()) |
360 | - { |
361 | - /* |
362 | - * If we do not blink on urgency, check if the window was last |
363 | - * drawn focused and redraw it unfocused. |
364 | - * This is for th case when the tuser changes the settings |
365 | - * in between two redraws. |
366 | - */ |
367 | - if (!screen_info->params->urgent_blink) |
368 | - { |
369 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE)) |
370 | - { |
371 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE); |
372 | - frameQueueDraw (c, FALSE); |
373 | - } |
374 | - |
375 | - if (c->blink_iterations) |
376 | - { |
377 | - c->blink_iterations = 0; |
378 | - } |
379 | - return TRUE; |
380 | - } |
381 | - /* |
382 | - * If we blink on urgency, check if we've not reach the number |
383 | - * of iterations and if not, simply change the status and redraw |
384 | - */ |
385 | - if (c->blink_iterations < (2 * MAX_BLINK_ITERATIONS)) |
386 | - { |
387 | - c->blink_iterations++; |
388 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE); |
389 | - frameQueueDraw (c, FALSE); |
390 | - return TRUE; |
391 | - } |
392 | - /* |
393 | - * If we reached the max number of iterations, check if we |
394 | - * repeat. If repeat_urgent_blink is set, redraw the frame and |
395 | - * restart counting from 1 |
396 | - */ |
397 | - if (screen_info->params->repeat_urgent_blink) |
398 | - { |
399 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE); |
400 | - frameQueueDraw (c, FALSE); |
401 | - c->blink_iterations = 1; |
402 | - return TRUE; |
403 | - } |
404 | - } |
405 | - else if (c->blink_iterations) |
406 | - { |
407 | - c->blink_iterations = 0; |
408 | - } |
409 | - return (TRUE); |
410 | -} |
411 | - |
412 | -void |
413 | -clientUpdateUrgency (Client *c) |
414 | -{ |
415 | - g_return_if_fail (c != NULL); |
416 | - |
417 | - TRACE ("entering clientUpdateUrgency"); |
418 | - |
419 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE); |
420 | - if (c->blink_timeout_id) |
421 | - { |
422 | - g_source_remove (c->blink_timeout_id); |
423 | - frameQueueDraw (c, FALSE); |
424 | - } |
425 | - FLAG_UNSET (c->wm_flags, WM_FLAG_URGENT); |
426 | - |
427 | - c->blink_timeout_id = 0; |
428 | - c->blink_iterations = 0; |
429 | - if ((c->wmhints) && (c->wmhints->flags & XUrgencyHint)) |
430 | - { |
431 | - FLAG_SET (c->wm_flags, WM_FLAG_URGENT); |
432 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
433 | - { |
434 | - c->blink_timeout_id = |
435 | - g_timeout_add_full (G_PRIORITY_DEFAULT, |
436 | - CLIENT_BLINK_TIMEOUT, |
437 | - (GtkFunction) urgent_cb, |
438 | - (gpointer) c, NULL); |
439 | - } |
440 | - } |
441 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE) |
442 | - && !FLAG_TEST (c->wm_flags, WM_FLAG_URGENT) |
443 | - && (c != clientGetFocus ())) |
444 | - { |
445 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE); |
446 | - frameQueueDraw (c, FALSE); |
447 | - } |
448 | -} |
449 | - |
450 | -void |
451 | -clientCoordGravitate (Client *c, int gravity, int mode, int *x, int *y) |
452 | -{ |
453 | - int dx, dy; |
454 | - |
455 | - g_return_if_fail (c != NULL); |
456 | - TRACE ("entering clientCoordGravitate"); |
457 | - |
458 | - switch (gravity) |
459 | - { |
460 | - case CenterGravity: |
461 | - dx = (c->border_width * 2) - ((frameLeft (c) + |
462 | - frameRight (c)) / 2); |
463 | - dy = (c->border_width * 2) - ((frameTop (c) + |
464 | - frameBottom (c)) / 2); |
465 | - break; |
466 | - case NorthGravity: |
467 | - dx = (c->border_width * 2) - ((frameLeft (c) + |
468 | - frameRight (c)) / 2); |
469 | - dy = frameTop (c); |
470 | - break; |
471 | - case SouthGravity: |
472 | - dx = (c->border_width * 2) - ((frameLeft (c) + |
473 | - frameRight (c)) / 2); |
474 | - dy = (c->border_width * 2) - frameBottom (c); |
475 | - break; |
476 | - case EastGravity: |
477 | - dx = (c->border_width * 2) - frameRight (c); |
478 | - dy = (c->border_width * 2) - ((frameTop (c) + |
479 | - frameBottom (c)) / 2); |
480 | - break; |
481 | - case WestGravity: |
482 | - dx = frameLeft (c); |
483 | - dy = (c->border_width * 2) - ((frameTop (c) + |
484 | - frameBottom (c)) / 2); |
485 | - break; |
486 | - case NorthWestGravity: |
487 | - dx = frameLeft (c); |
488 | - dy = frameTop (c); |
489 | - break; |
490 | - case NorthEastGravity: |
491 | - dx = (c->border_width * 2) - frameRight (c); |
492 | - dy = frameTop (c); |
493 | - break; |
494 | - case SouthWestGravity: |
495 | - dx = frameLeft (c); |
496 | - dy = (c->border_width * 2) - frameBottom (c); |
497 | - break; |
498 | - case SouthEastGravity: |
499 | - dx = (c->border_width * 2) - frameRight (c); |
500 | - dy = (c->border_width * 2) - frameBottom (c); |
501 | - break; |
502 | - default: |
503 | - dx = 0; |
504 | - dy = 0; |
505 | - break; |
506 | - } |
507 | - *x = *x + (dx * mode); |
508 | - *y = *y + (dy * mode); |
509 | -} |
510 | - |
511 | -void |
512 | -clientAdjustCoordGravity (Client *c, int gravity, unsigned long *mask, XWindowChanges *wc) |
513 | -{ |
514 | - int tx, ty, dw, dh; |
515 | - |
516 | - g_return_if_fail (c != NULL); |
517 | - TRACE ("entering clientAdjustCoordGravity"); |
518 | - |
519 | - tx = wc->x; |
520 | - ty = wc->y; |
521 | - clientCoordGravitate (c, gravity, APPLY, &tx, &ty); |
522 | - |
523 | - switch (gravity) |
524 | - { |
525 | - case CenterGravity: |
526 | - dw = (c->width - wc->width) / 2; |
527 | - dh = (c->height - wc->height) / 2; |
528 | - break; |
529 | - case NorthGravity: |
530 | - dw = (c->width - wc->width) / 2; |
531 | - dh = 0; |
532 | - break; |
533 | - case SouthGravity: |
534 | - dw = (c->width - wc->width) / 2; |
535 | - dh = (c->height - wc->height); |
536 | - break; |
537 | - case EastGravity: |
538 | - dw = (c->width - wc->width); |
539 | - dh = (c->height - wc->height) / 2; |
540 | - break; |
541 | - case WestGravity: |
542 | - dw = 0; |
543 | - dh = (c->height - wc->height) / 2; |
544 | - break; |
545 | - case NorthWestGravity: |
546 | - dw = 0; |
547 | - dh = 0; |
548 | - break; |
549 | - case NorthEastGravity: |
550 | - dw = (c->width - wc->width); |
551 | - dh = 0; |
552 | - break; |
553 | - case SouthWestGravity: |
554 | - dw = 0; |
555 | - dh = (c->height - wc->height); |
556 | - break; |
557 | - case SouthEastGravity: |
558 | - dw = (c->width - wc->width); |
559 | - dh = (c->height - wc->height); |
560 | - break; |
561 | - default: |
562 | - dw = 0; |
563 | - dh = 0; |
564 | - break; |
565 | - } |
566 | - |
567 | - if (*mask & CWX) |
568 | - { |
569 | - wc->x = tx; |
570 | - } |
571 | - else if (*mask & CWWidth) |
572 | - { |
573 | - wc->x = c->x + dw; |
574 | - *mask |= CWX; |
575 | - } |
576 | - |
577 | - if (*mask & CWY) |
578 | - { |
579 | - wc->y = ty; |
580 | - } |
581 | - else if (*mask & CWHeight) |
582 | - { |
583 | - wc->y = c->y + dh; |
584 | - *mask |= CWY; |
585 | - } |
586 | -} |
587 | - |
588 | -#define WIN_MOVED (mask & (CWX | CWY)) |
589 | -#define WIN_RESIZED (mask & (CWWidth | CWHeight)) |
590 | - |
591 | -static void |
592 | -clientConfigureWindows (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags) |
593 | -{ |
594 | - unsigned long change_mask_frame, change_mask_client; |
595 | - XWindowChanges change_values; |
596 | - DisplayInfo *display_info; |
597 | - ScreenInfo *screen_info; |
598 | - |
599 | - screen_info = c->screen_info; |
600 | - display_info = screen_info->display_info; |
601 | - |
602 | - change_mask_frame = mask & (CWX | CWY | CWWidth | CWHeight); |
603 | - change_mask_client = mask & (CWWidth | CWHeight); |
604 | - |
605 | - if ((WIN_RESIZED) || (flags & CFG_FORCE_REDRAW)) |
606 | - { |
607 | - frameDraw (c, (flags & CFG_FORCE_REDRAW)); |
608 | - } |
609 | - |
610 | - if (flags & CFG_FORCE_REDRAW) |
611 | - { |
612 | - change_mask_client |= (CWX | CWY); |
613 | - } |
614 | - |
615 | - if (change_mask_frame & (CWX | CWY | CWWidth | CWHeight)) |
616 | - { |
617 | - change_values.x = frameX (c); |
618 | - change_values.y = frameY (c); |
619 | - change_values.width = frameWidth (c); |
620 | - change_values.height = frameHeight (c); |
621 | - XConfigureWindow (display_info->dpy, c->frame, change_mask_frame, &change_values); |
622 | - } |
623 | - |
624 | - if (change_mask_client & (CWX | CWY | CWWidth | CWHeight)) |
625 | - { |
626 | - change_values.x = frameLeft (c); |
627 | - change_values.y = frameTop (c); |
628 | - change_values.width = c->width; |
629 | - change_values.height = c->height; |
630 | - XConfigureWindow (display_info->dpy, c->window, change_mask_client, &change_values); |
631 | - } |
632 | - if (WIN_RESIZED) |
633 | - { |
634 | - compositorResizeWindow (display_info, c->frame, frameX (c), frameY (c), frameWidth (c), frameHeight (c)); |
635 | - } |
636 | -} |
637 | - |
638 | -void |
639 | -clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags) |
640 | -{ |
641 | - XConfigureEvent ce; |
642 | - int px, py, pwidth, pheight; |
643 | - |
644 | - g_return_if_fail (c != NULL); |
645 | - g_return_if_fail (c->window != None); |
646 | - |
647 | - TRACE ("entering clientConfigure"); |
648 | - TRACE ("configuring client \"%s\" (0x%lx) %s, type %u", c->name, |
649 | - c->window, flags & CFG_CONSTRAINED ? "constrained" : "not contrained", c->type); |
650 | - |
651 | - px = c->x; |
652 | - py = c->y; |
653 | - pwidth = c->width; |
654 | - pheight = c->height; |
655 | - |
656 | - if (mask & CWX) |
657 | - { |
658 | - if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING)) |
659 | - { |
660 | - c->x = wc->x; |
661 | - } |
662 | - } |
663 | - if (mask & CWY) |
664 | - { |
665 | - if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING)) |
666 | - { |
667 | - c->y = wc->y; |
668 | - } |
669 | - } |
670 | - if (mask & CWWidth) |
671 | - { |
672 | - clientSetWidth (c, wc->width, flags & CFG_REQUEST); |
673 | - } |
674 | - if (mask & CWHeight) |
675 | - { |
676 | - clientSetHeight (c, wc->height, flags & CFG_REQUEST); |
677 | - } |
678 | - if (mask & CWBorderWidth) |
679 | - { |
680 | - c->border_width = wc->border_width; |
681 | - } |
682 | - if (mask & CWStackMode) |
683 | - { |
684 | - switch (wc->stack_mode) |
685 | - { |
686 | - /* |
687 | - * Limitation: we don't support neither |
688 | - * TopIf, BottomIf nor Opposite ... |
689 | - */ |
690 | - case Above: |
691 | - TRACE ("Above"); |
692 | - if (mask & CWSibling) |
693 | - { |
694 | - clientRaise (c, wc->sibling); |
695 | - } |
696 | - else |
697 | - { |
698 | - clientRaise (c, None); |
699 | - } |
700 | - break; |
701 | - case Below: |
702 | - TRACE ("Below"); |
703 | - if (mask & CWSibling) |
704 | - { |
705 | - clientLower (c, wc->sibling); |
706 | - } |
707 | - else |
708 | - { |
709 | - clientLower (c, None); |
710 | - } |
711 | - |
712 | - break; |
713 | - case Opposite: |
714 | - case TopIf: |
715 | - case BottomIf: |
716 | - default: |
717 | - break; |
718 | - } |
719 | - } |
720 | - mask &= ~(CWStackMode | CWSibling); |
721 | - |
722 | - /* Keep control over what the application does. */ |
723 | - if (((flags & (CFG_CONSTRAINED | CFG_REQUEST)) == (CFG_CONSTRAINED | CFG_REQUEST)) |
724 | - && CONSTRAINED_WINDOW (c)) |
725 | - { |
726 | - clientConstrainPos (c, flags & CFG_KEEP_VISIBLE); |
727 | - |
728 | - if (c->x != px) |
729 | - { |
730 | - mask |= CWX; |
731 | - } |
732 | - else |
733 | - { |
734 | - mask &= ~CWX; |
735 | - } |
736 | - |
737 | - if (c->y != py) |
738 | - { |
739 | - mask |= CWY; |
740 | - } |
741 | - else |
742 | - { |
743 | - mask &= ~CWY; |
744 | - } |
745 | - |
746 | - if (c->width != pwidth) |
747 | - { |
748 | - mask |= CWWidth; |
749 | - } |
750 | - else |
751 | - { |
752 | - mask &= ~CWWidth; |
753 | - } |
754 | - if (c->height != pheight) |
755 | - { |
756 | - mask |= CWHeight; |
757 | - } |
758 | - else |
759 | - { |
760 | - mask &= ~CWHeight; |
761 | - } |
762 | - } |
763 | - |
764 | - clientConfigureWindows (c, wc, mask, flags); |
765 | - /* |
766 | - |
767 | - We reparent the client window. According to the ICCCM spec, the |
768 | - WM must send a senthetic event when the window is moved and not resized. |
769 | - |
770 | - But, since we reparent the window, we must also send a synthetic |
771 | - configure event when the window is moved and resized. |
772 | - |
773 | - See this thread for the rational: |
774 | - http://www.mail-archive.com/wm-spec-list@gnome.org/msg00379.html |
775 | - |
776 | - And specifically this post from Carsten Haitzler: |
777 | - http://www.mail-archive.com/wm-spec-list@gnome.org/msg00382.html |
778 | - |
779 | - */ |
780 | - if ((WIN_MOVED) || (flags & CFG_NOTIFY) || |
781 | - ((flags & CFG_REQUEST) && !(WIN_MOVED || WIN_RESIZED))) |
782 | - { |
783 | - DBG ("Sending ConfigureNotify"); |
784 | - ce.type = ConfigureNotify; |
785 | - ce.display = clientGetXDisplay (c); |
786 | - ce.event = c->window; |
787 | - ce.window = c->window; |
788 | - ce.x = c->x; |
789 | - ce.y = c->y; |
790 | - ce.width = c->width; |
791 | - ce.height = c->height; |
792 | - ce.border_width = 0; |
793 | - ce.above = c->frame; |
794 | - ce.override_redirect = FALSE; |
795 | - XSendEvent (clientGetXDisplay (c), c->window, FALSE, |
796 | - StructureNotifyMask, (XEvent *) & ce); |
797 | - } |
798 | -#undef WIN_MOVED |
799 | -#undef WIN_RESIZED |
800 | -} |
801 | - |
802 | -void |
803 | -clientMoveResizeWindow (Client *c, XWindowChanges * wc, unsigned long mask) |
804 | -{ |
805 | - ScreenInfo *screen_info; |
806 | - DisplayInfo *display_info; |
807 | - unsigned short flags; |
808 | - |
809 | - g_return_if_fail (c != NULL); |
810 | - TRACE ("entering clientMoveResizeWindow"); |
811 | - TRACE ("client \"%s\" (0x%lx)", c->name, c->window); |
812 | - |
813 | - screen_info = c->screen_info; |
814 | - display_info = screen_info->display_info; |
815 | - if (c->type == WINDOW_DESKTOP) |
816 | - { |
817 | - /* Ignore stacking request for DESKTOP windows */ |
818 | - mask &= ~(CWSibling | CWStackMode); |
819 | - } |
820 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) |
821 | - || (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED) |
822 | - && (screen_info->params->borderless_maximize))) |
823 | - { |
824 | - /* Not allowed in fullscreen or maximzed mode */ |
825 | - mask &= ~(CWX | CWY | CWWidth | CWHeight); |
826 | - } |
827 | - /*clean up buggy requests that set all flags */ |
828 | - if ((mask & CWX) && (wc->x == c->x)) |
829 | - { |
830 | - mask &= ~CWX; |
831 | - } |
832 | - if ((mask & CWY) && (wc->y == c->y)) |
833 | - { |
834 | - mask &= ~CWY; |
835 | - } |
836 | - if ((mask & CWWidth) && (wc->width == c->width)) |
837 | - { |
838 | - mask &= ~CWWidth; |
839 | - } |
840 | - if ((mask & CWHeight) && (wc->height == c->height)) |
841 | - { |
842 | - mask &= ~CWHeight; |
843 | - } |
844 | - |
845 | - /* Still a move/resize after cleanup? */ |
846 | - flags = CFG_REQUEST; |
847 | - if (mask & (CWX | CWY | CWWidth | CWHeight)) |
848 | - { |
849 | - /* Clear any previously saved pos flag from screen resize */ |
850 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SAVED_POS); |
851 | - |
852 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
853 | - { |
854 | - clientRemoveMaximizeFlag (c); |
855 | - } |
856 | - |
857 | - flags |= CFG_REQUEST | CFG_CONSTRAINED; |
858 | - } |
859 | - if ((mask & (CWWidth | CWHeight)) && !(mask & (CWX | CWY))) |
860 | - { |
861 | - /* |
862 | - * The client is resizing its window, but did not specify a |
863 | - * position, make sure the window remains fully visible in that |
864 | - *case so that the user does not have to relocate the window |
865 | - */ |
866 | - flags |= CFG_KEEP_VISIBLE; |
867 | - } |
868 | - /* |
869 | - * Let's say that if the client performs a XRaiseWindow, we show the window if focus |
870 | - * stealing prevention is not activated, otherwise we just set the "demands attention" |
871 | - * flag... |
872 | - */ |
873 | - if ((mask & CWStackMode) && (wc->stack_mode == Above) && (wc->sibling == None) && !(c->type & WINDOW_TYPE_DONT_FOCUS)) |
874 | - { |
875 | - Client *last_raised; |
876 | - |
877 | - last_raised = clientGetLastRaise (screen_info); |
878 | - if (last_raised && (c != last_raised)) |
879 | - { |
880 | - if ((screen_info->params->prevent_focus_stealing) && (screen_info->params->activate_action == ACTIVATE_ACTION_NONE)) |
881 | - { |
882 | - mask &= ~(CWSibling | CWStackMode); |
883 | - TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); |
884 | - FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION); |
885 | - clientSetNetState (c); |
886 | - } |
887 | - else |
888 | - { |
889 | - clientActivate (c, getXServerTime (display_info), FALSE); |
890 | - } |
891 | - } |
892 | - } |
893 | - /* And finally, configure the window */ |
894 | - clientConfigure (c, wc, mask, flags); |
895 | -} |
896 | - |
897 | -void |
898 | -clientGetMWMHints (Client *c, gboolean update) |
899 | -{ |
900 | - ScreenInfo *screen_info; |
901 | - DisplayInfo *display_info; |
902 | - PropMwmHints *mwm_hints; |
903 | - XWindowChanges wc; |
904 | - |
905 | - g_return_if_fail (c != NULL); |
906 | - g_return_if_fail (c->window != None); |
907 | - |
908 | - TRACE ("entering clientGetMWMHints client \"%s\" (0x%lx)", c->name, |
909 | - c->window); |
910 | - |
911 | - screen_info = c->screen_info; |
912 | - display_info = screen_info->display_info; |
913 | - |
914 | - mwm_hints = getMotifHints (display_info, c->window); |
915 | - if (mwm_hints) |
916 | - { |
917 | - if ((mwm_hints->flags & MWM_HINTS_DECORATIONS)) |
918 | - { |
919 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE)) |
920 | - { |
921 | - if (mwm_hints->decorations & MWM_DECOR_ALL) |
922 | - { |
923 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU); |
924 | - } |
925 | - else |
926 | - { |
927 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU); |
928 | - FLAG_SET (c->xfwm_flags, (mwm_hints-> decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER)) |
929 | - ? XFWM_FLAG_HAS_BORDER : 0); |
930 | - FLAG_SET (c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MENU)) |
931 | - ? XFWM_FLAG_HAS_MENU : 0); |
932 | - /* |
933 | - FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_HIDE); |
934 | - FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE); |
935 | - FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MINIMIZE)) ? XFWM_FLAG_HAS_HIDE : 0); |
936 | - FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MAXIMIZE)) ? XFWM_FLAG_HAS_MAXIMIZE : 0); |
937 | - */ |
938 | - } |
939 | - } |
940 | - } |
941 | - /* The following is from Metacity : */ |
942 | - if (mwm_hints->flags & MWM_HINTS_FUNCTIONS) |
943 | - { |
944 | - if (!(mwm_hints->functions & MWM_FUNC_ALL)) |
945 | - { |
946 | - FLAG_UNSET (c->xfwm_flags, |
947 | - XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE | |
948 | - XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE | |
949 | - XFWM_FLAG_HAS_RESIZE); |
950 | - } |
951 | - else |
952 | - { |
953 | - FLAG_SET (c->xfwm_flags, |
954 | - XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE | |
955 | - XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE | |
956 | - XFWM_FLAG_HAS_RESIZE); |
957 | - } |
958 | - |
959 | - if (mwm_hints->functions & MWM_FUNC_CLOSE) |
960 | - { |
961 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_CLOSE); |
962 | - } |
963 | - if (mwm_hints->functions & MWM_FUNC_MINIMIZE) |
964 | - { |
965 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_HIDE); |
966 | - } |
967 | - if (mwm_hints->functions & MWM_FUNC_MAXIMIZE) |
968 | - { |
969 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE); |
970 | - } |
971 | - if (mwm_hints->functions & MWM_FUNC_RESIZE) |
972 | - { |
973 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_RESIZE); |
974 | - } |
975 | - if (mwm_hints->functions & MWM_FUNC_MOVE) |
976 | - { |
977 | - FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MOVE); |
978 | - } |
979 | - } |
980 | - g_free (mwm_hints); |
981 | - } |
982 | - |
983 | - if (update) |
984 | - { |
985 | - wc.x = c->x; |
986 | - wc.y = c->y; |
987 | - wc.width = c->width; |
988 | - wc.height = c->height; |
989 | - |
990 | - /* If client is maximized, we need to update its coordonates and size as well */ |
991 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
992 | - { |
993 | - GdkRectangle rect; |
994 | - myScreenFindMonitorAtPoint (screen_info, |
995 | - frameX (c) + (frameWidth (c) / 2), |
996 | - frameY (c) + (frameHeight (c) / 2), &rect); |
997 | - clientNewMaxSize (c, &wc, &rect, TILE_NONE); |
998 | - } |
999 | - |
1000 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW); |
1001 | - |
1002 | - /* MWM hints can add or remove decorations, update NET_FRAME_EXTENTS accordingly */ |
1003 | - setNetFrameExtents (display_info, |
1004 | - c->window, |
1005 | - frameTop (c), |
1006 | - frameLeft (c), |
1007 | - frameRight (c), |
1008 | - frameBottom (c)); |
1009 | - } |
1010 | -} |
1011 | - |
1012 | -void |
1013 | -clientGetWMNormalHints (Client *c, gboolean update) |
1014 | -{ |
1015 | - XWindowChanges wc; |
1016 | - unsigned long previous_value; |
1017 | - long dummy; |
1018 | - |
1019 | - g_return_if_fail (c != NULL); |
1020 | - g_return_if_fail (c->window != None); |
1021 | - |
1022 | - TRACE ("entering clientGetWMNormalHints client \"%s\" (0x%lx)", c->name, |
1023 | - c->window); |
1024 | - |
1025 | - if (!c->size) |
1026 | - { |
1027 | - c->size = XAllocSizeHints (); |
1028 | - } |
1029 | - g_assert (c->size); |
1030 | - |
1031 | - dummy = 0; |
1032 | - if (!XGetWMNormalHints (clientGetXDisplay (c), c->window, c->size, &dummy)) |
1033 | - { |
1034 | - c->size->flags = 0; |
1035 | - } |
1036 | - |
1037 | - /* Set/update gravity */ |
1038 | - c->gravity = c->size->flags & PWinGravity ? c->size->win_gravity : NorthWestGravity; |
1039 | - |
1040 | - previous_value = FLAG_TEST (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE); |
1041 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE); |
1042 | - |
1043 | - wc.x = c->x; |
1044 | - wc.y = c->y; |
1045 | - wc.width = c->width; |
1046 | - wc.height = c->height; |
1047 | - |
1048 | - if (!(c->size->flags & PMaxSize)) |
1049 | - { |
1050 | - c->size->max_width = G_MAXINT; |
1051 | - c->size->max_height = G_MAXINT; |
1052 | - c->size->flags |= PMaxSize; |
1053 | - } |
1054 | - |
1055 | - if (!(c->size->flags & PBaseSize)) |
1056 | - { |
1057 | - c->size->base_width = 0; |
1058 | - c->size->base_height = 0; |
1059 | - } |
1060 | - |
1061 | - if (!(c->size->flags & PMinSize)) |
1062 | - { |
1063 | - if ((c->size->flags & PBaseSize)) |
1064 | - { |
1065 | - c->size->min_width = c->size->base_width; |
1066 | - c->size->min_height = c->size->base_height; |
1067 | - } |
1068 | - else |
1069 | - { |
1070 | - c->size->min_width = 1; |
1071 | - c->size->min_height = 1; |
1072 | - } |
1073 | - c->size->flags |= PMinSize; |
1074 | - } |
1075 | - |
1076 | - if (c->size->flags & PResizeInc) |
1077 | - { |
1078 | - if (c->size->width_inc < 1) |
1079 | - { |
1080 | - c->size->width_inc = 1; |
1081 | - } |
1082 | - if (c->size->height_inc < 1) |
1083 | - { |
1084 | - c->size->height_inc = 1; |
1085 | - } |
1086 | - } |
1087 | - else |
1088 | - { |
1089 | - c->size->width_inc = 1; |
1090 | - c->size->height_inc = 1; |
1091 | - } |
1092 | - |
1093 | - if (c->size->flags & PAspect) |
1094 | - { |
1095 | - if (c->size->min_aspect.x < 1) |
1096 | - { |
1097 | - c->size->min_aspect.x = 1; |
1098 | - } |
1099 | - if (c->size->min_aspect.y < 1) |
1100 | - { |
1101 | - c->size->min_aspect.y = 1; |
1102 | - } |
1103 | - if (c->size->max_aspect.x < 1) |
1104 | - { |
1105 | - c->size->max_aspect.x = 1; |
1106 | - } |
1107 | - if (c->size->max_aspect.y < 1) |
1108 | - { |
1109 | - c->size->max_aspect.y = 1; |
1110 | - } |
1111 | - } |
1112 | - else |
1113 | - { |
1114 | - c->size->min_aspect.x = 1; |
1115 | - c->size->min_aspect.y = 1; |
1116 | - c->size->max_aspect.x = G_MAXINT; |
1117 | - c->size->max_aspect.y = G_MAXINT; |
1118 | - } |
1119 | - |
1120 | - if (c->size->min_width < 1) |
1121 | - { |
1122 | - c->size->min_width = 1; |
1123 | - } |
1124 | - if (c->size->min_height < 1) |
1125 | - { |
1126 | - c->size->min_height = 1; |
1127 | - } |
1128 | - if (c->size->max_width < 1) |
1129 | - { |
1130 | - c->size->max_width = 1; |
1131 | - } |
1132 | - if (c->size->max_height < 1) |
1133 | - { |
1134 | - c->size->max_height = 1; |
1135 | - } |
1136 | - if (wc.width > c->size->max_width) |
1137 | - { |
1138 | - wc.width = c->size->max_width; |
1139 | - } |
1140 | - if (wc.height > c->size->max_height) |
1141 | - { |
1142 | - wc.height = c->size->max_height; |
1143 | - } |
1144 | - if (wc.width < c->size->min_width) |
1145 | - { |
1146 | - wc.width = c->size->min_width; |
1147 | - } |
1148 | - if (wc.height < c->size->min_height) |
1149 | - { |
1150 | - wc.height = c->size->min_height; |
1151 | - } |
1152 | - |
1153 | - if ((c->size->min_width < c->size->max_width) || |
1154 | - (c->size->min_height < c->size->max_height)) |
1155 | - { |
1156 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE); |
1157 | - } |
1158 | - |
1159 | - if (update) |
1160 | - { |
1161 | - if ((c->width != wc.width) || (c->height != wc.height)) |
1162 | - { |
1163 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
1164 | - { |
1165 | - clientRemoveMaximizeFlag (c); |
1166 | - } |
1167 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_CONSTRAINED | CFG_FORCE_REDRAW); |
1168 | - } |
1169 | - else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE) != previous_value) |
1170 | - { |
1171 | - frameQueueDraw (c, FALSE); |
1172 | - } |
1173 | - } |
1174 | - else |
1175 | - { |
1176 | - c->width = wc.width; |
1177 | - c->height = wc.height; |
1178 | - } |
1179 | -} |
1180 | - |
1181 | -void |
1182 | -clientGetWMProtocols (Client *c) |
1183 | -{ |
1184 | - ScreenInfo *screen_info; |
1185 | - DisplayInfo *display_info; |
1186 | - unsigned int wm_protocols_flags; |
1187 | - |
1188 | - g_return_if_fail (c != NULL); |
1189 | - g_return_if_fail (c->window != None); |
1190 | - |
1191 | - TRACE ("entering clientGetWMProtocols client \"%s\" (0x%lx)", c->name, |
1192 | - c->window); |
1193 | - |
1194 | - screen_info = c->screen_info; |
1195 | - display_info = screen_info->display_info; |
1196 | - |
1197 | - wm_protocols_flags = getWMProtocols (display_info, c->window); |
1198 | - FLAG_SET (c->wm_flags, |
1199 | - (wm_protocols_flags & WM_PROTOCOLS_DELETE_WINDOW) ? |
1200 | - WM_FLAG_DELETE : 0); |
1201 | - FLAG_SET (c->wm_flags, |
1202 | - (wm_protocols_flags & WM_PROTOCOLS_TAKE_FOCUS) ? |
1203 | - WM_FLAG_TAKEFOCUS : 0); |
1204 | - /* KDE extension */ |
1205 | - FLAG_SET (c->wm_flags, |
1206 | - (wm_protocols_flags & WM_PROTOCOLS_CONTEXT_HELP) ? |
1207 | - WM_FLAG_CONTEXT_HELP : 0); |
1208 | - /* Ping */ |
1209 | - FLAG_SET (c->wm_flags, |
1210 | - (wm_protocols_flags & WM_PROTOCOLS_PING) ? |
1211 | - WM_FLAG_PING : 0); |
1212 | -} |
1213 | - |
1214 | -static void |
1215 | -clientFree (Client *c) |
1216 | -{ |
1217 | - g_return_if_fail (c != NULL); |
1218 | - |
1219 | - TRACE ("entering clientFree"); |
1220 | - TRACE ("freeing client \"%s\" (0x%lx)", c->name, c->window); |
1221 | - |
1222 | - clientClearFocus (c); |
1223 | - if (clientGetLastRaise (c->screen_info) == c) |
1224 | - { |
1225 | - clientClearLastRaise (c->screen_info); |
1226 | - } |
1227 | - if (clientGetDelayedFocus () == c) |
1228 | - { |
1229 | - clientClearDelayedFocus (); |
1230 | - } |
1231 | - if (c->blink_timeout_id) |
1232 | - { |
1233 | - g_source_remove (c->blink_timeout_id); |
1234 | - } |
1235 | - if (c->icon_timeout_id) |
1236 | - { |
1237 | - g_source_remove (c->icon_timeout_id); |
1238 | - } |
1239 | - if (c->frame_timeout_id) |
1240 | - { |
1241 | - g_source_remove (c->frame_timeout_id); |
1242 | - } |
1243 | - if (c->ping_timeout_id) |
1244 | - { |
1245 | - clientRemoveNetWMPing (c); |
1246 | - } |
1247 | - if (c->name) |
1248 | - { |
1249 | - g_free (c->name); |
1250 | - } |
1251 | - if (c->hostname) |
1252 | - { |
1253 | - g_free (c->hostname); |
1254 | - } |
1255 | -#ifdef HAVE_XSYNC |
1256 | - if (c->xsync_alarm != None) |
1257 | - { |
1258 | - clientDestroyXSyncAlarm (c); |
1259 | - } |
1260 | - if (c->xsync_timeout_id) |
1261 | - { |
1262 | - g_source_remove (c->xsync_timeout_id); |
1263 | - } |
1264 | -#endif /* HAVE_XSYNC */ |
1265 | -#ifdef HAVE_LIBSTARTUP_NOTIFICATION |
1266 | - if (c->startup_id) |
1267 | - { |
1268 | - g_free (c->startup_id); |
1269 | - } |
1270 | -#endif /* HAVE_LIBSTARTUP_NOTIFICATION */ |
1271 | - if (c->size) |
1272 | - { |
1273 | - XFree (c->size); |
1274 | - } |
1275 | - if (c->wmhints) |
1276 | - { |
1277 | - XFree (c->wmhints); |
1278 | - } |
1279 | - if ((c->ncmap > 0) && (c->cmap_windows)) |
1280 | - { |
1281 | - XFree (c->cmap_windows); |
1282 | - } |
1283 | - if (c->class.res_name) |
1284 | - { |
1285 | - XFree (c->class.res_name); |
1286 | - } |
1287 | - if (c->class.res_class) |
1288 | - { |
1289 | - XFree (c->class.res_class); |
1290 | - } |
1291 | - if (c->dialog_pid) |
1292 | - { |
1293 | - kill (c->dialog_pid, SIGKILL); |
1294 | - } |
1295 | - if (c->dialog_fd >= 0) |
1296 | - { |
1297 | - close (c->dialog_fd); |
1298 | - } |
1299 | - |
1300 | - g_free (c); |
1301 | -} |
1302 | - |
1303 | -static void |
1304 | -clientApplyInitialState (Client *c) |
1305 | -{ |
1306 | - g_return_if_fail (c != NULL); |
1307 | - |
1308 | - TRACE ("entering clientApplyInitialState"); |
1309 | - |
1310 | - /* We check that afterwards to make sure all states are now known */ |
1311 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
1312 | - { |
1313 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE)) |
1314 | - { |
1315 | - unsigned long mode = 0L; |
1316 | - |
1317 | - TRACE ("Applying client's initial state: maximized"); |
1318 | - mode = c->flags & CLIENT_FLAG_MAXIMIZED; |
1319 | - |
1320 | - /* Unset fullscreen mode so that clientToggleMaximized() really change the state */ |
1321 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED); |
1322 | - clientToggleMaximized (c, mode, FALSE); |
1323 | - } |
1324 | - } |
1325 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
1326 | - { |
1327 | - TRACE ("Applying client's initial state: fullscreen"); |
1328 | - clientUpdateFullscreenState (c); |
1329 | - } |
1330 | - if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_ABOVE, CLIENT_FLAG_BELOW)) |
1331 | - { |
1332 | - TRACE ("Applying client's initial state: above"); |
1333 | - clientUpdateLayerState (c); |
1334 | - } |
1335 | - if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_BELOW, CLIENT_FLAG_ABOVE)) |
1336 | - { |
1337 | - TRACE ("Applying client's initial state: below"); |
1338 | - clientUpdateLayerState (c); |
1339 | - } |
1340 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) && |
1341 | - FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK)) |
1342 | - { |
1343 | - TRACE ("Applying client's initial state: sticky"); |
1344 | - clientStick (c, TRUE); |
1345 | - } |
1346 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
1347 | - { |
1348 | - TRACE ("Applying client's initial state: shaded"); |
1349 | - clientShade (c); |
1350 | - } |
1351 | -} |
1352 | - |
1353 | -static gboolean |
1354 | -clientCheckShape (Client *c) |
1355 | -{ |
1356 | - ScreenInfo *screen_info; |
1357 | - DisplayInfo *display_info; |
1358 | - int xws, yws, xbs, ybs; |
1359 | - unsigned wws, hws, wbs, hbs; |
1360 | - int boundingShaped, clipShaped; |
1361 | - |
1362 | - g_return_val_if_fail (c != NULL, FALSE); |
1363 | - |
1364 | - screen_info = c->screen_info; |
1365 | - display_info = screen_info->display_info; |
1366 | - |
1367 | - if (display_info->have_shape) |
1368 | - { |
1369 | - XShapeQueryExtents (display_info->dpy, c->window, &boundingShaped, &xws, &yws, &wws, |
1370 | - &hws, &clipShaped, &xbs, &ybs, &wbs, &hbs); |
1371 | - return (boundingShaped != 0); |
1372 | - } |
1373 | - return FALSE; |
1374 | -} |
1375 | - |
1376 | -static void |
1377 | -clientUpdateIconPix (Client *c) |
1378 | -{ |
1379 | - ScreenInfo *screen_info; |
1380 | - DisplayInfo *display_info; |
1381 | - gint size; |
1382 | - GdkPixbuf *icon; |
1383 | - int i; |
1384 | - |
1385 | - g_return_if_fail (c != NULL); |
1386 | - g_return_if_fail (c->window != None); |
1387 | - |
1388 | - TRACE ("entering clientUpdateIconPix for \"%s\" (0x%lx)", c->name, c->window); |
1389 | - |
1390 | - screen_info = c->screen_info; |
1391 | - display_info = screen_info->display_info; |
1392 | - |
1393 | - for (i = 0; i < STATE_TOGGLED; i++) |
1394 | - { |
1395 | - xfwmPixmapFree (&c->appmenu[i]); |
1396 | - } |
1397 | - |
1398 | - if (xfwmPixmapNone(&screen_info->buttons[MENU_BUTTON][ACTIVE])) |
1399 | - { |
1400 | - /* The current theme has no menu button */ |
1401 | - return; |
1402 | - } |
1403 | - |
1404 | - for (i = 0; i < STATE_TOGGLED; i++) |
1405 | - { |
1406 | - if (!xfwmPixmapNone(&screen_info->buttons[MENU_BUTTON][i])) |
1407 | - { |
1408 | - xfwmPixmapDuplicate (&screen_info->buttons[MENU_BUTTON][i], &c->appmenu[i]); |
1409 | - } |
1410 | - } |
1411 | - size = MIN (screen_info->buttons[MENU_BUTTON][ACTIVE].width, |
1412 | - screen_info->buttons[MENU_BUTTON][ACTIVE].height); |
1413 | - |
1414 | - if (size > 1) |
1415 | - { |
1416 | - icon = getAppIcon (display_info, c->window, size, size); |
1417 | - |
1418 | - for (i = 0; i < STATE_TOGGLED; i++) |
1419 | - { |
1420 | - if (!xfwmPixmapNone(&c->appmenu[i])) |
1421 | - { |
1422 | - xfwmPixmapRenderGdkPixbuf (&c->appmenu[i], icon); |
1423 | - } |
1424 | - } |
1425 | - g_object_unref (icon); |
1426 | - } |
1427 | -} |
1428 | - |
1429 | -static gboolean |
1430 | -update_icon_idle_cb (gpointer data) |
1431 | -{ |
1432 | - Client *c; |
1433 | - |
1434 | - TRACE ("entering update_icon_idle_cb"); |
1435 | - |
1436 | - c = (Client *) data; |
1437 | - g_return_val_if_fail (c, FALSE); |
1438 | - |
1439 | - clientUpdateIconPix (c); |
1440 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
1441 | - { |
1442 | - frameQueueDraw (c, FALSE); |
1443 | - } |
1444 | - c->icon_timeout_id = 0; |
1445 | - |
1446 | - return (FALSE); |
1447 | -} |
1448 | - |
1449 | -void |
1450 | -clientUpdateIcon (Client *c) |
1451 | -{ |
1452 | - g_return_if_fail (c); |
1453 | - |
1454 | - TRACE ("entering clientUpdateIcon for \"%s\" (0x%lx)", c->name, c->window); |
1455 | - |
1456 | - if (c->icon_timeout_id == 0) |
1457 | - { |
1458 | - c->icon_timeout_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, |
1459 | - update_icon_idle_cb, c, NULL); |
1460 | - } |
1461 | -} |
1462 | - |
1463 | -void |
1464 | -clientSaveSizePos (Client *c) |
1465 | -{ |
1466 | - g_return_if_fail (c != NULL); |
1467 | - |
1468 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ)) |
1469 | - { |
1470 | - c->old_x = c->x; |
1471 | - c->old_width = c->width; |
1472 | - } |
1473 | - |
1474 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT)) |
1475 | - { |
1476 | - c->old_y = c->y; |
1477 | - c->old_height = c->height; |
1478 | - } |
1479 | -} |
1480 | - |
1481 | -Client * |
1482 | -clientFrame (DisplayInfo *display_info, Window w, gboolean recapture) |
1483 | -{ |
1484 | - ScreenInfo *screen_info; |
1485 | - XWindowAttributes attr; |
1486 | - XWindowChanges wc; |
1487 | - XSetWindowAttributes attributes; |
1488 | - Client *c = NULL; |
1489 | - gboolean shaped; |
1490 | - unsigned long valuemask; |
1491 | - long pid; |
1492 | - int i; |
1493 | - |
1494 | - g_return_val_if_fail (w != None, NULL); |
1495 | - g_return_val_if_fail (display_info != NULL, NULL); |
1496 | - |
1497 | - TRACE ("entering clientFrame"); |
1498 | - TRACE ("framing client (0x%lx)", w); |
1499 | - |
1500 | - gdk_error_trap_push (); |
1501 | - myDisplayGrabServer (display_info); |
1502 | - |
1503 | - if (!XGetWindowAttributes (display_info->dpy, w, &attr)) |
1504 | - { |
1505 | - g_warning ("Cannot get window attributes for window (0x%lx)", w); |
1506 | - myDisplayUngrabServer (display_info); |
1507 | - gdk_error_trap_pop (); |
1508 | - return NULL; |
1509 | - } |
1510 | - |
1511 | - screen_info = myDisplayGetScreenFromRoot (display_info, attr.root); |
1512 | - if (!screen_info) |
1513 | - { |
1514 | - g_warning ("Cannot determine screen info from window (0x%lx)", w); |
1515 | - myDisplayUngrabServer (display_info); |
1516 | - gdk_error_trap_pop (); |
1517 | - return NULL; |
1518 | - } |
1519 | - |
1520 | - if (w == screen_info->xfwm4_win) |
1521 | - { |
1522 | - TRACE ("Not managing our own event window"); |
1523 | - compositorAddWindow (display_info, w, NULL); |
1524 | - myDisplayUngrabServer (display_info); |
1525 | - gdk_error_trap_pop (); |
1526 | - return NULL; |
1527 | - } |
1528 | - |
1529 | -#ifdef ENABLE_KDE_SYSTRAY_PROXY |
1530 | - if (checkKdeSystrayWindow (display_info, w)) |
1531 | - { |
1532 | - TRACE ("Detected KDE systray windows"); |
1533 | - if (screen_info->systray != None) |
1534 | - { |
1535 | - sendSystrayReqDock (display_info, w, screen_info->systray); |
1536 | - myDisplayUngrabServer (display_info); |
1537 | - gdk_error_trap_pop (); |
1538 | - return NULL; |
1539 | - } |
1540 | - TRACE ("No systray found for this screen"); |
1541 | - } |
1542 | -#endif /* ENABLE_KDE_SYSTRAY_PROXY */ |
1543 | - |
1544 | - if (attr.override_redirect) |
1545 | - { |
1546 | - TRACE ("Override redirect window 0x%lx", w); |
1547 | - compositorAddWindow (display_info, w, NULL); |
1548 | - myDisplayUngrabServer (display_info); |
1549 | - gdk_error_trap_pop (); |
1550 | - return NULL; |
1551 | - } |
1552 | - |
1553 | - c = g_new0 (Client, 1); |
1554 | - if (!c) |
1555 | - { |
1556 | - TRACE ("Cannot allocate memory for the window structure"); |
1557 | - myDisplayUngrabServer (display_info); |
1558 | - gdk_error_trap_pop (); |
1559 | - return NULL; |
1560 | - } |
1561 | - |
1562 | - c->window = w; |
1563 | - c->screen_info = screen_info; |
1564 | - c->serial = screen_info->client_serial++; |
1565 | - |
1566 | - /* Termination dialog */ |
1567 | - c->dialog_pid = 0; |
1568 | - c->dialog_fd = -1; |
1569 | - |
1570 | - getWindowName (display_info, c->window, &c->name); |
1571 | - getWindowHostname (display_info, c->window, &c->hostname); |
1572 | - getTransientFor (display_info, screen_info->xroot, c->window, &c->transient_for); |
1573 | - XChangeSaveSet(display_info->dpy, c->window, SetModeInsert); |
1574 | - |
1575 | - /* Initialize structure */ |
1576 | - c->size = NULL; |
1577 | - c->flags = 0L; |
1578 | - c->wm_flags = 0L; |
1579 | - c->xfwm_flags = XFWM_FLAG_INITIAL_VALUES; |
1580 | - c->x = attr.x; |
1581 | - c->y = attr.y; |
1582 | - c->width = attr.width; |
1583 | - c->height = attr.height; |
1584 | - |
1585 | -#ifdef HAVE_LIBSTARTUP_NOTIFICATION |
1586 | - c->startup_id = NULL; |
1587 | -#endif /* HAVE_LIBSTARTUP_NOTIFICATION */ |
1588 | - |
1589 | -#ifdef HAVE_XSYNC |
1590 | - c->xsync_waiting = FALSE; |
1591 | - c->xsync_enabled = FALSE; |
1592 | - c->xsync_counter = None; |
1593 | - c->xsync_alarm = None; |
1594 | - c->xsync_timeout_id = 0; |
1595 | - if (display_info->have_xsync) |
1596 | - { |
1597 | - getXSyncCounter (display_info, c->window, &c->xsync_counter); |
1598 | - if ((c->xsync_counter) && clientCreateXSyncAlarm (c)) |
1599 | - { |
1600 | - c->xsync_enabled = TRUE; |
1601 | - } |
1602 | - } |
1603 | -#endif /* HAVE_XSYNC */ |
1604 | - |
1605 | - clientGetWMNormalHints (c, FALSE); |
1606 | - |
1607 | - c->size->x = c->x; |
1608 | - c->size->y = c->y; |
1609 | - c->size->width = c->width; |
1610 | - c->size->height = c->height; |
1611 | - c->previous_width = -1; |
1612 | - c->previous_height = -1; |
1613 | - c->border_width = attr.border_width; |
1614 | - c->cmap = attr.colormap; |
1615 | - |
1616 | - shaped = clientCheckShape(c); |
1617 | - if (shaped) |
1618 | - { |
1619 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER); |
1620 | - FLAG_SET (c->flags, CLIENT_FLAG_HAS_SHAPE); |
1621 | - } |
1622 | - |
1623 | - if (((c->size->flags & (PMinSize | PMaxSize)) != (PMinSize | PMaxSize)) |
1624 | - || (((c->size->flags & (PMinSize | PMaxSize)) == |
1625 | - (PMinSize | PMaxSize)) |
1626 | - && ((c->size->min_width < c->size->max_width) |
1627 | - || (c->size->min_height < c->size->max_height)))) |
1628 | - { |
1629 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE); |
1630 | - } |
1631 | - |
1632 | - for (i = 0; i < BUTTON_COUNT; i++) |
1633 | - { |
1634 | - c->button_status[i] = BUTTON_STATE_NORMAL; |
1635 | - } |
1636 | - |
1637 | - if (!XGetWMColormapWindows (display_info->dpy, c->window, &c->cmap_windows, &c->ncmap)) |
1638 | - { |
1639 | - c->ncmap = 0; |
1640 | - } |
1641 | - |
1642 | - c->fullscreen_monitors[0] = 0; |
1643 | - c->fullscreen_monitors[1] = 0; |
1644 | - c->fullscreen_monitors[2] = 0; |
1645 | - c->fullscreen_monitors[3] = 0; |
1646 | - |
1647 | - /* Opacity for compositing manager */ |
1648 | - c->opacity = NET_WM_OPAQUE; |
1649 | - getOpacity (display_info, c->window, &c->opacity); |
1650 | - c->opacity_applied = c->opacity; |
1651 | - c->opacity_flags = 0; |
1652 | - |
1653 | - /* Keep count of blinking iterations */ |
1654 | - c->blink_iterations = 0; |
1655 | - |
1656 | - if (getOpacityLock (display_info, c->window)) |
1657 | - { |
1658 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED); |
1659 | - } |
1660 | - |
1661 | - /* Timout for asynchronous icon update */ |
1662 | - c->icon_timeout_id = 0; |
1663 | - /* Timout for asynchronous frame update */ |
1664 | - c->frame_timeout_id = 0; |
1665 | - /* Timeout for blinking on urgency */ |
1666 | - c->blink_timeout_id = 0; |
1667 | - /* Ping timeout */ |
1668 | - c->ping_timeout_id = 0; |
1669 | - /* Ping timeout */ |
1670 | - c->ping_time = 0; |
1671 | - |
1672 | - c->class.res_name = NULL; |
1673 | - c->class.res_class = NULL; |
1674 | - XGetClassHint (display_info->dpy, w, &c->class); |
1675 | - c->wmhints = XGetWMHints (display_info->dpy, c->window); |
1676 | - c->group_leader = None; |
1677 | - if (c->wmhints) |
1678 | - { |
1679 | - if (c->wmhints->flags & WindowGroupHint) |
1680 | - { |
1681 | - c->group_leader = c->wmhints->window_group; |
1682 | - } |
1683 | - } |
1684 | - c->client_leader = getClientLeader (display_info, c->window); |
1685 | - |
1686 | - TRACE ("\"%s\" (0x%lx) initial map_state = %s", |
1687 | - c->name, c->window, |
1688 | - (attr.map_state == IsUnmapped) ? |
1689 | - "IsUnmapped" : |
1690 | - (attr.map_state == IsViewable) ? |
1691 | - "IsViewable" : |
1692 | - (attr.map_state == IsUnviewable) ? |
1693 | - "IsUnviewable" : |
1694 | - "(unknown)"); |
1695 | - if (attr.map_state != IsUnmapped) |
1696 | - { |
1697 | - /* Reparent will send us unmap/map events */ |
1698 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_MAP_PENDING); |
1699 | - } |
1700 | - c->ignore_unmap = 0; |
1701 | - c->type = UNSET; |
1702 | - c->type_atom = None; |
1703 | - |
1704 | - FLAG_SET (c->flags, START_ICONIC (c) ? CLIENT_FLAG_ICONIFIED : 0); |
1705 | - FLAG_SET (c->wm_flags, HINTS_ACCEPT_INPUT (c->wmhints) ? WM_FLAG_INPUT : 0); |
1706 | - |
1707 | - clientGetWMProtocols (c); |
1708 | - clientGetMWMHints (c, FALSE); |
1709 | - c->win_layer = WIN_LAYER_NORMAL; |
1710 | - c->fullscreen_old_layer = c->win_layer; |
1711 | - |
1712 | - /* net_wm_user_time standard */ |
1713 | - c->user_time = 0; |
1714 | - c->user_time_win = getNetWMUserTimeWindow(display_info, c->window); |
1715 | - clientAddUserTimeWin (c); |
1716 | - clientGetUserTime (c); |
1717 | - |
1718 | - /*client PID */ |
1719 | - getHint (display_info, c->window, NET_WM_PID, (long *) &pid); |
1720 | - c->pid = (GPid) pid; |
1721 | - TRACE ("Client \"%s\" (0x%lx) PID = %i", c->name, c->window, c->pid); |
1722 | - |
1723 | - /* Apply startup notification properties if available */ |
1724 | - sn_client_startup_properties (c); |
1725 | - |
1726 | - /* Reload from session */ |
1727 | - if (sessionMatchWinToSM (c)) |
1728 | - { |
1729 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_SESSION_MANAGED); |
1730 | - } |
1731 | - |
1732 | - /* Beware, order of calls is important here ! */ |
1733 | - clientGetNetState (c); |
1734 | - clientGetNetWmType (c); |
1735 | - clientGetInitialNetWmDesktop (c); |
1736 | - /* workarea will be updated when shown, no need to worry here */ |
1737 | - clientGetNetStruts (c); |
1738 | - |
1739 | - /* Once we know the type of window, we can initialize window position */ |
1740 | - if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SESSION_MANAGED)) |
1741 | - { |
1742 | - clientCoordGravitate (c, c->gravity, APPLY, &c->x, &c->y); |
1743 | - if ((attr.map_state == IsUnmapped)) |
1744 | - { |
1745 | - clientInitPosition (c); |
1746 | - } |
1747 | - } |
1748 | - |
1749 | - /* |
1750 | - Initialize "old" fields once the position is ensured, to avoid |
1751 | - initially maximized or fullscreen windows being placed offscreen |
1752 | - once de-maximized |
1753 | - */ |
1754 | - c->old_x = c->x; |
1755 | - c->old_y = c->y; |
1756 | - c->old_width = c->width; |
1757 | - c->old_height = c->height; |
1758 | - |
1759 | - c->fullscreen_old_x = c->x; |
1760 | - c->fullscreen_old_y = c->y; |
1761 | - c->fullscreen_old_width = c->width; |
1762 | - c->fullscreen_old_height = c->height; |
1763 | - |
1764 | - /* |
1765 | - We must call clientApplyInitialState() after having placed the |
1766 | - window so that the inital position values are correctly set if the |
1767 | - inital state is maximize or fullscreen |
1768 | - */ |
1769 | - clientApplyInitialState (c); |
1770 | - |
1771 | - valuemask = CWEventMask|CWBitGravity|CWWinGravity; |
1772 | - attributes.event_mask = (FRAME_EVENT_MASK | POINTER_EVENT_MASK); |
1773 | - attributes.win_gravity = StaticGravity; |
1774 | - attributes.bit_gravity = StaticGravity; |
1775 | - |
1776 | -#ifdef HAVE_RENDER |
1777 | - if ((attr.depth == 32) && (display_info->have_render)) |
1778 | - { |
1779 | - c->visual = attr.visual; |
1780 | - c->depth = attr.depth; |
1781 | - |
1782 | - attributes.colormap = attr.colormap; |
1783 | - attributes.background_pixmap = None; |
1784 | - attributes.border_pixel = 0; |
1785 | - attributes.background_pixel = 0; |
1786 | - |
1787 | - valuemask |= CWColormap|CWBackPixmap|CWBackPixel|CWBorderPixel; |
1788 | - } |
1789 | - else |
1790 | - { |
1791 | - /* Default depth/visual */ |
1792 | - c->visual = screen_info->visual; |
1793 | - c->depth = screen_info->depth; |
1794 | - } |
1795 | -#else /* HAVE_RENDER */ |
1796 | - /* We don't support multiple depth/visual w/out render */ |
1797 | - c->visual = screen_info->visual; |
1798 | - c->depth = screen_info->depth; |
1799 | -#endif /* HAVE_RENDER */ |
1800 | - |
1801 | - c->frame = |
1802 | - XCreateWindow (display_info->dpy, screen_info->xroot, 0, 0, 1, 1, 0, |
1803 | - c->depth, InputOutput, c->visual, valuemask, &attributes); |
1804 | - |
1805 | - XSelectInput (display_info->dpy, c->window, NoEventMask); |
1806 | - XSetWindowBorderWidth (display_info->dpy, c->window, 0); |
1807 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
1808 | - { |
1809 | - XUnmapWindow (display_info->dpy, c->window); |
1810 | - } |
1811 | - XReparentWindow (display_info->dpy, c->window, c->frame, frameLeft (c), frameTop (c)); |
1812 | - valuemask = CWEventMask; |
1813 | - attributes.event_mask = (CLIENT_EVENT_MASK); |
1814 | - XChangeWindowAttributes (display_info->dpy, c->window, valuemask, &attributes); |
1815 | - if (display_info->have_shape) |
1816 | - { |
1817 | - XShapeSelectInput (display_info->dpy, c->window, ShapeNotifyMask); |
1818 | - } |
1819 | - |
1820 | - clientAddToList (c); |
1821 | - clientGrabButtons(c); |
1822 | - |
1823 | - /* Initialize per client menu button pixmap */ |
1824 | - |
1825 | - for (i = 0; i < STATE_TOGGLED; i++) |
1826 | - { |
1827 | - xfwmPixmapInit (screen_info, &c->appmenu[i]); |
1828 | - } |
1829 | - |
1830 | - for (i = 0; i < SIDE_TOP; i++) /* Keep SIDE_TOP for later */ |
1831 | - { |
1832 | - xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame, |
1833 | - &c->sides[i], NoEventMask, |
1834 | - myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + i)); |
1835 | - } |
1836 | - |
1837 | - for (i = 0; i < CORNER_COUNT; i++) |
1838 | - { |
1839 | - xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame, |
1840 | - &c->corners[i], NoEventMask, |
1841 | - myDisplayGetCursorResize(screen_info->display_info, i)); |
1842 | - } |
1843 | - |
1844 | - xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame, |
1845 | - &c->title, NoEventMask, None); |
1846 | - |
1847 | - /*create the top side window AFTER the title window since they overlap |
1848 | - and the top side window should be on top */ |
1849 | - |
1850 | - xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame, |
1851 | - &c->sides[SIDE_TOP], NoEventMask, |
1852 | - myDisplayGetCursorResize(screen_info->display_info, |
1853 | - CORNER_COUNT + SIDE_TOP)); |
1854 | - |
1855 | - for (i = 0; i < BUTTON_COUNT; i++) |
1856 | - { |
1857 | - xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame, |
1858 | - &c->buttons[i], BUTTON_EVENT_MASK, None); |
1859 | - } |
1860 | - clientUpdateIconPix (c); |
1861 | - |
1862 | - /* Put the window on top to avoid XShape, that speeds up hw accelerated |
1863 | - GL apps dramatically */ |
1864 | - XRaiseWindow (display_info->dpy, c->window); |
1865 | - |
1866 | - TRACE ("now calling configure for the new window \"%s\" (0x%lx)", c->name, c->window); |
1867 | - wc.x = c->x; |
1868 | - wc.y = c->y; |
1869 | - wc.width = c->width; |
1870 | - wc.height = c->height; |
1871 | - clientConfigure (c, &wc, CWX | CWY | CWHeight | CWWidth, CFG_NOTIFY | CFG_FORCE_REDRAW); |
1872 | - |
1873 | - /* Notify the compositor about this new window */ |
1874 | - compositorAddWindow (display_info, c->frame, c); |
1875 | - |
1876 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED)) |
1877 | - { |
1878 | - if ((c->win_workspace == screen_info->current_ws) || |
1879 | - FLAG_TEST(c->flags, CLIENT_FLAG_STICKY)) |
1880 | - { |
1881 | - if (recapture) |
1882 | - { |
1883 | - clientRaise (c, None); |
1884 | - clientShow (c, TRUE); |
1885 | - clientSortRing(c); |
1886 | - } |
1887 | - else |
1888 | - { |
1889 | - clientFocusNew(c); |
1890 | - } |
1891 | - } |
1892 | - else |
1893 | - { |
1894 | - clientRaise (c, None); |
1895 | - clientInitFocusFlag (c); |
1896 | - clientSetNetActions (c); |
1897 | - } |
1898 | - } |
1899 | - else |
1900 | - { |
1901 | - clientRaise (c, None); |
1902 | - setWMState (display_info, c->window, IconicState); |
1903 | - clientSetNetActions (c); |
1904 | - } |
1905 | - clientUpdateOpacity (c); |
1906 | - clientGrabMouseButton (c); |
1907 | - setNetFrameExtents (display_info, c->window, frameTop (c), frameLeft (c), |
1908 | - frameRight (c), frameBottom (c)); |
1909 | - clientSetNetState (c); |
1910 | - |
1911 | - /* Window is reparented now, so we can safely release the grab |
1912 | - * on the server |
1913 | - */ |
1914 | - myDisplayUngrabServer (display_info); |
1915 | - gdk_error_trap_pop (); |
1916 | - |
1917 | - DBG ("client \"%s\" (0x%lx) is now managed", c->name, c->window); |
1918 | - DBG ("client_count=%d", screen_info->client_count); |
1919 | - |
1920 | - return c; |
1921 | -} |
1922 | - |
1923 | -void |
1924 | -clientUnframe (Client *c, gboolean remap) |
1925 | -{ |
1926 | - ScreenInfo *screen_info; |
1927 | - DisplayInfo *display_info; |
1928 | - XEvent ev; |
1929 | - int i; |
1930 | - gboolean reparented; |
1931 | - |
1932 | - TRACE ("entering clientUnframe"); |
1933 | - TRACE ("unframing client \"%s\" (0x%lx) [%s]", |
1934 | - c->name, c->window, remap ? "remap" : "no remap"); |
1935 | - |
1936 | - g_return_if_fail (c != NULL); |
1937 | - |
1938 | - screen_info = c->screen_info; |
1939 | - display_info = screen_info->display_info; |
1940 | - |
1941 | - clientRemoveFromList (c); |
1942 | - compositorSetClient (display_info, c->frame, NULL); |
1943 | - |
1944 | - myDisplayGrabServer (display_info); |
1945 | - gdk_error_trap_push (); |
1946 | - clientRemoveUserTimeWin (c); |
1947 | - clientUngrabButtons (c); |
1948 | - XUnmapWindow (display_info->dpy, c->frame); |
1949 | - clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y); |
1950 | - XSelectInput (display_info->dpy, c->window, NoEventMask); |
1951 | - XChangeSaveSet(display_info->dpy, c->window, SetModeDelete); |
1952 | - |
1953 | - reparented = XCheckTypedWindowEvent (display_info->dpy, c->window, ReparentNotify, &ev); |
1954 | - |
1955 | - if (remap || !reparented) |
1956 | - { |
1957 | - XReparentWindow (display_info->dpy, c->window, c->screen_info->xroot, c->x, c->y); |
1958 | - XSetWindowBorderWidth (display_info->dpy, c->window, c->border_width); |
1959 | - if (remap) |
1960 | - { |
1961 | - compositorAddWindow (display_info, c->window, NULL); |
1962 | - XMapWindow (display_info->dpy, c->window); |
1963 | - } |
1964 | - else |
1965 | - { |
1966 | - XUnmapWindow (display_info->dpy, c->window); |
1967 | - setWMState (display_info, c->window, WithdrawnState); |
1968 | - } |
1969 | - } |
1970 | - |
1971 | - if (!remap) |
1972 | - { |
1973 | - XDeleteProperty (display_info->dpy, c->window, |
1974 | - display_info->atoms[NET_WM_STATE]); |
1975 | - XDeleteProperty (display_info->dpy, c->window, |
1976 | - display_info->atoms[NET_WM_DESKTOP]); |
1977 | - XDeleteProperty (display_info->dpy, c->window, |
1978 | - display_info->atoms[NET_WM_ALLOWED_ACTIONS]); |
1979 | - } |
1980 | - |
1981 | - xfwmWindowDelete (&c->title); |
1982 | - |
1983 | - for (i = 0; i < SIDE_COUNT; i++) |
1984 | - { |
1985 | - xfwmWindowDelete (&c->sides[i]); |
1986 | - } |
1987 | - for (i = 0; i < CORNER_COUNT; i++) |
1988 | - { |
1989 | - xfwmWindowDelete (&c->corners[i]); |
1990 | - } |
1991 | - for (i = 0; i < STATE_TOGGLED; i++) |
1992 | - { |
1993 | - xfwmPixmapFree (&c->appmenu[i]); |
1994 | - } |
1995 | - for (i = 0; i < BUTTON_COUNT; i++) |
1996 | - { |
1997 | - xfwmWindowDelete (&c->buttons[i]); |
1998 | - } |
1999 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT)) |
2000 | - { |
2001 | - workspaceUpdateArea (c->screen_info); |
2002 | - } |
2003 | - XDestroyWindow (display_info->dpy, c->frame); |
2004 | - |
2005 | - myDisplayUngrabServer (display_info); |
2006 | - gdk_error_trap_pop (); |
2007 | - clientFree (c); |
2008 | -} |
2009 | - |
2010 | -void |
2011 | -clientFrameAll (ScreenInfo *screen_info) |
2012 | -{ |
2013 | - DisplayInfo *display_info; |
2014 | - XWindowAttributes attr; |
2015 | - xfwmWindow shield; |
2016 | - Window w1, w2, *wins; |
2017 | - unsigned int count, i; |
2018 | - |
2019 | - TRACE ("entering clientFrameAll"); |
2020 | - |
2021 | - display_info = screen_info->display_info; |
2022 | - clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG); |
2023 | - xfwmWindowTemp (screen_info, |
2024 | - NULL, 0, |
2025 | - screen_info->xroot, |
2026 | - &shield, |
2027 | - 0, 0, |
2028 | - screen_info->width, |
2029 | - screen_info->height, |
2030 | - EnterWindowMask, |
2031 | - FALSE); |
2032 | - |
2033 | - XSync (display_info->dpy, FALSE); |
2034 | - myDisplayGrabServer (display_info); |
2035 | - XQueryTree (display_info->dpy, screen_info->xroot, &w1, &w2, &wins, &count); |
2036 | - for (i = 0; i < count; i++) |
2037 | - { |
2038 | - XGetWindowAttributes (display_info->dpy, wins[i], &attr); |
2039 | - if ((attr.map_state == IsViewable) && (attr.root == screen_info->xroot)) |
2040 | - { |
2041 | - Client *c = clientFrame (display_info, wins[i], TRUE); |
2042 | - if ((c) && ((screen_info->params->raise_on_click) || (screen_info->params->click_to_focus))) |
2043 | - { |
2044 | - clientGrabMouseButton (c); |
2045 | - } |
2046 | - } |
2047 | - else |
2048 | - { |
2049 | - compositorAddWindow (display_info, wins[i], NULL); |
2050 | - } |
2051 | - } |
2052 | - if (wins) |
2053 | - { |
2054 | - XFree (wins); |
2055 | - } |
2056 | - clientFocusTop (screen_info, WIN_LAYER_FULLSCREEN, myDisplayGetCurrentTime (display_info)); |
2057 | - xfwmWindowDelete (&shield); |
2058 | - myDisplayUngrabServer (display_info); |
2059 | - XSync (display_info->dpy, FALSE); |
2060 | -} |
2061 | - |
2062 | -void |
2063 | -clientUnframeAll (ScreenInfo *screen_info) |
2064 | -{ |
2065 | - DisplayInfo *display_info; |
2066 | - Client *c; |
2067 | - Window w1, w2, *wins; |
2068 | - unsigned int count, i; |
2069 | - |
2070 | - TRACE ("entering clientUnframeAll"); |
2071 | - |
2072 | - display_info = screen_info->display_info; |
2073 | - clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), FOCUS_IGNORE_MODAL); |
2074 | - XSync (display_info->dpy, FALSE); |
2075 | - myDisplayGrabServer (display_info); |
2076 | - XQueryTree (display_info->dpy, screen_info->xroot, &w1, &w2, &wins, &count); |
2077 | - for (i = 0; i < count; i++) |
2078 | - { |
2079 | - c = myScreenGetClientFromWindow (screen_info, wins[i], SEARCH_FRAME); |
2080 | - if (c) |
2081 | - { |
2082 | - clientUnframe (c, TRUE); |
2083 | - } |
2084 | - } |
2085 | - myDisplayUngrabServer (display_info); |
2086 | - XSync(display_info->dpy, FALSE); |
2087 | - if (wins) |
2088 | - { |
2089 | - XFree (wins); |
2090 | - } |
2091 | -} |
2092 | - |
2093 | -Client * |
2094 | -clientGetFromWindow (Client *c, Window w, unsigned short mode) |
2095 | -{ |
2096 | - int b; |
2097 | - |
2098 | - g_return_val_if_fail (w != None, NULL); |
2099 | - g_return_val_if_fail (c != NULL, NULL); |
2100 | - TRACE ("entering clientGetFromWindow"); |
2101 | - |
2102 | - if (mode & SEARCH_WINDOW) |
2103 | - { |
2104 | - if (c->window == w) |
2105 | - { |
2106 | - TRACE ("found \"%s\" (mode WINDOW)", c->name); |
2107 | - return (c); |
2108 | - } |
2109 | - } |
2110 | - |
2111 | - if (mode & SEARCH_FRAME) |
2112 | - { |
2113 | - if (c->frame == w) |
2114 | - { |
2115 | - TRACE ("found \"%s\" (mode FRAME)", c->name); |
2116 | - return (c); |
2117 | - } |
2118 | - } |
2119 | - |
2120 | - if (mode & SEARCH_WIN_USER_TIME) |
2121 | - { |
2122 | - if (c->user_time_win == w) |
2123 | - { |
2124 | - TRACE ("found \"%s\" (mode WIN_USER_TIME)", c->name); |
2125 | - return (c); |
2126 | - } |
2127 | - } |
2128 | - |
2129 | - if (mode & SEARCH_BUTTON) |
2130 | - { |
2131 | - for (b = 0; b < BUTTON_COUNT; b++) |
2132 | - { |
2133 | - if (MYWINDOW_XWINDOW(c->buttons[b]) == w) |
2134 | - { |
2135 | - TRACE ("found \"%s\" (mode BUTTON)", c->name); |
2136 | - return (c); |
2137 | - } |
2138 | - } |
2139 | - } |
2140 | - |
2141 | - TRACE ("no client found"); |
2142 | - |
2143 | - return NULL; |
2144 | -} |
2145 | - |
2146 | -static void |
2147 | -clientSetWorkspaceSingle (Client *c, guint ws) |
2148 | -{ |
2149 | - ScreenInfo *screen_info; |
2150 | - DisplayInfo *display_info; |
2151 | - |
2152 | - g_return_if_fail (c != NULL); |
2153 | - |
2154 | - TRACE ("entering clientSetWorkspaceSingle"); |
2155 | - |
2156 | - screen_info = c->screen_info; |
2157 | - display_info = screen_info->display_info; |
2158 | - |
2159 | - if (ws > screen_info->workspace_count - 1) |
2160 | - { |
2161 | - ws = screen_info->workspace_count - 1; |
2162 | - TRACE ("value off limits, using %i instead", ws); |
2163 | - } |
2164 | - |
2165 | - if (c->win_workspace != ws) |
2166 | - { |
2167 | - TRACE ("setting client \"%s\" (0x%lx) to current_ws %d", c->name, c->window, ws); |
2168 | - c->win_workspace = ws; |
2169 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)) |
2170 | - { |
2171 | - setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES); |
2172 | - } |
2173 | - else |
2174 | - { |
2175 | - setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ws); |
2176 | - } |
2177 | - } |
2178 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_WORKSPACE_SET); |
2179 | -} |
2180 | - |
2181 | -void |
2182 | -clientSetWorkspace (Client *c, guint ws, gboolean manage_mapping) |
2183 | -{ |
2184 | - Client *c2; |
2185 | - GList *list_of_windows; |
2186 | - GList *list; |
2187 | - guint previous_ws; |
2188 | - |
2189 | - g_return_if_fail (c != NULL); |
2190 | - |
2191 | - TRACE ("entering clientSetWorkspace"); |
2192 | - |
2193 | - if (ws > c->screen_info->workspace_count - 1) |
2194 | - { |
2195 | - g_warning ("Requested workspace %d does not exist", ws); |
2196 | - return; |
2197 | - } |
2198 | - |
2199 | - list_of_windows = clientListTransientOrModal (c); |
2200 | - for (list = list_of_windows; list; list = g_list_next (list)) |
2201 | - { |
2202 | - c2 = (Client *) list->data; |
2203 | - |
2204 | - if (c2->win_workspace != ws) |
2205 | - { |
2206 | - TRACE ("setting client \"%s\" (0x%lx) to current_ws %d", c->name, c->window, ws); |
2207 | - |
2208 | - previous_ws = c2->win_workspace; |
2209 | - clientSetWorkspaceSingle (c2, ws); |
2210 | - |
2211 | - if (manage_mapping && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED)) |
2212 | - { |
2213 | - if (previous_ws == c2->screen_info->current_ws) |
2214 | - { |
2215 | - clientWithdraw (c2, c2->screen_info->current_ws, FALSE); |
2216 | - } |
2217 | - if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY) || (ws == c2->screen_info->current_ws)) |
2218 | - { |
2219 | - clientShow (c2, FALSE); |
2220 | - } |
2221 | - } |
2222 | - } |
2223 | - } |
2224 | - g_list_free (list_of_windows); |
2225 | -} |
2226 | - |
2227 | -static void |
2228 | -clientShowSingle (Client *c, gboolean deiconify) |
2229 | -{ |
2230 | - ScreenInfo *screen_info; |
2231 | - DisplayInfo *display_info; |
2232 | - |
2233 | - g_return_if_fail (c != NULL); |
2234 | - |
2235 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
2236 | - { |
2237 | - /* Should we map the window if it is visible? */ |
2238 | - return; |
2239 | - } |
2240 | - |
2241 | - screen_info = c->screen_info; |
2242 | - display_info = screen_info->display_info; |
2243 | - |
2244 | - if ((c->win_workspace == screen_info->current_ws) || FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)) |
2245 | - { |
2246 | - TRACE ("showing client \"%s\" (0x%lx)", c->name, c->window); |
2247 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_VISIBLE); |
2248 | - XMapWindow (display_info->dpy, c->frame); |
2249 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
2250 | - { |
2251 | - XMapWindow (display_info->dpy, c->window); |
2252 | - } |
2253 | - /* Adjust to urgency state as the window is visible */ |
2254 | - clientUpdateUrgency (c); |
2255 | - } |
2256 | - if (deiconify) |
2257 | - { |
2258 | - FLAG_UNSET (c->flags, CLIENT_FLAG_ICONIFIED); |
2259 | - setWMState (display_info, c->window, NormalState); |
2260 | - } |
2261 | - clientSetNetActions (c); |
2262 | - clientSetNetState (c); |
2263 | -} |
2264 | - |
2265 | -void |
2266 | -clientShow (Client *c, gboolean deiconify) |
2267 | -{ |
2268 | - Client *c2; |
2269 | - GList *list_of_windows; |
2270 | - GList *list; |
2271 | - |
2272 | - g_return_if_fail (c != NULL); |
2273 | - TRACE ("entering clientShow \"%s\" (0x%lx)", c->name, c->window); |
2274 | - |
2275 | - list_of_windows = clientListTransientOrModal (c); |
2276 | - for (list = g_list_last (list_of_windows); list; list = g_list_previous (list)) |
2277 | - { |
2278 | - c2 = (Client *) list->data; |
2279 | - clientSetWorkspaceSingle (c2, c->win_workspace); |
2280 | - /* Ignore request before if the window is not yet managed */ |
2281 | - if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED)) |
2282 | - { |
2283 | - continue; |
2284 | - } |
2285 | - clientShowSingle (c2, deiconify); |
2286 | - } |
2287 | - g_list_free (list_of_windows); |
2288 | - |
2289 | - /* Update working area as windows have been shown */ |
2290 | - workspaceUpdateArea (c->screen_info); |
2291 | -} |
2292 | - |
2293 | -static void |
2294 | -clientWithdrawSingle (Client *c, GList *exclude_list, gboolean iconify) |
2295 | -{ |
2296 | - ScreenInfo *screen_info; |
2297 | - DisplayInfo *display_info; |
2298 | - |
2299 | - g_return_if_fail (c != NULL); |
2300 | - |
2301 | - screen_info = c->screen_info; |
2302 | - display_info = screen_info->display_info; |
2303 | - |
2304 | - TRACE ("hiding client \"%s\" (0x%lx)", c->name, c->window); |
2305 | - clientPassFocus(c->screen_info, c, exclude_list); |
2306 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
2307 | - { |
2308 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_VISIBLE); |
2309 | - c->ignore_unmap++; |
2310 | - /* Adjust to urgency state as the window is not visible */ |
2311 | - clientUpdateUrgency (c); |
2312 | - } |
2313 | - XUnmapWindow (display_info->dpy, c->window); |
2314 | - XUnmapWindow (display_info->dpy, c->frame); |
2315 | - if (iconify) |
2316 | - { |
2317 | - FLAG_SET (c->flags, CLIENT_FLAG_ICONIFIED); |
2318 | - setWMState (display_info, c->window, IconicState); |
2319 | - if (!screen_info->show_desktop) |
2320 | - { |
2321 | - clientSetLast (c); |
2322 | - } |
2323 | - } |
2324 | - clientSetNetActions (c); |
2325 | - clientSetNetState (c); |
2326 | -} |
2327 | - |
2328 | -void |
2329 | -clientWithdraw (Client *c, guint ws, gboolean iconify) |
2330 | -{ |
2331 | - Client *c2; |
2332 | - GList *list_of_windows; |
2333 | - GList *list; |
2334 | - |
2335 | - g_return_if_fail (c != NULL); |
2336 | - TRACE ("entering clientWithdraw \"%s\" (0x%lx)", c->name, c->window); |
2337 | - |
2338 | - list_of_windows = clientListTransientOrModal (c); |
2339 | - for (list = list_of_windows; list; list = g_list_next (list)) |
2340 | - { |
2341 | - c2 = (Client *) list->data; |
2342 | - |
2343 | - /* Ignore request before if the window is not yet managed */ |
2344 | - if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED)) |
2345 | - { |
2346 | - continue; |
2347 | - } |
2348 | - |
2349 | - if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY) && !iconify) |
2350 | - { |
2351 | - continue; |
2352 | - } |
2353 | - |
2354 | - if (clientIsTransientOrModalForGroup (c2)) |
2355 | - { |
2356 | - |
2357 | - if (clientTransientOrModalHasAncestor (c2, c2->win_workspace)) |
2358 | - { |
2359 | - /* Other ancestors for that transient for group are still |
2360 | - * visible on current workspace, so don't hide it... |
2361 | - */ |
2362 | - continue; |
2363 | - } |
2364 | - if ((ws != c2->win_workspace) && |
2365 | - clientTransientOrModalHasAncestor (c2, ws)) |
2366 | - { |
2367 | - /* ws is used when transitioning between desktops, to avoid |
2368 | - hiding a transient for group that will be shown again on the new |
2369 | - workspace (transient for groups can be transients for multiple |
2370 | - ancesors splitted across workspaces...) |
2371 | - */ |
2372 | - continue; |
2373 | - } |
2374 | - } |
2375 | - clientWithdrawSingle (c2, list_of_windows, iconify); |
2376 | - } |
2377 | - g_list_free (list_of_windows); |
2378 | - |
2379 | - /* Update working area as windows have been hidden */ |
2380 | - workspaceUpdateArea (c->screen_info); |
2381 | -} |
2382 | - |
2383 | -void |
2384 | -clientWithdrawAll (Client *c, guint ws) |
2385 | -{ |
2386 | - GList *list; |
2387 | - Client *c2; |
2388 | - ScreenInfo *screen_info; |
2389 | - |
2390 | - g_return_if_fail (c != NULL); |
2391 | - |
2392 | - TRACE ("entering clientWithdrawAll"); |
2393 | - |
2394 | - screen_info = c->screen_info; |
2395 | - for (list = screen_info->windows_stack; list; list = g_list_next (list)) |
2396 | - { |
2397 | - c2 = (Client *) list->data; |
2398 | - |
2399 | - if ((c2 != c) |
2400 | - && CLIENT_CAN_HIDE_WINDOW (c2) |
2401 | - && !clientIsTransientOrModal (c2)) |
2402 | - { |
2403 | - if (((!c) && (c2->win_workspace == ws)) |
2404 | - || ((c) && !clientIsTransientOrModalFor (c, c2) |
2405 | - && (c2->win_workspace == c->win_workspace))) |
2406 | - { |
2407 | - clientWithdraw (c2, ws, TRUE); |
2408 | - } |
2409 | - } |
2410 | - } |
2411 | -} |
2412 | - |
2413 | -void |
2414 | -clientClearAllShowDesktop (ScreenInfo *screen_info) |
2415 | -{ |
2416 | - GList *list; |
2417 | - |
2418 | - TRACE ("entering clientClearShowDesktop"); |
2419 | - |
2420 | - if (screen_info->show_desktop) |
2421 | - { |
2422 | - for (list = screen_info->windows_stack; list; list = g_list_next (list)) |
2423 | - { |
2424 | - Client *c = (Client *) list->data; |
2425 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN); |
2426 | - } |
2427 | - screen_info->show_desktop = FALSE; |
2428 | - sendRootMessage (screen_info, NET_SHOWING_DESKTOP, screen_info->show_desktop, |
2429 | - myDisplayGetCurrentTime (screen_info->display_info)); |
2430 | - } |
2431 | -} |
2432 | - |
2433 | -void |
2434 | -clientToggleShowDesktop (ScreenInfo *screen_info) |
2435 | -{ |
2436 | - GList *list; |
2437 | - |
2438 | - TRACE ("entering clientToggleShowDesktop"); |
2439 | - |
2440 | - clientSetFocus (screen_info, NULL, |
2441 | - myDisplayGetCurrentTime (screen_info->display_info), |
2442 | - FOCUS_IGNORE_MODAL); |
2443 | - if (screen_info->show_desktop) |
2444 | - { |
2445 | - for (list = screen_info->windows_stack; list; list = g_list_next (list)) |
2446 | - { |
2447 | - Client *c = (Client *) list->data; |
2448 | - if ((c->type & WINDOW_REGULAR_FOCUSABLE) |
2449 | - && !FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED | CLIENT_FLAG_SKIP_TASKBAR)) |
2450 | - { |
2451 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN); |
2452 | - clientWithdraw (c, c->win_workspace, TRUE); |
2453 | - } |
2454 | - } |
2455 | - clientFocusTop (screen_info, WIN_LAYER_DESKTOP, myDisplayGetCurrentTime (screen_info->display_info)); |
2456 | - } |
2457 | - else |
2458 | - { |
2459 | - for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list)) |
2460 | - { |
2461 | - Client *c = (Client *) list->data; |
2462 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN)) |
2463 | - { |
2464 | - clientShow (c, TRUE); |
2465 | - } |
2466 | - FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN); |
2467 | - } |
2468 | - clientFocusTop (screen_info, WIN_LAYER_FULLSCREEN, myDisplayGetCurrentTime (screen_info->display_info)); |
2469 | - } |
2470 | -} |
2471 | - |
2472 | -void |
2473 | -clientActivate (Client *c, guint32 timestamp, gboolean source_is_application) |
2474 | -{ |
2475 | - ScreenInfo *screen_info; |
2476 | - Client *focused; |
2477 | - Client *sibling; |
2478 | - |
2479 | - g_return_if_fail (c != NULL); |
2480 | - TRACE ("entering clientActivate \"%s\" (0x%lx)", c->name, c->window); |
2481 | - |
2482 | - screen_info = c->screen_info; |
2483 | - sibling = clientGetTransientFor(c); |
2484 | - focused = clientGetFocus (); |
2485 | - |
2486 | - if ((screen_info->current_ws == c->win_workspace) || (screen_info->params->activate_action != ACTIVATE_ACTION_NONE)) |
2487 | - { |
2488 | - if ((focused) && (c != focused)) |
2489 | - { |
2490 | - /* We might be able to avoid this if we are about to switch workspace */ |
2491 | - clientAdjustFullscreenLayer (focused, FALSE); |
2492 | - } |
2493 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN)) |
2494 | - { |
2495 | - /* We are explicitely activating a window that was shown before show-desktop */ |
2496 | - clientClearAllShowDesktop (screen_info); |
2497 | - } |
2498 | - if (screen_info->current_ws != c->win_workspace) |
2499 | - { |
2500 | - if (screen_info->params->activate_action == ACTIVATE_ACTION_BRING) |
2501 | - { |
2502 | - clientSetWorkspace (c, screen_info->current_ws, TRUE); |
2503 | - } |
2504 | - else |
2505 | - { |
2506 | - workspaceSwitch (screen_info, c->win_workspace, NULL, FALSE, timestamp); |
2507 | - } |
2508 | - } |
2509 | - clientRaise (sibling, None); |
2510 | - clientShow (sibling, TRUE); |
2511 | - if (source_is_application || screen_info->params->click_to_focus || (c->type & WINDOW_TYPE_DONT_FOCUS)) |
2512 | - { |
2513 | - /* |
2514 | - It's a bit tricky here, we want to honor the activate request only if: |
2515 | - |
2516 | - - The window use the _NET_ACTIVE_WINDOW protocol and identify itself as an application, |
2517 | - - Or we use the click to focus model, in that case we focus the raised window anyway, |
2518 | - - Or the request comes from an application that we would not focus by default, |
2519 | - such as panels for example |
2520 | - */ |
2521 | - clientSetFocus (screen_info, c, timestamp, NO_FOCUS_FLAG); |
2522 | - } |
2523 | - clientSetLastRaise (c); |
2524 | - } |
2525 | - else |
2526 | - { |
2527 | - TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window); |
2528 | - FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION); |
2529 | - clientSetNetState (c); |
2530 | - } |
2531 | -} |
2532 | - |
2533 | -void |
2534 | -clientClose (Client *c) |
2535 | -{ |
2536 | - ScreenInfo *screen_info; |
2537 | - DisplayInfo *display_info; |
2538 | - guint32 timestamp; |
2539 | - |
2540 | - g_return_if_fail (c != NULL); |
2541 | - |
2542 | - TRACE ("entering clientClose"); |
2543 | - TRACE ("closing client \"%s\" (0x%lx)", c->name, c->window); |
2544 | - |
2545 | - screen_info = c->screen_info; |
2546 | - display_info = screen_info->display_info; |
2547 | - timestamp = myDisplayGetCurrentTime (display_info); |
2548 | - timestamp = myDisplayGetTime (display_info, timestamp); |
2549 | - |
2550 | - if (FLAG_TEST (c->wm_flags, WM_FLAG_DELETE)) |
2551 | - { |
2552 | - sendClientMessage (screen_info, c->window, WM_DELETE_WINDOW, timestamp); |
2553 | - } |
2554 | - else |
2555 | - { |
2556 | - clientKill (c); |
2557 | - } |
2558 | - if (FLAG_TEST (c->wm_flags, WM_FLAG_PING)) |
2559 | - { |
2560 | - clientSendNetWMPing (c, timestamp); |
2561 | - } |
2562 | -} |
2563 | - |
2564 | -void |
2565 | -clientKill (Client *c) |
2566 | -{ |
2567 | - g_return_if_fail (c != NULL); |
2568 | - TRACE ("entering clientKill"); |
2569 | - TRACE ("killing client \"%s\" (0x%lx)", c->name, c->window); |
2570 | - |
2571 | - XKillClient (clientGetXDisplay (c), c->window); |
2572 | -} |
2573 | - |
2574 | -void |
2575 | -clientTerminate (Client *c) |
2576 | -{ |
2577 | - ScreenInfo *screen_info; |
2578 | - DisplayInfo *display_info; |
2579 | - |
2580 | - g_return_if_fail (c != NULL); |
2581 | - TRACE ("entering clientTerminate"); |
2582 | - |
2583 | - screen_info = c->screen_info; |
2584 | - display_info = screen_info->display_info; |
2585 | - |
2586 | - if ((c->hostname) && (c->pid > 0)) |
2587 | - { |
2588 | - if (!strcmp (display_info->hostname, c->hostname)) |
2589 | - { |
2590 | - TRACE ("Sending client %s (pid %i) signal SIGKILL\n", c->name, c->pid); |
2591 | - |
2592 | - if (kill (c->pid, SIGKILL) < 0) |
2593 | - { |
2594 | - g_warning ("Failed to kill client id %d: %s", c->pid, strerror (errno)); |
2595 | - } |
2596 | - } |
2597 | - } |
2598 | - |
2599 | - clientKill (c); |
2600 | -} |
2601 | - |
2602 | -void |
2603 | -clientEnterContextMenuState (Client *c) |
2604 | -{ |
2605 | - ScreenInfo *screen_info; |
2606 | - DisplayInfo *display_info; |
2607 | - |
2608 | - g_return_if_fail (c != NULL); |
2609 | - |
2610 | - TRACE ("entering clientEnterContextMenuState"); |
2611 | - TRACE ("Showing the what's this help for client \"%s\" (0x%lx)", c->name, c->window); |
2612 | - |
2613 | - screen_info = c->screen_info; |
2614 | - display_info = screen_info->display_info; |
2615 | - |
2616 | - if (FLAG_TEST (c->wm_flags, WM_FLAG_CONTEXT_HELP)) |
2617 | - { |
2618 | - sendClientMessage (c->screen_info, c->window, NET_WM_CONTEXT_HELP, |
2619 | - myDisplayGetCurrentTime (display_info)); |
2620 | - } |
2621 | -} |
2622 | - |
2623 | -void |
2624 | -clientSetLayer (Client *c, guint l) |
2625 | -{ |
2626 | - GList *list_of_windows = NULL; |
2627 | - GList *list = NULL; |
2628 | - Client *c2 = NULL; |
2629 | - |
2630 | - g_return_if_fail (c != NULL); |
2631 | - TRACE ("entering clientSetLayer for \"%s\" (0x%lx) on layer %d", c->name, c->window, l); |
2632 | - |
2633 | - list_of_windows = clientListTransientOrModal (c); |
2634 | - for (list = list_of_windows; list; list = g_list_next (list)) |
2635 | - { |
2636 | - c2 = (Client *) list->data; |
2637 | - if (c2->win_layer != l) |
2638 | - { |
2639 | - TRACE ("setting client \"%s\" (0x%lx) layer to %d", c2->name, |
2640 | - c2->window, l); |
2641 | - c2->win_layer = l; |
2642 | - } |
2643 | - } |
2644 | - g_list_free (list_of_windows); |
2645 | - |
2646 | - if (clientGetLastRaise (c->screen_info) == c) |
2647 | - { |
2648 | - clientClearLastRaise (c->screen_info); |
2649 | - } |
2650 | - |
2651 | - c2 = clientGetFocusOrPending (); |
2652 | - if (c2 && (c2 != c) && (c2->win_layer == c->win_layer)) |
2653 | - { |
2654 | - TRACE ("Placing %s under %s", c->name, c2->name); |
2655 | - clientLower (c, c2->frame); |
2656 | - } |
2657 | - else |
2658 | - { |
2659 | - TRACE ("Placing %s on top of its layer %lu", c->name, c->win_layer); |
2660 | - clientRaise (c, None); |
2661 | - } |
2662 | -} |
2663 | - |
2664 | -void |
2665 | -clientShade (Client *c) |
2666 | -{ |
2667 | - XWindowChanges wc; |
2668 | - ScreenInfo *screen_info; |
2669 | - DisplayInfo *display_info; |
2670 | - unsigned long mask; |
2671 | - |
2672 | - g_return_if_fail (c != NULL); |
2673 | - TRACE ("entering clientToggleShaded"); |
2674 | - TRACE ("shading client \"%s\" (0x%lx)", c->name, c->window); |
2675 | - |
2676 | - if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER) |
2677 | - || FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
2678 | - { |
2679 | - TRACE ("cowardly refusing to shade \"%s\" (0x%lx) because it has no border", c->name, c->window); |
2680 | - return; |
2681 | - } |
2682 | - else if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
2683 | - { |
2684 | - TRACE ("\"%s\" (0x%lx) is already shaded", c->name, c->window); |
2685 | - return; |
2686 | - } |
2687 | - |
2688 | - screen_info = c->screen_info; |
2689 | - display_info = screen_info->display_info; |
2690 | - |
2691 | - FLAG_SET (c->flags, CLIENT_FLAG_SHADED); |
2692 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED)) |
2693 | - { |
2694 | - mask = (CWWidth | CWHeight); |
2695 | - if (clientConstrainPos (c, FALSE)) |
2696 | - { |
2697 | - wc.x = c->x; |
2698 | - wc.y = c->y; |
2699 | - mask |= (CWX | CWY); |
2700 | - } |
2701 | - |
2702 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
2703 | - { |
2704 | - c->ignore_unmap++; |
2705 | - } |
2706 | - /* |
2707 | - * Shading unmaps the client window. We therefore have to transfer focus to its frame |
2708 | - * so that focus doesn't return to root. clientSetFocus() will take care of focusing |
2709 | - * the window frame since the SHADED flag is now set. |
2710 | - */ |
2711 | - if (c == clientGetFocus ()) |
2712 | - { |
2713 | - clientSetFocus (screen_info, c, myDisplayGetCurrentTime (display_info), FOCUS_FORCE); |
2714 | - } |
2715 | - XUnmapWindow (display_info->dpy, c->window); |
2716 | - |
2717 | - wc.width = c->width; |
2718 | - wc.height = c->height; |
2719 | - clientConfigure (c, &wc, mask, CFG_FORCE_REDRAW); |
2720 | - } |
2721 | - clientSetNetState (c); |
2722 | -} |
2723 | - |
2724 | -void |
2725 | -clientUnshade (Client *c) |
2726 | -{ |
2727 | - XWindowChanges wc; |
2728 | - ScreenInfo *screen_info; |
2729 | - DisplayInfo *display_info; |
2730 | - |
2731 | - g_return_if_fail (c != NULL); |
2732 | - TRACE ("entering clientToggleShaded"); |
2733 | - TRACE ("shading/unshading client \"%s\" (0x%lx)", c->name, c->window); |
2734 | - |
2735 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
2736 | - { |
2737 | - TRACE ("\"%s\" (0x%lx) is not shaded", c->name, c->window); |
2738 | - return; |
2739 | - } |
2740 | - |
2741 | - screen_info = c->screen_info; |
2742 | - display_info = screen_info->display_info; |
2743 | - |
2744 | - FLAG_UNSET (c->flags, CLIENT_FLAG_SHADED); |
2745 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED)) |
2746 | - { |
2747 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE)) |
2748 | - { |
2749 | - XMapWindow (display_info->dpy, c->window); |
2750 | - } |
2751 | - /* |
2752 | - * Unshading will show the client window, so we need to focus it when unshading. |
2753 | - */ |
2754 | - if (c == clientGetFocus ()) |
2755 | - { |
2756 | - clientSetFocus (screen_info, c, myDisplayGetCurrentTime (display_info), FOCUS_FORCE); |
2757 | - } |
2758 | - |
2759 | - wc.width = c->width; |
2760 | - wc.height = c->height; |
2761 | - clientConfigure (c, &wc, CWWidth | CWHeight, CFG_FORCE_REDRAW); |
2762 | - } |
2763 | - clientSetNetState (c); |
2764 | -} |
2765 | - |
2766 | -void |
2767 | -clientToggleShaded (Client *c) |
2768 | -{ |
2769 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)) |
2770 | - { |
2771 | - clientUnshade (c); |
2772 | - } |
2773 | - else |
2774 | - { |
2775 | - clientShade (c); |
2776 | - } |
2777 | -} |
2778 | - |
2779 | -void |
2780 | -clientStick (Client *c, gboolean include_transients) |
2781 | -{ |
2782 | - ScreenInfo *screen_info; |
2783 | - DisplayInfo *display_info; |
2784 | - Client *c2; |
2785 | - GList *list_of_windows; |
2786 | - GList *list; |
2787 | - |
2788 | - g_return_if_fail (c != NULL); |
2789 | - TRACE ("entering clientStick"); |
2790 | - |
2791 | - screen_info = c->screen_info; |
2792 | - display_info = screen_info->display_info; |
2793 | - |
2794 | - if (include_transients) |
2795 | - { |
2796 | - list_of_windows = clientListTransientOrModal (c); |
2797 | - for (list = list_of_windows; list; list = g_list_next (list)) |
2798 | - { |
2799 | - c2 = (Client *) list->data; |
2800 | - TRACE ("Sticking client \"%s\" (0x%lx)", c2->name, c2->window); |
2801 | - FLAG_SET (c2->flags, CLIENT_FLAG_STICKY); |
2802 | - setHint (display_info, c2->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES); |
2803 | - frameQueueDraw (c2, FALSE); |
2804 | - } |
2805 | - g_list_free (list_of_windows); |
2806 | - } |
2807 | - else |
2808 | - { |
2809 | - TRACE ("Sticking client \"%s\" (0x%lx)", c->name, c->window); |
2810 | - FLAG_SET (c->flags, CLIENT_FLAG_STICKY); |
2811 | - setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES); |
2812 | - } |
2813 | - clientSetWorkspace (c, screen_info->current_ws, TRUE); |
2814 | - clientSetNetState (c); |
2815 | -} |
2816 | - |
2817 | -void |
2818 | -clientUnstick (Client *c, gboolean include_transients) |
2819 | -{ |
2820 | - ScreenInfo *screen_info; |
2821 | - DisplayInfo *display_info; |
2822 | - Client *c2; |
2823 | - GList *list_of_windows; |
2824 | - GList *list; |
2825 | - |
2826 | - g_return_if_fail (c != NULL); |
2827 | - TRACE ("entering clientUnstick"); |
2828 | - |
2829 | - screen_info = c->screen_info; |
2830 | - display_info = screen_info->display_info; |
2831 | - |
2832 | - if (include_transients) |
2833 | - { |
2834 | - list_of_windows = clientListTransientOrModal (c); |
2835 | - for (list = list_of_windows; list; list = g_list_next (list)) |
2836 | - { |
2837 | - c2 = (Client *) list->data; |
2838 | - TRACE ("Unsticking client \"%s\" (0x%lx)", c2->name, c2->window); |
2839 | - FLAG_UNSET (c2->flags, CLIENT_FLAG_STICKY); |
2840 | - setHint (display_info, c2->window, NET_WM_DESKTOP, (unsigned long) screen_info->current_ws); |
2841 | - frameQueueDraw (c2, FALSE); |
2842 | - } |
2843 | - g_list_free (list_of_windows); |
2844 | - } |
2845 | - else |
2846 | - { |
2847 | - TRACE ("Unsticking client \"%s\" (0x%lx)", c->name, c->window); |
2848 | - FLAG_UNSET (c->flags, CLIENT_FLAG_STICKY); |
2849 | - setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) screen_info->current_ws); |
2850 | - } |
2851 | - clientSetWorkspace (c, screen_info->current_ws, TRUE); |
2852 | - clientSetNetState (c); |
2853 | -} |
2854 | - |
2855 | -void |
2856 | -clientToggleSticky (Client *c, gboolean include_transients) |
2857 | -{ |
2858 | - g_return_if_fail (c != NULL); |
2859 | - TRACE ("entering clientToggleSticky"); |
2860 | - TRACE ("sticking/unsticking client \"%s\" (0x%lx)", c->name, c->window); |
2861 | - |
2862 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)) |
2863 | - { |
2864 | - clientUnstick (c, include_transients); |
2865 | - } |
2866 | - else |
2867 | - { |
2868 | - clientStick (c, include_transients); |
2869 | - } |
2870 | -} |
2871 | - |
2872 | -void |
2873 | -clientUpdateFullscreenSize (Client *c) |
2874 | -{ |
2875 | - ScreenInfo *screen_info; |
2876 | - XWindowChanges wc; |
2877 | - GdkRectangle monitor, rect; |
2878 | - int i; |
2879 | - |
2880 | - g_return_if_fail (c != NULL); |
2881 | - TRACE ("entering clientUpdateFullscreenSize"); |
2882 | - TRACE ("Update fullscreen size for client \"%s\" (0x%lx)", c->name, c->window); |
2883 | - |
2884 | - screen_info = c->screen_info; |
2885 | - |
2886 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
2887 | - { |
2888 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS)) |
2889 | - { |
2890 | - gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[0], &rect); |
2891 | - for (i = 1; i < 4; i++) |
2892 | - { |
2893 | - gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[i], &monitor); |
2894 | - gdk_rectangle_union (&rect, &monitor, &rect); |
2895 | - } |
2896 | - } |
2897 | - else |
2898 | - { |
2899 | - int cx, cy; |
2900 | - |
2901 | - cx = frameX (c) + (frameWidth (c) / 2); |
2902 | - cy = frameY (c) + (frameHeight (c) / 2); |
2903 | - |
2904 | - myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect); |
2905 | - } |
2906 | - |
2907 | - wc.x = rect.x; |
2908 | - wc.y = rect.y; |
2909 | - wc.width = rect.width; |
2910 | - wc.height = rect.height; |
2911 | - } |
2912 | - |
2913 | - else |
2914 | - { |
2915 | - wc.x = c->fullscreen_old_x; |
2916 | - wc.y = c->fullscreen_old_y; |
2917 | - wc.width = c->fullscreen_old_width; |
2918 | - wc.height = c->fullscreen_old_height; |
2919 | - } |
2920 | - |
2921 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED)) |
2922 | - { |
2923 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW); |
2924 | - } |
2925 | - else |
2926 | - { |
2927 | - c->x = wc.x; |
2928 | - c->y = wc.y; |
2929 | - c->height = wc.height; |
2930 | - c->width = wc.width; |
2931 | - } |
2932 | -} |
2933 | - |
2934 | -void clientToggleFullscreen (Client *c) |
2935 | -{ |
2936 | - g_return_if_fail (c != NULL); |
2937 | - TRACE ("entering clientToggleFullscreen"); |
2938 | - TRACE ("toggle fullscreen client \"%s\" (0x%lx)", c->name, c->window); |
2939 | - |
2940 | - /*can we switch to full screen, does it make any sense? */ |
2941 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) && (c->size->flags & PMaxSize)) |
2942 | - { |
2943 | - GdkRectangle rect; |
2944 | - int cx, cy; |
2945 | - |
2946 | - cx = frameX (c) + (frameWidth (c) / 2); |
2947 | - cy = frameY (c) + (frameHeight (c) / 2); |
2948 | - |
2949 | - myScreenFindMonitorAtPoint (c->screen_info, cx, cy, &rect); |
2950 | - |
2951 | - if ((c->size->max_width < rect.width) || (c->size->max_height < rect.height)) |
2952 | - { |
2953 | - return; |
2954 | - } |
2955 | - } |
2956 | - |
2957 | - if (!clientIsTransientOrModal (c) && (c->type == WINDOW_NORMAL)) |
2958 | - { |
2959 | - FLAG_TOGGLE (c->flags, CLIENT_FLAG_FULLSCREEN); |
2960 | - clientUpdateFullscreenState (c); |
2961 | - } |
2962 | -} |
2963 | - |
2964 | -void clientSetFullscreenMonitor (Client *c, gint top, gint bottom, gint left, gint right) |
2965 | -{ |
2966 | - ScreenInfo *screen_info; |
2967 | - DisplayInfo *display_info; |
2968 | - gint num_monitors; |
2969 | - |
2970 | - g_return_if_fail (c != NULL); |
2971 | - TRACE ("entering clientSetFullscreenMonitor"); |
2972 | - |
2973 | - screen_info = c->screen_info; |
2974 | - display_info = screen_info->display_info; |
2975 | - |
2976 | - num_monitors = gdk_screen_get_n_monitors (screen_info->gscr); |
2977 | - if ((top >= 0) && (top < num_monitors) && |
2978 | - (bottom >= 0) && (bottom < num_monitors) && |
2979 | - (left >= 0) && (left < num_monitors) && |
2980 | - (right >= 0) && (right < num_monitors)) |
2981 | - { |
2982 | - c->fullscreen_monitors[0] = top; |
2983 | - c->fullscreen_monitors[1] = bottom; |
2984 | - c->fullscreen_monitors[2] = left; |
2985 | - c->fullscreen_monitors[3] = right; |
2986 | - FLAG_SET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS); |
2987 | - } |
2988 | - else |
2989 | - { |
2990 | - c->fullscreen_monitors[0] = 0; |
2991 | - c->fullscreen_monitors[1] = 0; |
2992 | - c->fullscreen_monitors[2] = 0; |
2993 | - c->fullscreen_monitors[3] = 0; |
2994 | - FLAG_UNSET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS); |
2995 | - } |
2996 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
2997 | - { |
2998 | - clientUpdateFullscreenSize (c); |
2999 | - } |
3000 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS)) |
3001 | - { |
3002 | - setNetFullscreenMonitors (display_info, c->window, top, bottom, left, right); |
3003 | - } |
3004 | -} |
3005 | - |
3006 | -void clientToggleLayerAbove (Client *c) |
3007 | -{ |
3008 | - g_return_if_fail (c != NULL); |
3009 | - TRACE ("entering clientToggleAbove"); |
3010 | - |
3011 | - if ((c->type & WINDOW_REGULAR_FOCUSABLE) && |
3012 | - !clientIsTransientOrModal (c) && |
3013 | - !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
3014 | - { |
3015 | - FLAG_UNSET (c->flags, CLIENT_FLAG_BELOW); |
3016 | - FLAG_TOGGLE (c->flags, CLIENT_FLAG_ABOVE); |
3017 | - clientUpdateLayerState (c); |
3018 | - } |
3019 | -} |
3020 | - |
3021 | -void clientToggleLayerBelow (Client *c) |
3022 | -{ |
3023 | - g_return_if_fail (c != NULL); |
3024 | - TRACE ("entering clientToggleBelow"); |
3025 | - |
3026 | - if ((c->type & WINDOW_REGULAR_FOCUSABLE) && |
3027 | - !clientIsTransientOrModal (c) && |
3028 | - !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
3029 | - { |
3030 | - FLAG_UNSET (c->flags, CLIENT_FLAG_ABOVE); |
3031 | - FLAG_TOGGLE (c->flags, CLIENT_FLAG_BELOW); |
3032 | - clientUpdateLayerState (c); |
3033 | - } |
3034 | -} |
3035 | - |
3036 | -void clientSetLayerNormal (Client *c) |
3037 | -{ |
3038 | - g_return_if_fail (c != NULL); |
3039 | - TRACE ("entering clientSetLayerNormal"); |
3040 | - |
3041 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
3042 | - { |
3043 | - FLAG_UNSET (c->flags, CLIENT_FLAG_ABOVE | CLIENT_FLAG_BELOW); |
3044 | - clientUpdateLayerState (c); |
3045 | - } |
3046 | -} |
3047 | - |
3048 | -void |
3049 | -clientRemoveMaximizeFlag (Client *c) |
3050 | -{ |
3051 | - g_return_if_fail (c != NULL); |
3052 | - TRACE ("entering clientRemoveMaximizeFlag"); |
3053 | - TRACE ("Removing maximize flag on client \"%s\" (0x%lx)", c->name, |
3054 | - c->window); |
3055 | - |
3056 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED); |
3057 | - frameQueueDraw (c, FALSE); |
3058 | - clientSetNetActions (c); |
3059 | - clientSetNetState (c); |
3060 | -} |
3061 | - |
3062 | -static void |
3063 | -clientNewMaxState (Client *c, XWindowChanges *wc, int mode) |
3064 | -{ |
3065 | - if (FLAG_TEST_ALL (mode, CLIENT_FLAG_MAXIMIZED)) |
3066 | - { |
3067 | - /* |
3068 | - * We need to test specifically for full de-maximization |
3069 | - * otherwise it's too confusing when the window changes |
3070 | - * from horiz to vertical maximization or vice-versa. |
3071 | - */ |
3072 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3073 | - { |
3074 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED); |
3075 | - wc->x = c->old_x; |
3076 | - wc->y = c->old_y; |
3077 | - wc->width = c->old_width; |
3078 | - wc->height = c->old_height; |
3079 | - |
3080 | - return; |
3081 | - } |
3082 | - } |
3083 | - |
3084 | - if (FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED_HORIZ)) |
3085 | - { |
3086 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ)) |
3087 | - { |
3088 | - FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ); |
3089 | - } |
3090 | - else |
3091 | - { |
3092 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ); |
3093 | - wc->x = c->old_x; |
3094 | - wc->y = c->old_y; |
3095 | - wc->width = c->old_width; |
3096 | - wc->height = c->old_height; |
3097 | - } |
3098 | - } |
3099 | - |
3100 | - if (FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED_VERT)) |
3101 | - { |
3102 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT)) |
3103 | - { |
3104 | - FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT); |
3105 | - } |
3106 | - else |
3107 | - { |
3108 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT); |
3109 | - wc->x = c->old_x; |
3110 | - wc->y = c->old_y; |
3111 | - wc->width = c->old_width; |
3112 | - wc->height = c->old_height; |
3113 | - } |
3114 | - } |
3115 | -} |
3116 | - |
3117 | -static gboolean |
3118 | -clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositionType tile) |
3119 | -{ |
3120 | - ScreenInfo *screen_info; |
3121 | - int full_x, full_y, full_w, full_h; |
3122 | - int tmp_x, tmp_y, tmp_w, tmp_h; |
3123 | - |
3124 | - tmp_x = frameX (c); |
3125 | - tmp_y = frameY (c); |
3126 | - tmp_h = frameHeight (c); |
3127 | - tmp_w = frameWidth (c); |
3128 | - screen_info = c->screen_info; |
3129 | - |
3130 | - full_x = MAX (screen_info->params->xfwm_margins[STRUTS_LEFT], rect->x); |
3131 | - full_y = MAX (screen_info->params->xfwm_margins[STRUTS_TOP], rect->y); |
3132 | - full_w = MIN (screen_info->width - screen_info->params->xfwm_margins[STRUTS_RIGHT], |
3133 | - rect->x + rect->width) - full_x; |
3134 | - full_h = MIN (screen_info->height - screen_info->params->xfwm_margins[STRUTS_BOTTOM], |
3135 | - rect->y + rect->height) - full_y; |
3136 | - |
3137 | - if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3138 | - { |
3139 | - /* Adjust size to the largest size available, not covering struts */ |
3140 | - clientMaxSpace (screen_info, &full_x, &full_y, &full_w, &full_h); |
3141 | - wc->x = full_x + frameLeft (c); |
3142 | - wc->y = full_y + frameTop (c); |
3143 | - wc->width = full_w - frameLeft (c) - frameRight (c); |
3144 | - wc->height = full_h - frameTop (c) - frameBottom (c); |
3145 | - |
3146 | - return ((wc->width <= c->size->max_width) && (wc->height <= c->size->max_height)); |
3147 | - } |
3148 | - |
3149 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ)) |
3150 | - { |
3151 | - /* Adjust size to the widest size available, for the current vertical position/height */ |
3152 | - switch (tile) |
3153 | - { |
3154 | - case TILE_UP: |
3155 | - tmp_h = full_h / 2; |
3156 | - tmp_y = full_y; |
3157 | - clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h); |
3158 | - wc->y = tmp_y + frameTop (c); |
3159 | - wc->height = tmp_h - frameTop (c) - frameBottom (c); |
3160 | - break; |
3161 | - case TILE_DOWN: |
3162 | - tmp_h = full_h / 2; |
3163 | - tmp_y = full_y + full_h / 2; |
3164 | - clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h); |
3165 | - wc->y = tmp_y + frameTop (c); |
3166 | - wc->height = tmp_h - frameTop (c) - frameBottom (c); |
3167 | - break; |
3168 | - default: |
3169 | - clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h); |
3170 | - break; |
3171 | - } |
3172 | - |
3173 | - wc->x = full_x + frameLeft (c); |
3174 | - wc->width = full_w - frameLeft (c) - frameRight (c); |
3175 | - |
3176 | - return (wc->width <= c->size->max_width); |
3177 | - } |
3178 | - |
3179 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT)) |
3180 | - { |
3181 | - /* Adjust size to the tallest size available, for the current horizontal position/width */ |
3182 | - switch (tile) |
3183 | - { |
3184 | - case TILE_LEFT: |
3185 | - tmp_x = full_x; |
3186 | - tmp_w = full_w / 2; |
3187 | - clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h); |
3188 | - wc->x = tmp_x + frameLeft (c); |
3189 | - wc->width = tmp_w - frameLeft (c) - frameRight (c); |
3190 | - break; |
3191 | - case TILE_RIGHT: |
3192 | - tmp_x = full_x + full_w /2; |
3193 | - tmp_w = full_w / 2; |
3194 | - clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h); |
3195 | - wc->x = tmp_x + frameLeft (c); |
3196 | - wc->width = tmp_w - frameLeft (c) - frameRight (c); |
3197 | - break; |
3198 | - default: |
3199 | - clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h); |
3200 | - break; |
3201 | - } |
3202 | - |
3203 | - wc->y = full_y + frameTop (c); |
3204 | - wc->height = full_h - frameTop (c) - frameBottom (c); |
3205 | - |
3206 | - return (wc->height <= c->size->max_height); |
3207 | - } |
3208 | - |
3209 | - return TRUE; |
3210 | -} |
3211 | - |
3212 | -gboolean |
3213 | -clientToggleMaximized (Client *c, int mode, gboolean restore_position) |
3214 | -{ |
3215 | - DisplayInfo *display_info; |
3216 | - ScreenInfo *screen_info; |
3217 | - XWindowChanges wc; |
3218 | - GdkRectangle rect; |
3219 | - unsigned long old_flags; |
3220 | - |
3221 | - g_return_val_if_fail (c != NULL, FALSE); |
3222 | - |
3223 | - TRACE ("entering clientToggleMaximized"); |
3224 | - TRACE ("maximzing/unmaximizing client \"%s\" (0x%lx)", c->name, c->window); |
3225 | - |
3226 | - if (!CLIENT_CAN_MAXIMIZE_WINDOW (c)) |
3227 | - { |
3228 | - return FALSE; |
3229 | - } |
3230 | - |
3231 | - screen_info = c->screen_info; |
3232 | - display_info = screen_info->display_info; |
3233 | - myScreenFindMonitorAtPoint (screen_info, |
3234 | - frameX (c) + (frameWidth (c) / 2), |
3235 | - frameY (c) + (frameHeight (c) / 2), &rect); |
3236 | - |
3237 | - wc.x = c->x; |
3238 | - wc.y = c->y; |
3239 | - wc.width = c->width; |
3240 | - wc.height = c->height; |
3241 | - |
3242 | - if (restore_position && |
3243 | - FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED) && |
3244 | - !FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3245 | - { |
3246 | - clientSaveSizePos (c); |
3247 | - } |
3248 | - |
3249 | - old_flags = c->flags; |
3250 | - |
3251 | - /* 1) Compute the new state */ |
3252 | - clientNewMaxState (c, &wc, mode); |
3253 | - |
3254 | - /* 2) Compute the new size, based on the state */ |
3255 | - if (!clientNewMaxSize (c, &wc, &rect, TILE_NONE)) |
3256 | - { |
3257 | - c->flags = old_flags; |
3258 | - return FALSE; |
3259 | - } |
3260 | - |
3261 | - /* 3) Update size and position fields */ |
3262 | - c->x = wc.x; |
3263 | - c->y = wc.y; |
3264 | - c->height = wc.height; |
3265 | - c->width = wc.width; |
3266 | - |
3267 | - /* Maximizing may remove decoration on the side, update NET_FRAME_EXTENTS accordingly */ |
3268 | - setNetFrameExtents (display_info, |
3269 | - c->window, |
3270 | - frameTop (c), |
3271 | - frameLeft (c), |
3272 | - frameRight (c), |
3273 | - frameBottom (c)); |
3274 | - |
3275 | - /* Maximized windows w/out border cannot be resized, update allowed actions */ |
3276 | - clientSetNetActions (c); |
3277 | - if (restore_position && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED)) |
3278 | - { |
3279 | - clientConfigure (c, &wc, CWWidth | CWHeight | CWX | CWY, CFG_FORCE_REDRAW); |
3280 | - } |
3281 | - clientSetNetState (c); |
3282 | - |
3283 | - return TRUE; |
3284 | -} |
3285 | - |
3286 | -gboolean |
3287 | -clientTile (Client *c, gint cx, gint cy, tilePositionType tile, gboolean send_configure) |
3288 | -{ |
3289 | - DisplayInfo *display_info; |
3290 | - ScreenInfo *screen_info; |
3291 | - XWindowChanges wc; |
3292 | - GdkRectangle rect; |
3293 | - unsigned long old_flags; |
3294 | - int mode; |
3295 | - |
3296 | - g_return_val_if_fail (c != NULL, FALSE); |
3297 | - |
3298 | - TRACE ("entering clientTile"); |
3299 | - TRACE ("Tiling client \"%s\" (0x%lx)", c->name, c->window); |
3300 | - |
3301 | - if (!CLIENT_CAN_TILE_WINDOW (c)) |
3302 | - { |
3303 | - return FALSE; |
3304 | - } |
3305 | - |
3306 | - screen_info = c->screen_info; |
3307 | - display_info = screen_info->display_info; |
3308 | - myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect); |
3309 | - |
3310 | - wc.x = c->x; |
3311 | - wc.y = c->y; |
3312 | - wc.width = c->width; |
3313 | - wc.height = c->height; |
3314 | - |
3315 | - switch (tile) |
3316 | - { |
3317 | - case TILE_LEFT: |
3318 | - case TILE_RIGHT: |
3319 | - mode = CLIENT_FLAG_MAXIMIZED_VERT; |
3320 | - break; |
3321 | - case TILE_UP: |
3322 | - case TILE_DOWN: |
3323 | - mode = CLIENT_FLAG_MAXIMIZED_HORIZ; |
3324 | - break; |
3325 | - default: |
3326 | - return FALSE; |
3327 | - break; |
3328 | - } |
3329 | - |
3330 | - if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3331 | - { |
3332 | - clientSaveSizePos (c); |
3333 | - } |
3334 | - |
3335 | - old_flags = c->flags; |
3336 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED); |
3337 | - clientNewMaxState (c, &wc, mode); |
3338 | - if (!clientNewMaxSize (c, &wc, &rect, tile)) |
3339 | - { |
3340 | - c->flags = old_flags; |
3341 | - return FALSE; |
3342 | - } |
3343 | - |
3344 | - c->x = wc.x; |
3345 | - c->y = wc.y; |
3346 | - c->height = wc.height; |
3347 | - c->width = wc.width; |
3348 | - |
3349 | - if (send_configure) |
3350 | - { |
3351 | - setNetFrameExtents (display_info, |
3352 | - c->window, |
3353 | - frameTop (c), |
3354 | - frameLeft (c), |
3355 | - frameRight (c), |
3356 | - frameBottom (c)); |
3357 | - |
3358 | - clientSetNetActions (c); |
3359 | - |
3360 | - clientConfigure (c, &wc, CWWidth | CWHeight | CWX | CWY, CFG_FORCE_REDRAW); |
3361 | - } |
3362 | - clientSetNetState (c); |
3363 | - |
3364 | - return TRUE; |
3365 | -} |
3366 | - |
3367 | -void |
3368 | -clientUpdateOpacity (Client *c) |
3369 | -{ |
3370 | - ScreenInfo *screen_info; |
3371 | - DisplayInfo *display_info; |
3372 | - Client *focused; |
3373 | - gboolean opaque; |
3374 | - |
3375 | - g_return_if_fail (c != NULL); |
3376 | - |
3377 | - screen_info = c->screen_info; |
3378 | - display_info = screen_info->display_info; |
3379 | - if (!compositorIsUsable (display_info)) |
3380 | - { |
3381 | - return; |
3382 | - } |
3383 | - |
3384 | - focused = clientGetFocus (); |
3385 | - opaque = (FLAG_TEST(c->type, WINDOW_TYPE_DONT_PLACE | WINDOW_TYPE_DONT_FOCUS) |
3386 | - || (focused == c)); |
3387 | - |
3388 | - clientSetOpacity (c, c->opacity, OPACITY_INACTIVE, opaque ? 0 : OPACITY_INACTIVE); |
3389 | -} |
3390 | - |
3391 | -void |
3392 | -clientUpdateAllOpacity (ScreenInfo *screen_info) |
3393 | -{ |
3394 | - DisplayInfo *display_info; |
3395 | - Client *c; |
3396 | - guint i; |
3397 | - |
3398 | - g_return_if_fail (screen_info != NULL); |
3399 | - |
3400 | - display_info = screen_info->display_info; |
3401 | - if (!compositorIsUsable (display_info)) |
3402 | - { |
3403 | - return; |
3404 | - } |
3405 | - |
3406 | - for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, ++i) |
3407 | - { |
3408 | - clientUpdateOpacity (c); |
3409 | - } |
3410 | -} |
3411 | - |
3412 | -void |
3413 | -clientSetOpacity (Client *c, guint opacity, guint clear, guint xor) |
3414 | -{ |
3415 | - ScreenInfo *screen_info; |
3416 | - DisplayInfo *display_info; |
3417 | - guint applied; |
3418 | - |
3419 | - screen_info = c->screen_info; |
3420 | - display_info = screen_info->display_info; |
3421 | - |
3422 | - if (!compositorIsUsable (display_info)) |
3423 | - { |
3424 | - return; |
3425 | - } |
3426 | - |
3427 | - c->opacity_flags = (c->opacity_flags & ~clear) ^ xor; |
3428 | - |
3429 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED)) |
3430 | - { |
3431 | - applied = c->opacity; |
3432 | - } |
3433 | - else |
3434 | - { |
3435 | - long long multiplier = 1, divisor = 1; |
3436 | - |
3437 | - c->opacity = applied = opacity; |
3438 | - |
3439 | - if (FLAG_TEST (c->opacity_flags, OPACITY_MOVE)) |
3440 | - { |
3441 | - multiplier *= c->screen_info->params->move_opacity; |
3442 | - divisor *= 100; |
3443 | - } |
3444 | - if (FLAG_TEST (c->opacity_flags, OPACITY_RESIZE)) |
3445 | - { |
3446 | - multiplier *= c->screen_info->params->resize_opacity; |
3447 | - divisor *= 100; |
3448 | - } |
3449 | - if (FLAG_TEST (c->opacity_flags, OPACITY_INACTIVE)) |
3450 | - { |
3451 | - multiplier *= c->screen_info->params->inactive_opacity; |
3452 | - divisor *= 100; |
3453 | - } |
3454 | - |
3455 | - applied = (guint) ((long long) applied * multiplier / divisor); |
3456 | - } |
3457 | - |
3458 | - if (applied != c->opacity_applied) |
3459 | - { |
3460 | - c->opacity_applied = applied; |
3461 | - compositorWindowSetOpacity (display_info, c->frame, applied); |
3462 | - } |
3463 | -} |
3464 | - |
3465 | -void |
3466 | -clientDecOpacity (Client *c) |
3467 | -{ |
3468 | - ScreenInfo *screen_info; |
3469 | - DisplayInfo *display_info; |
3470 | - |
3471 | - screen_info = c->screen_info; |
3472 | - display_info = screen_info->display_info; |
3473 | - |
3474 | - if (!compositorIsUsable (display_info)) |
3475 | - { |
3476 | - return; |
3477 | - } |
3478 | - |
3479 | - if ((c->opacity > OPACITY_SET_MIN) && !(FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED))) |
3480 | - { |
3481 | - clientSetOpacity (c, c->opacity - OPACITY_SET_STEP, 0, 0); |
3482 | - } |
3483 | -} |
3484 | - |
3485 | -void |
3486 | -clientIncOpacity (Client *c) |
3487 | -{ |
3488 | - ScreenInfo *screen_info; |
3489 | - DisplayInfo *display_info; |
3490 | - |
3491 | - screen_info = c->screen_info; |
3492 | - display_info = screen_info->display_info; |
3493 | - |
3494 | - if (!compositorIsUsable (display_info)) |
3495 | - { |
3496 | - return; |
3497 | - } |
3498 | - |
3499 | - if ((c->opacity < NET_WM_OPAQUE) && !(FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED))) |
3500 | - { |
3501 | - guint opacity = c->opacity + OPACITY_SET_STEP; |
3502 | - |
3503 | - if (opacity < OPACITY_SET_MIN) |
3504 | - { |
3505 | - opacity = NET_WM_OPAQUE; |
3506 | - } |
3507 | - clientSetOpacity (c, opacity, 0, 0); |
3508 | - } |
3509 | -} |
3510 | - |
3511 | -/* Xrandr stuff: on screen size change, make sure all clients are still visible */ |
3512 | -void |
3513 | -clientScreenResize(ScreenInfo *screen_info, gboolean fully_visible) |
3514 | -{ |
3515 | - Client *c = NULL; |
3516 | - GList *list, *list_of_windows; |
3517 | - XWindowChanges wc; |
3518 | - unsigned short configure_flags; |
3519 | - |
3520 | - list_of_windows = clientGetStackList (screen_info); |
3521 | - |
3522 | - if (!list_of_windows) |
3523 | - { |
3524 | - return; |
3525 | - } |
3526 | - |
3527 | - /* Revalidate client struts */ |
3528 | - for (list = list_of_windows; list; list = g_list_next (list)) |
3529 | - { |
3530 | - c = (Client *) list->data; |
3531 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT)) |
3532 | - { |
3533 | - clientValidateNetStrut (c); |
3534 | - } |
3535 | - } |
3536 | - |
3537 | - for (list = list_of_windows; list; list = g_list_next (list)) |
3538 | - { |
3539 | - unsigned long maximization_flags = 0L; |
3540 | - |
3541 | - c = (Client *) list->data; |
3542 | - if (!CONSTRAINED_WINDOW (c)) |
3543 | - { |
3544 | - continue; |
3545 | - } |
3546 | - |
3547 | - /* Recompute size and position of maximized windows */ |
3548 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3549 | - { |
3550 | - maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED; |
3551 | - |
3552 | - /* Force an update by clearing the internal flags */ |
3553 | - FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED); |
3554 | - clientToggleMaximized (c, maximization_flags, FALSE); |
3555 | - |
3556 | - wc.x = c->x; |
3557 | - wc.y = c->y; |
3558 | - wc.width = c->width; |
3559 | - wc.height = c->height; |
3560 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_NOTIFY); |
3561 | - } |
3562 | - else if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
3563 | - { |
3564 | - clientUpdateFullscreenSize (c); |
3565 | - } |
3566 | - else |
3567 | - { |
3568 | - configure_flags = CFG_CONSTRAINED | CFG_REQUEST; |
3569 | - if (fully_visible) |
3570 | - { |
3571 | - configure_flags |= CFG_KEEP_VISIBLE; |
3572 | - } |
3573 | - if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SAVED_POS)) |
3574 | - { |
3575 | - wc.x = c->saved_x; |
3576 | - wc.y = c->saved_y; |
3577 | - } |
3578 | - else |
3579 | - { |
3580 | - FLAG_SET (c->xfwm_flags, XFWM_FLAG_SAVED_POS); |
3581 | - |
3582 | - c->saved_x = c->x; |
3583 | - c->saved_y = c->y; |
3584 | - |
3585 | - wc.x = c->x; |
3586 | - wc.y = c->y; |
3587 | - } |
3588 | - |
3589 | - clientConfigure (c, &wc, CWX | CWY, configure_flags); |
3590 | - } |
3591 | - } |
3592 | - |
3593 | - g_list_free (list_of_windows); |
3594 | -} |
3595 | - |
3596 | -void |
3597 | -clientUpdateCursor (Client *c) |
3598 | -{ |
3599 | - ScreenInfo *screen_info; |
3600 | - DisplayInfo *display_info; |
3601 | - guint i; |
3602 | - |
3603 | - g_return_if_fail (c != NULL); |
3604 | - |
3605 | - screen_info = c->screen_info; |
3606 | - display_info = screen_info->display_info; |
3607 | - |
3608 | - for (i = 0; i <= SIDE_TOP; i++) |
3609 | - { |
3610 | - xfwmWindowSetCursor (&c->sides[i], |
3611 | - myDisplayGetCursorResize(display_info, CORNER_COUNT + i)); |
3612 | - } |
3613 | - |
3614 | - for (i = 0; i < CORNER_COUNT; i++) |
3615 | - { |
3616 | - xfwmWindowSetCursor (&c->corners[i], |
3617 | - myDisplayGetCursorResize(display_info, i)); |
3618 | - } |
3619 | -} |
3620 | - |
3621 | -void |
3622 | -clientUpdateAllCursor (ScreenInfo *screen_info) |
3623 | -{ |
3624 | - Client *c; |
3625 | - guint i; |
3626 | - |
3627 | - g_return_if_fail (screen_info != NULL); |
3628 | - |
3629 | - for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, ++i) |
3630 | - { |
3631 | - clientUpdateCursor (c); |
3632 | - } |
3633 | -} |
3634 | - |
3635 | -static eventFilterStatus |
3636 | -clientButtonPressEventFilter (XEvent * xevent, gpointer data) |
3637 | -{ |
3638 | - ScreenInfo *screen_info; |
3639 | - DisplayInfo *display_info; |
3640 | - Client *c; |
3641 | - ButtonPressData *passdata; |
3642 | - eventFilterStatus status; |
3643 | - int b; |
3644 | - gboolean pressed; |
3645 | - |
3646 | - passdata = (ButtonPressData *) data; |
3647 | - c = passdata->c; |
3648 | - b = passdata->b; |
3649 | - |
3650 | - screen_info = c->screen_info; |
3651 | - display_info = screen_info->display_info; |
3652 | - |
3653 | - /* Update the display time */ |
3654 | - myDisplayUpdateCurrentTime (display_info, xevent); |
3655 | - |
3656 | - status = EVENT_FILTER_STOP; |
3657 | - pressed = TRUE; |
3658 | - |
3659 | - switch (xevent->type) |
3660 | - { |
3661 | - case EnterNotify: |
3662 | - if ((xevent->xcrossing.mode != NotifyGrab) && (xevent->xcrossing.mode != NotifyUngrab)) |
3663 | - { |
3664 | - c->button_status[b] = BUTTON_STATE_PRESSED; |
3665 | - frameQueueDraw (c, FALSE); |
3666 | - } |
3667 | - break; |
3668 | - case LeaveNotify: |
3669 | - if ((xevent->xcrossing.mode != NotifyGrab) && (xevent->xcrossing.mode != NotifyUngrab)) |
3670 | - { |
3671 | - c->button_status[b] = BUTTON_STATE_NORMAL; |
3672 | - frameQueueDraw (c, FALSE); |
3673 | - } |
3674 | - break; |
3675 | - case ButtonRelease: |
3676 | - pressed = FALSE; |
3677 | - break; |
3678 | - case UnmapNotify: |
3679 | - if (xevent->xunmap.window == c->window) |
3680 | - { |
3681 | - pressed = FALSE; |
3682 | - c->button_status[b] = BUTTON_STATE_NORMAL; |
3683 | - } |
3684 | - break; |
3685 | - case KeyPress: |
3686 | - case KeyRelease: |
3687 | - break; |
3688 | - default: |
3689 | - status = EVENT_FILTER_CONTINUE; |
3690 | - break; |
3691 | - } |
3692 | - |
3693 | - if (!pressed) |
3694 | - { |
3695 | - TRACE ("event loop now finished"); |
3696 | - gtk_main_quit (); |
3697 | - } |
3698 | - |
3699 | - return status; |
3700 | -} |
3701 | - |
3702 | -void |
3703 | -clientButtonPress (Client *c, Window w, XButtonEvent * bev) |
3704 | -{ |
3705 | - ScreenInfo *screen_info; |
3706 | - DisplayInfo *display_info; |
3707 | - ButtonPressData passdata; |
3708 | - int b, g1; |
3709 | - |
3710 | - g_return_if_fail (c != NULL); |
3711 | - TRACE ("entering clientButtonPress"); |
3712 | - |
3713 | - for (b = 0; b < BUTTON_COUNT; b++) |
3714 | - { |
3715 | - if (MYWINDOW_XWINDOW (c->buttons[b]) == w) |
3716 | - { |
3717 | - break; |
3718 | - } |
3719 | - } |
3720 | - |
3721 | - screen_info = c->screen_info; |
3722 | - display_info = screen_info->display_info; |
3723 | - |
3724 | - g1 = XGrabPointer (display_info->dpy, w, FALSE, |
3725 | - ButtonReleaseMask | EnterWindowMask | LeaveWindowMask, |
3726 | - GrabModeAsync, GrabModeAsync, |
3727 | - screen_info->xroot, None, |
3728 | - myDisplayGetCurrentTime (display_info)); |
3729 | - |
3730 | - if (g1 != GrabSuccess) |
3731 | - { |
3732 | - TRACE ("grab failed in clientButtonPress"); |
3733 | - gdk_beep (); |
3734 | - if (g1 == GrabSuccess) |
3735 | - { |
3736 | - XUngrabKeyboard (display_info->dpy, myDisplayGetCurrentTime (display_info)); |
3737 | - } |
3738 | - return; |
3739 | - } |
3740 | - |
3741 | - passdata.c = c; |
3742 | - passdata.b = b; |
3743 | - |
3744 | - c->button_status[b] = BUTTON_STATE_PRESSED; |
3745 | - frameQueueDraw (c, FALSE); |
3746 | - |
3747 | - TRACE ("entering button press loop"); |
3748 | - eventFilterPush (display_info->xfilter, clientButtonPressEventFilter, &passdata); |
3749 | - gtk_main (); |
3750 | - eventFilterPop (display_info->xfilter); |
3751 | - TRACE ("leaving button press loop"); |
3752 | - |
3753 | - XUngrabPointer (display_info->dpy, myDisplayGetCurrentTime (display_info)); |
3754 | - |
3755 | - if (c->button_status[b] == BUTTON_STATE_PRESSED) |
3756 | - { |
3757 | - /* |
3758 | - * Button was pressed at the time, means the pointer was still within |
3759 | - * the button, so return to prelight if available, normal otherwise. |
3760 | - */ |
3761 | - if (!xfwmPixmapNone(clientGetButtonPixmap(c, b, PRELIGHT))) |
3762 | - { |
3763 | - c->button_status[b] = BUTTON_STATE_PRELIGHT; |
3764 | - } |
3765 | - else |
3766 | - { |
3767 | - c->button_status[b] = BUTTON_STATE_NORMAL; |
3768 | - } |
3769 | - |
3770 | - switch (b) |
3771 | - { |
3772 | - case HIDE_BUTTON: |
3773 | - if (CLIENT_CAN_HIDE_WINDOW (c)) |
3774 | - { |
3775 | - clientWithdraw (c, c->win_workspace, TRUE); |
3776 | - } |
3777 | - break; |
3778 | - case CLOSE_BUTTON: |
3779 | - clientClose (c); |
3780 | - break; |
3781 | - case MAXIMIZE_BUTTON: |
3782 | - if (CLIENT_CAN_MAXIMIZE_WINDOW (c)) |
3783 | - { |
3784 | - if (bev->button == Button1) |
3785 | - { |
3786 | - clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED, TRUE); |
3787 | - } |
3788 | - else if (bev->button == Button2) |
3789 | - { |
3790 | - clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED_VERT, TRUE); |
3791 | - } |
3792 | - else if (bev->button == Button3) |
3793 | - { |
3794 | - clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED_HORIZ, TRUE); |
3795 | - } |
3796 | - } |
3797 | - break; |
3798 | - case SHADE_BUTTON: |
3799 | - clientToggleShaded (c); |
3800 | - break; |
3801 | - case STICK_BUTTON: |
3802 | - clientToggleSticky (c, TRUE); |
3803 | - break; |
3804 | - default: |
3805 | - break; |
3806 | - } |
3807 | - frameQueueDraw (c, FALSE); |
3808 | - } |
3809 | -} |
3810 | - |
3811 | -xfwmPixmap * |
3812 | -clientGetButtonPixmap (Client *c, int button, int state) |
3813 | -{ |
3814 | - ScreenInfo *screen_info; |
3815 | - |
3816 | - TRACE ("entering clientGetButtonPixmap button=%i, state=%i", button, state); |
3817 | - screen_info = c->screen_info; |
3818 | - switch (button) |
3819 | - { |
3820 | - case MENU_BUTTON: |
3821 | - if ((screen_info->params->show_app_icon) |
3822 | - && (!xfwmPixmapNone(&c->appmenu[state]))) |
3823 | - { |
3824 | - return &c->appmenu[state]; |
3825 | - } |
3826 | - break; |
3827 | - case SHADE_BUTTON: |
3828 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED) |
3829 | - && (!xfwmPixmapNone(&screen_info->buttons[SHADE_BUTTON][state + STATE_TOGGLED]))) |
3830 | - { |
3831 | - return &screen_info->buttons[SHADE_BUTTON][state + STATE_TOGGLED]; |
3832 | - } |
3833 | - return &screen_info->buttons[SHADE_BUTTON][state]; |
3834 | - break; |
3835 | - case STICK_BUTTON: |
3836 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) |
3837 | - && (!xfwmPixmapNone(&screen_info->buttons[STICK_BUTTON][state + STATE_TOGGLED]))) |
3838 | - { |
3839 | - return &screen_info->buttons[STICK_BUTTON][state + STATE_TOGGLED]; |
3840 | - } |
3841 | - return &screen_info->buttons[STICK_BUTTON][state]; |
3842 | - break; |
3843 | - case MAXIMIZE_BUTTON: |
3844 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED) |
3845 | - && (!xfwmPixmapNone(&screen_info->buttons[MAXIMIZE_BUTTON][state + STATE_TOGGLED]))) |
3846 | - { |
3847 | - return &screen_info->buttons[MAXIMIZE_BUTTON][state + STATE_TOGGLED]; |
3848 | - } |
3849 | - return &screen_info->buttons[MAXIMIZE_BUTTON][state]; |
3850 | - break; |
3851 | - default: |
3852 | - break; |
3853 | - } |
3854 | - return &screen_info->buttons[button][state]; |
3855 | -} |
3856 | - |
3857 | -int |
3858 | -clientGetButtonState (Client *c, int button, int state) |
3859 | -{ |
3860 | - if (state == INACTIVE) |
3861 | - { |
3862 | - return (state); |
3863 | - } |
3864 | - |
3865 | - if ((c->button_status[button] == BUTTON_STATE_PRESSED) && |
3866 | - clientGetButtonPixmap (c, button, PRESSED)) |
3867 | - { |
3868 | - return (PRESSED); |
3869 | - } |
3870 | - |
3871 | - if ((c->button_status[button] == BUTTON_STATE_PRELIGHT) && |
3872 | - clientGetButtonPixmap (c, button, PRELIGHT)) |
3873 | - { |
3874 | - return (PRELIGHT); |
3875 | - } |
3876 | - |
3877 | - return (ACTIVE); |
3878 | -} |
3879 | - |
3880 | - |
3881 | -Client * |
3882 | -clientGetLeader (Client *c) |
3883 | -{ |
3884 | - TRACE ("entering clientGetLeader"); |
3885 | - g_return_val_if_fail (c != NULL, NULL); |
3886 | - |
3887 | - if (c->group_leader != None) |
3888 | - { |
3889 | - return myScreenGetClientFromWindow (c->screen_info, c->group_leader, SEARCH_WINDOW); |
3890 | - } |
3891 | - else if (c->client_leader != None) |
3892 | - { |
3893 | - return myScreenGetClientFromWindow (c->screen_info, c->client_leader, SEARCH_WINDOW); |
3894 | - } |
3895 | - return NULL; |
3896 | -} |
3897 | - |
3898 | -#ifdef HAVE_LIBSTARTUP_NOTIFICATION |
3899 | -char * |
3900 | -clientGetStartupId (Client *c) |
3901 | -{ |
3902 | - ScreenInfo *screen_info; |
3903 | - DisplayInfo *display_info; |
3904 | - gboolean got_startup_id; |
3905 | - |
3906 | - g_return_val_if_fail (c != NULL, NULL); |
3907 | - g_return_val_if_fail (c->window != None, NULL); |
3908 | - |
3909 | - screen_info = c->screen_info; |
3910 | - display_info = screen_info->display_info; |
3911 | - got_startup_id = FALSE; |
3912 | - |
3913 | - if (c->startup_id) |
3914 | - { |
3915 | - return (c->startup_id); |
3916 | - } |
3917 | - |
3918 | - got_startup_id = getWindowStartupId (display_info, c->window, &c->startup_id); |
3919 | - |
3920 | - if (!got_startup_id && (c->client_leader)) |
3921 | - { |
3922 | - got_startup_id = getWindowStartupId (display_info, c->client_leader, &c->startup_id); |
3923 | - } |
3924 | - |
3925 | - if (!got_startup_id && (c->group_leader)) |
3926 | - { |
3927 | - got_startup_id = getWindowStartupId (display_info, c->group_leader, &c->startup_id); |
3928 | - } |
3929 | - |
3930 | - return (c->startup_id); |
3931 | -} |
3932 | -#endif /* HAVE_LIBSTARTUP_NOTIFICATION */ |
3933 | |
3934 | === removed file '.pc/applied-patches' |
3935 | --- .pc/applied-patches 2014-01-19 20:02:51 +0000 |
3936 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
3937 | @@ -1,1 +0,0 @@ |
3938 | -8563.patch |
3939 | |
3940 | === modified file 'debian/changelog' |
3941 | --- debian/changelog 2014-01-19 20:02:51 +0000 |
3942 | +++ debian/changelog 2014-03-01 19:23:47 +0000 |
3943 | @@ -1,3 +1,22 @@ |
3944 | +xfwm4 (4.11.1-2ubuntu1) trusty; urgency=medium |
3945 | + |
3946 | + * Drop all existing ubuntu changes, fixed in debian |
3947 | + * Add -DMONITOR_ROOT_PIXMAP to CFLAGS for xubuntu seamless greeter |
3948 | + to desktop transition. LP: #1232804 |
3949 | + |
3950 | + -- Jackson Doak <noskcaj@ubuntu.com> Sat, 01 Mar 2014 19:27:21 +1100 |
3951 | + |
3952 | +xfwm4 (4.11.1-2) experimental; urgency=medium |
3953 | + |
3954 | + [ Mateusz Ĺukasik ] |
3955 | + * debian/control: |
3956 | + - demote xfwm4-themes to Suggests. |
3957 | + * debian/patches: |
3958 | + - 0001-fix-fullscreen-qt4-behavior-bug-8563 added to fix fullscreen |
3959 | + behavior with Qt4 based apps |
3960 | + |
3961 | + -- Yves-Alexis Perez <corsac@debian.org> Fri, 28 Feb 2014 21:50:20 +0100 |
3962 | + |
3963 | xfwm4 (4.11.1-1ubuntu1) trusty; urgency=medium |
3964 | |
3965 | * Merge from Debian unstable. Remaining changes: |
3966 | |
3967 | === added file 'debian/patches/0001-fix-fullscreen-qt4-behavior-bug-8563.patch' |
3968 | --- debian/patches/0001-fix-fullscreen-qt4-behavior-bug-8563.patch 1970-01-01 00:00:00 +0000 |
3969 | +++ debian/patches/0001-fix-fullscreen-qt4-behavior-bug-8563.patch 2014-03-01 19:23:47 +0000 |
3970 | @@ -0,0 +1,50 @@ |
3971 | +Description: Fix fullscreen behavior in Qt based apps |
3972 | +Origin: https://bugzilla.xfce.org/show_bug.cgi?id=8563 |
3973 | +Forwarded: yes |
3974 | +Author: Viktor Semykin |
3975 | + |
3976 | +--- |
3977 | + src/client.c | 16 ++++++++++------ |
3978 | + 1 file changed, 10 insertions(+), 6 deletions(-) |
3979 | + |
3980 | +--- a/src/client.c |
3981 | ++++ b/src/client.c |
3982 | +@@ -981,8 +981,12 @@ clientGetMWMHints (Client *c, gboolean u |
3983 | + wc.width = c->width; |
3984 | + wc.height = c->height; |
3985 | + |
3986 | ++ if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
3987 | ++ { |
3988 | ++ clientUpdateFullscreenSize (c); |
3989 | ++ } |
3990 | + /* If client is maximized, we need to update its coordonates and size as well */ |
3991 | +- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3992 | ++ else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
3993 | + { |
3994 | + GdkRectangle rect; |
3995 | + myScreenFindMonitorAtPoint (screen_info, |
3996 | +@@ -3538,8 +3542,12 @@ clientScreenResize(ScreenInfo *screen_in |
3997 | + continue; |
3998 | + } |
3999 | + |
4000 | ++ if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4001 | ++ { |
4002 | ++ clientUpdateFullscreenSize (c); |
4003 | ++ } |
4004 | + /* Recompute size and position of maximized windows */ |
4005 | +- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4006 | ++ else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4007 | + { |
4008 | + maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED; |
4009 | + |
4010 | +@@ -3553,10 +3561,6 @@ clientScreenResize(ScreenInfo *screen_in |
4011 | + wc.height = c->height; |
4012 | + clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_NOTIFY); |
4013 | + } |
4014 | +- else if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4015 | +- { |
4016 | +- clientUpdateFullscreenSize (c); |
4017 | +- } |
4018 | + else |
4019 | + { |
4020 | + configure_flags = CFG_CONSTRAINED | CFG_REQUEST; |
4021 | |
4022 | === removed file 'debian/patches/8563.patch' |
4023 | --- debian/patches/8563.patch 2014-01-19 20:02:51 +0000 |
4024 | +++ debian/patches/8563.patch 1970-01-01 00:00:00 +0000 |
4025 | @@ -1,50 +0,0 @@ |
4026 | -Description: Fix fullscreen behavior in Qt based apps |
4027 | -Origin: https://bugzilla.xfce.org/show_bug.cgi?id=8563 |
4028 | -Forwarded: yes |
4029 | -Author: Viktor Semykin |
4030 | - |
4031 | ---- |
4032 | - src/client.c | 16 ++++++++++------ |
4033 | - 1 file changed, 10 insertions(+), 6 deletions(-) |
4034 | - |
4035 | ---- a/src/client.c |
4036 | -+++ b/src/client.c |
4037 | -@@ -981,8 +981,12 @@ clientGetMWMHints (Client *c, gboolean u |
4038 | - wc.width = c->width; |
4039 | - wc.height = c->height; |
4040 | - |
4041 | -+ if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4042 | -+ { |
4043 | -+ clientUpdateFullscreenSize (c); |
4044 | -+ } |
4045 | - /* If client is maximized, we need to update its coordonates and size as well */ |
4046 | -- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4047 | -+ else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4048 | - { |
4049 | - GdkRectangle rect; |
4050 | - myScreenFindMonitorAtPoint (screen_info, |
4051 | -@@ -3538,8 +3542,12 @@ clientScreenResize(ScreenInfo *screen_in |
4052 | - continue; |
4053 | - } |
4054 | - |
4055 | -+ if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4056 | -+ { |
4057 | -+ clientUpdateFullscreenSize (c); |
4058 | -+ } |
4059 | - /* Recompute size and position of maximized windows */ |
4060 | -- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4061 | -+ else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4062 | - { |
4063 | - maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED; |
4064 | - |
4065 | -@@ -3553,10 +3561,6 @@ clientScreenResize(ScreenInfo *screen_in |
4066 | - wc.height = c->height; |
4067 | - clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_NOTIFY); |
4068 | - } |
4069 | -- else if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4070 | -- { |
4071 | -- clientUpdateFullscreenSize (c); |
4072 | -- } |
4073 | - else |
4074 | - { |
4075 | - configure_flags = CFG_CONSTRAINED | CFG_REQUEST; |
4076 | |
4077 | === modified file 'debian/patches/series' |
4078 | --- debian/patches/series 2014-01-19 20:02:51 +0000 |
4079 | +++ debian/patches/series 2014-03-01 19:23:47 +0000 |
4080 | @@ -1,1 +1,1 @@ |
4081 | -8563.patch |
4082 | +0001-fix-fullscreen-qt4-behavior-bug-8563.patch |
4083 | |
4084 | === modified file 'debian/rules' |
4085 | --- debian/rules 2013-09-28 06:17:39 +0000 |
4086 | +++ debian/rules 2014-03-01 19:23:47 +0000 |
4087 | @@ -2,6 +2,7 @@ |
4088 | |
4089 | export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed -Wl,-O1 -Wl,-z,defs |
4090 | export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
4091 | +export DEB_CFLAGS_MAINT_APPEND=-DMONITOR_ROOT_PIXMAP |
4092 | |
4093 | override_dh_strip: |
4094 | dh_strip --dbg-package=xfwm4-dbg |
4095 | |
4096 | === modified file 'src/client.c' |
4097 | --- src/client.c 2013-12-03 15:24:16 +0000 |
4098 | +++ src/client.c 2014-03-01 19:23:47 +0000 |
4099 | @@ -981,12 +981,8 @@ |
4100 | wc.width = c->width; |
4101 | wc.height = c->height; |
4102 | |
4103 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4104 | - { |
4105 | - clientUpdateFullscreenSize (c); |
4106 | - } |
4107 | /* If client is maximized, we need to update its coordonates and size as well */ |
4108 | - else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4109 | + if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4110 | { |
4111 | GdkRectangle rect; |
4112 | myScreenFindMonitorAtPoint (screen_info, |
4113 | @@ -3542,12 +3538,8 @@ |
4114 | continue; |
4115 | } |
4116 | |
4117 | - if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4118 | - { |
4119 | - clientUpdateFullscreenSize (c); |
4120 | - } |
4121 | /* Recompute size and position of maximized windows */ |
4122 | - else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4123 | + if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)) |
4124 | { |
4125 | maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED; |
4126 | |
4127 | @@ -3561,6 +3553,10 @@ |
4128 | wc.height = c->height; |
4129 | clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_NOTIFY); |
4130 | } |
4131 | + else if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)) |
4132 | + { |
4133 | + clientUpdateFullscreenSize (c); |
4134 | + } |
4135 | else |
4136 | { |
4137 | configure_flags = CFG_CONSTRAINED | CFG_REQUEST; |
I took the liberty to replace CFLAGS to CPPFLAGS (since defines are taken care of by the preprocessor), and uploaded. Thanks.