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