Merge lp:~focus-follows-mouse/ubuntu/precise/compiz/fix-883383 into lp:ubuntu/precise/compiz
- Precise (12.04)
- fix-883383
- Merge into precise
Proposed by
James Pharaoh
Status: | Work in progress |
---|---|
Proposed branch: | lp:~focus-follows-mouse/ubuntu/precise/compiz/fix-883383 |
Merge into: | lp:ubuntu/precise/compiz |
Diff against target: |
4406 lines (+4227/-2) 19 files modified
.pc/.quilt_patches (+1/-0) .pc/.quilt_series (+1/-0) .pc/applied-patches (+2/-0) .pc/fix-881329.patch/plugins/move/src/move.cpp (+756/-0) .pc/fix-881329.patch/plugins/move/src/move.h (+135/-0) .pc/fix-883383.patch/unity/unity_window_decorator/src/events.c (+1146/-0) .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.c (+443/-0) .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.h (+1009/-0) .pc/fix-883383.patch/unity/unity_window_decorator/src/settings.c (+567/-0) debian/changelog (+9/-0) debian/patches/fix-881329.patch (+49/-0) debian/patches/fix-883383.patch (+77/-0) debian/patches/series (+2/-0) plugins/move/src/move.cpp (+10/-1) plugins/move/src/move.h (+2/-0) unity/unity_window_decorator/src/events.c (+2/-1) unity/unity_window_decorator/src/gtk-window-decorator.c (+2/-0) unity/unity_window_decorator/src/gtk-window-decorator.h (+5/-0) unity/unity_window_decorator/src/settings.c (+9/-0) |
To merge this branch: | bzr merge lp:~focus-follows-mouse/ubuntu/precise/compiz/fix-883383 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Pending | ||
Ubuntu branches | Pending | ||
Review via email: mp+80727@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Stéphane Graber (stgraber) wrote : | # |
Based on comment above, marking work in progress.
Unmerged revisions
- 254. By James Pharaoh
-
* debian/
patches/ fix-883383. patch:
- Drag title bar should not raise if raise-on-click is disabled (LP: #883383) - 253. By James Pharaoh
-
* debian/
patches/ fix-881329. patch:
- Alt+click should raise with raise-on-click disabled (LP: #881329)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file '.pc/.quilt_patches' |
2 | --- .pc/.quilt_patches 1970-01-01 00:00:00 +0000 |
3 | +++ .pc/.quilt_patches 2011-10-29 09:07:25 +0000 |
4 | @@ -0,0 +1,1 @@ |
5 | +debian/patches |
6 | |
7 | === added file '.pc/.quilt_series' |
8 | --- .pc/.quilt_series 1970-01-01 00:00:00 +0000 |
9 | +++ .pc/.quilt_series 2011-10-29 09:07:25 +0000 |
10 | @@ -0,0 +1,1 @@ |
11 | +series |
12 | |
13 | === modified file '.pc/applied-patches' |
14 | --- .pc/applied-patches 2011-10-12 10:44:49 +0000 |
15 | +++ .pc/applied-patches 2011-10-29 09:07:25 +0000 |
16 | @@ -12,3 +12,5 @@ |
17 | fix-832150.patch |
18 | fix-864478.patch |
19 | fix-864330.patch |
20 | +fix-881329.patch |
21 | +fix-883383.patch |
22 | |
23 | === added directory '.pc/fix-881329.patch' |
24 | === added file '.pc/fix-881329.patch/.timestamp' |
25 | === added directory '.pc/fix-881329.patch/plugins' |
26 | === added directory '.pc/fix-881329.patch/plugins/move' |
27 | === added directory '.pc/fix-881329.patch/plugins/move/src' |
28 | === added file '.pc/fix-881329.patch/plugins/move/src/move.cpp' |
29 | --- .pc/fix-881329.patch/plugins/move/src/move.cpp 1970-01-01 00:00:00 +0000 |
30 | +++ .pc/fix-881329.patch/plugins/move/src/move.cpp 2011-10-29 09:07:25 +0000 |
31 | @@ -0,0 +1,756 @@ |
32 | +/* |
33 | + * Copyright © 2005 Novell, Inc. |
34 | + * |
35 | + * Permission to use, copy, modify, distribute, and sell this software |
36 | + * and its documentation for any purpose is hereby granted without |
37 | + * fee, provided that the above copyright notice appear in all copies |
38 | + * and that both that copyright notice and this permission notice |
39 | + * appear in supporting documentation, and that the name of |
40 | + * Novell, Inc. not be used in advertising or publicity pertaining to |
41 | + * distribution of the software without specific, written prior permission. |
42 | + * Novell, Inc. makes no representations about the suitability of this |
43 | + * software for any purpose. It is provided "as is" without express or |
44 | + * implied warranty. |
45 | + * |
46 | + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
47 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
48 | + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
49 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
50 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
51 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
52 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
53 | + * |
54 | + * Author: David Reveman <davidr@novell.com> |
55 | + */ |
56 | + |
57 | +#include <stdio.h> |
58 | +#include <stdlib.h> |
59 | +#include <string.h> |
60 | + |
61 | +#include <X11/cursorfont.h> |
62 | + |
63 | +#include <core/atoms.h> |
64 | +#include "move.h" |
65 | + |
66 | +COMPIZ_PLUGIN_20090315 (move, MovePluginVTable) |
67 | + |
68 | +static bool |
69 | +moveInitiate (CompAction *action, |
70 | + CompAction::State state, |
71 | + CompOption::Vector &options) |
72 | +{ |
73 | + CompWindow *w; |
74 | + Window xid; |
75 | + |
76 | + MOVE_SCREEN (screen); |
77 | + |
78 | + xid = CompOption::getIntOptionNamed (options, "window"); |
79 | + |
80 | + w = screen->findWindow (xid); |
81 | + if (w && (w->actions () & CompWindowActionMoveMask)) |
82 | + { |
83 | + CompRect workArea; |
84 | + unsigned int mods; |
85 | + int x, y, button; |
86 | + bool sourceExternalApp; |
87 | + |
88 | + CompScreen *s = screen; |
89 | + |
90 | + mods = CompOption::getIntOptionNamed (options, "modifiers", 0); |
91 | + |
92 | + x = CompOption::getIntOptionNamed (options, "x", w->geometry ().x () + |
93 | + (w->size ().width () / 2)); |
94 | + y = CompOption::getIntOptionNamed (options, "y", w->geometry ().y () + |
95 | + (w->size ().height () / 2)); |
96 | + |
97 | + button = CompOption::getIntOptionNamed (options, "button", -1); |
98 | + |
99 | + if (s->otherGrabExist ("move", NULL)) |
100 | + return false; |
101 | + |
102 | + if (ms->w) |
103 | + return false; |
104 | + |
105 | + if (w->type () & (CompWindowTypeDesktopMask | |
106 | + CompWindowTypeDockMask | |
107 | + CompWindowTypeFullscreenMask)) |
108 | + return false; |
109 | + |
110 | + if (w->overrideRedirect ()) |
111 | + return false; |
112 | + |
113 | + if (state & CompAction::StateInitButton) |
114 | + action->setState (action->state () | CompAction::StateTermButton); |
115 | + |
116 | + if (ms->region) |
117 | + { |
118 | + XDestroyRegion (ms->region); |
119 | + ms->region = NULL; |
120 | + } |
121 | + |
122 | + ms->status = RectangleOut; |
123 | + |
124 | + ms->savedX = w->serverGeometry ().x (); |
125 | + ms->savedY = w->serverGeometry ().y (); |
126 | + |
127 | + ms->x = 0; |
128 | + ms->y = 0; |
129 | + |
130 | + lastPointerX = x; |
131 | + lastPointerY = y; |
132 | + |
133 | + sourceExternalApp = |
134 | + CompOption::getBoolOptionNamed (options, "external", false); |
135 | + ms->yConstrained = sourceExternalApp && ms->optionGetConstrainY (); |
136 | + |
137 | + ms->origState = w->state (); |
138 | + |
139 | + workArea = s->getWorkareaForOutput (w->outputDevice ()); |
140 | + |
141 | + ms->snapBackY = w->serverGeometry ().y () - workArea.y (); |
142 | + ms->snapOffY = y - workArea.y (); |
143 | + |
144 | + if (!ms->grab) |
145 | + ms->grab = s->pushGrab (ms->moveCursor, "move"); |
146 | + |
147 | + if (ms->grab) |
148 | + { |
149 | + unsigned int grabMask = CompWindowGrabMoveMask | |
150 | + CompWindowGrabButtonMask; |
151 | + |
152 | + if (sourceExternalApp) |
153 | + grabMask |= CompWindowGrabExternalAppMask; |
154 | + |
155 | + ms->w = w; |
156 | + |
157 | + ms->releaseButton = button; |
158 | + |
159 | + w->grabNotify (x, y, mods, grabMask); |
160 | + |
161 | + /* Click raise happens implicitly on buttons 1, 2 and 3 so don't |
162 | + * restack this window again if the action buttonbinding was from |
163 | + * one of those buttons */ |
164 | + if (screen->getOption ("raise_on_click")->value ().b () && |
165 | + button != Button1 && button != Button2 && button != Button3) |
166 | + w->updateAttributes (CompStackingUpdateModeAboveFullscreen); |
167 | + |
168 | + if (state & CompAction::StateInitKey) |
169 | + { |
170 | + int xRoot, yRoot; |
171 | + |
172 | + xRoot = w->geometry ().x () + (w->size ().width () / 2); |
173 | + yRoot = w->geometry ().y () + (w->size ().height () / 2); |
174 | + |
175 | + s->warpPointer (xRoot - pointerX, yRoot - pointerY); |
176 | + } |
177 | + |
178 | + if (ms->moveOpacity != OPAQUE) |
179 | + { |
180 | + MOVE_WINDOW (w); |
181 | + |
182 | + if (mw->cWindow) |
183 | + mw->cWindow->addDamage (); |
184 | + if (mw->gWindow) |
185 | + mw->gWindow->glPaintSetEnabled (mw, true); |
186 | + } |
187 | + } |
188 | + } |
189 | + |
190 | + return false; |
191 | +} |
192 | + |
193 | +static bool |
194 | +moveTerminate (CompAction *action, |
195 | + CompAction::State state, |
196 | + CompOption::Vector &options) |
197 | +{ |
198 | + MOVE_SCREEN (screen); |
199 | + |
200 | + if (ms->w) |
201 | + { |
202 | + if (state & CompAction::StateCancel) |
203 | + ms->w->move (ms->savedX - ms->w->geometry ().x (), |
204 | + ms->savedY - ms->w->geometry ().y (), false); |
205 | + |
206 | + ms->w->syncPosition (); |
207 | + |
208 | + /* update window attributes as window constraints may have |
209 | + changed - needed e.g. if a maximized window was moved |
210 | + to another output device */ |
211 | + ms->w->updateAttributes (CompStackingUpdateModeNone); |
212 | + |
213 | + ms->w->ungrabNotify (); |
214 | + |
215 | + if (ms->grab) |
216 | + { |
217 | + screen->removeGrab (ms->grab, NULL); |
218 | + ms->grab = NULL; |
219 | + } |
220 | + |
221 | + if (ms->moveOpacity != OPAQUE) |
222 | + { |
223 | + MOVE_WINDOW (ms->w); |
224 | + |
225 | + if (mw->cWindow) |
226 | + mw->cWindow->addDamage (); |
227 | + if (mw->gWindow) |
228 | + mw->gWindow->glPaintSetEnabled (mw, false); |
229 | + } |
230 | + |
231 | + ms->w = 0; |
232 | + ms->releaseButton = 0; |
233 | + } |
234 | + |
235 | + action->setState (action->state () & ~(CompAction::StateTermKey | |
236 | + CompAction::StateTermButton)); |
237 | + |
238 | + return false; |
239 | +} |
240 | + |
241 | +/* creates a region containing top and bottom struts. only struts that are |
242 | + outside the screen workarea are considered. */ |
243 | +static Region |
244 | +moveGetYConstrainRegion (CompScreen *s) |
245 | +{ |
246 | + CompWindow *w; |
247 | + Region region; |
248 | + REGION r; |
249 | + CompRect workArea; |
250 | + BoxRec extents; |
251 | + unsigned int i; |
252 | + |
253 | + region = XCreateRegion (); |
254 | + if (!region) |
255 | + return NULL; |
256 | + |
257 | + r.rects = &r.extents; |
258 | + r.numRects = r.size = 1; |
259 | + |
260 | + r.extents.x1 = MINSHORT; |
261 | + r.extents.y1 = 0; |
262 | + r.extents.x2 = 0; |
263 | + r.extents.y2 = s->height (); |
264 | + |
265 | + XUnionRegion (&r, region, region); |
266 | + |
267 | + r.extents.x1 = s->width (); |
268 | + r.extents.x2 = MAXSHORT; |
269 | + |
270 | + XUnionRegion (&r, region, region); |
271 | + |
272 | + for (i = 0; i < s->outputDevs ().size (); i++) |
273 | + { |
274 | + XUnionRegion (s->outputDevs ()[i].region (), region, region); |
275 | + |
276 | + workArea = s->getWorkareaForOutput (i); |
277 | + extents = s->outputDevs ()[i].region ()->extents; |
278 | + |
279 | + foreach (w, s->windows ()) |
280 | + { |
281 | + if (!w->mapNum ()) |
282 | + continue; |
283 | + |
284 | + if (w->struts ()) |
285 | + { |
286 | + r.extents.x1 = w->struts ()->top.x; |
287 | + r.extents.y1 = w->struts ()->top.y; |
288 | + r.extents.x2 = r.extents.x1 + w->struts ()->top.width; |
289 | + r.extents.y2 = r.extents.y1 + w->struts ()->top.height; |
290 | + |
291 | + if (r.extents.x1 < extents.x1) |
292 | + r.extents.x1 = extents.x1; |
293 | + if (r.extents.x2 > extents.x2) |
294 | + r.extents.x2 = extents.x2; |
295 | + if (r.extents.y1 < extents.y1) |
296 | + r.extents.y1 = extents.y1; |
297 | + if (r.extents.y2 > extents.y2) |
298 | + r.extents.y2 = extents.y2; |
299 | + |
300 | + if (r.extents.x1 < r.extents.x2 && r.extents.y1 < r.extents.y2) |
301 | + { |
302 | + if (r.extents.y2 <= workArea.y ()) |
303 | + XSubtractRegion (region, &r, region); |
304 | + } |
305 | + |
306 | + r.extents.x1 = w->struts ()->bottom.x; |
307 | + r.extents.y1 = w->struts ()->bottom.y; |
308 | + r.extents.x2 = r.extents.x1 + w->struts ()->bottom.width; |
309 | + r.extents.y2 = r.extents.y1 + w->struts ()->bottom.height; |
310 | + |
311 | + if (r.extents.x1 < extents.x1) |
312 | + r.extents.x1 = extents.x1; |
313 | + if (r.extents.x2 > extents.x2) |
314 | + r.extents.x2 = extents.x2; |
315 | + if (r.extents.y1 < extents.y1) |
316 | + r.extents.y1 = extents.y1; |
317 | + if (r.extents.y2 > extents.y2) |
318 | + r.extents.y2 = extents.y2; |
319 | + |
320 | + if (r.extents.x1 < r.extents.x2 && r.extents.y1 < r.extents.y2) |
321 | + { |
322 | + if (r.extents.y1 >= workArea.bottom ()) |
323 | + XSubtractRegion (region, &r, region); |
324 | + } |
325 | + } |
326 | + } |
327 | + } |
328 | + |
329 | + return region; |
330 | +} |
331 | + |
332 | +static void |
333 | +moveHandleMotionEvent (CompScreen *s, |
334 | + int xRoot, |
335 | + int yRoot) |
336 | +{ |
337 | + MOVE_SCREEN (s); |
338 | + |
339 | + if (ms->grab) |
340 | + { |
341 | + int dx, dy; |
342 | + int wX, wY; |
343 | + int wWidth, wHeight; |
344 | + CompWindow *w; |
345 | + |
346 | + w = ms->w; |
347 | + |
348 | + wX = w->geometry ().x (); |
349 | + wY = w->geometry ().y (); |
350 | + wWidth = w->geometry ().width () + |
351 | + w->geometry ().border () * 2; |
352 | + wHeight = w->geometry ().height () + |
353 | + w->geometry ().border () * 2; |
354 | + |
355 | + ms->x += xRoot - lastPointerX; |
356 | + ms->y += yRoot - lastPointerY; |
357 | + |
358 | + if (w->type () & CompWindowTypeFullscreenMask) |
359 | + { |
360 | + dx = dy = 0; |
361 | + } |
362 | + else |
363 | + { |
364 | + CompRect workArea; |
365 | + int min, max; |
366 | + |
367 | + dx = ms->x; |
368 | + dy = ms->y; |
369 | + |
370 | + workArea = s->getWorkareaForOutput (w->outputDevice ()); |
371 | + |
372 | + if (ms->yConstrained) |
373 | + { |
374 | + if (!ms->region) |
375 | + ms->region = moveGetYConstrainRegion (s); |
376 | + |
377 | + /* make sure that the top border extents or the top row of |
378 | + pixels are within what is currently our valid screen |
379 | + region */ |
380 | + if (ms->region) |
381 | + { |
382 | + int x, y, width, height; |
383 | + int status; |
384 | + |
385 | + x = wX + dx - w->border ().left; |
386 | + y = wY + dy - w->border ().top; |
387 | + width = wWidth + w->border ().left + w->border ().right; |
388 | + height = w->border ().top ? w->border ().top : 1; |
389 | + |
390 | + status = XRectInRegion (ms->region, x, y, |
391 | + (unsigned int) width, |
392 | + (unsigned int) height); |
393 | + |
394 | + /* only constrain movement if previous position was valid */ |
395 | + if (ms->status == RectangleIn) |
396 | + { |
397 | + int xStatus = status; |
398 | + |
399 | + while (dx && xStatus != RectangleIn) |
400 | + { |
401 | + xStatus = XRectInRegion (ms->region, |
402 | + x, y - dy, |
403 | + (unsigned int) width, |
404 | + (unsigned int) height); |
405 | + |
406 | + if (xStatus != RectangleIn) |
407 | + dx += (dx < 0) ? 1 : -1; |
408 | + |
409 | + x = wX + dx - w->border ().left; |
410 | + } |
411 | + |
412 | + while (dy && status != RectangleIn) |
413 | + { |
414 | + status = XRectInRegion (ms->region, |
415 | + x, y, |
416 | + (unsigned int) width, |
417 | + (unsigned int) height); |
418 | + |
419 | + if (status != RectangleIn) |
420 | + dy += (dy < 0) ? 1 : -1; |
421 | + |
422 | + y = wY + dy - w->border ().top; |
423 | + } |
424 | + } |
425 | + else |
426 | + { |
427 | + ms->status = status; |
428 | + } |
429 | + } |
430 | + } |
431 | + |
432 | + if (ms->optionGetSnapoffMaximized ()) |
433 | + { |
434 | + if (w->state () & CompWindowStateMaximizedVertMask) |
435 | + { |
436 | + if (abs (yRoot - workArea.y () - ms->snapOffY) >= SNAP_OFF) |
437 | + { |
438 | + if (!s->otherGrabExist ("move", NULL)) |
439 | + { |
440 | + int width = w->serverGeometry ().width (); |
441 | + |
442 | + w->saveMask () |= CWX | CWY; |
443 | + |
444 | + if (w->saveMask ()& CWWidth) |
445 | + width = w->saveWc ().width; |
446 | + |
447 | + w->saveWc ().x = xRoot - (width >> 1); |
448 | + w->saveWc ().y = yRoot + (w->border ().top >> 1); |
449 | + |
450 | + ms->x = ms->y = 0; |
451 | + |
452 | + w->maximize (0); |
453 | + |
454 | + ms->snapOffY = ms->snapBackY; |
455 | + |
456 | + return; |
457 | + } |
458 | + } |
459 | + } |
460 | + else if (ms->origState & CompWindowStateMaximizedVertMask) |
461 | + { |
462 | + if (abs (yRoot - workArea.y () - ms->snapBackY) < SNAP_BACK) |
463 | + { |
464 | + if (!s->otherGrabExist ("move", NULL)) |
465 | + { |
466 | + int wy; |
467 | + |
468 | + /* update server position before maximizing |
469 | + window again so that it is maximized on |
470 | + correct output */ |
471 | + w->syncPosition (); |
472 | + |
473 | + w->maximize (ms->origState); |
474 | + |
475 | + wy = workArea.y () + (w->border ().top >> 1); |
476 | + wy += w->sizeHints ().height_inc >> 1; |
477 | + |
478 | + s->warpPointer (0, wy - pointerY); |
479 | + |
480 | + return; |
481 | + } |
482 | + } |
483 | + } |
484 | + } |
485 | + |
486 | + if (w->state () & CompWindowStateMaximizedVertMask) |
487 | + { |
488 | + min = workArea.y () + w->border ().top; |
489 | + max = workArea.bottom () - w->border ().bottom - wHeight; |
490 | + |
491 | + if (wY + dy < min) |
492 | + dy = min - wY; |
493 | + else if (wY + dy > max) |
494 | + dy = max - wY; |
495 | + } |
496 | + |
497 | + if (w->state () & CompWindowStateMaximizedHorzMask) |
498 | + { |
499 | + if (wX > (int) s->width () || |
500 | + wX + w->size ().width () < 0) |
501 | + return; |
502 | + |
503 | + if (wX + wWidth < 0) |
504 | + return; |
505 | + |
506 | + min = workArea.x () + w->border ().left; |
507 | + max = workArea.right () - w->border ().right - wWidth; |
508 | + |
509 | + if (wX + dx < min) |
510 | + dx = min - wX; |
511 | + else if (wX + dx > max) |
512 | + dx = max - wX; |
513 | + } |
514 | + } |
515 | + |
516 | + if (dx || dy) |
517 | + { |
518 | + w->move (wX + dx - w->geometry ().x (), |
519 | + wY + dy - w->geometry ().y (), false); |
520 | + |
521 | + if (ms->optionGetLazyPositioning () && |
522 | + ms->hasCompositing && |
523 | + !MoveWindow::get (ms->w)->mLocked) |
524 | + { |
525 | + /* FIXME: This form of lazy positioning is broken and should |
526 | + be replaced asap. Current code exists just to avoid a |
527 | + major performance regression in the 0.5.2 release. */ |
528 | + w->serverGeometry ().setX (w->geometry ().x ()); |
529 | + w->serverGeometry ().setY (w->geometry ().y ()); |
530 | + } |
531 | + else |
532 | + { |
533 | + w->syncPosition (); |
534 | + } |
535 | + |
536 | + ms->x -= dx; |
537 | + ms->y -= dy; |
538 | + } |
539 | + } |
540 | +} |
541 | + |
542 | +/* FIXME: This is a hack to prevent a race condition |
543 | + * when core is processing ConfigureNotify events. It |
544 | + * MUST be removed after 0.9.6 when we can break ABI |
545 | + * and do lazy positioning correctly ! */ |
546 | + |
547 | +void |
548 | +MoveScreen::handleCompizEvent (const char *plugin, const char *event, CompOption::Vector &options) |
549 | +{ |
550 | + if (w) |
551 | + { |
552 | + if (std::string ("core") == std::string (plugin)) |
553 | + { |
554 | + if (std::string ("lock_position") == std::string (event)) |
555 | + { |
556 | + Window xid = CompOption::getIntOptionNamed (options, "window", 0); |
557 | + int lock = CompOption::getIntOptionNamed (options, "active", 0); |
558 | + |
559 | + if (xid == ROOTPARENT (w)) |
560 | + MoveWindow::get (w)->mLocked = lock ? true : false; |
561 | + } |
562 | + } |
563 | + } |
564 | + |
565 | + screen->handleCompizEvent (plugin, event, options); |
566 | +} |
567 | + |
568 | +void |
569 | +MoveScreen::handleEvent (XEvent *event) |
570 | +{ |
571 | + switch (event->type) { |
572 | + case ButtonPress: |
573 | + case ButtonRelease: |
574 | + if (event->xbutton.root == screen->root ()) |
575 | + { |
576 | + if (grab) |
577 | + { |
578 | + if (releaseButton == -1 || |
579 | + releaseButton == (int) event->xbutton.button) |
580 | + { |
581 | + moveTerminate (&optionGetInitiateButton (), |
582 | + CompAction::StateTermButton, |
583 | + noOptions); |
584 | + } |
585 | + } |
586 | + } |
587 | + break; |
588 | + case KeyPress: |
589 | + if (event->xkey.root == screen->root ()) |
590 | + { |
591 | + if (grab) |
592 | + { |
593 | + unsigned int i; |
594 | + |
595 | + for (i = 0; i < NUM_KEYS; i++) |
596 | + { |
597 | + if (event->xkey.keycode == key[i]) |
598 | + { |
599 | + XWarpPointer (screen->dpy (), None, None, |
600 | + 0, 0, 0, 0, |
601 | + mKeys[i].dx * KEY_MOVE_INC, |
602 | + mKeys[i].dy * KEY_MOVE_INC); |
603 | + break; |
604 | + } |
605 | + } |
606 | + } |
607 | + } |
608 | + break; |
609 | + case MotionNotify: |
610 | + if (event->xmotion.root == screen->root ()) |
611 | + moveHandleMotionEvent (screen, pointerX, pointerY); |
612 | + break; |
613 | + case EnterNotify: |
614 | + case LeaveNotify: |
615 | + if (event->xcrossing.root == screen->root ()) |
616 | + moveHandleMotionEvent (screen, pointerX, pointerY); |
617 | + break; |
618 | + case ClientMessage: |
619 | + if (event->xclient.message_type == Atoms::wmMoveResize) |
620 | + { |
621 | + CompWindow *w; |
622 | + unsigned long type = (unsigned long) event->xclient.data.l[2]; |
623 | + |
624 | + MOVE_SCREEN (screen); |
625 | + |
626 | + if (type == WmMoveResizeMove || |
627 | + type == WmMoveResizeMoveKeyboard) |
628 | + { |
629 | + w = screen->findWindow (event->xclient.window); |
630 | + if (w) |
631 | + { |
632 | + CompOption::Vector o; |
633 | + |
634 | + o.push_back (CompOption ("window", CompOption::TypeInt)); |
635 | + o[0].value ().set ((int) event->xclient.window); |
636 | + |
637 | + o.push_back (CompOption ("external", |
638 | + CompOption::TypeBool)); |
639 | + o[1].value ().set (true); |
640 | + |
641 | + if (event->xclient.data.l[2] == WmMoveResizeMoveKeyboard) |
642 | + { |
643 | + moveInitiate (&optionGetInitiateKey (), |
644 | + CompAction::StateInitKey, o); |
645 | + } |
646 | + else |
647 | + { |
648 | + |
649 | + /* TODO: not only button 1 */ |
650 | + if (pointerMods & Button1Mask) |
651 | + { |
652 | + o.push_back (CompOption ("modifiers", CompOption::TypeInt)); |
653 | + o[2].value ().set ((int) pointerMods); |
654 | + |
655 | + o.push_back (CompOption ("x", CompOption::TypeInt)); |
656 | + o[3].value ().set ((int) event->xclient.data.l[0]); |
657 | + |
658 | + o.push_back (CompOption ("y", CompOption::TypeInt)); |
659 | + o[4].value ().set ((int) event->xclient.data.l[1]); |
660 | + |
661 | + o.push_back (CompOption ("button", CompOption::TypeInt)); |
662 | + o[5].value ().set ((int) (event->xclient.data.l[3] ? |
663 | + event->xclient.data.l[3] : -1)); |
664 | + |
665 | + moveInitiate (&optionGetInitiateButton (), |
666 | + CompAction::StateInitButton, o); |
667 | + |
668 | + moveHandleMotionEvent (screen, pointerX, pointerY); |
669 | + } |
670 | + } |
671 | + } |
672 | + } |
673 | + else if (ms->w && type == WmMoveResizeCancel) |
674 | + { |
675 | + if (ms->w->id () == event->xclient.window) |
676 | + { |
677 | + moveTerminate (&optionGetInitiateButton (), |
678 | + CompAction::StateCancel, noOptions); |
679 | + moveTerminate (&optionGetInitiateKey (), |
680 | + CompAction::StateCancel, noOptions); |
681 | + |
682 | + } |
683 | + } |
684 | + } |
685 | + break; |
686 | + case DestroyNotify: |
687 | + if (w && w->id () == event->xdestroywindow.window) |
688 | + { |
689 | + moveTerminate (&optionGetInitiateButton (), 0, noOptions); |
690 | + moveTerminate (&optionGetInitiateKey (), 0, noOptions); |
691 | + } |
692 | + break; |
693 | + case UnmapNotify: |
694 | + if (w && w->id () == event->xunmap.window) |
695 | + { |
696 | + moveTerminate (&optionGetInitiateButton (), 0, noOptions); |
697 | + moveTerminate (&optionGetInitiateKey (), 0, noOptions); |
698 | + } |
699 | + default: |
700 | + break; |
701 | + } |
702 | + |
703 | + screen->handleEvent (event); |
704 | +} |
705 | + |
706 | +bool |
707 | +MoveWindow::glPaint (const GLWindowPaintAttrib &attrib, |
708 | + const GLMatrix &transform, |
709 | + const CompRegion ®ion, |
710 | + unsigned int mask) |
711 | +{ |
712 | + GLWindowPaintAttrib sAttrib = attrib; |
713 | + bool status; |
714 | + |
715 | + MOVE_SCREEN (screen); |
716 | + |
717 | + if (ms->grab) |
718 | + { |
719 | + if (ms->w == window && ms->moveOpacity != OPAQUE) |
720 | + { |
721 | + /* modify opacity of windows that are not active */ |
722 | + sAttrib.opacity = (sAttrib.opacity * ms->moveOpacity) >> 16; |
723 | + } |
724 | + } |
725 | + |
726 | + status = gWindow->glPaint (sAttrib, transform, region, mask); |
727 | + |
728 | + return status; |
729 | +} |
730 | + |
731 | +void |
732 | +MoveScreen::updateOpacity () |
733 | +{ |
734 | + moveOpacity = (optionGetOpacity () * OPAQUE) / 100; |
735 | +} |
736 | + |
737 | +MoveScreen::MoveScreen (CompScreen *screen) : |
738 | + PluginClassHandler<MoveScreen,CompScreen> (screen), |
739 | + w (0), |
740 | + region (NULL), |
741 | + status (RectangleOut), |
742 | + releaseButton (0), |
743 | + grab (NULL), |
744 | + hasCompositing (false), |
745 | + yConstrained (false) |
746 | +{ |
747 | + |
748 | + updateOpacity (); |
749 | + |
750 | + for (unsigned int i = 0; i < NUM_KEYS; i++) |
751 | + key[i] = XKeysymToKeycode (screen->dpy (), |
752 | + XStringToKeysym (mKeys[i].name)); |
753 | + |
754 | + moveCursor = XCreateFontCursor (screen->dpy (), XC_fleur); |
755 | + if (CompositeScreen::get (screen)) |
756 | + hasCompositing = |
757 | + CompositeScreen::get (screen)->compositingActive (); |
758 | + |
759 | + optionSetOpacityNotify (boost::bind (&MoveScreen::updateOpacity, this)); |
760 | + |
761 | + optionSetInitiateButtonInitiate (moveInitiate); |
762 | + optionSetInitiateButtonTerminate (moveTerminate); |
763 | + |
764 | + optionSetInitiateKeyInitiate (moveInitiate); |
765 | + optionSetInitiateKeyTerminate (moveTerminate); |
766 | + |
767 | + ScreenInterface::setHandler (screen); |
768 | +} |
769 | + |
770 | +MoveScreen::~MoveScreen () |
771 | +{ |
772 | + if (region) |
773 | + XDestroyRegion (region); |
774 | + |
775 | + if (moveCursor) |
776 | + XFreeCursor (screen->dpy (), moveCursor); |
777 | +} |
778 | + |
779 | +bool |
780 | +MovePluginVTable::init () |
781 | +{ |
782 | + if (!CompPlugin::checkPluginABI ("core", CORE_ABIVERSION)) |
783 | + return false; |
784 | + |
785 | + return true; |
786 | +} |
787 | + |
788 | |
789 | === added file '.pc/fix-881329.patch/plugins/move/src/move.h' |
790 | --- .pc/fix-881329.patch/plugins/move/src/move.h 1970-01-01 00:00:00 +0000 |
791 | +++ .pc/fix-881329.patch/plugins/move/src/move.h 2011-10-29 09:07:25 +0000 |
792 | @@ -0,0 +1,135 @@ |
793 | +/* |
794 | + * Copyright © 2005 Novell, Inc. |
795 | + * |
796 | + * Permission to use, copy, modify, distribute, and sell this software |
797 | + * and its documentation for any purpose is hereby granted without |
798 | + * fee, provided that the above copyright notice appear in all copies |
799 | + * and that both that copyright notice and this permission notice |
800 | + * appear in supporting documentation, and that the name of |
801 | + * Novell, Inc. not be used in advertising or publicity pertaining to |
802 | + * distribution of the software without specific, written prior permission. |
803 | + * Novell, Inc. makes no representations about the suitability of this |
804 | + * software for any purpose. It is provided "as is" without express or |
805 | + * implied warranty. |
806 | + * |
807 | + * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
808 | + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN |
809 | + * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
810 | + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS |
811 | + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
812 | + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION |
813 | + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
814 | + * |
815 | + * Author: David Reveman <davidr@novell.com> |
816 | + */ |
817 | + |
818 | +#include <core/core.h> |
819 | +#include <core/pluginclasshandler.h> |
820 | + |
821 | +#include <composite/composite.h> |
822 | +#include <opengl/opengl.h> |
823 | + |
824 | +#include "move_options.h" |
825 | + |
826 | +#define NUM_KEYS (sizeof (mKeys) / sizeof (mKeys[0])) |
827 | + |
828 | +#define KEY_MOVE_INC 24 |
829 | + |
830 | +#define SNAP_BACK 20 |
831 | +#define SNAP_OFF 100 |
832 | + |
833 | +struct _MoveKeys { |
834 | + const char *name; |
835 | + int dx; |
836 | + int dy; |
837 | +} mKeys[] = { |
838 | + { "Left", -1, 0 }, |
839 | + { "Right", 1, 0 }, |
840 | + { "Up", 0, -1 }, |
841 | + { "Down", 0, 1 } |
842 | +}; |
843 | + |
844 | +class MoveScreen : |
845 | + public ScreenInterface, |
846 | + public PluginClassHandler<MoveScreen,CompScreen>, |
847 | + public MoveOptions |
848 | +{ |
849 | + public: |
850 | + MoveScreen (CompScreen *screen); |
851 | + ~MoveScreen (); |
852 | + |
853 | + void updateOpacity (); |
854 | + |
855 | + void handleEvent (XEvent *); |
856 | + void handleCompizEvent (const char *plugin, |
857 | + const char *event, |
858 | + CompOption::Vector &options); |
859 | + |
860 | + CompWindow *w; |
861 | + int savedX; |
862 | + int savedY; |
863 | + int x; |
864 | + int y; |
865 | + Region region; |
866 | + int status; |
867 | + KeyCode key[NUM_KEYS]; |
868 | + |
869 | + int releaseButton; |
870 | + |
871 | + GLushort moveOpacity; |
872 | + |
873 | + CompScreen::GrabHandle grab; |
874 | + |
875 | + Cursor moveCursor; |
876 | + |
877 | + unsigned int origState; |
878 | + |
879 | + int snapOffY; |
880 | + int snapBackY; |
881 | + |
882 | + bool hasCompositing; |
883 | + |
884 | + bool yConstrained; |
885 | +}; |
886 | + |
887 | +class MoveWindow : |
888 | + public GLWindowInterface, |
889 | + public PluginClassHandler<MoveWindow,CompWindow> |
890 | +{ |
891 | + public: |
892 | + MoveWindow (CompWindow *window) : |
893 | + PluginClassHandler<MoveWindow,CompWindow> (window), |
894 | + window (window), |
895 | + gWindow (GLWindow::get (window)), |
896 | + cWindow (CompositeWindow::get (window)), |
897 | + mLocked (false) |
898 | + { |
899 | + if (gWindow) |
900 | + GLWindowInterface::setHandler (gWindow, false); |
901 | + }; |
902 | + |
903 | + bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &, |
904 | + const CompRegion &, unsigned int); |
905 | + |
906 | + CompWindow *window; |
907 | + GLWindow *gWindow; |
908 | + CompositeWindow *cWindow; |
909 | + |
910 | + bool mLocked; |
911 | +}; |
912 | + |
913 | +#define MOVE_SCREEN(s) \ |
914 | + MoveScreen *ms = MoveScreen::get (s) |
915 | + |
916 | +#define MOVE_WINDOW(w) \ |
917 | + MoveWindow *mw = MoveWindow::get (w) |
918 | + |
919 | + |
920 | +class MovePluginVTable : |
921 | + public CompPlugin::VTableForScreenAndWindow<MoveScreen, MoveWindow> |
922 | +{ |
923 | + public: |
924 | + |
925 | + bool init (); |
926 | +}; |
927 | + |
928 | |
929 | === added directory '.pc/fix-883383.patch' |
930 | === added file '.pc/fix-883383.patch/.timestamp' |
931 | === added directory '.pc/fix-883383.patch/unity' |
932 | === added directory '.pc/fix-883383.patch/unity/unity_window_decorator' |
933 | === added directory '.pc/fix-883383.patch/unity/unity_window_decorator/src' |
934 | === added file '.pc/fix-883383.patch/unity/unity_window_decorator/src/events.c' |
935 | --- .pc/fix-883383.patch/unity/unity_window_decorator/src/events.c 1970-01-01 00:00:00 +0000 |
936 | +++ .pc/fix-883383.patch/unity/unity_window_decorator/src/events.c 2011-10-29 09:07:25 +0000 |
937 | @@ -0,0 +1,1146 @@ |
938 | +#include "gtk-window-decorator.h" |
939 | + |
940 | +void |
941 | +move_resize_window (WnckWindow *win, |
942 | + int direction, |
943 | + decor_event *gtkwd_event) |
944 | +{ |
945 | + Display *xdisplay; |
946 | + GdkDisplay *gdkdisplay; |
947 | + GdkScreen *screen; |
948 | + Window xroot; |
949 | + XEvent ev; |
950 | + |
951 | + gdkdisplay = gdk_display_get_default (); |
952 | + xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay); |
953 | + screen = gdk_display_get_default_screen (gdkdisplay); |
954 | + xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen)); |
955 | + |
956 | + if (action_menu_mapped) |
957 | + { |
958 | + gtk_object_destroy (GTK_OBJECT (action_menu)); |
959 | + action_menu_mapped = FALSE; |
960 | + action_menu = NULL; |
961 | + return; |
962 | + } |
963 | + |
964 | + ev.xclient.type = ClientMessage; |
965 | + ev.xclient.display = xdisplay; |
966 | + |
967 | + ev.xclient.serial = 0; |
968 | + ev.xclient.send_event = TRUE; |
969 | + |
970 | + ev.xclient.window = wnck_window_get_xid (win); |
971 | + ev.xclient.message_type = wm_move_resize_atom; |
972 | + ev.xclient.format = 32; |
973 | + |
974 | + ev.xclient.data.l[0] = gtkwd_event->x_root; |
975 | + ev.xclient.data.l[1] = gtkwd_event->y_root; |
976 | + ev.xclient.data.l[2] = direction; |
977 | + ev.xclient.data.l[3] = gtkwd_event->button; |
978 | + ev.xclient.data.l[4] = 1; |
979 | + |
980 | + XUngrabPointer (xdisplay, gtkwd_event->time); |
981 | + XUngrabKeyboard (xdisplay, gtkwd_event->time); |
982 | + |
983 | + XSendEvent (xdisplay, xroot, FALSE, |
984 | + SubstructureRedirectMask | SubstructureNotifyMask, |
985 | + &ev); |
986 | + |
987 | + XSync (xdisplay, FALSE); |
988 | +} |
989 | + |
990 | +void |
991 | +common_button_event (WnckWindow *win, |
992 | + decor_event *gtkwd_event, |
993 | + decor_event_type gtkwd_type, |
994 | + int button, |
995 | + int max) |
996 | +{ |
997 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
998 | + guint state = d->button_states[button]; |
999 | + |
1000 | + if (d->frame_window && gtkwd_type == GEnterNotify) |
1001 | + { |
1002 | + GdkCursor* cursor; |
1003 | + cursor = gdk_cursor_new (GDK_LEFT_PTR); |
1004 | + gdk_window_set_cursor (d->frame_window, cursor); |
1005 | + gdk_cursor_unref (cursor); |
1006 | + } |
1007 | + |
1008 | + switch (gtkwd_type) { |
1009 | + case GButtonPress: |
1010 | + if (gtkwd_event->button <= max) |
1011 | + d->button_states[button] |= PRESSED_EVENT_WINDOW; |
1012 | + break; |
1013 | + case GButtonRelease: |
1014 | + if (gtkwd_event->button <= max) |
1015 | + d->button_states[button] &= ~PRESSED_EVENT_WINDOW; |
1016 | + break; |
1017 | + case GEnterNotify: |
1018 | + d->button_states[button] |= IN_EVENT_WINDOW; |
1019 | + break; |
1020 | + case GLeaveNotify: |
1021 | + d->button_states[button] &= ~IN_EVENT_WINDOW; |
1022 | + break; |
1023 | + default: |
1024 | + break; |
1025 | + } |
1026 | + |
1027 | + if (state != d->button_states[button]) |
1028 | + queue_decor_draw (d); |
1029 | +} |
1030 | + |
1031 | +#define BUTTON_EVENT_ACTION_STATE (PRESSED_EVENT_WINDOW | IN_EVENT_WINDOW) |
1032 | + |
1033 | +void |
1034 | +close_button_event (WnckWindow *win, |
1035 | + decor_event *gtkwd_event, |
1036 | + decor_event_type gtkwd_type) |
1037 | +{ |
1038 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1039 | + guint state = d->button_states[BUTTON_CLOSE]; |
1040 | + |
1041 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1042 | + BUTTON_CLOSE, 1); |
1043 | + |
1044 | + switch (gtkwd_type) { |
1045 | + case GButtonRelease: |
1046 | + if (gtkwd_event->button == 1) |
1047 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1048 | + wnck_window_close (win, gtkwd_event->time); |
1049 | + break; |
1050 | + default: |
1051 | + break; |
1052 | + } |
1053 | +} |
1054 | + |
1055 | +void |
1056 | +max_button_event (WnckWindow *win, |
1057 | + decor_event *gtkwd_event, |
1058 | + decor_event_type gtkwd_type) |
1059 | +{ |
1060 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1061 | + guint state = d->button_states[BUTTON_MAX]; |
1062 | + |
1063 | + if (wnck_window_is_maximized (win)) |
1064 | + common_button_event (win, gtkwd_event, gtkwd_type, BUTTON_MAX, |
1065 | + 3); |
1066 | + else |
1067 | + common_button_event (win, gtkwd_event, gtkwd_type, BUTTON_MAX, |
1068 | + 3); |
1069 | + |
1070 | + switch (gtkwd_type) { |
1071 | + case GButtonRelease: |
1072 | + if (gtkwd_event->button <= 3) |
1073 | + { |
1074 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1075 | + { |
1076 | + if (gtkwd_event->button == 2) |
1077 | + { |
1078 | + if (wnck_window_is_maximized_vertically (win)) |
1079 | + wnck_window_unmaximize_vertically (win); |
1080 | + else |
1081 | + wnck_window_maximize_vertically (win); |
1082 | + } |
1083 | + else if (gtkwd_event->button == 3) |
1084 | + { |
1085 | + if (wnck_window_is_maximized_horizontally (win)) |
1086 | + wnck_window_unmaximize_horizontally (win); |
1087 | + else |
1088 | + wnck_window_maximize_horizontally (win); |
1089 | + } |
1090 | + else |
1091 | + { |
1092 | + if (wnck_window_is_maximized (win)) |
1093 | + wnck_window_unmaximize (win); |
1094 | + else |
1095 | + wnck_window_maximize (win); |
1096 | + } |
1097 | + } |
1098 | + } |
1099 | + break; |
1100 | + default: |
1101 | + break; |
1102 | + } |
1103 | +} |
1104 | + |
1105 | +void |
1106 | +min_button_event (WnckWindow *win, |
1107 | + decor_event *gtkwd_event, |
1108 | + decor_event_type gtkwd_type) |
1109 | +{ |
1110 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1111 | + guint state = d->button_states[BUTTON_MIN]; |
1112 | + |
1113 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1114 | + BUTTON_MIN, 1); |
1115 | + |
1116 | + switch (gtkwd_type) { |
1117 | + case GButtonRelease: |
1118 | + if (gtkwd_event->button == 1) |
1119 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1120 | + wnck_window_minimize (win); |
1121 | + break; |
1122 | + default: |
1123 | + break; |
1124 | + } |
1125 | +} |
1126 | + |
1127 | +void |
1128 | +menu_button_event (WnckWindow *win, |
1129 | + decor_event *gtkwd_event, |
1130 | + decor_event_type gtkwd_type) |
1131 | +{ |
1132 | + |
1133 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1134 | + BUTTON_MENU, 1); |
1135 | + |
1136 | + switch (gtkwd_type) { |
1137 | + case GButtonPress: |
1138 | + if (gtkwd_event->button == 1) |
1139 | + action_menu_map (win, |
1140 | + gtkwd_event->button, |
1141 | + gtkwd_event->time); |
1142 | + break; |
1143 | + default: |
1144 | + break; |
1145 | + } |
1146 | +} |
1147 | + |
1148 | +void |
1149 | +shade_button_event (WnckWindow *win, |
1150 | + decor_event *gtkwd_event, |
1151 | + decor_event_type gtkwd_type) |
1152 | +{ |
1153 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1154 | + guint state = d->button_states[BUTTON_SHADE]; |
1155 | + |
1156 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1157 | + BUTTON_SHADE, 1); |
1158 | + |
1159 | + switch (gtkwd_type) { |
1160 | + case GButtonRelease: |
1161 | + if (gtkwd_event->button == 1) |
1162 | + { |
1163 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1164 | + wnck_window_shade (win); |
1165 | + } |
1166 | + break; |
1167 | + default: |
1168 | + break; |
1169 | + } |
1170 | +} |
1171 | + |
1172 | +void |
1173 | +above_button_event (WnckWindow *win, |
1174 | + decor_event *gtkwd_event, |
1175 | + decor_event_type gtkwd_type) |
1176 | +{ |
1177 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1178 | + guint state = d->button_states[BUTTON_ABOVE]; |
1179 | + |
1180 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1181 | + BUTTON_ABOVE, 1); |
1182 | + |
1183 | + switch (gtkwd_type) { |
1184 | + case GButtonRelease: |
1185 | + if (gtkwd_event->button == 1) |
1186 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1187 | +#ifdef HAVE_LIBWNCK_2_18_1 |
1188 | + wnck_window_make_above (win); |
1189 | +#endif |
1190 | + break; |
1191 | + default: |
1192 | + break; |
1193 | + } |
1194 | +} |
1195 | + |
1196 | +void |
1197 | +stick_button_event (WnckWindow *win, |
1198 | + decor_event *gtkwd_event, |
1199 | + decor_event_type gtkwd_type) |
1200 | +{ |
1201 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1202 | + guint state = d->button_states[BUTTON_STICK]; |
1203 | + |
1204 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1205 | + BUTTON_STICK, 1); |
1206 | + |
1207 | + switch (gtkwd_type) { |
1208 | + case GButtonRelease: |
1209 | + if (gtkwd_event->button == 1) |
1210 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1211 | + wnck_window_stick (win); |
1212 | + break; |
1213 | + default: |
1214 | + break; |
1215 | + } |
1216 | +} |
1217 | + |
1218 | +void |
1219 | +unshade_button_event (WnckWindow *win, |
1220 | + decor_event *gtkwd_event, |
1221 | + decor_event_type gtkwd_type) |
1222 | +{ |
1223 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1224 | + guint state = d->button_states[BUTTON_UNSHADE]; |
1225 | + |
1226 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1227 | + BUTTON_UNSHADE, 1); |
1228 | + |
1229 | + switch (gtkwd_type) { |
1230 | + case GButtonRelease: |
1231 | + if (gtkwd_event->button == 1) |
1232 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1233 | + wnck_window_unshade (win); |
1234 | + break; |
1235 | + default: |
1236 | + break; |
1237 | + } |
1238 | +} |
1239 | + |
1240 | +void |
1241 | +unabove_button_event (WnckWindow *win, |
1242 | + decor_event *gtkwd_event, |
1243 | + decor_event_type gtkwd_type) |
1244 | +{ |
1245 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1246 | + guint state = d->button_states[BUTTON_UNABOVE]; |
1247 | + |
1248 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1249 | + BUTTON_UNABOVE, 1); |
1250 | + |
1251 | + switch (gtkwd_type) { |
1252 | + case GButtonRelease: |
1253 | + if (gtkwd_event->button == 1) |
1254 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1255 | +#ifdef HAVE_LIBWNCK_2_18_1 |
1256 | + wnck_window_unmake_above (win); |
1257 | +#endif |
1258 | + break; |
1259 | + default: |
1260 | + break; |
1261 | + } |
1262 | +} |
1263 | + |
1264 | +void |
1265 | +unstick_button_event (WnckWindow *win, |
1266 | + decor_event *gtkwd_event, |
1267 | + decor_event_type gtkwd_type) |
1268 | +{ |
1269 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1270 | + guint state = d->button_states[BUTTON_UNSTICK]; |
1271 | + |
1272 | + common_button_event (win, gtkwd_event, gtkwd_type, |
1273 | + BUTTON_UNSTICK, 1); |
1274 | + |
1275 | + switch (gtkwd_type) { |
1276 | + case GButtonRelease: |
1277 | + if (gtkwd_event->button == 1) |
1278 | + if (state == BUTTON_EVENT_ACTION_STATE) |
1279 | + wnck_window_unstick (win); |
1280 | + break; |
1281 | + default: |
1282 | + break; |
1283 | + } |
1284 | +} |
1285 | + |
1286 | +void |
1287 | +handle_title_button_event (WnckWindow *win, |
1288 | + int action, |
1289 | + decor_event *gtkwd_event) |
1290 | +{ |
1291 | + switch (action) { |
1292 | + case CLICK_ACTION_SHADE: |
1293 | + if (wnck_window_is_shaded (win)) |
1294 | + wnck_window_unshade (win); |
1295 | + else |
1296 | + wnck_window_shade (win); |
1297 | + break; |
1298 | + case CLICK_ACTION_MAXIMIZE: |
1299 | + if (wnck_window_is_maximized (win)) |
1300 | + wnck_window_unmaximize (win); |
1301 | + else |
1302 | + wnck_window_maximize (win); |
1303 | + break; |
1304 | + case CLICK_ACTION_MINIMIZE: |
1305 | + if (!wnck_window_is_minimized (win)) |
1306 | + wnck_window_minimize (win); |
1307 | + break; |
1308 | + case CLICK_ACTION_RAISE: |
1309 | + restack_window (win, Above); |
1310 | + break; |
1311 | + case CLICK_ACTION_LOWER: |
1312 | + restack_window (win, Below); |
1313 | + break; |
1314 | + case CLICK_ACTION_MENU: |
1315 | + action_menu_map (win, gtkwd_event->button, gtkwd_event->time); |
1316 | + break; |
1317 | + } |
1318 | +} |
1319 | + |
1320 | +void |
1321 | +handle_mouse_wheel_title_event (WnckWindow *win, |
1322 | + unsigned int button) |
1323 | +{ |
1324 | + switch (wheel_action) { |
1325 | + case WHEEL_ACTION_SHADE: |
1326 | + if (button == 4) |
1327 | + { |
1328 | + if (!wnck_window_is_shaded (win)) |
1329 | + wnck_window_shade (win); |
1330 | + } |
1331 | + else if (button == 5) |
1332 | + { |
1333 | + if (wnck_window_is_shaded (win)) |
1334 | + wnck_window_unshade (win); |
1335 | + } |
1336 | + break; |
1337 | + default: |
1338 | + break; |
1339 | + } |
1340 | +} |
1341 | + |
1342 | +void |
1343 | +title_event (WnckWindow *win, |
1344 | + decor_event *gtkwd_event, |
1345 | + decor_event_type gtkwd_type) |
1346 | +{ |
1347 | + static int last_button_num = 0; |
1348 | + static Window last_button_xwindow = None; |
1349 | + static Time last_button_time = 0; |
1350 | + static int last_button_x = 0; |
1351 | + static int last_button_y = 0; |
1352 | + |
1353 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1354 | + |
1355 | + if (d->frame_window && gtkwd_type == GEnterNotify) |
1356 | + { |
1357 | + GdkCursor* cursor = gdk_cursor_new (GDK_LEFT_PTR); |
1358 | + gdk_window_set_cursor (d->frame_window, cursor); |
1359 | + gdk_cursor_unref (cursor); |
1360 | + } |
1361 | + |
1362 | + if (gtkwd_type != GButtonPress) |
1363 | + return; |
1364 | + |
1365 | + if (gtkwd_event->button == 1) |
1366 | + { |
1367 | + if (gtkwd_event->button == last_button_num && |
1368 | + gtkwd_event->window == last_button_xwindow && |
1369 | + gtkwd_event->time < last_button_time + double_click_timeout && |
1370 | + dist (gtkwd_event->x, gtkwd_event->y, |
1371 | + last_button_x, last_button_y) < DOUBLE_CLICK_DISTANCE) |
1372 | + { |
1373 | + handle_title_button_event (win, double_click_action, |
1374 | + gtkwd_event); |
1375 | + |
1376 | + last_button_num = 0; |
1377 | + last_button_xwindow = None; |
1378 | + last_button_time = 0; |
1379 | + last_button_x = 0; |
1380 | + last_button_y = 0; |
1381 | + } |
1382 | + else |
1383 | + { |
1384 | + last_button_num = gtkwd_event->button; |
1385 | + last_button_xwindow = gtkwd_event->window; |
1386 | + last_button_time = gtkwd_event->time; |
1387 | + last_button_x = gtkwd_event->x; |
1388 | + last_button_y = gtkwd_event->y; |
1389 | + |
1390 | + restack_window (win, Above); |
1391 | + |
1392 | + move_resize_window (win, WM_MOVERESIZE_MOVE, gtkwd_event); |
1393 | + } |
1394 | + } |
1395 | + else if (gtkwd_event->button == 2) |
1396 | + { |
1397 | + handle_title_button_event (win, middle_click_action, |
1398 | + gtkwd_event); |
1399 | + } |
1400 | + else if (gtkwd_event->button == 3) |
1401 | + { |
1402 | + handle_title_button_event (win, right_click_action, |
1403 | + gtkwd_event); |
1404 | + } |
1405 | + else if (gtkwd_event->button == 4 || |
1406 | + gtkwd_event->button == 5) |
1407 | + { |
1408 | + handle_mouse_wheel_title_event (win, gtkwd_event->button); |
1409 | + } |
1410 | +} |
1411 | + |
1412 | +void |
1413 | +frame_common_event (WnckWindow *win, |
1414 | + int direction, |
1415 | + decor_event *gtkwd_event, |
1416 | + decor_event_type gtkwd_type) |
1417 | +{ |
1418 | + |
1419 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1420 | + |
1421 | + if (d->frame_window && gtkwd_type == GEnterNotify) |
1422 | + { |
1423 | + GdkCursor *cursor = NULL; |
1424 | + |
1425 | + switch (direction) |
1426 | + { |
1427 | + case WM_MOVERESIZE_SIZE_TOPLEFT: |
1428 | + cursor = gdk_cursor_new (GDK_TOP_LEFT_CORNER); |
1429 | + break; |
1430 | + case WM_MOVERESIZE_SIZE_LEFT: |
1431 | + cursor = gdk_cursor_new (GDK_LEFT_SIDE); |
1432 | + break; |
1433 | + case WM_MOVERESIZE_SIZE_BOTTOMLEFT: |
1434 | + cursor = gdk_cursor_new (GDK_BOTTOM_LEFT_CORNER); |
1435 | + break; |
1436 | + case WM_MOVERESIZE_SIZE_BOTTOM: |
1437 | + cursor = gdk_cursor_new (GDK_BOTTOM_SIDE); |
1438 | + break; |
1439 | + case WM_MOVERESIZE_SIZE_BOTTOMRIGHT: |
1440 | + cursor = gdk_cursor_new (GDK_BOTTOM_RIGHT_CORNER); |
1441 | + break; |
1442 | + case WM_MOVERESIZE_SIZE_RIGHT: |
1443 | + cursor = gdk_cursor_new (GDK_RIGHT_SIDE); |
1444 | + break; |
1445 | + case WM_MOVERESIZE_SIZE_TOPRIGHT: |
1446 | + cursor = gdk_cursor_new (GDK_TOP_RIGHT_CORNER); |
1447 | + break; |
1448 | + case WM_MOVERESIZE_SIZE_TOP: |
1449 | + cursor = gdk_cursor_new (GDK_TOP_SIDE); |
1450 | + break; |
1451 | + default: |
1452 | + break; |
1453 | + } |
1454 | + |
1455 | + if (cursor) |
1456 | + { |
1457 | + gdk_window_set_cursor (d->frame_window, cursor); |
1458 | + gdk_cursor_unref (cursor); |
1459 | + } |
1460 | + } |
1461 | + |
1462 | + if (gtkwd_type != GButtonPress) |
1463 | + return; |
1464 | + |
1465 | + switch (gtkwd_event->button) { |
1466 | + case 1: |
1467 | + move_resize_window (win, direction, gtkwd_event); |
1468 | + restack_window (win, Above); |
1469 | + break; |
1470 | + case 2: |
1471 | + handle_title_button_event (win, middle_click_action, |
1472 | + gtkwd_event); |
1473 | + break; |
1474 | + case 3: |
1475 | + handle_title_button_event (win, right_click_action, |
1476 | + gtkwd_event); |
1477 | + break; |
1478 | + } |
1479 | +} |
1480 | + |
1481 | +void |
1482 | +top_left_event (WnckWindow *win, |
1483 | + decor_event *gtkwd_event, |
1484 | + decor_event_type gtkwd_type) |
1485 | +{ |
1486 | + frame_common_event (win, WM_MOVERESIZE_SIZE_TOPLEFT, |
1487 | + gtkwd_event, gtkwd_type); |
1488 | +} |
1489 | + |
1490 | +void |
1491 | +top_event (WnckWindow *win, |
1492 | + decor_event *gtkwd_event, |
1493 | + decor_event_type gtkwd_type) |
1494 | +{ |
1495 | + frame_common_event (win, WM_MOVERESIZE_SIZE_TOP, |
1496 | + gtkwd_event, gtkwd_type); |
1497 | +} |
1498 | + |
1499 | +void |
1500 | +top_right_event (WnckWindow *win, |
1501 | + decor_event *gtkwd_event, |
1502 | + decor_event_type gtkwd_type) |
1503 | +{ |
1504 | + frame_common_event (win, WM_MOVERESIZE_SIZE_TOPRIGHT, |
1505 | + gtkwd_event, gtkwd_type); |
1506 | +} |
1507 | + |
1508 | +void |
1509 | +left_event (WnckWindow *win, |
1510 | + decor_event *gtkwd_event, |
1511 | + decor_event_type gtkwd_type) |
1512 | +{ |
1513 | + frame_common_event (win, WM_MOVERESIZE_SIZE_LEFT, |
1514 | + gtkwd_event, gtkwd_type); |
1515 | +} |
1516 | + |
1517 | +void |
1518 | +right_event (WnckWindow *win, |
1519 | + decor_event *gtkwd_event, |
1520 | + decor_event_type gtkwd_type) |
1521 | +{ |
1522 | + frame_common_event (win, WM_MOVERESIZE_SIZE_RIGHT, |
1523 | + gtkwd_event, gtkwd_type); |
1524 | +} |
1525 | + |
1526 | +void |
1527 | +bottom_left_event (WnckWindow *win, |
1528 | + decor_event *gtkwd_event, |
1529 | + decor_event_type gtkwd_type) |
1530 | +{ |
1531 | + frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMLEFT, |
1532 | + gtkwd_event, gtkwd_type); |
1533 | +} |
1534 | + |
1535 | +void |
1536 | +bottom_event (WnckWindow *win, |
1537 | + decor_event *gtkwd_event, |
1538 | + decor_event_type gtkwd_type) |
1539 | +{ |
1540 | + frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOM, |
1541 | + gtkwd_event, gtkwd_type); |
1542 | +} |
1543 | + |
1544 | +void |
1545 | +bottom_right_event (WnckWindow *win, |
1546 | + decor_event *gtkwd_event, |
1547 | + decor_event_type gtkwd_type) |
1548 | +{ |
1549 | + frame_common_event (win, WM_MOVERESIZE_SIZE_BOTTOMRIGHT, |
1550 | + gtkwd_event, gtkwd_type); |
1551 | +} |
1552 | + |
1553 | +void |
1554 | +frame_window_realized (GtkWidget *widget, |
1555 | + gpointer data) |
1556 | +{ |
1557 | + decor_t *d = (decor_t *) data; |
1558 | + |
1559 | + if (d) |
1560 | + { |
1561 | + GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window); |
1562 | + gdk_window_reparent (gdk_frame_window, d->frame_window, 0, 0); |
1563 | + gdk_window_lower (gdk_frame_window); |
1564 | + |
1565 | + } |
1566 | +} |
1567 | + |
1568 | +event_callback |
1569 | +find_event_callback_for_point (decor_t *d, |
1570 | + int x, |
1571 | + int y, |
1572 | + Bool *enter, |
1573 | + Bool *leave, |
1574 | + BoxPtr *entered_box) |
1575 | +{ |
1576 | + int i, j; |
1577 | + BoxPtr box; |
1578 | + |
1579 | + for (i = 0; i < BUTTON_NUM; i++) |
1580 | + { |
1581 | + box = &d->button_windows[i].pos; |
1582 | + if (x >= box->x1 && x <= box->x2 && |
1583 | + y >= box->y1 && y <= box->y2) |
1584 | + { |
1585 | + if (d->last_pos_entered != box) |
1586 | + { |
1587 | + if (enter) |
1588 | + *enter = TRUE; |
1589 | + if (leave && d->last_pos_entered) |
1590 | + *leave = TRUE; |
1591 | + if (entered_box) |
1592 | + *entered_box = box; |
1593 | + } |
1594 | + return d->button_windows[i].callback; |
1595 | + } |
1596 | + } |
1597 | + |
1598 | + for (i = 0; i < 3; i++) |
1599 | + { |
1600 | + for (j = 0; j < 3; j++) |
1601 | + { |
1602 | + box = &d->event_windows[i][j].pos; |
1603 | + if (x >= box->x1 && x <= box->x2 && |
1604 | + y >= box->y1 && y <= box->y2) |
1605 | + { |
1606 | + if (d->last_pos_entered != box) |
1607 | + { |
1608 | + if (enter) |
1609 | + *enter = TRUE; |
1610 | + if (leave && d->last_pos_entered) |
1611 | + *leave = TRUE; |
1612 | + if (entered_box) |
1613 | + *entered_box = box; |
1614 | + } |
1615 | + return d->event_windows[i][j].callback; |
1616 | + } |
1617 | + } |
1618 | + } |
1619 | + |
1620 | + return NULL; |
1621 | +} |
1622 | + |
1623 | +event_callback |
1624 | +find_leave_event_callback (decor_t *d) |
1625 | +{ |
1626 | + int i, j; |
1627 | + |
1628 | + for (i = 0; i < BUTTON_NUM; i++) |
1629 | + { |
1630 | + if (d->last_pos_entered == &d->button_windows[i].pos) |
1631 | + return d->button_windows[i].callback; |
1632 | + } |
1633 | + |
1634 | + for (i = 0; i < 3; i++) |
1635 | + { |
1636 | + for (j = 0; j < 3; j++) |
1637 | + { |
1638 | + if (d->last_pos_entered == &d->event_windows[i][j].pos) |
1639 | + return d->event_windows[i][j].callback; |
1640 | + } |
1641 | + } |
1642 | + |
1643 | + return NULL; |
1644 | +} |
1645 | + |
1646 | +void |
1647 | +frame_handle_button_press (GtkWidget *widget, |
1648 | + GdkEventButton *event, |
1649 | + gpointer user_data) |
1650 | +{ |
1651 | + decor_t *d = (decor_t *) user_data; |
1652 | + |
1653 | + if (d) |
1654 | + { |
1655 | + /* Check to see where the event happened and fill out an appropriate |
1656 | + * struct |
1657 | + */ |
1658 | + event_callback cb; |
1659 | + |
1660 | + cb = find_event_callback_for_point (d, event->x, event->y, |
1661 | + NULL, NULL, NULL); |
1662 | + |
1663 | + if (cb && d->decorated) |
1664 | + { |
1665 | + decor_event gtkwd_event; |
1666 | + |
1667 | + gtkwd_event.window = GDK_WINDOW_XID (d->frame_window); |
1668 | + gtkwd_event.button = event->button; |
1669 | + gtkwd_event.x = event->x; |
1670 | + gtkwd_event.y = event->y; |
1671 | + gtkwd_event.x_root = event->x_root; |
1672 | + gtkwd_event.y_root = event->y_root; |
1673 | + gtkwd_event.time = event->time; |
1674 | + |
1675 | + (*cb) (d->win, >kwd_event, GButtonPress); |
1676 | + } |
1677 | + } |
1678 | +} |
1679 | + |
1680 | +void |
1681 | +frame_handle_button_release (GtkWidget *widget, |
1682 | + GdkEventButton *event, |
1683 | + gpointer user_data) |
1684 | +{ |
1685 | + decor_t *d = (decor_t *) user_data; |
1686 | + |
1687 | + if (d) |
1688 | + { |
1689 | + event_callback cb; |
1690 | + |
1691 | + cb = find_event_callback_for_point (d, event->x, event->y, |
1692 | + NULL, NULL, NULL); |
1693 | + |
1694 | + if (cb && d->decorated) |
1695 | + { |
1696 | + decor_event gtkwd_event; |
1697 | + |
1698 | + gtkwd_event.window = GDK_WINDOW_XID (d->frame_window); |
1699 | + gtkwd_event.button = event->button; |
1700 | + gtkwd_event.x = event->x; |
1701 | + gtkwd_event.y = event->y; |
1702 | + gtkwd_event.x_root = event->x_root; |
1703 | + gtkwd_event.y_root = event->y_root; |
1704 | + gtkwd_event.time = event->time; |
1705 | + |
1706 | + (*cb) (d->win, >kwd_event, GButtonRelease); |
1707 | + } |
1708 | + } |
1709 | +} |
1710 | + |
1711 | +void |
1712 | +frame_handle_motion (GtkWidget *widget, |
1713 | + GdkEventMotion *event, |
1714 | + gpointer user_data) |
1715 | +{ |
1716 | + decor_t *d = (decor_t *) user_data; |
1717 | + |
1718 | + if (d) |
1719 | + { |
1720 | + event_callback cb = NULL; |
1721 | + Bool send_enter = FALSE; |
1722 | + Bool send_leave = FALSE; |
1723 | + BoxPtr entered_box; |
1724 | + |
1725 | + cb = find_event_callback_for_point (d, event->x, event->y, |
1726 | + &send_enter, &send_leave, |
1727 | + &entered_box); |
1728 | + |
1729 | + if (cb && d->decorated) |
1730 | + { |
1731 | + decor_event gtkwd_event; |
1732 | + |
1733 | + gtkwd_event.window = GDK_WINDOW_XID (d->frame_window); |
1734 | + gtkwd_event.x = event->x; |
1735 | + gtkwd_event.y = event->y; |
1736 | + gtkwd_event.x_root = event->x_root; |
1737 | + gtkwd_event.y_root = event->y_root; |
1738 | + gtkwd_event.time = event->time; |
1739 | + |
1740 | + if (send_enter) |
1741 | + (*cb) (d->win, >kwd_event, GEnterNotify); |
1742 | + |
1743 | + if (send_leave) |
1744 | + { |
1745 | + event_callback leave_cb; |
1746 | + |
1747 | + leave_cb = find_leave_event_callback (d); |
1748 | + |
1749 | + if (leave_cb) |
1750 | + (*leave_cb) (d->win, >kwd_event, GLeaveNotify); |
1751 | + |
1752 | + } |
1753 | + |
1754 | + if (send_enter) |
1755 | + d->last_pos_entered = entered_box; |
1756 | + } |
1757 | + else if (d->last_pos_entered && d->decorated) |
1758 | + { |
1759 | + /* We are not in an event / button window but last_pos_entered |
1760 | + * is still set, so send a GLeaveNotify to last_pos_entered |
1761 | + * and set it to NULL |
1762 | + */ |
1763 | + |
1764 | + event_callback leave_cb; |
1765 | + |
1766 | + leave_cb = find_leave_event_callback (d); |
1767 | + |
1768 | + if (leave_cb) |
1769 | + { |
1770 | + decor_event gtkwd_event; |
1771 | + |
1772 | + gtkwd_event.window = GDK_WINDOW_XID (d->frame_window); |
1773 | + gtkwd_event.x = event->x; |
1774 | + gtkwd_event.y = event->y; |
1775 | + gtkwd_event.x_root = event->x_root; |
1776 | + gtkwd_event.y_root = event->y_root; |
1777 | + gtkwd_event.time = event->time; |
1778 | + |
1779 | + (*leave_cb) (d->win, >kwd_event, GLeaveNotify); |
1780 | + } |
1781 | + |
1782 | + d->last_pos_entered = NULL; |
1783 | + } |
1784 | + } |
1785 | +} |
1786 | + |
1787 | +GdkFilterReturn |
1788 | +event_filter_func (GdkXEvent *gdkxevent, |
1789 | + GdkEvent *event, |
1790 | + gpointer data) |
1791 | +{ |
1792 | + Display *xdisplay; |
1793 | + GdkDisplay *gdkdisplay; |
1794 | + XEvent *xevent = gdkxevent; |
1795 | + gulong xid = 0; |
1796 | + Window select = 0; |
1797 | + |
1798 | + gdkdisplay = gdk_display_get_default (); |
1799 | + xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay); |
1800 | + |
1801 | + switch (xevent->type) { |
1802 | + case CreateNotify: |
1803 | + { |
1804 | + if (!wnck_window_get (xevent->xcreatewindow.window)) |
1805 | + { |
1806 | + GdkWindow *toplevel = create_foreign_window (xevent->xcreatewindow.window); |
1807 | + |
1808 | + if (toplevel) |
1809 | + { |
1810 | + gdk_window_set_events (toplevel, |
1811 | + gdk_window_get_events (toplevel) | |
1812 | + GDK_PROPERTY_CHANGE_MASK); |
1813 | + |
1814 | + /* check if the window is a switcher and update accordingly */ |
1815 | + |
1816 | + if (get_window_prop (xevent->xcreatewindow.window, select_window_atom, &select)) |
1817 | + update_switcher_window (xevent->xcreatewindow.window, select); |
1818 | + } |
1819 | + } |
1820 | + } |
1821 | + break; |
1822 | + case ButtonPress: |
1823 | + case ButtonRelease: |
1824 | + xid = (gulong) |
1825 | + g_hash_table_lookup (frame_table, |
1826 | + GINT_TO_POINTER (xevent->xbutton.window)); |
1827 | + break; |
1828 | + case EnterNotify: |
1829 | + case LeaveNotify: |
1830 | + xid = (gulong) |
1831 | + g_hash_table_lookup (frame_table, |
1832 | + GINT_TO_POINTER (xevent->xcrossing.window)); |
1833 | + break; |
1834 | + case MotionNotify: |
1835 | + xid = (gulong) |
1836 | + g_hash_table_lookup (frame_table, |
1837 | + GINT_TO_POINTER (xevent->xmotion.window)); |
1838 | + break; |
1839 | + case PropertyNotify: |
1840 | + if (xevent->xproperty.atom == frame_input_window_atom) |
1841 | + { |
1842 | + WnckWindow *win; |
1843 | + |
1844 | + xid = xevent->xproperty.window; |
1845 | + |
1846 | + win = wnck_window_get (xid); |
1847 | + if (win) |
1848 | + { |
1849 | + Window frame; |
1850 | + |
1851 | + if (!get_window_prop (xid, select_window_atom, &select)) |
1852 | + { |
1853 | + if (get_window_prop (xid, frame_input_window_atom, &frame)) |
1854 | + add_frame_window (win, frame, FALSE); |
1855 | + else |
1856 | + remove_frame_window (win); |
1857 | + } |
1858 | + } |
1859 | + } |
1860 | + if (xevent->xproperty.atom == frame_output_window_atom) |
1861 | + { |
1862 | + WnckWindow *win; |
1863 | + |
1864 | + xid = xevent->xproperty.window; |
1865 | + |
1866 | + win = wnck_window_get (xid); |
1867 | + if (win) |
1868 | + { |
1869 | + Window frame; |
1870 | + |
1871 | + if (!get_window_prop (xid, select_window_atom, &select)) |
1872 | + { |
1873 | + if (get_window_prop (xid, frame_output_window_atom, &frame)) |
1874 | + add_frame_window (win, frame, TRUE); |
1875 | + else |
1876 | + remove_frame_window (win); |
1877 | + } |
1878 | + } |
1879 | + } |
1880 | + else if (xevent->xproperty.atom == compiz_shadow_info_atom || |
1881 | + xevent->xproperty.atom == compiz_shadow_color_atom) |
1882 | + { |
1883 | + GdkScreen *g_screen = gdk_display_get_default_screen (gdkdisplay); |
1884 | + Window root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (g_screen)); |
1885 | + WnckScreen *screen; |
1886 | + |
1887 | + screen = wnck_screen_get_for_root (root); |
1888 | + |
1889 | + if (screen) |
1890 | + { |
1891 | + shadow_property_changed (screen); |
1892 | + } |
1893 | + } |
1894 | + else if (xevent->xproperty.atom == mwm_hints_atom) |
1895 | + { |
1896 | + WnckWindow *win; |
1897 | + |
1898 | + xid = xevent->xproperty.window; |
1899 | + |
1900 | + win = wnck_window_get (xid); |
1901 | + if (win) |
1902 | + { |
1903 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1904 | + gboolean decorated = FALSE; |
1905 | + |
1906 | + if (get_mwm_prop (xid) & (MWM_DECOR_ALL | MWM_DECOR_TITLE)) |
1907 | + decorated = TRUE; |
1908 | + |
1909 | + if (decorated != d->decorated) |
1910 | + { |
1911 | + d->decorated = decorated; |
1912 | + if (decorated) |
1913 | + { |
1914 | + d->context = NULL; |
1915 | + d->width = d->height = 0; |
1916 | + |
1917 | + update_window_decoration_size (win); |
1918 | + update_event_windows (win); |
1919 | + } |
1920 | + else |
1921 | + { |
1922 | + gdk_error_trap_push (); |
1923 | + XDeleteProperty (xdisplay, xid, win_decor_atom); |
1924 | + gdk_display_sync (gdk_display_get_default ()); |
1925 | + gdk_error_trap_pop (); |
1926 | + } |
1927 | + } |
1928 | + } |
1929 | + } |
1930 | + else if (xevent->xproperty.atom == select_window_atom) |
1931 | + { |
1932 | + Window select; |
1933 | + |
1934 | + if (get_window_prop (xevent->xproperty.window, select_window_atom, &select)) |
1935 | + update_switcher_window (xevent->xproperty.window, select); |
1936 | + } |
1937 | + break; |
1938 | + case DestroyNotify: |
1939 | + { |
1940 | + g_hash_table_remove (frame_table, |
1941 | + GINT_TO_POINTER (xevent->xproperty.window)); |
1942 | + |
1943 | + break; |
1944 | + } |
1945 | + case ClientMessage: |
1946 | + if (xevent->xclient.message_type == toolkit_action_atom) |
1947 | + { |
1948 | + long action; |
1949 | + |
1950 | + action = xevent->xclient.data.l[0]; |
1951 | + if (action == toolkit_action_window_menu_atom) |
1952 | + { |
1953 | + WnckWindow *win; |
1954 | + |
1955 | + win = wnck_window_get (xevent->xclient.window); |
1956 | + if (win) |
1957 | + { |
1958 | + action_menu_map (win, |
1959 | + xevent->xclient.data.l[2], |
1960 | + xevent->xclient.data.l[1]); |
1961 | + } |
1962 | + } |
1963 | + else if (action == toolkit_action_force_quit_dialog_atom) |
1964 | + { |
1965 | + WnckWindow *win; |
1966 | + |
1967 | + win = wnck_window_get (xevent->xclient.window); |
1968 | + if (win) |
1969 | + { |
1970 | + if (xevent->xclient.data.l[2]) |
1971 | + show_force_quit_dialog (win, |
1972 | + xevent->xclient.data.l[1]); |
1973 | + else |
1974 | + hide_force_quit_dialog (win); |
1975 | + } |
1976 | + } |
1977 | + } |
1978 | + default: |
1979 | + break; |
1980 | + } |
1981 | + |
1982 | + if (xid) |
1983 | + { |
1984 | + WnckWindow *win; |
1985 | + |
1986 | + win = wnck_window_get (xid); |
1987 | + if (win) |
1988 | + { |
1989 | + decor_t *d = g_object_get_data (G_OBJECT (win), "decor"); |
1990 | + |
1991 | + if (d->decorated) |
1992 | + { |
1993 | + gint i, j; |
1994 | + event_callback cb = NULL; |
1995 | + Window w = xevent->xany.window; |
1996 | + |
1997 | + for (i = 0; i < 3; i++) |
1998 | + for (j = 0; j < 3; j++) |
1999 | + if (d->event_windows[i][j].window == w) |
2000 | + cb = d->event_windows[i][j].callback; |
2001 | + |
2002 | + if (!cb) |
2003 | + { |
2004 | + for (i = 0; i < BUTTON_NUM; i++) |
2005 | + if (d->button_windows[i].window == w) |
2006 | + cb = d->button_windows[i].callback; |
2007 | + } |
2008 | + |
2009 | + if (cb) |
2010 | + { |
2011 | + decor_event gtkwd_event; |
2012 | + decor_event_type gtkwd_type; |
2013 | + |
2014 | + gtkwd_event.window = w; |
2015 | + |
2016 | + switch (xevent->type) |
2017 | + { |
2018 | + case ButtonPress: |
2019 | + case ButtonRelease: |
2020 | + if (xevent->type == ButtonPress) |
2021 | + gtkwd_type = GButtonPress; |
2022 | + else |
2023 | + gtkwd_type = GButtonRelease; |
2024 | + gtkwd_event.button = xevent->xbutton.button; |
2025 | + gtkwd_event.x = xevent->xbutton.x; |
2026 | + gtkwd_event.y = xevent->xbutton.y; |
2027 | + gtkwd_event.x_root = xevent->xbutton.x_root; |
2028 | + gtkwd_event.y_root = xevent->xbutton.y_root; |
2029 | + gtkwd_event.time = xevent->xbutton.time; |
2030 | + break; |
2031 | + case EnterNotify: |
2032 | + case LeaveNotify: |
2033 | + if (xevent->type == EnterNotify) |
2034 | + gtkwd_type = GEnterNotify; |
2035 | + else |
2036 | + gtkwd_type = GLeaveNotify; |
2037 | + gtkwd_event.x = xevent->xcrossing.x; |
2038 | + gtkwd_event.y = xevent->xcrossing.y; |
2039 | + gtkwd_event.x_root = xevent->xcrossing.x_root; |
2040 | + gtkwd_event.y_root = xevent->xcrossing.y_root; |
2041 | + gtkwd_event.time = xevent->xcrossing.time; |
2042 | + break; |
2043 | + default: |
2044 | + cb = NULL; |
2045 | + break; |
2046 | + } |
2047 | + if (cb) |
2048 | + (*cb) (win, >kwd_event, gtkwd_type); |
2049 | + } |
2050 | + } |
2051 | + } |
2052 | + } |
2053 | + |
2054 | + return GDK_FILTER_CONTINUE; |
2055 | +} |
2056 | + |
2057 | +GdkFilterReturn |
2058 | +selection_event_filter_func (GdkXEvent *gdkxevent, |
2059 | + GdkEvent *event, |
2060 | + gpointer data) |
2061 | +{ |
2062 | + Display *xdisplay; |
2063 | + GdkDisplay *gdkdisplay; |
2064 | + XEvent *xevent = gdkxevent; |
2065 | + int status; |
2066 | + |
2067 | + gdkdisplay = gdk_display_get_default (); |
2068 | + xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay); |
2069 | + |
2070 | + switch (xevent->type) { |
2071 | + case SelectionRequest: |
2072 | + decor_handle_selection_request (xdisplay, xevent, dm_sn_timestamp); |
2073 | + break; |
2074 | + case SelectionClear: |
2075 | + status = decor_handle_selection_clear (xdisplay, xevent, 0); |
2076 | + if (status == DECOR_SELECTION_GIVE_UP) |
2077 | + exit (0); |
2078 | + default: |
2079 | + break; |
2080 | + } |
2081 | + |
2082 | + return GDK_FILTER_CONTINUE; |
2083 | +} |
2084 | |
2085 | === added file '.pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.c' |
2086 | --- .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.c 1970-01-01 00:00:00 +0000 |
2087 | +++ .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-29 09:07:25 +0000 |
2088 | @@ -0,0 +1,443 @@ |
2089 | +/* |
2090 | + * Copyright © 2006 Novell, Inc. |
2091 | + * |
2092 | + * This library is free software; you can redistribute it and/or |
2093 | + * modify it under the terms of the GNU Lesser General Public |
2094 | + * License as published by the Free Software Foundation; either |
2095 | + * version 2 of the License, or (at your option) any later version. |
2096 | + * |
2097 | + * This library is distributed in the hope that it will be useful, |
2098 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2099 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2100 | + * Lesser General Public License for more details. |
2101 | + * |
2102 | + * You should have received a copy of the GNU Lesser General Public |
2103 | + * License along with this library; if not, write to the |
2104 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2105 | + * Boston, MA 02111-1307, USA. |
2106 | + * |
2107 | + * Author: David Reveman <davidr@novell.com> |
2108 | + */ |
2109 | + |
2110 | +#include "gtk-window-decorator.h" |
2111 | + |
2112 | +gboolean minimal = FALSE; |
2113 | + |
2114 | +double decoration_alpha = 0.5; |
2115 | + |
2116 | +#define SWITCHER_SPACE 40 |
2117 | + |
2118 | +decor_extents_t _shadow_extents = { 0, 0, 0, 0 }; |
2119 | +decor_extents_t _win_extents = { 6, 6, 6, 6 }; |
2120 | +decor_extents_t _max_win_extents = { 6, 6, 4, 6 }; |
2121 | +decor_extents_t _default_win_extents = { 6, 6, 6, 6 }; |
2122 | +decor_extents_t _switcher_extents = { 6, 6, 6, 6 + SWITCHER_SPACE }; |
2123 | + |
2124 | +int titlebar_height = 17; |
2125 | +int max_titlebar_height = 17; |
2126 | + |
2127 | +decor_context_t window_active_context = { |
2128 | + { 0, 0, 0, 0 }, |
2129 | + 6, 6, 4, 6, |
2130 | + 0, 0, 0, 0 |
2131 | +}; |
2132 | + |
2133 | +decor_context_t max_window_active_context = { |
2134 | + { 0, 0, 0, 0 }, |
2135 | + 6, 6, 4, 6, |
2136 | + 0, 0, 0, 0 |
2137 | +}; |
2138 | + |
2139 | +decor_context_t window_inactive_context = { |
2140 | + { 0, 0, 0, 0 }, |
2141 | + 6, 6, 4, 6, |
2142 | + 0, 0, 0, 0 |
2143 | +}; |
2144 | + |
2145 | +decor_context_t max_window_inactive_context = { |
2146 | + { 0, 0, 0, 0 }, |
2147 | + 6, 6, 4, 6, |
2148 | + 0, 0, 0, 0 |
2149 | +}; |
2150 | + |
2151 | +decor_context_t window_context_no_shadow = { |
2152 | + { 0, 0, 0, 0 }, |
2153 | + 6, 6, 4, 6, |
2154 | + 0, 0, 0, 0 |
2155 | +}; |
2156 | + |
2157 | +decor_context_t max_window_context_no_shadow = { |
2158 | + { 0, 0, 0, 0 }, |
2159 | + 6, 6, 4, 6, |
2160 | + 0, 0, 0, 0 |
2161 | +}; |
2162 | + |
2163 | +decor_context_t switcher_context = { |
2164 | + { 0, 0, 0, 0 }, |
2165 | + 6, 6, 6, 6 + SWITCHER_SPACE, |
2166 | + 0, 0, 0, 0 |
2167 | +}; |
2168 | + |
2169 | +decor_context_t shadow_context = { |
2170 | + { 0, 0, 0, 0 }, |
2171 | + 0, 0, 0, 0, |
2172 | + 0, 0, 0, 0, |
2173 | +}; |
2174 | + |
2175 | +gdouble shadow_radius = SHADOW_RADIUS; |
2176 | +gdouble shadow_opacity = SHADOW_OPACITY; |
2177 | +gushort shadow_color[3] = { |
2178 | + SHADOW_COLOR_RED, |
2179 | + SHADOW_COLOR_GREEN, |
2180 | + SHADOW_COLOR_BLUE |
2181 | +}; |
2182 | +gint shadow_offset_x = SHADOW_OFFSET_X; |
2183 | +gint shadow_offset_y = SHADOW_OFFSET_Y; |
2184 | + |
2185 | +guint cmdline_options = 0; |
2186 | + |
2187 | +decor_shadow_t *no_border_shadow = NULL; |
2188 | +decor_shadow_t *border_active_shadow = NULL; |
2189 | +decor_shadow_t *border_inactive_shadow = NULL; |
2190 | +decor_shadow_t *max_border_active_shadow = NULL; |
2191 | +decor_shadow_t *max_border_inactive_shadow = NULL; |
2192 | +decor_shadow_t *border_no_shadow = NULL; |
2193 | +decor_shadow_t *max_border_no_shadow = NULL; |
2194 | +decor_shadow_t *switcher_shadow = NULL; |
2195 | + |
2196 | +GdkPixmap *decor_normal_pixmap = NULL; |
2197 | +GdkPixmap *decor_active_pixmap = NULL; |
2198 | + |
2199 | +Atom frame_input_window_atom; |
2200 | +Atom frame_output_window_atom; |
2201 | +Atom win_decor_atom; |
2202 | +Atom win_blur_decor_atom; |
2203 | +Atom wm_move_resize_atom; |
2204 | +Atom restack_window_atom; |
2205 | +Atom select_window_atom; |
2206 | +Atom mwm_hints_atom; |
2207 | +Atom switcher_fg_atom; |
2208 | + |
2209 | +Atom compiz_shadow_info_atom; |
2210 | +Atom compiz_shadow_color_atom; |
2211 | + |
2212 | +Atom toolkit_action_atom; |
2213 | +Atom toolkit_action_window_menu_atom; |
2214 | +Atom toolkit_action_force_quit_dialog_atom; |
2215 | + |
2216 | +Time dm_sn_timestamp; |
2217 | + |
2218 | +struct _cursor cursor[3][3] = { |
2219 | + { C (top_left_corner), C (top_side), C (top_right_corner) }, |
2220 | + { C (left_side), C (left_ptr), C (right_side) }, |
2221 | + { C (bottom_left_corner), C (bottom_side), C (bottom_right_corner) } |
2222 | +}; |
2223 | + |
2224 | +struct _pos pos[3][3] = { |
2225 | + { |
2226 | + { 0, 0, 10, 21, 0, 0, 0, 0, 0, 1 }, |
2227 | + { 10, 0, -8, 6, 0, 0, 1, 0, 0, 1 }, |
2228 | + { 2, 0, 10, 21, 1, 0, 0, 0, 0, 1 } |
2229 | + }, { |
2230 | + { 0, 10, 6, 11, 0, 0, 0, 1, 1, 0 }, |
2231 | + { 6, 6, 0, 15, 0, 0, 1, 0, 0, 1 }, |
2232 | + { 6, 10, 6, 11, 1, 0, 0, 1, 1, 0 } |
2233 | + }, { |
2234 | + { 0, 17, 10, 10, 0, 1, 0, 0, 1, 0 }, |
2235 | + { 10, 21, -8, 6, 0, 1, 1, 0, 1, 0 }, |
2236 | + { 2, 17, 10, 10, 1, 1, 0, 0, 1, 0 } |
2237 | + } |
2238 | +}, bpos[] = { |
2239 | + { 0, 6, 16, 16, 1, 0, 0, 0, 0, 0 }, |
2240 | + { 0, 6, 16, 16, 1, 0, 0, 0, 0, 0 }, |
2241 | + { 0, 6, 16, 16, 1, 0, 0, 0, 0, 0 }, |
2242 | + { 6, 2, 16, 16, 0, 0, 0, 0, 0, 0 } |
2243 | +}; |
2244 | + |
2245 | +char *program_name; |
2246 | + |
2247 | +GtkWidget *style_window_rgba; |
2248 | +GtkWidget *style_window_rgb; |
2249 | +GtkWidget *switcher_label; |
2250 | + |
2251 | +GHashTable *frame_table; |
2252 | +GtkWidget *action_menu = NULL; |
2253 | +gboolean action_menu_mapped = FALSE; |
2254 | +decor_color_t _title_color[2]; |
2255 | +PangoContext *pango_context; |
2256 | +gint double_click_timeout = 250; |
2257 | + |
2258 | +GSList *draw_list = NULL; |
2259 | +guint draw_idle_id = 0; |
2260 | + |
2261 | +PangoFontDescription *titlebar_font = NULL; |
2262 | +gboolean use_system_font = FALSE; |
2263 | +gint text_height; |
2264 | + |
2265 | +gint blur_type = BLUR_TYPE_NONE; |
2266 | + |
2267 | +GdkPixmap *switcher_pixmap = NULL; |
2268 | +GdkPixmap *switcher_buffer_pixmap = NULL; |
2269 | +gint switcher_width; |
2270 | +gint switcher_height; |
2271 | +Window switcher_selected_window = None; |
2272 | +decor_t *switcher_window = NULL; |
2273 | + |
2274 | +XRenderPictFormat *xformat_rgba; |
2275 | +XRenderPictFormat *xformat_rgb; |
2276 | + |
2277 | +int |
2278 | +main (int argc, char *argv[]) |
2279 | +{ |
2280 | + GdkDisplay *gdkdisplay; |
2281 | + Display *xdisplay; |
2282 | + GdkScreen *gdkscreen; |
2283 | + WnckScreen *screen; |
2284 | + gint i, j, status; |
2285 | + unsigned int nchildren; |
2286 | + Window root_ret, parent_ret; |
2287 | + Window *children = NULL; |
2288 | + gboolean replace = FALSE; |
2289 | + |
2290 | +#ifdef USE_METACITY |
2291 | + char *meta_theme = NULL; |
2292 | +#endif |
2293 | + |
2294 | + program_name = argv[0]; |
2295 | + |
2296 | + gtk_init (&argc, &argv); |
2297 | + |
2298 | + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); |
2299 | + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); |
2300 | + textdomain (GETTEXT_PACKAGE); |
2301 | + |
2302 | + for (i = 0; i < argc; i++) |
2303 | + { |
2304 | + if (strcmp (argv[i], "--minimal") == 0) |
2305 | + { |
2306 | + minimal = TRUE; |
2307 | + } |
2308 | + else if (strcmp (argv[i], "--replace") == 0) |
2309 | + { |
2310 | + replace = TRUE; |
2311 | + } |
2312 | + else if (strcmp (argv[i], "--blur") == 0) |
2313 | + { |
2314 | + if (argc > ++i) |
2315 | + { |
2316 | + if (strcmp (argv[i], "titlebar") == 0) |
2317 | + blur_type = BLUR_TYPE_TITLEBAR; |
2318 | + else if (strcmp (argv[i], "all") == 0) |
2319 | + blur_type = BLUR_TYPE_ALL; |
2320 | + } |
2321 | + cmdline_options |= CMDLINE_BLUR; |
2322 | + } |
2323 | + |
2324 | +#ifdef USE_METACITY |
2325 | + else if (strcmp (argv[i], "--opacity") == 0) |
2326 | + { |
2327 | + if (argc > ++i) |
2328 | + meta_opacity = atof (argv[i]); |
2329 | + cmdline_options |= CMDLINE_OPACITY; |
2330 | + } |
2331 | + else if (strcmp (argv[i], "--no-opacity-shade") == 0) |
2332 | + { |
2333 | + meta_shade_opacity = FALSE; |
2334 | + cmdline_options |= CMDLINE_OPACITY_SHADE; |
2335 | + } |
2336 | + else if (strcmp (argv[i], "--active-opacity") == 0) |
2337 | + { |
2338 | + if (argc > ++i) |
2339 | + meta_active_opacity = atof (argv[i]); |
2340 | + cmdline_options |= CMDLINE_ACTIVE_OPACITY; |
2341 | + } |
2342 | + else if (strcmp (argv[i], "--no-active-opacity-shade") == 0) |
2343 | + { |
2344 | + meta_active_shade_opacity = FALSE; |
2345 | + cmdline_options |= CMDLINE_ACTIVE_OPACITY_SHADE; |
2346 | + } |
2347 | + else if (strcmp (argv[i], "--metacity-theme") == 0) |
2348 | + { |
2349 | + if (argc > ++i) |
2350 | + meta_theme = argv[i]; |
2351 | + cmdline_options |= CMDLINE_THEME; |
2352 | + } |
2353 | +#endif |
2354 | + |
2355 | + else if (strcmp (argv[i], "--help") == 0) |
2356 | + { |
2357 | + fprintf (stderr, "%s " |
2358 | + "[--minimal] " |
2359 | + "[--replace] " |
2360 | + "[--blur none|titlebar|all] " |
2361 | + |
2362 | +#ifdef USE_METACITY |
2363 | + "[--opacity OPACITY] " |
2364 | + "[--no-opacity-shade] " |
2365 | + "[--active-opacity OPACITY] " |
2366 | + "[--no-active-opacity-shade] " |
2367 | + "[--metacity-theme THEME] " |
2368 | +#endif |
2369 | + |
2370 | + "[--help]" |
2371 | + |
2372 | + "\n", program_name); |
2373 | + return 0; |
2374 | + } |
2375 | + } |
2376 | + |
2377 | + theme_draw_window_decoration = draw_window_decoration; |
2378 | + theme_calc_decoration_size = calc_decoration_size; |
2379 | + theme_update_border_extents = update_border_extents; |
2380 | + theme_get_event_window_position = get_event_window_position; |
2381 | + theme_get_button_position = get_button_position; |
2382 | + theme_update_shadow = cairo_update_shadow; |
2383 | + theme_get_shadow = get_shadow; |
2384 | + theme_get_border_extents = get_border_extents; |
2385 | + |
2386 | +#ifdef USE_METACITY |
2387 | + if (meta_theme) |
2388 | + { |
2389 | + meta_theme_set_current (meta_theme, TRUE); |
2390 | + if (meta_theme_get_current ()) |
2391 | + { |
2392 | + theme_draw_window_decoration = meta_draw_window_decoration; |
2393 | + theme_calc_decoration_size = meta_calc_decoration_size; |
2394 | + theme_update_border_extents = meta_update_border_extents; |
2395 | + theme_get_event_window_position = meta_get_event_window_position; |
2396 | + theme_get_button_position = meta_get_button_position; |
2397 | + theme_update_shadow = meta_update_shadow; |
2398 | + theme_get_shadow = meta_get_shadow; |
2399 | + theme_get_border_extents = meta_get_border_extents; |
2400 | + } |
2401 | + } |
2402 | +#endif |
2403 | + |
2404 | + gdkdisplay = gdk_display_get_default (); |
2405 | + xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay); |
2406 | + gdkscreen = gdk_display_get_default_screen (gdkdisplay); |
2407 | + |
2408 | + frame_input_window_atom = XInternAtom (xdisplay, |
2409 | + DECOR_INPUT_FRAME_ATOM_NAME, FALSE); |
2410 | + frame_output_window_atom = XInternAtom (xdisplay, |
2411 | + DECOR_OUTPUT_FRAME_ATOM_NAME, FALSE); |
2412 | + |
2413 | + win_decor_atom = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, FALSE); |
2414 | + win_blur_decor_atom = XInternAtom (xdisplay, DECOR_BLUR_ATOM_NAME, FALSE); |
2415 | + wm_move_resize_atom = XInternAtom (xdisplay, "_NET_WM_MOVERESIZE", FALSE); |
2416 | + restack_window_atom = XInternAtom (xdisplay, "_NET_RESTACK_WINDOW", FALSE); |
2417 | + select_window_atom = XInternAtom (xdisplay, DECOR_SWITCH_WINDOW_ATOM_NAME, |
2418 | + FALSE); |
2419 | + mwm_hints_atom = XInternAtom (xdisplay, "_MOTIF_WM_HINTS", FALSE); |
2420 | + switcher_fg_atom = XInternAtom (xdisplay, |
2421 | + DECOR_SWITCH_FOREGROUND_COLOR_ATOM_NAME, |
2422 | + FALSE); |
2423 | + |
2424 | + compiz_shadow_info_atom = XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_PROPERTIES", FALSE); |
2425 | + compiz_shadow_color_atom = XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_COLOR", FALSE); |
2426 | + |
2427 | + toolkit_action_atom = |
2428 | + XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION", FALSE); |
2429 | + toolkit_action_window_menu_atom = |
2430 | + XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_WINDOW_MENU", FALSE); |
2431 | + toolkit_action_force_quit_dialog_atom = |
2432 | + XInternAtom (xdisplay, "_COMPIZ_TOOLKIT_ACTION_FORCE_QUIT_DIALOG", |
2433 | + FALSE); |
2434 | + |
2435 | + status = decor_acquire_dm_session (xdisplay, |
2436 | + gdk_screen_get_number (gdkscreen), |
2437 | + "gwd", replace, &dm_sn_timestamp); |
2438 | + if (status != DECOR_ACQUIRE_STATUS_SUCCESS) |
2439 | + { |
2440 | + if (status == DECOR_ACQUIRE_STATUS_FAILED) |
2441 | + { |
2442 | + fprintf (stderr, |
2443 | + "%s: Could not acquire decoration manager " |
2444 | + "selection on screen %d display \"%s\"\n", |
2445 | + program_name, gdk_screen_get_number (gdkscreen), |
2446 | + DisplayString (xdisplay)); |
2447 | + } |
2448 | + else if (status == DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING) |
2449 | + { |
2450 | + fprintf (stderr, |
2451 | + "%s: Screen %d on display \"%s\" already " |
2452 | + "has a decoration manager; try using the " |
2453 | + "--replace option to replace the current " |
2454 | + "decoration manager.\n", |
2455 | + program_name, gdk_screen_get_number (gdkscreen), |
2456 | + DisplayString (xdisplay)); |
2457 | + } |
2458 | + |
2459 | + return 1; |
2460 | + } |
2461 | + |
2462 | + for (i = 0; i < 3; i++) |
2463 | + { |
2464 | + for (j = 0; j < 3; j++) |
2465 | + { |
2466 | + if (cursor[i][j].shape != XC_left_ptr) |
2467 | + cursor[i][j].cursor = |
2468 | + XCreateFontCursor (xdisplay, cursor[i][j].shape); |
2469 | + } |
2470 | + } |
2471 | + |
2472 | + xformat_rgba = XRenderFindStandardFormat (xdisplay, PictStandardARGB32); |
2473 | + xformat_rgb = XRenderFindStandardFormat (xdisplay, PictStandardRGB24); |
2474 | + |
2475 | + frame_table = g_hash_table_new (NULL, NULL); |
2476 | + |
2477 | + screen = wnck_screen_get_default (); |
2478 | + wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER); |
2479 | + |
2480 | + gdk_window_add_filter (NULL, |
2481 | + selection_event_filter_func, |
2482 | + NULL); |
2483 | + |
2484 | + if (!minimal) |
2485 | + { |
2486 | + GdkWindow *root = create_foreign_window (gdk_x11_get_default_root_xwindow ()); |
2487 | + |
2488 | + gdk_window_add_filter (NULL, |
2489 | + event_filter_func, |
2490 | + NULL); |
2491 | + |
2492 | + XQueryTree (xdisplay, gdk_x11_get_default_root_xwindow (), |
2493 | + &root_ret, &parent_ret, &children, &nchildren); |
2494 | + |
2495 | + for (i = 0; i < nchildren; i++) |
2496 | + { |
2497 | + GdkWindow *toplevel = create_foreign_window (children[i]); |
2498 | + |
2499 | + /* Need property notify on all windows */ |
2500 | + |
2501 | + gdk_window_set_events (toplevel, |
2502 | + gdk_window_get_events (toplevel) | |
2503 | + GDK_PROPERTY_CHANGE_MASK); |
2504 | + } |
2505 | + |
2506 | + /* Need MapNotify on new windows */ |
2507 | + gdk_window_set_events (root, gdk_window_get_events (root) | |
2508 | + GDK_STRUCTURE_MASK | |
2509 | + GDK_PROPERTY_CHANGE_MASK | |
2510 | + GDK_VISIBILITY_NOTIFY_MASK | |
2511 | + GDK_SUBSTRUCTURE_MASK); |
2512 | + |
2513 | + connect_screen (screen); |
2514 | + } |
2515 | + |
2516 | + if (!init_settings (screen)) |
2517 | + { |
2518 | + fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]); |
2519 | + return 1; |
2520 | + } |
2521 | + |
2522 | + decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen), |
2523 | + WINDOW_DECORATION_TYPE_PIXMAP | |
2524 | + WINDOW_DECORATION_TYPE_WINDOW); |
2525 | + |
2526 | + update_default_decorations (gdkscreen); |
2527 | + |
2528 | + gtk_main (); |
2529 | + |
2530 | + return 0; |
2531 | +} |
2532 | |
2533 | === added file '.pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.h' |
2534 | --- .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.h 1970-01-01 00:00:00 +0000 |
2535 | +++ .pc/fix-883383.patch/unity/unity_window_decorator/src/gtk-window-decorator.h 2011-10-29 09:07:25 +0000 |
2536 | @@ -0,0 +1,1009 @@ |
2537 | +#ifndef _GTK_WINDOW_DECORATOR_H |
2538 | +#define _GTK_WINDOW_DECORATOR_H |
2539 | +#ifdef HAVE_CONFIG_H |
2540 | +#include <config.h> |
2541 | +#endif |
2542 | + |
2543 | +#include <decoration.h> |
2544 | + |
2545 | +#include <X11/Xlib.h> |
2546 | +#include <X11/Xatom.h> |
2547 | +#include <X11/cursorfont.h> |
2548 | +#include <X11/extensions/Xrender.h> |
2549 | +#include <X11/Xregion.h> |
2550 | + |
2551 | +#ifdef HAVE_GTK_2_24 |
2552 | + |
2553 | +#ifndef GDK_DISABLE_DEPRECATED |
2554 | +#define GDK_DISABLE_DEPRECATED |
2555 | +#endif |
2556 | + |
2557 | +#define create_foreign_window(xid) \ |
2558 | + gdk_x11_foreign_new_for_display (gdk_display_get_default (), \ |
2559 | + xid); |
2560 | +#else |
2561 | + |
2562 | +#define create_foreign_window(xid) \ |
2563 | + gdk_window_foreign_new (xid) |
2564 | + |
2565 | +#ifdef GTK_DISABLE_DEPRECATED |
2566 | +#undef GTK_DISABLE_DEPRECATED |
2567 | +#endif |
2568 | + |
2569 | +#endif |
2570 | + |
2571 | +#include <gtk/gtk.h> |
2572 | +#include <gdk/gdkx.h> |
2573 | +#include <gdk/gdk.h> |
2574 | + |
2575 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
2576 | +#include <gconf/gconf-client.h> |
2577 | +#endif |
2578 | + |
2579 | +#ifdef USE_DBUS_GLIB |
2580 | +#define DBUS_API_SUBJECT_TO_CHANGE |
2581 | +#include <dbus/dbus.h> |
2582 | +#include <dbus/dbus-glib-lowlevel.h> |
2583 | +#endif |
2584 | + |
2585 | +#define WNCK_I_KNOW_THIS_IS_UNSTABLE |
2586 | +#include <libwnck/libwnck.h> |
2587 | +#include <libwnck/window-action-menu.h> |
2588 | + |
2589 | +#ifndef HAVE_LIBWNCK_2_19_4 |
2590 | +#define wnck_window_get_client_window_geometry wnck_window_get_geometry |
2591 | +#endif |
2592 | + |
2593 | +#include <cairo.h> |
2594 | +#include <cairo-xlib.h> |
2595 | + |
2596 | +#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 1, 0) |
2597 | +#define CAIRO_EXTEND_PAD CAIRO_EXTEND_NONE |
2598 | +#endif |
2599 | + |
2600 | +#include <pango/pango-context.h> |
2601 | +#include <pango/pangocairo.h> |
2602 | + |
2603 | +#include <string.h> |
2604 | +#include <stdlib.h> |
2605 | +#include <math.h> |
2606 | +#include <limits.h> |
2607 | +#include <unistd.h> |
2608 | +#include <sys/types.h> |
2609 | +#include <signal.h> |
2610 | + |
2611 | +#include <libintl.h> |
2612 | +#define _(x) gettext (x) |
2613 | +#define N_(x) x |
2614 | + |
2615 | +#ifdef USE_METACITY |
2616 | +#include <metacity-private/theme.h> |
2617 | +#endif |
2618 | + |
2619 | +#define METACITY_GCONF_DIR "/apps/metacity/general" |
2620 | + |
2621 | +#define COMPIZ_USE_SYSTEM_FONT_KEY \ |
2622 | +METACITY_GCONF_DIR "/titlebar_uses_system_font" |
2623 | + |
2624 | +#define COMPIZ_TITLEBAR_FONT_KEY \ |
2625 | +METACITY_GCONF_DIR "/titlebar_font" |
2626 | + |
2627 | +#define COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY \ |
2628 | +METACITY_GCONF_DIR "/action_double_click_titlebar" |
2629 | + |
2630 | +#define COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY \ |
2631 | +METACITY_GCONF_DIR "/action_middle_click_titlebar" |
2632 | + |
2633 | +#define COMPIZ_RIGHT_CLICK_TITLEBAR_KEY \ |
2634 | +METACITY_GCONF_DIR "/action_right_click_titlebar" |
2635 | + |
2636 | +#define COMPIZ_GCONF_DIR1 "/apps/compiz/plugins/decoration/allscreens/options" |
2637 | + |
2638 | +#define COMPIZ_SHADOW_RADIUS_KEY \ |
2639 | +COMPIZ_GCONF_DIR1 "/shadow_radius" |
2640 | + |
2641 | +#define COMPIZ_SHADOW_OPACITY_KEY \ |
2642 | +COMPIZ_GCONF_DIR1 "/shadow_opacity" |
2643 | + |
2644 | +#define COMPIZ_SHADOW_COLOR_KEY \ |
2645 | +COMPIZ_GCONF_DIR1 "/shadow_color" |
2646 | + |
2647 | +#define COMPIZ_SHADOW_OFFSET_X_KEY \ |
2648 | +COMPIZ_GCONF_DIR1 "/shadow_x_offset" |
2649 | + |
2650 | +#define COMPIZ_SHADOW_OFFSET_Y_KEY \ |
2651 | +COMPIZ_GCONF_DIR1 "/shadow_y_offset" |
2652 | + |
2653 | +#define META_THEME_KEY \ |
2654 | +METACITY_GCONF_DIR "/theme" |
2655 | + |
2656 | +#define META_BUTTON_LAYOUT_KEY \ |
2657 | +METACITY_GCONF_DIR "/button_layout" |
2658 | + |
2659 | +#define GCONF_DIR "/apps/gwd" |
2660 | + |
2661 | +#define USE_META_THEME_KEY \ |
2662 | +GCONF_DIR "/use_metacity_theme" |
2663 | + |
2664 | +#define META_THEME_OPACITY_KEY \ |
2665 | +GCONF_DIR "/metacity_theme_opacity" |
2666 | + |
2667 | +#define META_THEME_SHADE_OPACITY_KEY \ |
2668 | +GCONF_DIR "/metacity_theme_shade_opacity" |
2669 | + |
2670 | +#define META_THEME_ACTIVE_OPACITY_KEY \ |
2671 | +GCONF_DIR "/metacity_theme_active_opacity" |
2672 | + |
2673 | +#define META_THEME_ACTIVE_SHADE_OPACITY_KEY \ |
2674 | +GCONF_DIR "/metacity_theme_active_shade_opacity" |
2675 | + |
2676 | +#define BLUR_TYPE_KEY \ |
2677 | +GCONF_DIR "/blur_type" |
2678 | + |
2679 | +#define WHEEL_ACTION_KEY \ |
2680 | +GCONF_DIR "/mouse_wheel_action" |
2681 | + |
2682 | +#define DBUS_DEST "org.freedesktop.compiz" |
2683 | +#define DBUS_PATH "/org/freedesktop/compiz/decor/screen0" |
2684 | +#define DBUS_INTERFACE "org.freedesktop.compiz" |
2685 | +#define DBUS_METHOD_GET "get" |
2686 | + |
2687 | +#define STROKE_ALPHA 0.6 |
2688 | + |
2689 | +#define ICON_SPACE 20 |
2690 | + |
2691 | +#define DOUBLE_CLICK_DISTANCE 8.0 |
2692 | + |
2693 | +#define WM_MOVERESIZE_SIZE_TOPLEFT 0 |
2694 | +#define WM_MOVERESIZE_SIZE_TOP 1 |
2695 | +#define WM_MOVERESIZE_SIZE_TOPRIGHT 2 |
2696 | +#define WM_MOVERESIZE_SIZE_RIGHT 3 |
2697 | +#define WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4 |
2698 | +#define WM_MOVERESIZE_SIZE_BOTTOM 5 |
2699 | +#define WM_MOVERESIZE_SIZE_BOTTOMLEFT 6 |
2700 | +#define WM_MOVERESIZE_SIZE_LEFT 7 |
2701 | +#define WM_MOVERESIZE_MOVE 8 |
2702 | +#define WM_MOVERESIZE_SIZE_KEYBOARD 9 |
2703 | +#define WM_MOVERESIZE_MOVE_KEYBOARD 10 |
2704 | + |
2705 | +#define SHADOW_RADIUS 8.0 |
2706 | +#define SHADOW_OPACITY 0.5 |
2707 | +#define SHADOW_OFFSET_X 1 |
2708 | +#define SHADOW_OFFSET_Y 1 |
2709 | +#define SHADOW_COLOR_RED 0x0000 |
2710 | +#define SHADOW_COLOR_GREEN 0x0000 |
2711 | +#define SHADOW_COLOR_BLUE 0x0000 |
2712 | + |
2713 | +#define SHADOW_TYPE_ACTIVE_NORMAL 1 |
2714 | +#define SHADOW_TYPE_ACTIVE_MAX 2 |
2715 | +#define SHADOW_TYPE_INACTIVE_NORMAL 3 |
2716 | +#define SHADOW_TYPE_INACTIVE_MAX 4 |
2717 | + |
2718 | +#define META_OPACITY 0.75 |
2719 | +#define META_SHADE_OPACITY TRUE |
2720 | +#define META_ACTIVE_OPACITY 1.0 |
2721 | +#define META_ACTIVE_SHADE_OPACITY TRUE |
2722 | + |
2723 | +#define META_MAXIMIZED (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | \ |
2724 | +WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY) |
2725 | + |
2726 | +#define CMDLINE_OPACITY (1 << 0) |
2727 | +#define CMDLINE_OPACITY_SHADE (1 << 1) |
2728 | +#define CMDLINE_ACTIVE_OPACITY (1 << 2) |
2729 | +#define CMDLINE_ACTIVE_OPACITY_SHADE (1 << 3) |
2730 | +#define CMDLINE_BLUR (1 << 4) |
2731 | +#define CMDLINE_THEME (1 << 5) |
2732 | + |
2733 | +#define MWM_HINTS_DECORATIONS (1L << 1) |
2734 | + |
2735 | +#define MWM_DECOR_ALL (1L << 0) |
2736 | +#define MWM_DECOR_BORDER (1L << 1) |
2737 | +#define MWM_DECOR_HANDLE (1L << 2) |
2738 | +#define MWM_DECOR_TITLE (1L << 3) |
2739 | +#define MWM_DECOR_MENU (1L << 4) |
2740 | +#define MWM_DECOR_MINIMIZE (1L << 5) |
2741 | +#define MWM_DECOR_MAXIMIZE (1L << 6) |
2742 | + |
2743 | +#define PROP_MOTIF_WM_HINT_ELEMENTS 3 |
2744 | + |
2745 | +/* to save some memory, value is specific to current decorations */ |
2746 | +#define TRANSLUCENT_CORNER_SIZE 3 |
2747 | + |
2748 | +typedef struct { |
2749 | +unsigned long flags; |
2750 | +unsigned long functions; |
2751 | +unsigned long decorations; |
2752 | +} MwmHints; |
2753 | + |
2754 | +enum { |
2755 | + CLICK_ACTION_NONE, |
2756 | + CLICK_ACTION_SHADE, |
2757 | + CLICK_ACTION_MAXIMIZE, |
2758 | + CLICK_ACTION_MINIMIZE, |
2759 | + CLICK_ACTION_RAISE, |
2760 | + CLICK_ACTION_LOWER, |
2761 | + CLICK_ACTION_MENU |
2762 | +}; |
2763 | + |
2764 | +enum { |
2765 | + WHEEL_ACTION_NONE, |
2766 | + WHEEL_ACTION_SHADE |
2767 | +}; |
2768 | + |
2769 | +#define DOUBLE_CLICK_ACTION_DEFAULT CLICK_ACTION_MAXIMIZE |
2770 | +#define MIDDLE_CLICK_ACTION_DEFAULT CLICK_ACTION_LOWER |
2771 | +#define RIGHT_CLICK_ACTION_DEFAULT CLICK_ACTION_MENU |
2772 | +#define WHEEL_ACTION_DEFAULT WHEEL_ACTION_NONE |
2773 | + |
2774 | +int double_click_action; |
2775 | +int middle_click_action; |
2776 | +int right_click_action; |
2777 | +int wheel_action; |
2778 | + |
2779 | +extern gboolean minimal; |
2780 | +extern double decoration_alpha; |
2781 | + |
2782 | +#define SWITCHER_SPACE 40 |
2783 | + |
2784 | +extern decor_extents_t _shadow_extents; |
2785 | +extern decor_extents_t _win_extents; |
2786 | +extern decor_extents_t _max_win_extents; |
2787 | +extern decor_extents_t _default_win_extents; |
2788 | +extern decor_extents_t _switcher_extents; |
2789 | + |
2790 | +extern int titlebar_height; |
2791 | +extern int max_titlebar_height; |
2792 | + |
2793 | +extern decor_context_t window_active_context; |
2794 | +extern decor_context_t window_inactive_context; |
2795 | +extern decor_context_t window_context_no_shadow; |
2796 | +extern decor_context_t max_window_active_context; |
2797 | +extern decor_context_t max_window_inactive_context; |
2798 | +extern decor_context_t max_window_context_no_shadow; |
2799 | +extern decor_context_t switcher_context; |
2800 | +extern decor_context_t shadow_context; |
2801 | + |
2802 | +extern gdouble shadow_radius; |
2803 | +extern gdouble shadow_opacity; |
2804 | +extern gushort shadow_color[3]; |
2805 | +extern gint shadow_offset_x; |
2806 | +extern gint shadow_offset_y; |
2807 | + |
2808 | +#ifdef USE_METACITY |
2809 | +extern double meta_opacity; |
2810 | +extern gboolean meta_shade_opacity; |
2811 | +extern double meta_active_opacity; |
2812 | +extern gboolean meta_active_shade_opacity; |
2813 | + |
2814 | +extern gboolean meta_button_layout_set; |
2815 | +extern MetaButtonLayout meta_button_layout; |
2816 | +#endif |
2817 | + |
2818 | +extern guint cmdline_options; |
2819 | + |
2820 | +extern decor_shadow_t *no_border_shadow; |
2821 | +extern decor_shadow_t *border_active_shadow; |
2822 | +extern decor_shadow_t *border_inactive_shadow; |
2823 | +extern decor_shadow_t *border_no_shadow; |
2824 | +extern decor_shadow_t *max_border_active_shadow; |
2825 | +extern decor_shadow_t *max_border_inactive_shadow; |
2826 | +extern decor_shadow_t *max_border_no_shadow; |
2827 | +extern decor_shadow_t *switcher_shadow; |
2828 | + |
2829 | +extern GdkPixmap *decor_normal_pixmap; |
2830 | +extern GdkPixmap *decor_active_pixmap; |
2831 | + |
2832 | +extern Atom frame_input_window_atom; |
2833 | +extern Atom frame_output_window_atom; |
2834 | +extern Atom win_decor_atom; |
2835 | +extern Atom win_blur_decor_atom; |
2836 | +extern Atom wm_move_resize_atom; |
2837 | +extern Atom restack_window_atom; |
2838 | +extern Atom select_window_atom; |
2839 | +extern Atom mwm_hints_atom; |
2840 | +extern Atom switcher_fg_atom; |
2841 | + |
2842 | +extern Atom toolkit_action_atom; |
2843 | +extern Atom toolkit_action_window_menu_atom; |
2844 | +extern Atom toolkit_action_force_quit_dialog_atom; |
2845 | + |
2846 | +extern Time dm_sn_timestamp; |
2847 | + |
2848 | +#define C(name) { 0, XC_ ## name } |
2849 | + |
2850 | +struct _cursor { |
2851 | + Cursor cursor; |
2852 | + unsigned int shape; |
2853 | +}; |
2854 | + |
2855 | +extern struct _cursor cursor[3][3]; |
2856 | + |
2857 | +#define BUTTON_CLOSE 0 |
2858 | +#define BUTTON_MAX 1 |
2859 | +#define BUTTON_MIN 2 |
2860 | +#define BUTTON_MENU 3 |
2861 | +#define BUTTON_SHADE 4 |
2862 | +#define BUTTON_ABOVE 5 |
2863 | +#define BUTTON_STICK 6 |
2864 | +#define BUTTON_UNSHADE 7 |
2865 | +#define BUTTON_UNABOVE 8 |
2866 | +#define BUTTON_UNSTICK 9 |
2867 | +#define BUTTON_NUM 10 |
2868 | + |
2869 | +struct _pos { |
2870 | + int x, y, w, h; |
2871 | + int xw, yh, ww, hh, yth, hth; |
2872 | +}; |
2873 | + |
2874 | +extern struct _pos pos[3][3], bpos[]; |
2875 | + |
2876 | +typedef struct _decor_color { |
2877 | + double r; |
2878 | + double g; |
2879 | + double b; |
2880 | +} decor_color_t; |
2881 | + |
2882 | + |
2883 | +#define IN_EVENT_WINDOW (1 << 0) |
2884 | +#define PRESSED_EVENT_WINDOW (1 << 1) |
2885 | + |
2886 | +typedef struct _decor_event { |
2887 | + guint time; |
2888 | + guint window; |
2889 | + guint x; |
2890 | + guint y; |
2891 | + guint x_root; |
2892 | + guint y_root; |
2893 | + guint button; |
2894 | +} decor_event; |
2895 | + |
2896 | +typedef enum _decor_event_type { |
2897 | + GButtonPress = 1, |
2898 | + GButtonRelease, |
2899 | + GEnterNotify, |
2900 | + GLeaveNotify, |
2901 | + GMotionNotify |
2902 | +} decor_event_type; |
2903 | + |
2904 | +typedef void (*event_callback) (WnckWindow *win, |
2905 | + decor_event *gtkwd_event, |
2906 | + decor_event_type gtkwd_type); |
2907 | + |
2908 | +typedef struct { |
2909 | + Window window; |
2910 | + Box pos; |
2911 | + event_callback callback; |
2912 | +} event_window; |
2913 | + |
2914 | +typedef struct _decor { |
2915 | + WnckWindow *win; |
2916 | + event_window event_windows[3][3]; |
2917 | + event_window button_windows[BUTTON_NUM]; |
2918 | + Box *last_pos_entered; |
2919 | + guint button_states[BUTTON_NUM]; |
2920 | + GdkPixmap *pixmap; |
2921 | + GdkPixmap *buffer_pixmap; |
2922 | + GdkWindow *frame_window; |
2923 | + GtkWidget *decor_window; |
2924 | + GtkWidget *decor_event_box; |
2925 | + GtkWidget *decor_image; |
2926 | + cairo_t *cr; |
2927 | + decor_layout_t border_layout; |
2928 | + decor_context_t *context; |
2929 | + decor_shadow_t *shadow; |
2930 | + Picture picture; |
2931 | + gint button_width; |
2932 | + gint width; |
2933 | + gint height; |
2934 | + gint client_width; |
2935 | + gint client_height; |
2936 | + gboolean decorated; |
2937 | + gboolean active; |
2938 | + PangoLayout *layout; |
2939 | + gchar *name; |
2940 | + cairo_pattern_t *icon; |
2941 | + GdkPixmap *icon_pixmap; |
2942 | + GdkPixbuf *icon_pixbuf; |
2943 | + WnckWindowState state; |
2944 | + WnckWindowActions actions; |
2945 | + XID prop_xid; |
2946 | + GtkWidget *force_quit_dialog; |
2947 | + GSList *transient_windows; |
2948 | + WnckWindow *transient_parent; |
2949 | + Bool created; |
2950 | + void (*draw) (struct _decor *d); |
2951 | +} decor_t; |
2952 | + |
2953 | +void (*theme_draw_window_decoration) (decor_t *d); |
2954 | +gboolean (*theme_calc_decoration_size) (decor_t *d, |
2955 | + int client_width, |
2956 | + int client_height, |
2957 | + int text_width, |
2958 | + int *width, |
2959 | + int *height); |
2960 | +void (*theme_update_border_extents) (gint text_height); |
2961 | +void (*theme_get_event_window_position) (decor_t *d, |
2962 | + gint i, |
2963 | + gint j, |
2964 | + gint width, |
2965 | + gint height, |
2966 | + gint *x, |
2967 | + gint *y, |
2968 | + gint *w, |
2969 | + gint *h); |
2970 | +gboolean (*theme_get_button_position) (decor_t *d, |
2971 | + gint i, |
2972 | + gint width, |
2973 | + gint height, |
2974 | + gint *x, |
2975 | + gint *y, |
2976 | + gint *w, |
2977 | + gint *h); |
2978 | + |
2979 | +decor_shadow_t * (*theme_update_shadow) (gint shadow_type); |
2980 | + |
2981 | +void (*theme_get_shadow) (decor_t *d, |
2982 | + gint shadow_type); |
2983 | + |
2984 | +void (*theme_get_border_extents) (decor_extents_t *extents, |
2985 | + decor_extents_t *frame_extents, |
2986 | + decor_extents_t *extents_max, |
2987 | + decor_extents_t *frame_extents_max); |
2988 | + |
2989 | +extern char *program_name; |
2990 | + |
2991 | +extern GtkWidget *style_window_rgba; |
2992 | +extern GtkWidget *style_window_rgb; |
2993 | +extern GtkWidget *switcher_label; |
2994 | + |
2995 | +extern GHashTable *frame_table; |
2996 | +extern GtkWidget *action_menu; |
2997 | +extern gboolean action_menu_mapped; |
2998 | +extern decor_color_t _title_color[2]; |
2999 | +extern PangoContext *pango_context; |
3000 | +extern gint double_click_timeout; |
3001 | + |
3002 | +extern GSList *draw_list; |
3003 | +extern guint draw_idle_id; |
3004 | + |
3005 | +extern PangoFontDescription *titlebar_font; |
3006 | +extern gboolean use_system_font; |
3007 | +extern gint text_height; |
3008 | + |
3009 | +#define BLUR_TYPE_NONE 0 |
3010 | +#define BLUR_TYPE_TITLEBAR 1 |
3011 | +#define BLUR_TYPE_ALL 2 |
3012 | + |
3013 | +extern gint blur_type; |
3014 | + |
3015 | +extern GdkPixmap *switcher_pixmap; |
3016 | +extern GdkPixmap *switcher_buffer_pixmap; |
3017 | +extern gint switcher_width; |
3018 | +extern gint switcher_height; |
3019 | +extern Window switcher_selected_window; |
3020 | +extern decor_t *switcher_window; |
3021 | + |
3022 | +extern XRenderPictFormat *xformat_rgba; |
3023 | +extern XRenderPictFormat *xformat_rgb; |
3024 | + |
3025 | +extern Atom compiz_shadow_info_atom; |
3026 | +extern Atom compiz_shadow_color_atom; |
3027 | + |
3028 | +/* gtk-window-decorator.c */ |
3029 | + |
3030 | +double |
3031 | +dist (double x1, double y1, |
3032 | + double x2, double y2); |
3033 | + |
3034 | +/* decorator.c */ |
3035 | + |
3036 | +gboolean |
3037 | +update_window_decoration_size (WnckWindow *win); |
3038 | + |
3039 | +void |
3040 | +update_window_decoration_name (WnckWindow *win); |
3041 | + |
3042 | +gint |
3043 | +max_window_name_width (WnckWindow *win); |
3044 | + |
3045 | +void |
3046 | +update_default_decorations (GdkScreen *screen); |
3047 | + |
3048 | +void |
3049 | +update_window_decoration_state (WnckWindow *win); |
3050 | + |
3051 | +void |
3052 | +update_window_decoration_actions (WnckWindow *win); |
3053 | + |
3054 | +void |
3055 | +update_window_decoration_icon (WnckWindow *win); |
3056 | + |
3057 | +void |
3058 | +update_event_windows (WnckWindow *win); |
3059 | + |
3060 | +int |
3061 | +update_shadow (void); |
3062 | + |
3063 | +void |
3064 | +shadow_property_changed (WnckScreen *screen); |
3065 | + |
3066 | +void |
3067 | +update_titlebar_font (void); |
3068 | + |
3069 | +void |
3070 | +update_window_decoration_name (WnckWindow *win); |
3071 | + |
3072 | +void |
3073 | +update_window_decoration (WnckWindow *win); |
3074 | + |
3075 | +void |
3076 | +queue_decor_draw (decor_t *d); |
3077 | + |
3078 | +void |
3079 | +copy_to_front_buffer (decor_t *d); |
3080 | + |
3081 | +void |
3082 | +draw_border_shape (Display *xdisplay, |
3083 | + Pixmap pixmap, |
3084 | + Picture picture, |
3085 | + int width, |
3086 | + int height, |
3087 | + decor_context_t *c, |
3088 | + void *closure); |
3089 | + |
3090 | + |
3091 | +/* wnck.c*/ |
3092 | + |
3093 | +void |
3094 | +decorations_changed (WnckScreen *screen); |
3095 | + |
3096 | +void |
3097 | +connect_screen (WnckScreen *screen); |
3098 | + |
3099 | +void |
3100 | +add_frame_window (WnckWindow *win, |
3101 | + Window frame, |
3102 | + Bool mode); |
3103 | + |
3104 | +void |
3105 | +remove_frame_window (WnckWindow *win); |
3106 | + |
3107 | +void |
3108 | +restack_window (WnckWindow *win, |
3109 | + int stack_mode); |
3110 | + |
3111 | +void connect_window (WnckWindow *win); |
3112 | + |
3113 | +/* blur.c */ |
3114 | + |
3115 | +void |
3116 | +decor_update_blur_property (decor_t *d, |
3117 | + int width, |
3118 | + int height, |
3119 | + Region top_region, |
3120 | + int top_offset, |
3121 | + Region bottom_region, |
3122 | + int bottom_offset, |
3123 | + Region left_region, |
3124 | + int left_offset, |
3125 | + Region right_region, |
3126 | + int right_offset); |
3127 | + |
3128 | +/* decorprops.c */ |
3129 | + |
3130 | +void |
3131 | +decor_update_window_property (decor_t *d); |
3132 | + |
3133 | +void |
3134 | +decor_update_switcher_property (decor_t *d); |
3135 | + |
3136 | +/* cairo.c */ |
3137 | + |
3138 | +#define CORNER_TOPLEFT (1 << 0) |
3139 | +#define CORNER_TOPRIGHT (1 << 1) |
3140 | +#define CORNER_BOTTOMRIGHT (1 << 2) |
3141 | +#define CORNER_BOTTOMLEFT (1 << 3) |
3142 | + |
3143 | +#define SHADE_LEFT (1 << 0) |
3144 | +#define SHADE_RIGHT (1 << 1) |
3145 | +#define SHADE_TOP (1 << 2) |
3146 | +#define SHADE_BOTTOM (1 << 3) |
3147 | + |
3148 | +void |
3149 | +draw_shadow_background (decor_t *d, |
3150 | + cairo_t *cr, |
3151 | + decor_shadow_t *s, |
3152 | + decor_context_t *c); |
3153 | + |
3154 | +void |
3155 | +draw_window_decoration (decor_t *d); |
3156 | + |
3157 | +void |
3158 | +fill_rounded_rectangle (cairo_t *cr, |
3159 | + double x, |
3160 | + double y, |
3161 | + double w, |
3162 | + double h, |
3163 | + double radius, |
3164 | + int corner, |
3165 | + decor_color_t *c0, |
3166 | + double alpha0, |
3167 | + decor_color_t *c1, |
3168 | + double alpha1, |
3169 | + int gravity); |
3170 | + |
3171 | +void |
3172 | +rounded_rectangle (cairo_t *cr, |
3173 | + double x, |
3174 | + double y, |
3175 | + double w, |
3176 | + double h, |
3177 | + double radius, |
3178 | + int corner); |
3179 | + |
3180 | +gboolean |
3181 | +calc_decoration_size (decor_t *d, |
3182 | + gint w, |
3183 | + gint h, |
3184 | + gint name_width, |
3185 | + gint *width, |
3186 | + gint *height); |
3187 | + |
3188 | +void |
3189 | +update_border_extents (gint text_height); |
3190 | + |
3191 | +void |
3192 | +get_border_extents (decor_extents_t *extents, |
3193 | + decor_extents_t *frame_extents, |
3194 | + decor_extents_t *extents_max, |
3195 | + decor_extents_t *frame_extents_max); |
3196 | + |
3197 | +gboolean |
3198 | +get_button_position (decor_t *d, |
3199 | + gint i, |
3200 | + gint width, |
3201 | + gint height, |
3202 | + gint *x, |
3203 | + gint *y, |
3204 | + gint *w, |
3205 | + gint *h); |
3206 | + |
3207 | +void |
3208 | +get_event_window_position (decor_t *d, |
3209 | + gint i, |
3210 | + gint j, |
3211 | + gint width, |
3212 | + gint height, |
3213 | + gint *x, |
3214 | + gint *y, |
3215 | + gint *w, |
3216 | + gint *h); |
3217 | + |
3218 | +decor_shadow_t * |
3219 | +cairo_update_shadow (gint shadow_type); |
3220 | + |
3221 | +void |
3222 | +get_shadow (decor_t *, gint shadow_type); |
3223 | + |
3224 | +/* gdk.c */ |
3225 | + |
3226 | +void |
3227 | +gdk_cairo_set_source_color_alpha (cairo_t *cr, |
3228 | + GdkColor *color, |
3229 | + double alpha); |
3230 | + |
3231 | +inline GdkWindow * |
3232 | +create_gdk_window (Window xframe); |
3233 | + |
3234 | +GdkColormap * |
3235 | +get_colormap_for_drawable (GdkDrawable *d); |
3236 | + |
3237 | +XRenderPictFormat * |
3238 | +get_format_for_drawable (decor_t *d, GdkDrawable *drawable); |
3239 | + |
3240 | +GdkPixmap * |
3241 | +create_pixmap (int w, |
3242 | + int h, |
3243 | + int depth); |
3244 | + |
3245 | +GdkPixmap * |
3246 | +pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, int depth); |
3247 | + |
3248 | +/* metacity.c */ |
3249 | +#ifdef USE_METACITY |
3250 | +void |
3251 | +meta_draw_window_decoration (decor_t *d); |
3252 | + |
3253 | +void |
3254 | +meta_get_decoration_geometry (decor_t *d, |
3255 | + MetaTheme *theme, |
3256 | + MetaFrameFlags *flags, |
3257 | + MetaFrameGeometry *fgeom, |
3258 | + MetaButtonLayout *button_layout, |
3259 | + GdkRectangle *clip); |
3260 | + |
3261 | +void |
3262 | +meta_calc_button_size (decor_t *d); |
3263 | + |
3264 | +gboolean |
3265 | +meta_calc_decoration_size (decor_t *d, |
3266 | + gint w, |
3267 | + gint h, |
3268 | + gint name_width, |
3269 | + gint *width, |
3270 | + gint *height); |
3271 | + |
3272 | +gboolean |
3273 | +meta_get_button_position (decor_t *d, |
3274 | + gint i, |
3275 | + gint width, |
3276 | + gint height, |
3277 | + gint *x, |
3278 | + gint *y, |
3279 | + gint *w, |
3280 | + gint *h); |
3281 | + |
3282 | +gboolean |
3283 | +meta_button_present (MetaButtonLayout *button_layout, |
3284 | + MetaButtonFunction function); |
3285 | + |
3286 | +void |
3287 | +meta_get_event_window_position (decor_t *d, |
3288 | + gint i, |
3289 | + gint j, |
3290 | + gint width, |
3291 | + gint height, |
3292 | + gint *x, |
3293 | + gint *y, |
3294 | + gint *w, |
3295 | + gint *h); |
3296 | +void |
3297 | +meta_update_border_extents (gint text_height); |
3298 | + |
3299 | +void |
3300 | +meta_get_border_extents (decor_extents_t *extents, |
3301 | + decor_extents_t *frame_extents, |
3302 | + decor_extents_t *extents_max, |
3303 | + decor_extents_t *frame_extents_max); |
3304 | + |
3305 | +void |
3306 | +meta_update_button_layout (const char *value); |
3307 | + |
3308 | +decor_shadow_t * |
3309 | +meta_update_shadow (gint shadow_type); |
3310 | + |
3311 | +void |
3312 | +meta_get_shadow (decor_t *, gint shadow_type); |
3313 | + |
3314 | +#endif |
3315 | +/* switcher.c */ |
3316 | + |
3317 | +#define SWITCHER_ALPHA 0xa0a0 |
3318 | + |
3319 | +void |
3320 | +draw_switcher_decoration (decor_t *d); |
3321 | + |
3322 | +gboolean |
3323 | +update_switcher_window (Window popup, |
3324 | + Window selected); |
3325 | + |
3326 | +decor_t * |
3327 | +switcher_window_opened (Window popup, Window selected); |
3328 | + |
3329 | +void |
3330 | +switcher_window_closed (); |
3331 | + |
3332 | +/* events.c */ |
3333 | + |
3334 | +void |
3335 | +move_resize_window (WnckWindow *win, |
3336 | + int direction, |
3337 | + decor_event *gtkwd_event); |
3338 | + |
3339 | +void |
3340 | +common_button_event (WnckWindow *win, |
3341 | + decor_event *gtkwd_event, |
3342 | + decor_event_type gtkwd_type, |
3343 | + int button, |
3344 | + int max); |
3345 | + |
3346 | +void |
3347 | +close_button_event (WnckWindow *win, |
3348 | + decor_event *gtkwd_event, |
3349 | + decor_event_type gtkwd_type); |
3350 | + |
3351 | +void |
3352 | +max_button_event (WnckWindow *win, |
3353 | + decor_event *gtkwd_event, |
3354 | + decor_event_type gtkwd_type); |
3355 | + |
3356 | +void |
3357 | +min_button_event (WnckWindow *win, |
3358 | + decor_event *gtkwd_event, |
3359 | + decor_event_type gtkwd_type); |
3360 | + |
3361 | +void |
3362 | +menu_button_event (WnckWindow *win, |
3363 | + decor_event *gtkwd_event, |
3364 | + decor_event_type gtkwd_type); |
3365 | + |
3366 | +void |
3367 | +shade_button_event (WnckWindow *win, |
3368 | + decor_event *gtkwd_event, |
3369 | + decor_event_type gtkwd_type); |
3370 | + |
3371 | +void |
3372 | +above_button_event (WnckWindow *win, |
3373 | + decor_event *gtkwd_event, |
3374 | + decor_event_type gtkwd_type); |
3375 | + |
3376 | +void |
3377 | +stick_button_event (WnckWindow *win, |
3378 | + decor_event *gtkwd_event, |
3379 | + decor_event_type gtkwd_type); |
3380 | +void |
3381 | +unshade_button_event (WnckWindow *win, |
3382 | + decor_event *gtkwd_event, |
3383 | + decor_event_type gtkwd_type); |
3384 | + |
3385 | +void |
3386 | +unabove_button_event (WnckWindow *win, |
3387 | + decor_event *gtkwd_event, |
3388 | + decor_event_type gtkwd_type); |
3389 | + |
3390 | +void |
3391 | +unstick_button_event (WnckWindow *win, |
3392 | + decor_event *gtkwd_event, |
3393 | + decor_event_type gtkwd_type); |
3394 | + |
3395 | +void |
3396 | +handle_title_button_event (WnckWindow *win, |
3397 | + int action, |
3398 | + decor_event *gtkwd_event); |
3399 | + |
3400 | +void |
3401 | +handle_mouse_wheel_title_event (WnckWindow *win, |
3402 | + unsigned int button); |
3403 | + |
3404 | +void |
3405 | +title_event (WnckWindow *win, |
3406 | + decor_event *gtkwd_event, |
3407 | + decor_event_type gtkwd_type); |
3408 | + |
3409 | +void |
3410 | +frame_common_event (WnckWindow *win, |
3411 | + int direction, |
3412 | + decor_event *gtkwd_event, |
3413 | + decor_event_type gtkwd_type); |
3414 | + |
3415 | +void |
3416 | +top_left_event (WnckWindow *win, |
3417 | + decor_event *gtkwd_event, |
3418 | + decor_event_type gtkwd_type); |
3419 | + |
3420 | +void |
3421 | +top_event (WnckWindow *win, |
3422 | + decor_event *gtkwd_event, |
3423 | + decor_event_type gtkwd_type); |
3424 | + |
3425 | +void |
3426 | +top_right_event (WnckWindow *win, |
3427 | + decor_event *gtkwd_event, |
3428 | + decor_event_type gtkwd_type); |
3429 | + |
3430 | +void |
3431 | +left_event (WnckWindow *win, |
3432 | + decor_event *gtkwd_event, |
3433 | + decor_event_type gtkwd_type); |
3434 | +void |
3435 | +right_event (WnckWindow *win, |
3436 | + decor_event *gtkwd_event, |
3437 | + decor_event_type gtkwd_type); |
3438 | + |
3439 | +void |
3440 | +bottom_left_event (WnckWindow *win, |
3441 | + decor_event *gtkwd_event, |
3442 | + decor_event_type gtkwd_type); |
3443 | + |
3444 | +void |
3445 | +bottom_event (WnckWindow *win, |
3446 | + decor_event *gtkwd_event, |
3447 | + decor_event_type gtkwd_type); |
3448 | +void |
3449 | +bottom_right_event (WnckWindow *win, |
3450 | + decor_event *gtkwd_event, |
3451 | + decor_event_type gtkwd_type); |
3452 | + |
3453 | +void |
3454 | +frame_window_realized (GtkWidget *widget, |
3455 | + gpointer data); |
3456 | + |
3457 | +event_callback |
3458 | +find_event_callback_for_point (decor_t *d, |
3459 | + int x, |
3460 | + int y, |
3461 | + Bool *enter, |
3462 | + Bool *leave, |
3463 | + BoxPtr *entered_box); |
3464 | + |
3465 | +event_callback |
3466 | +find_leave_event_callback (decor_t *d); |
3467 | + |
3468 | +void |
3469 | +frame_handle_button_press (GtkWidget *widget, |
3470 | + GdkEventButton *event, |
3471 | + gpointer user_data); |
3472 | + |
3473 | +void |
3474 | +frame_handle_button_release (GtkWidget *widget, |
3475 | + GdkEventButton *event, |
3476 | + gpointer user_data); |
3477 | + |
3478 | +void |
3479 | +frame_handle_motion (GtkWidget *widget, |
3480 | + GdkEventMotion *event, |
3481 | + gpointer user_data); |
3482 | + |
3483 | +GdkFilterReturn |
3484 | +selection_event_filter_func (GdkXEvent *gdkxevent, |
3485 | + GdkEvent *event, |
3486 | + gpointer data); |
3487 | + |
3488 | +GdkFilterReturn |
3489 | +event_filter_func (GdkXEvent *gdkxevent, |
3490 | + GdkEvent *event, |
3491 | + gpointer data); |
3492 | + |
3493 | +/* forcequit.c */ |
3494 | + |
3495 | +void |
3496 | +show_force_quit_dialog (WnckWindow *win, |
3497 | + Time timestamp); |
3498 | + |
3499 | +void |
3500 | +hide_force_quit_dialog (WnckWindow *win); |
3501 | + |
3502 | +/* actionmenu.c */ |
3503 | + |
3504 | +void |
3505 | +action_menu_map (WnckWindow *win, |
3506 | + long button, |
3507 | + Time time); |
3508 | + |
3509 | +/* util.c */ |
3510 | + |
3511 | +double |
3512 | +square (double x); |
3513 | + |
3514 | +double |
3515 | +dist (double x1, double y1, |
3516 | + double x2, double y2); |
3517 | + |
3518 | +void |
3519 | +shade (const decor_color_t *a, |
3520 | + decor_color_t *b, |
3521 | + float k); |
3522 | + |
3523 | +gboolean |
3524 | +get_window_prop (Window xwindow, |
3525 | + Atom atom, |
3526 | + Window *val); |
3527 | + |
3528 | +unsigned int |
3529 | +get_mwm_prop (Window xwindow); |
3530 | + |
3531 | + |
3532 | +/* style.c */ |
3533 | + |
3534 | +void |
3535 | +update_style (GtkWidget *widget); |
3536 | + |
3537 | +void |
3538 | +style_changed (GtkWidget *widget); |
3539 | + |
3540 | +/* settings.c */ |
3541 | + |
3542 | +gboolean |
3543 | +init_settings (WnckScreen *screen); |
3544 | + |
3545 | +#endif |
3546 | |
3547 | === added file '.pc/fix-883383.patch/unity/unity_window_decorator/src/settings.c' |
3548 | --- .pc/fix-883383.patch/unity/unity_window_decorator/src/settings.c 1970-01-01 00:00:00 +0000 |
3549 | +++ .pc/fix-883383.patch/unity/unity_window_decorator/src/settings.c 2011-10-29 09:07:25 +0000 |
3550 | @@ -0,0 +1,567 @@ |
3551 | +#include "gtk-window-decorator.h" |
3552 | + |
3553 | +/* TODO: Trash all of this and use a window property |
3554 | + * instead - much much cleaner! |
3555 | + */ |
3556 | + |
3557 | +void |
3558 | +shadow_property_changed (WnckScreen *s) |
3559 | +{ |
3560 | + GdkDisplay *display = gdk_display_get_default (); |
3561 | + Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); |
3562 | + GdkScreen *screen = gdk_display_get_default_screen (display); |
3563 | + Window root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (screen)); |
3564 | + Atom actual; |
3565 | + int result, format; |
3566 | + unsigned long n, left; |
3567 | + unsigned char *prop_data; |
3568 | + gboolean changed = FALSE; |
3569 | + XTextProperty shadow_color_xtp; |
3570 | + |
3571 | + result = XGetWindowProperty (xdisplay, root, compiz_shadow_info_atom, |
3572 | + 0, 32768, 0, XA_INTEGER, &actual, |
3573 | + &format, &n, &left, &prop_data); |
3574 | + |
3575 | + if (result != Success) |
3576 | + return; |
3577 | + |
3578 | + if (n == 4) |
3579 | + { |
3580 | + long *data = (long *) prop_data; |
3581 | + gdouble radius = data[0]; |
3582 | + gdouble opacity = data[1]; |
3583 | + gint x_off = data[2]; |
3584 | + gint y_off = data[3]; |
3585 | + |
3586 | + /* Radius and Opacity are multiplied by 1000 to keep precision, |
3587 | + * divide by that much to get our real radius and opacity |
3588 | + */ |
3589 | + radius /= 1000; |
3590 | + opacity /= 1000; |
3591 | + |
3592 | + changed = radius != shadow_radius || |
3593 | + opacity != shadow_opacity || |
3594 | + x_off != shadow_offset_x || |
3595 | + y_off != shadow_offset_y; |
3596 | + |
3597 | + shadow_radius = (gdouble) MAX (0.0, MIN (radius, 48.0)); |
3598 | + shadow_opacity = (gdouble) MAX (0.0, MIN (opacity, 6.0)); |
3599 | + shadow_offset_x = (gint) MAX (-16, MIN (x_off, 16)); |
3600 | + shadow_offset_y = (gint) MAX (-16, MIN (y_off, 16)); |
3601 | + } |
3602 | + |
3603 | + XFree (prop_data); |
3604 | + |
3605 | + result = XGetTextProperty (xdisplay, root, &shadow_color_xtp, |
3606 | + compiz_shadow_color_atom); |
3607 | + |
3608 | + if (shadow_color_xtp.value) |
3609 | + { |
3610 | + int ret_count = 0; |
3611 | + char **t_data = NULL; |
3612 | + |
3613 | + XTextPropertyToStringList (&shadow_color_xtp, &t_data, &ret_count); |
3614 | + |
3615 | + if (ret_count == 1) |
3616 | + { |
3617 | + int c[4]; |
3618 | + |
3619 | + if (sscanf (t_data[0], "#%2x%2x%2x%2x", |
3620 | + &c[0], &c[1], &c[2], &c[3]) == 4) |
3621 | + { |
3622 | + shadow_color[0] = c[0] << 8 | c[0]; |
3623 | + shadow_color[1] = c[1] << 8 | c[1]; |
3624 | + shadow_color[2] = c[2] << 8 | c[2]; |
3625 | + changed = TRUE; |
3626 | + } |
3627 | + } |
3628 | + |
3629 | + XFree (shadow_color_xtp.value); |
3630 | + if (t_data) |
3631 | + XFreeStringList (t_data); |
3632 | + } |
3633 | + |
3634 | + if (changed) |
3635 | + decorations_changed (s); |
3636 | +} |
3637 | + |
3638 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
3639 | +static gboolean |
3640 | +blur_settings_changed (GConfClient *client) |
3641 | +{ |
3642 | + gchar *type; |
3643 | + int new_type = blur_type; |
3644 | + |
3645 | + if (cmdline_options & CMDLINE_BLUR) |
3646 | + return FALSE; |
3647 | + |
3648 | + type = gconf_client_get_string (client, |
3649 | + BLUR_TYPE_KEY, |
3650 | + NULL); |
3651 | + |
3652 | + if (type) |
3653 | + { |
3654 | + if (strcmp (type, "titlebar") == 0) |
3655 | + new_type = BLUR_TYPE_TITLEBAR; |
3656 | + else if (strcmp (type, "all") == 0) |
3657 | + new_type = BLUR_TYPE_ALL; |
3658 | + else if (strcmp (type, "none") == 0) |
3659 | + new_type = BLUR_TYPE_NONE; |
3660 | + |
3661 | + g_free (type); |
3662 | + } |
3663 | + |
3664 | + if (new_type != blur_type) |
3665 | + { |
3666 | + blur_type = new_type; |
3667 | + return TRUE; |
3668 | + } |
3669 | + |
3670 | + return FALSE; |
3671 | +} |
3672 | + |
3673 | +static gboolean |
3674 | +theme_changed (GConfClient *client) |
3675 | +{ |
3676 | + |
3677 | +#ifdef USE_METACITY |
3678 | + gboolean use_meta_theme; |
3679 | + |
3680 | + if (cmdline_options & CMDLINE_THEME) |
3681 | + return FALSE; |
3682 | + |
3683 | + use_meta_theme = gconf_client_get_bool (client, |
3684 | + USE_META_THEME_KEY, |
3685 | + NULL); |
3686 | + |
3687 | + if (use_meta_theme) |
3688 | + { |
3689 | + gchar *theme; |
3690 | + |
3691 | + theme = gconf_client_get_string (client, |
3692 | + META_THEME_KEY, |
3693 | + NULL); |
3694 | + |
3695 | + if (theme) |
3696 | + { |
3697 | + meta_theme_set_current (theme, TRUE); |
3698 | + if (!meta_theme_get_current ()) |
3699 | + use_meta_theme = FALSE; |
3700 | + |
3701 | + g_free (theme); |
3702 | + } |
3703 | + else |
3704 | + { |
3705 | + use_meta_theme = FALSE; |
3706 | + } |
3707 | + } |
3708 | + |
3709 | + if (use_meta_theme) |
3710 | + { |
3711 | + theme_draw_window_decoration = meta_draw_window_decoration; |
3712 | + theme_calc_decoration_size = meta_calc_decoration_size; |
3713 | + theme_update_border_extents = meta_update_border_extents; |
3714 | + theme_get_event_window_position = meta_get_event_window_position; |
3715 | + theme_get_button_position = meta_get_button_position; |
3716 | + theme_update_shadow = meta_update_shadow; |
3717 | + theme_get_shadow = meta_get_shadow; |
3718 | + theme_get_border_extents = meta_get_border_extents; |
3719 | + } |
3720 | + else |
3721 | + { |
3722 | + theme_draw_window_decoration = draw_window_decoration; |
3723 | + theme_calc_decoration_size = calc_decoration_size; |
3724 | + theme_update_border_extents = update_border_extents; |
3725 | + theme_get_event_window_position = get_event_window_position; |
3726 | + theme_get_button_position = get_button_position; |
3727 | + theme_update_shadow = cairo_update_shadow; |
3728 | + theme_get_shadow = get_shadow; |
3729 | + theme_get_border_extents = get_border_extents; |
3730 | + } |
3731 | + |
3732 | + return TRUE; |
3733 | +#else |
3734 | + theme_draw_window_decoration = draw_window_decoration; |
3735 | + theme_calc_decoration_size = calc_decoration_size; |
3736 | + theme_update_border_extents = update_border_extents; |
3737 | + theme_get_event_window_position = get_event_window_position; |
3738 | + theme_get_button_position = get_button_position; |
3739 | + theme_get_border_extents = get_border_extents; |
3740 | + |
3741 | + return FALSE; |
3742 | +#endif |
3743 | + |
3744 | +} |
3745 | + |
3746 | +static gboolean |
3747 | +theme_opacity_changed (GConfClient *client) |
3748 | +{ |
3749 | + |
3750 | +#ifdef USE_METACITY |
3751 | + gboolean shade_opacity, changed = FALSE; |
3752 | + gdouble opacity; |
3753 | + |
3754 | + opacity = gconf_client_get_float (client, |
3755 | + META_THEME_OPACITY_KEY, |
3756 | + NULL); |
3757 | + |
3758 | + if (!(cmdline_options & CMDLINE_OPACITY) && |
3759 | + opacity != meta_opacity) |
3760 | + { |
3761 | + meta_opacity = opacity; |
3762 | + changed = TRUE; |
3763 | + } |
3764 | + |
3765 | + if (opacity < 1.0) |
3766 | + { |
3767 | + shade_opacity = gconf_client_get_bool (client, |
3768 | + META_THEME_SHADE_OPACITY_KEY, |
3769 | + NULL); |
3770 | + |
3771 | + if (!(cmdline_options & CMDLINE_OPACITY_SHADE) && |
3772 | + shade_opacity != meta_shade_opacity) |
3773 | + { |
3774 | + meta_shade_opacity = shade_opacity; |
3775 | + changed = TRUE; |
3776 | + } |
3777 | + } |
3778 | + |
3779 | + opacity = gconf_client_get_float (client, |
3780 | + META_THEME_ACTIVE_OPACITY_KEY, |
3781 | + NULL); |
3782 | + |
3783 | + if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY) && |
3784 | + opacity != meta_active_opacity) |
3785 | + { |
3786 | + meta_active_opacity = opacity; |
3787 | + changed = TRUE; |
3788 | + } |
3789 | + |
3790 | + if (opacity < 1.0) |
3791 | + { |
3792 | + shade_opacity = |
3793 | + gconf_client_get_bool (client, |
3794 | + META_THEME_ACTIVE_SHADE_OPACITY_KEY, |
3795 | + NULL); |
3796 | + |
3797 | + if (!(cmdline_options & CMDLINE_ACTIVE_OPACITY_SHADE) && |
3798 | + shade_opacity != meta_active_shade_opacity) |
3799 | + { |
3800 | + meta_active_shade_opacity = shade_opacity; |
3801 | + changed = TRUE; |
3802 | + } |
3803 | + } |
3804 | + |
3805 | + return changed; |
3806 | +#else |
3807 | + return FALSE; |
3808 | +#endif |
3809 | + |
3810 | +} |
3811 | + |
3812 | +static gboolean |
3813 | +button_layout_changed (GConfClient *client) |
3814 | +{ |
3815 | + |
3816 | +#ifdef USE_METACITY |
3817 | + gchar *button_layout; |
3818 | + |
3819 | + button_layout = gconf_client_get_string (client, |
3820 | + META_BUTTON_LAYOUT_KEY, |
3821 | + NULL); |
3822 | + |
3823 | + if (button_layout) |
3824 | + { |
3825 | + meta_update_button_layout (button_layout); |
3826 | + |
3827 | + meta_button_layout_set = TRUE; |
3828 | + |
3829 | + g_free (button_layout); |
3830 | + |
3831 | + return TRUE; |
3832 | + } |
3833 | + |
3834 | + if (meta_button_layout_set) |
3835 | + { |
3836 | + meta_button_layout_set = FALSE; |
3837 | + return TRUE; |
3838 | + } |
3839 | +#endif |
3840 | + |
3841 | + return FALSE; |
3842 | +} |
3843 | + |
3844 | +static void |
3845 | +titlebar_font_changed (GConfClient *client) |
3846 | +{ |
3847 | + gchar *str; |
3848 | + |
3849 | + str = gconf_client_get_string (client, |
3850 | + COMPIZ_TITLEBAR_FONT_KEY, |
3851 | + NULL); |
3852 | + if (!str) |
3853 | + str = g_strdup ("Sans Bold 12"); |
3854 | + |
3855 | + if (titlebar_font) |
3856 | + pango_font_description_free (titlebar_font); |
3857 | + |
3858 | + titlebar_font = pango_font_description_from_string (str); |
3859 | + |
3860 | + g_free (str); |
3861 | +} |
3862 | + |
3863 | +static void |
3864 | +titlebar_click_action_changed (GConfClient *client, |
3865 | + const gchar *key, |
3866 | + int *action_value, |
3867 | + int default_value) |
3868 | +{ |
3869 | + gchar *action; |
3870 | + |
3871 | + *action_value = default_value; |
3872 | + |
3873 | + action = gconf_client_get_string (client, key, NULL); |
3874 | + if (action) |
3875 | + { |
3876 | + if (strcmp (action, "toggle_shade") == 0) |
3877 | + *action_value = CLICK_ACTION_SHADE; |
3878 | + else if (strcmp (action, "toggle_maximize") == 0) |
3879 | + *action_value = CLICK_ACTION_MAXIMIZE; |
3880 | + else if (strcmp (action, "minimize") == 0) |
3881 | + *action_value = CLICK_ACTION_MINIMIZE; |
3882 | + else if (strcmp (action, "raise") == 0) |
3883 | + *action_value = CLICK_ACTION_RAISE; |
3884 | + else if (strcmp (action, "lower") == 0) |
3885 | + *action_value = CLICK_ACTION_LOWER; |
3886 | + else if (strcmp (action, "menu") == 0) |
3887 | + *action_value = CLICK_ACTION_MENU; |
3888 | + else if (strcmp (action, "none") == 0) |
3889 | + *action_value = CLICK_ACTION_NONE; |
3890 | + |
3891 | + g_free (action); |
3892 | + } |
3893 | +} |
3894 | + |
3895 | +static void |
3896 | +wheel_action_changed (GConfClient *client) |
3897 | +{ |
3898 | + gchar *action; |
3899 | + |
3900 | + wheel_action = WHEEL_ACTION_DEFAULT; |
3901 | + |
3902 | + action = gconf_client_get_string (client, WHEEL_ACTION_KEY, NULL); |
3903 | + if (action) |
3904 | + { |
3905 | + if (strcmp (action, "shade") == 0) |
3906 | + wheel_action = WHEEL_ACTION_SHADE; |
3907 | + else if (strcmp (action, "none") == 0) |
3908 | + wheel_action = WHEEL_ACTION_NONE; |
3909 | + |
3910 | + g_free (action); |
3911 | + } |
3912 | +} |
3913 | + |
3914 | +static void |
3915 | +value_changed (GConfClient *client, |
3916 | + const gchar *key, |
3917 | + GConfValue *value, |
3918 | + void *data) |
3919 | +{ |
3920 | + gboolean changed = FALSE; |
3921 | + |
3922 | + if (strcmp (key, COMPIZ_USE_SYSTEM_FONT_KEY) == 0) |
3923 | + { |
3924 | + if (gconf_client_get_bool (client, |
3925 | + COMPIZ_USE_SYSTEM_FONT_KEY, |
3926 | + NULL) != use_system_font) |
3927 | + { |
3928 | + use_system_font = !use_system_font; |
3929 | + changed = TRUE; |
3930 | + } |
3931 | + } |
3932 | + else if (strcmp (key, COMPIZ_TITLEBAR_FONT_KEY) == 0) |
3933 | + { |
3934 | + titlebar_font_changed (client); |
3935 | + changed = !use_system_font; |
3936 | + } |
3937 | + else if (strcmp (key, COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY) == 0) |
3938 | + { |
3939 | + titlebar_click_action_changed (client, key, |
3940 | + &double_click_action, |
3941 | + DOUBLE_CLICK_ACTION_DEFAULT); |
3942 | + } |
3943 | + else if (strcmp (key, COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY) == 0) |
3944 | + { |
3945 | + titlebar_click_action_changed (client, key, |
3946 | + &middle_click_action, |
3947 | + MIDDLE_CLICK_ACTION_DEFAULT); |
3948 | + } |
3949 | + else if (strcmp (key, COMPIZ_RIGHT_CLICK_TITLEBAR_KEY) == 0) |
3950 | + { |
3951 | + titlebar_click_action_changed (client, key, |
3952 | + &right_click_action, |
3953 | + RIGHT_CLICK_ACTION_DEFAULT); |
3954 | + } |
3955 | + else if (strcmp (key, WHEEL_ACTION_KEY) == 0) |
3956 | + { |
3957 | + wheel_action_changed (client); |
3958 | + } |
3959 | + else if (strcmp (key, BLUR_TYPE_KEY) == 0) |
3960 | + { |
3961 | + if (blur_settings_changed (client)) |
3962 | + changed = TRUE; |
3963 | + } |
3964 | + else if (strcmp (key, USE_META_THEME_KEY) == 0 || |
3965 | + strcmp (key, META_THEME_KEY) == 0) |
3966 | + { |
3967 | + if (theme_changed (client)) |
3968 | + changed = TRUE; |
3969 | + } |
3970 | + else if (strcmp (key, META_BUTTON_LAYOUT_KEY) == 0) |
3971 | + { |
3972 | + if (button_layout_changed (client)) |
3973 | + changed = TRUE; |
3974 | + } |
3975 | + else if (strcmp (key, META_THEME_OPACITY_KEY) == 0 || |
3976 | + strcmp (key, META_THEME_SHADE_OPACITY_KEY) == 0 || |
3977 | + strcmp (key, META_THEME_ACTIVE_OPACITY_KEY) == 0 || |
3978 | + strcmp (key, META_THEME_ACTIVE_SHADE_OPACITY_KEY) == 0) |
3979 | + { |
3980 | + if (theme_opacity_changed (client)) |
3981 | + changed = TRUE; |
3982 | + } |
3983 | + |
3984 | + if (changed) |
3985 | + decorations_changed (data); |
3986 | +} |
3987 | +#endif |
3988 | + |
3989 | +gboolean |
3990 | +init_settings (WnckScreen *screen) |
3991 | +{ |
3992 | + GtkSettings *settings; |
3993 | + GdkScreen *gdkscreen; |
3994 | + GdkColormap *colormap; |
3995 | + AtkObject *switcher_label_obj; |
3996 | + |
3997 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
3998 | + GConfClient *gconf; |
3999 | + |
4000 | + gconf = gconf_client_get_default (); |
4001 | + |
4002 | + gconf_client_add_dir (gconf, |
4003 | + GCONF_DIR, |
4004 | + GCONF_CLIENT_PRELOAD_ONELEVEL, |
4005 | + NULL); |
4006 | + |
4007 | + gconf_client_add_dir (gconf, |
4008 | + METACITY_GCONF_DIR, |
4009 | + GCONF_CLIENT_PRELOAD_ONELEVEL, |
4010 | + NULL); |
4011 | + |
4012 | + g_signal_connect (G_OBJECT (gconf), |
4013 | + "value_changed", |
4014 | + G_CALLBACK (value_changed), |
4015 | + screen); |
4016 | +#endif |
4017 | + |
4018 | + style_window_rgba = gtk_window_new (GTK_WINDOW_POPUP); |
4019 | + |
4020 | + gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ()); |
4021 | + colormap = gdk_screen_get_rgba_colormap (gdkscreen); |
4022 | + if (colormap) |
4023 | + gtk_widget_set_colormap (style_window_rgba, colormap); |
4024 | + |
4025 | + gtk_widget_realize (style_window_rgba); |
4026 | + |
4027 | + switcher_label = gtk_label_new (""); |
4028 | + switcher_label_obj = gtk_widget_get_accessible (switcher_label); |
4029 | + atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); |
4030 | + gtk_container_add (GTK_CONTAINER (style_window_rgba), switcher_label); |
4031 | + |
4032 | + gtk_widget_set_size_request (style_window_rgba, 0, 0); |
4033 | + gtk_window_move (GTK_WINDOW (style_window_rgba), -100, -100); |
4034 | + gtk_widget_show_all (style_window_rgba); |
4035 | + |
4036 | + g_signal_connect_object (style_window_rgba, "style-set", |
4037 | + G_CALLBACK (style_changed), |
4038 | + 0, 0); |
4039 | + |
4040 | + settings = gtk_widget_get_settings (style_window_rgba); |
4041 | + |
4042 | + g_object_get (G_OBJECT (settings), "gtk-double-click-time", |
4043 | + &double_click_timeout, NULL); |
4044 | + |
4045 | + pango_context = gtk_widget_create_pango_context (style_window_rgba); |
4046 | + |
4047 | + style_window_rgb = gtk_window_new (GTK_WINDOW_POPUP); |
4048 | + |
4049 | + gdkscreen = gdk_display_get_default_screen (gdk_display_get_default ()); |
4050 | + colormap = gdk_screen_get_rgb_colormap (gdkscreen); |
4051 | + if (colormap) |
4052 | + gtk_widget_set_colormap (style_window_rgb, colormap); |
4053 | + |
4054 | + gtk_widget_realize (style_window_rgb); |
4055 | + |
4056 | + switcher_label = gtk_label_new (""); |
4057 | + switcher_label_obj = gtk_widget_get_accessible (switcher_label); |
4058 | + atk_object_set_role (switcher_label_obj, ATK_ROLE_STATUSBAR); |
4059 | + gtk_container_add (GTK_CONTAINER (style_window_rgb), switcher_label); |
4060 | + |
4061 | + gtk_widget_set_size_request (style_window_rgb, 0, 0); |
4062 | + gtk_window_move (GTK_WINDOW (style_window_rgb), -100, -100); |
4063 | + gtk_widget_show_all (style_window_rgb); |
4064 | + |
4065 | + g_signal_connect_object (style_window_rgb, "style-set", |
4066 | + G_CALLBACK (style_changed), |
4067 | + 0, 0); |
4068 | + |
4069 | + settings = gtk_widget_get_settings (style_window_rgb); |
4070 | + |
4071 | + g_object_get (G_OBJECT (settings), "gtk-double-click-time", |
4072 | + &double_click_timeout, NULL); |
4073 | + |
4074 | + pango_context = gtk_widget_create_pango_context (style_window_rgb); |
4075 | + |
4076 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
4077 | + use_system_font = gconf_client_get_bool (gconf, |
4078 | + COMPIZ_USE_SYSTEM_FONT_KEY, |
4079 | + NULL); |
4080 | + theme_changed (gconf); |
4081 | + theme_opacity_changed (gconf); |
4082 | + button_layout_changed (gconf); |
4083 | +#endif |
4084 | + |
4085 | + update_style (style_window_rgba); |
4086 | + update_style (style_window_rgb); |
4087 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
4088 | + titlebar_font_changed (gconf); |
4089 | +#endif |
4090 | + |
4091 | + update_titlebar_font (); |
4092 | + |
4093 | +#ifdef USE_GCONF_UNITY_WINDOW_DECORATOR |
4094 | + titlebar_click_action_changed (gconf, |
4095 | + COMPIZ_DOUBLE_CLICK_TITLEBAR_KEY, |
4096 | + &double_click_action, |
4097 | + DOUBLE_CLICK_ACTION_DEFAULT); |
4098 | + titlebar_click_action_changed (gconf, |
4099 | + COMPIZ_MIDDLE_CLICK_TITLEBAR_KEY, |
4100 | + &middle_click_action, |
4101 | + MIDDLE_CLICK_ACTION_DEFAULT); |
4102 | + titlebar_click_action_changed (gconf, |
4103 | + COMPIZ_RIGHT_CLICK_TITLEBAR_KEY, |
4104 | + &right_click_action, |
4105 | + RIGHT_CLICK_ACTION_DEFAULT); |
4106 | + wheel_action_changed (gconf); |
4107 | + blur_settings_changed (gconf); |
4108 | +#endif |
4109 | + |
4110 | + (*theme_update_border_extents) (text_height); |
4111 | + |
4112 | + shadow_property_changed (screen); |
4113 | + |
4114 | + update_shadow (); |
4115 | + |
4116 | + return TRUE; |
4117 | +} |
4118 | |
4119 | === modified file 'debian/changelog' |
4120 | --- debian/changelog 2011-10-12 10:44:49 +0000 |
4121 | +++ debian/changelog 2011-10-29 09:07:25 +0000 |
4122 | @@ -1,3 +1,12 @@ |
4123 | +compiz (1:0.9.6+bzr20110929-0ubuntu6) precise; urgency=low |
4124 | + |
4125 | + * debian/patches/fix-881329.patch: |
4126 | + - Alt+click should raise with raise-on-click disabled (LP: #881329) |
4127 | + * debian/patches/fix-883383.patch: |
4128 | + - Drag title bar should not raise if raise-on-click is disabled (LP: #883383) |
4129 | + |
4130 | + -- James Pharaoh <james@phsys.co.uk> Tue, 25 Oct 2011 12:07:03 +0200 |
4131 | + |
4132 | compiz (1:0.9.6+bzr20110929-0ubuntu5) oneiric-proposed; urgency=low |
4133 | |
4134 | * debian/patches/fix-864330.patch: |
4135 | |
4136 | === added file 'debian/patches/fix-881329.patch' |
4137 | --- debian/patches/fix-881329.patch 1970-01-01 00:00:00 +0000 |
4138 | +++ debian/patches/fix-881329.patch 2011-10-29 09:07:25 +0000 |
4139 | @@ -0,0 +1,49 @@ |
4140 | +Index: fix-881329/plugins/move/src/move.cpp |
4141 | +=================================================================== |
4142 | +--- fix-881329.orig/plugins/move/src/move.cpp 2011-10-25 11:55:52.191836766 +0200 |
4143 | ++++ fix-881329/plugins/move/src/move.cpp 2011-10-25 11:56:01.683903132 +0200 |
4144 | +@@ -153,6 +153,8 @@ |
4145 | + if (mw->gWindow) |
4146 | + mw->gWindow->glPaintSetEnabled (mw, true); |
4147 | + } |
4148 | ++ |
4149 | ++ ms->hasMoved = false; |
4150 | + } |
4151 | + } |
4152 | + |
4153 | +@@ -177,7 +179,12 @@ |
4154 | + /* update window attributes as window constraints may have |
4155 | + changed - needed e.g. if a maximized window was moved |
4156 | + to another output device */ |
4157 | +- ms->w->updateAttributes (CompStackingUpdateModeNone); |
4158 | ++ /* also raise on alt-click when raise on click is disabled */ |
4159 | ++ bool raiseOnClick = screen->getOption ("raise_on_click")->value ().b (); |
4160 | ++ if (! raiseOnClick && ! ms->hasMoved) |
4161 | ++ ms->w->updateAttributes (CompStackingUpdateModeAboveFullscreen); |
4162 | ++ else |
4163 | ++ ms->w->updateAttributes (CompStackingUpdateModeNone); |
4164 | + |
4165 | + ms->w->ungrabNotify (); |
4166 | + |
4167 | +@@ -504,6 +511,8 @@ |
4168 | + |
4169 | + ms->x -= dx; |
4170 | + ms->y -= dy; |
4171 | ++ |
4172 | ++ ms->hasMoved = true; |
4173 | + } |
4174 | + } |
4175 | + } |
4176 | +Index: fix-881329/plugins/move/src/move.h |
4177 | +=================================================================== |
4178 | +--- fix-881329.orig/plugins/move/src/move.h 2011-10-25 11:55:52.215836933 +0200 |
4179 | ++++ fix-881329/plugins/move/src/move.h 2011-10-25 11:56:01.683903132 +0200 |
4180 | +@@ -90,6 +90,8 @@ |
4181 | + bool hasCompositing; |
4182 | + |
4183 | + bool yConstrained; |
4184 | ++ |
4185 | ++ bool hasMoved; |
4186 | + }; |
4187 | + |
4188 | + class MoveWindow : |
4189 | |
4190 | === added file 'debian/patches/fix-883383.patch' |
4191 | --- debian/patches/fix-883383.patch 1970-01-01 00:00:00 +0000 |
4192 | +++ debian/patches/fix-883383.patch 2011-10-29 09:07:25 +0000 |
4193 | @@ -0,0 +1,77 @@ |
4194 | +Index: fix-883383/unity/unity_window_decorator/src/events.c |
4195 | +=================================================================== |
4196 | +--- fix-883383.orig/unity/unity_window_decorator/src/events.c 2011-10-29 10:22:29.079644323 +0200 |
4197 | ++++ fix-883383/unity/unity_window_decorator/src/events.c 2011-10-29 10:22:31.631675000 +0200 |
4198 | +@@ -450,7 +450,8 @@ |
4199 | + last_button_x = gtkwd_event->x; |
4200 | + last_button_y = gtkwd_event->y; |
4201 | + |
4202 | +- restack_window (win, Above); |
4203 | ++ if (raise_on_click) |
4204 | ++ restack_window (win, Above); |
4205 | + |
4206 | + move_resize_window (win, WM_MOVERESIZE_MOVE, gtkwd_event); |
4207 | + } |
4208 | +Index: fix-883383/unity/unity_window_decorator/src/gtk-window-decorator.c |
4209 | +=================================================================== |
4210 | +--- fix-883383.orig/unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-29 10:22:29.099644474 +0200 |
4211 | ++++ fix-883383/unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-29 10:22:31.631675000 +0200 |
4212 | +@@ -25,6 +25,8 @@ |
4213 | + |
4214 | + double decoration_alpha = 0.5; |
4215 | + |
4216 | ++gboolean raise_on_click = TRUE; |
4217 | ++ |
4218 | + #define SWITCHER_SPACE 40 |
4219 | + |
4220 | + decor_extents_t _shadow_extents = { 0, 0, 0, 0 }; |
4221 | +Index: fix-883383/unity/unity_window_decorator/src/gtk-window-decorator.h |
4222 | +=================================================================== |
4223 | +--- fix-883383.orig/unity/unity_window_decorator/src/gtk-window-decorator.h 2011-10-29 10:22:29.123644654 +0200 |
4224 | ++++ fix-883383/unity/unity_window_decorator/src/gtk-window-decorator.h 2011-10-29 10:22:31.631675000 +0200 |
4225 | +@@ -97,6 +97,9 @@ |
4226 | + #define COMPIZ_RIGHT_CLICK_TITLEBAR_KEY \ |
4227 | + METACITY_GCONF_DIR "/action_right_click_titlebar" |
4228 | + |
4229 | ++#define COMPIZ_RAISE_ON_CLICK_KEY \ |
4230 | ++METACITY_GCONF_DIR "/raise_on_click" |
4231 | ++ |
4232 | + #define COMPIZ_GCONF_DIR1 "/apps/compiz/plugins/decoration/allscreens/options" |
4233 | + |
4234 | + #define COMPIZ_SHADOW_RADIUS_KEY \ |
4235 | +@@ -243,6 +246,8 @@ |
4236 | + extern gboolean minimal; |
4237 | + extern double decoration_alpha; |
4238 | + |
4239 | ++extern gboolean raise_on_click; |
4240 | ++ |
4241 | + #define SWITCHER_SPACE 40 |
4242 | + |
4243 | + extern decor_extents_t _shadow_extents; |
4244 | +Index: fix-883383/unity/unity_window_decorator/src/settings.c |
4245 | +=================================================================== |
4246 | +--- fix-883383.orig/unity/unity_window_decorator/src/settings.c 2011-10-29 10:22:29.151644865 +0200 |
4247 | ++++ fix-883383/unity/unity_window_decorator/src/settings.c 2011-10-29 10:22:31.631675000 +0200 |
4248 | +@@ -402,6 +402,12 @@ |
4249 | + &right_click_action, |
4250 | + RIGHT_CLICK_ACTION_DEFAULT); |
4251 | + } |
4252 | ++ else if (strcmp (key, COMPIZ_RAISE_ON_CLICK_KEY) == 0) |
4253 | ++ { |
4254 | ++ raise_on_click = gconf_client_get_bool (client, |
4255 | ++ COMPIZ_RAISE_ON_CLICK_KEY, |
4256 | ++ NULL); |
4257 | ++ } |
4258 | + else if (strcmp (key, WHEEL_ACTION_KEY) == 0) |
4259 | + { |
4260 | + wheel_action_changed (client); |
4261 | +@@ -555,6 +561,9 @@ |
4262 | + RIGHT_CLICK_ACTION_DEFAULT); |
4263 | + wheel_action_changed (gconf); |
4264 | + blur_settings_changed (gconf); |
4265 | ++ raise_on_click = gconf_client_get_bool (gconf, |
4266 | ++ COMPIZ_RAISE_ON_CLICK_KEY, |
4267 | ++ NULL); |
4268 | + #endif |
4269 | + |
4270 | + (*theme_update_border_extents) (text_height); |
4271 | |
4272 | === modified file 'debian/patches/series' |
4273 | --- debian/patches/series 2011-10-12 10:44:49 +0000 |
4274 | +++ debian/patches/series 2011-10-29 09:07:25 +0000 |
4275 | @@ -12,3 +12,5 @@ |
4276 | fix-832150.patch |
4277 | fix-864478.patch |
4278 | fix-864330.patch |
4279 | +fix-881329.patch |
4280 | +fix-883383.patch |
4281 | |
4282 | === modified file 'plugins/move/src/move.cpp' |
4283 | --- plugins/move/src/move.cpp 2011-10-12 10:44:49 +0000 |
4284 | +++ plugins/move/src/move.cpp 2011-10-29 09:07:25 +0000 |
4285 | @@ -153,6 +153,8 @@ |
4286 | if (mw->gWindow) |
4287 | mw->gWindow->glPaintSetEnabled (mw, true); |
4288 | } |
4289 | + |
4290 | + ms->hasMoved = false; |
4291 | } |
4292 | } |
4293 | |
4294 | @@ -177,7 +179,12 @@ |
4295 | /* update window attributes as window constraints may have |
4296 | changed - needed e.g. if a maximized window was moved |
4297 | to another output device */ |
4298 | - ms->w->updateAttributes (CompStackingUpdateModeNone); |
4299 | + /* also raise on alt-click when raise on click is disabled */ |
4300 | + bool raiseOnClick = screen->getOption ("raise_on_click")->value ().b (); |
4301 | + if (! raiseOnClick && ! ms->hasMoved) |
4302 | + ms->w->updateAttributes (CompStackingUpdateModeAboveFullscreen); |
4303 | + else |
4304 | + ms->w->updateAttributes (CompStackingUpdateModeNone); |
4305 | |
4306 | ms->w->ungrabNotify (); |
4307 | |
4308 | @@ -504,6 +511,8 @@ |
4309 | |
4310 | ms->x -= dx; |
4311 | ms->y -= dy; |
4312 | + |
4313 | + ms->hasMoved = true; |
4314 | } |
4315 | } |
4316 | } |
4317 | |
4318 | === modified file 'plugins/move/src/move.h' |
4319 | --- plugins/move/src/move.h 2011-09-28 14:15:21 +0000 |
4320 | +++ plugins/move/src/move.h 2011-10-29 09:07:25 +0000 |
4321 | @@ -90,6 +90,8 @@ |
4322 | bool hasCompositing; |
4323 | |
4324 | bool yConstrained; |
4325 | + |
4326 | + bool hasMoved; |
4327 | }; |
4328 | |
4329 | class MoveWindow : |
4330 | |
4331 | === modified file 'unity/unity_window_decorator/src/events.c' |
4332 | --- unity/unity_window_decorator/src/events.c 2011-09-28 14:15:21 +0000 |
4333 | +++ unity/unity_window_decorator/src/events.c 2011-10-29 09:07:25 +0000 |
4334 | @@ -450,7 +450,8 @@ |
4335 | last_button_x = gtkwd_event->x; |
4336 | last_button_y = gtkwd_event->y; |
4337 | |
4338 | - restack_window (win, Above); |
4339 | + if (raise_on_click) |
4340 | + restack_window (win, Above); |
4341 | |
4342 | move_resize_window (win, WM_MOVERESIZE_MOVE, gtkwd_event); |
4343 | } |
4344 | |
4345 | === modified file 'unity/unity_window_decorator/src/gtk-window-decorator.c' |
4346 | --- unity/unity_window_decorator/src/gtk-window-decorator.c 2011-08-23 18:19:11 +0000 |
4347 | +++ unity/unity_window_decorator/src/gtk-window-decorator.c 2011-10-29 09:07:25 +0000 |
4348 | @@ -25,6 +25,8 @@ |
4349 | |
4350 | double decoration_alpha = 0.5; |
4351 | |
4352 | +gboolean raise_on_click = TRUE; |
4353 | + |
4354 | #define SWITCHER_SPACE 40 |
4355 | |
4356 | decor_extents_t _shadow_extents = { 0, 0, 0, 0 }; |
4357 | |
4358 | === modified file 'unity/unity_window_decorator/src/gtk-window-decorator.h' |
4359 | --- unity/unity_window_decorator/src/gtk-window-decorator.h 2011-08-23 18:19:11 +0000 |
4360 | +++ unity/unity_window_decorator/src/gtk-window-decorator.h 2011-10-29 09:07:25 +0000 |
4361 | @@ -97,6 +97,9 @@ |
4362 | #define COMPIZ_RIGHT_CLICK_TITLEBAR_KEY \ |
4363 | METACITY_GCONF_DIR "/action_right_click_titlebar" |
4364 | |
4365 | +#define COMPIZ_RAISE_ON_CLICK_KEY \ |
4366 | +METACITY_GCONF_DIR "/raise_on_click" |
4367 | + |
4368 | #define COMPIZ_GCONF_DIR1 "/apps/compiz/plugins/decoration/allscreens/options" |
4369 | |
4370 | #define COMPIZ_SHADOW_RADIUS_KEY \ |
4371 | @@ -243,6 +246,8 @@ |
4372 | extern gboolean minimal; |
4373 | extern double decoration_alpha; |
4374 | |
4375 | +extern gboolean raise_on_click; |
4376 | + |
4377 | #define SWITCHER_SPACE 40 |
4378 | |
4379 | extern decor_extents_t _shadow_extents; |
4380 | |
4381 | === modified file 'unity/unity_window_decorator/src/settings.c' |
4382 | --- unity/unity_window_decorator/src/settings.c 2011-08-23 18:19:11 +0000 |
4383 | +++ unity/unity_window_decorator/src/settings.c 2011-10-29 09:07:25 +0000 |
4384 | @@ -402,6 +402,12 @@ |
4385 | &right_click_action, |
4386 | RIGHT_CLICK_ACTION_DEFAULT); |
4387 | } |
4388 | + else if (strcmp (key, COMPIZ_RAISE_ON_CLICK_KEY) == 0) |
4389 | + { |
4390 | + raise_on_click = gconf_client_get_bool (client, |
4391 | + COMPIZ_RAISE_ON_CLICK_KEY, |
4392 | + NULL); |
4393 | + } |
4394 | else if (strcmp (key, WHEEL_ACTION_KEY) == 0) |
4395 | { |
4396 | wheel_action_changed (client); |
4397 | @@ -555,6 +561,9 @@ |
4398 | RIGHT_CLICK_ACTION_DEFAULT); |
4399 | wheel_action_changed (gconf); |
4400 | blur_settings_changed (gconf); |
4401 | + raise_on_click = gconf_client_get_bool (gconf, |
4402 | + COMPIZ_RAISE_ON_CLICK_KEY, |
4403 | + NULL); |
4404 | #endif |
4405 | |
4406 | (*theme_update_border_extents) (text_height); |
Hi.
I'm assuming that his is the same thing as https:/ /code.launchpad .net/~jamesphar aoh/ubuntu/ precise/ compiz/ fix-881329/ +merge/ 80314
Could you propose this against lp:compiz-core? This is the packaging branch.