Merge lp:~compiz-team/compiz-core/oneiric.uwd_fixes into lp:compiz-core/oneiric
- oneiric.uwd_fixes
- Merge into oneiric
Status: | Merged |
---|---|
Approved by: | Jason Smith |
Approved revision: | 2798 |
Merged at revision: | 2784 |
Proposed branch: | lp:~compiz-team/compiz-core/oneiric.uwd_fixes |
Merge into: | lp:compiz-core/oneiric |
Diff against target: |
4244 lines (+1202/-1299) 30 files modified
gtk/CMakeLists.txt (+0/-5) gtk/config.h.gtk.in (+0/-25) gtk/window-decorator/CMakeLists.txt (+3/-156) gtk/window-decorator/config.h.gtk.in (+0/-25) gtk/window-decorator/decoration-test.c (+0/-537) gtk/window-decorator/decoration-test.h (+8/-5) gtk/window-decorator/decoration_inspector/CMakeLists.txt (+3/-1) gtk/window-decorator/decoration_inspector/decoration_inspector.c (+17/-19) gtk/window-decorator/simple_decorator/CMakeLists.txt (+3/-1) gtk/window-decorator/simple_decorator/simple-decorator.c (+4/-0) gtk/window-decorator/src/CMakeLists.txt (+155/-0) gtk/window-decorator/src/cairo.c (+7/-6) gtk/window-decorator/src/config.h.gtk.in (+25/-0) gtk/window-decorator/src/decorator.c (+6/-46) gtk/window-decorator/src/events.c (+187/-106) gtk/window-decorator/src/frames.c (+2/-0) gtk/window-decorator/src/gtk-window-decorator.c (+21/-17) gtk/window-decorator/src/gtk-window-decorator.h (+27/-14) gtk/window-decorator/src/metacity.c (+209/-90) gtk/window-decorator/src/settings.c (+0/-2) gtk/window-decorator/src/switcher.c (+1/-1) gtk/window-decorator/src/util.c (+10/-0) gtk/window-decorator/src/wnck.c (+120/-97) gtk/window-decorator/test-cache.c (+0/-116) gtk/window-decorator/test-cache/CMakeLists.txt (+9/-0) gtk/window-decorator/test-cache/test-cache.c (+116/-0) include/decoration.h (+66/-2) libdecoration/decoration.c (+32/-1) plugins/decor/src/decor.cpp (+168/-27) plugins/decor/src/decor.h (+3/-0) |
To merge this branch: | bzr merge lp:~compiz-team/compiz-core/oneiric.uwd_fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Smith (community) | Approve | ||
Review via email: mp+71750@code.launchpad.net |
This proposal supersedes a proposal from 2011-08-16.
This proposal has been superseded by a proposal from 2011-08-19.
Commit message
Description of the change
Various UWD fixes to get the review process started. Needs LP bug references.
- 2791. By Sam Spilsbury
-
Fixed wrong extents offsets for quads on theme changes
cleanup code a little - 2792. By Sam Spilsbury
-
Try to handle leave events and cleanup
- 2793. By Sam Spilsbury
-
Actually handle the leave notify event correctly
- 2794. By Sam Spilsbury
-
Fix crash on unmaximize
- 2795. By Sam Spilsbury
-
Fix some crashes when handling synthetic ButtonRelease events
when the frame window was destroyed (BadWindow) and also maybe
fix bug where sometimes frame windows wouldn't be created or reparented
in - 2796. By Sam Spilsbury
-
Actually generate default decorations
- 2797. By Sam Spilsbury
-
Fix warnings, remove debug messages
- 2798. By Sam Spilsbury
-
Rearrange the build a bit to fix warnings due to gtk2/3 mixing.
CMake requires that the decorator be in a separate subdirectory because
it needs conflicting includes
Preview Diff
1 | === modified file 'gtk/CMakeLists.txt' |
2 | --- gtk/CMakeLists.txt 2011-08-11 08:56:52 +0000 |
3 | +++ gtk/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
4 | @@ -42,10 +42,5 @@ |
5 | compiz_set (USE_GNOME_KEYBINDINGS 0) |
6 | endif (NOT USE_GNOME) |
7 | |
8 | -configure_file ( |
9 | - ${CMAKE_CURRENT_SOURCE_DIR}/config.h.gtk.in |
10 | - ${CMAKE_CURRENT_BINARY_DIR}/config.h |
11 | -) |
12 | - |
13 | add_subdirectory (gnome) |
14 | add_subdirectory (window-decorator) |
15 | |
16 | === removed file 'gtk/config.h.gtk.in' |
17 | --- gtk/config.h.gtk.in 2008-10-14 10:27:55 +0000 |
18 | +++ gtk/config.h.gtk.in 1970-01-01 00:00:00 +0000 |
19 | @@ -1,25 +0,0 @@ |
20 | -/* Define to 1 if Metacity support is enabled */ |
21 | -#cmakedefine USE_METACITY 1 |
22 | - |
23 | -/* Define to 1 if Gconf support is enabled */ |
24 | -#cmakedefine USE_GCONF 1 |
25 | - |
26 | -/* Define to 1 if you have the `wnck_window_has_name' function. */ |
27 | -#cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1 |
28 | - |
29 | -/* Define to 1 if libwnck version >= 2_18_1 */ |
30 | -#cmakedefine HAVE_LIBWNCK_2_18_1 1 |
31 | - |
32 | -/* Define to 1 if libwnck version >= 2_19_4 */ |
33 | -#cmakedefine HAVE_LIBWNCK_2_19_4 1 |
34 | - |
35 | -/* Define to 1 if metacity version >= 2.15.21 */ |
36 | -#cmakedefine HAVE_METACITY_2_15_21 1 |
37 | - |
38 | -/* Define to 1 if metacity version >= 2.17.0 */ |
39 | -#cmakedefine HAVE_METACITY_2_17_0 1 |
40 | - |
41 | -/* Define to 1 if metacity version >= 2.23.2 */ |
42 | -#cmakedefine HAVE_METACITY_2_23_2 1 |
43 | - |
44 | -#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}" |
45 | |
46 | === modified file 'gtk/window-decorator/CMakeLists.txt' |
47 | --- gtk/window-decorator/CMakeLists.txt 2011-08-11 16:42:06 +0000 |
48 | +++ gtk/window-decorator/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
49 | @@ -36,162 +36,9 @@ |
50 | pangocairo |
51 | ) |
52 | if (UNITY_WINDOW_DECORATOR_FOUND) |
53 | - include (CheckFunctionExists) |
54 | - set (CMAKE_REQUIRED_FLAGS ${UNITY_WINDOW_DECORATOR_CFLAGS}) |
55 | - set (CMAKE_REQUIRED_LIBRARIES ${UNITY_WINDOW_DECORATOR_LIBRARIES}) |
56 | - list (FIND CMAKE_REQUIRED_FLAGS "-D_REENTRANT" REENTRANT_INDEX) |
57 | - if (REENTRANT_INDEX) |
58 | - list (REMOVE_AT CMAKE_REQUIRED_FLAGS REENTRANT_INDEX) |
59 | - list (APPEND CMAKE_REQUIRED_FLAGS "-D_REENTRANT=1") |
60 | - endif (REENTRANT_INDEX) |
61 | - check_function_exists (wnck_window_has_name HAVE_WNCK_WINDOW_HAS_NAME) |
62 | - set (CMAKE_REQUIRED_FLAGS "") |
63 | - set (CMAKE_REQUIRED_LIBRARIES "") |
64 | - |
65 | - compiz_pkg_check_modules (HAVE_LIBWNCK_2_18_1 libwnck-1.0>=2.18.1) |
66 | - compiz_pkg_check_modules (HAVE_LIBWNCK_2_19_4 libwnck-1.0>=2.19.4) |
67 | - |
68 | - if (BUILD_METACITY) |
69 | - pkg_check_modules (METACITY libmetacity-private) |
70 | - if (METACITY_FOUND) |
71 | - compiz_pkg_check_modules (HAVE_METACITY_2_15_21 libmetacity-private>=2.15.21) |
72 | - compiz_pkg_check_modules (HAVE_METACITY_2_17_0 libmetacity-private>=2.17.0) |
73 | - compiz_pkg_check_modules (HAVE_METACITY_2_23_2 libmetacity-private>=2.23.2) |
74 | - else (METACITY_FOUND) |
75 | - compiz_set (USE_METACITY 0) |
76 | - endif (METACITY_FOUND) |
77 | - endif (BUILD_METACITY) |
78 | - |
79 | - if (COMPIZ_BUILD_WITH_RPATH) |
80 | - set (CMAKE_INSTALL_RPATH ${libdir}) |
81 | - endif (COMPIZ_BUILD_WITH_RPATH) |
82 | - |
83 | - configure_file ( |
84 | - ${CMAKE_CURRENT_SOURCE_DIR}/config.h.gtk.in |
85 | - ${CMAKE_CURRENT_BINARY_DIR}/config.h |
86 | - ) |
87 | - |
88 | - include_directories ( |
89 | - ${compiz_SOURCE_DIR}/include |
90 | - ${CMAKE_CURRENT_BINARY_DIR} |
91 | - ${UNITY_WINDOW_DECORATOR_INCLUDE_DIRS} |
92 | - ${METACITY_INCLUDE_DIRS} |
93 | - ${GCONF_INCLUDE_DIRS} |
94 | - ${DBUS_GLIB_INCLUDE_DIRS} |
95 | - ) |
96 | - |
97 | - add_definitions ( |
98 | - -DHAVE_CONFIG_H |
99 | - -DALL_LINGUAS=\"${ALL_LINGUAS}\" |
100 | - -DLOCALEDIR=\\\"${datadir}/locale\\\" |
101 | - ) |
102 | - |
103 | - link_directories ( |
104 | - ${UNITY_WINDOW_DECORATOR_LIBRARY_DIRS} |
105 | - ${COMPIZ_LINK_DIRS} |
106 | - ) |
107 | - |
108 | - if (USE_GCONF_UNITY_WINDOW_DECORATOR) |
109 | - |
110 | - if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
111 | - set (SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/gconf/schemas") |
112 | - else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
113 | - set (SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}") |
114 | - endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
115 | - |
116 | - set (gwd_schema ${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas) |
117 | - |
118 | - compiz_translate_xml ( |
119 | - ${CMAKE_CURRENT_SOURCE_DIR}/gwd.schemas.in |
120 | - ${gwd_schema} |
121 | - ) |
122 | - |
123 | - compiz_install_gconf_schema (${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas ${SCHEMADIR}) |
124 | - |
125 | - endif (USE_GCONF_UNITY_WINDOW_DECORATOR) |
126 | - |
127 | - add_executable (unity-window-decorator |
128 | - gtk-window-decorator.c |
129 | - blurprops.c |
130 | - decorprops.c |
131 | - cairo.c |
132 | - gdk.c |
133 | - switcher.c |
134 | - metacity.c |
135 | - events.c |
136 | - forcequit.c |
137 | - actionmenu.c |
138 | - settings.c |
139 | - util.c |
140 | - style.c |
141 | - wnck.c |
142 | - decorator.c |
143 | - frames.c |
144 | - ${gwd_schema} |
145 | - ) |
146 | - |
147 | - add_executable (gtk-window-decorator |
148 | - gtk-window-decorator.c |
149 | - blurprops.c |
150 | - decorprops.c |
151 | - cairo.c |
152 | - gdk.c |
153 | - switcher.c |
154 | - metacity.c |
155 | - events.c |
156 | - forcequit.c |
157 | - actionmenu.c |
158 | - settings.c |
159 | - util.c |
160 | - style.c |
161 | - wnck.c |
162 | - decorator.c |
163 | - frames.c |
164 | - ${gwd_schema} |
165 | - ) |
166 | - |
167 | - if (USE_METACITY) |
168 | - set (metacitylibs ${METACITY_LIBRARIES}) |
169 | - endif (USE_METACITY) |
170 | - |
171 | - set_target_properties ( |
172 | - unity-window-decorator PROPERTIES |
173 | - INSTALL_RPATH_USE_LINK_PATH 0 |
174 | - ) |
175 | - |
176 | - target_link_libraries (unity-window-decorator |
177 | - decoration |
178 | - ${UNITY_WINDOW_DECORATOR_LIBRARIES} |
179 | - ${GCONF_LIBRARIES} |
180 | - ${DBUS_GLIB_LIBRARIES} |
181 | - ${metacitylibs} |
182 | - ) |
183 | - |
184 | - install ( |
185 | - TARGETS unity-window-decorator |
186 | - DESTINATION ${COMPIZ_DESTDIR}${exec_prefix} |
187 | - RUNTIME DESTINATION bin |
188 | - ) |
189 | - |
190 | - set_target_properties ( |
191 | - gtk-window-decorator PROPERTIES |
192 | - INSTALL_RPATH_USE_LINK_PATH 0 |
193 | - ) |
194 | - |
195 | - target_link_libraries (gtk-window-decorator |
196 | - decoration |
197 | - ${UNITY_WINDOW_DECORATOR_LIBRARIES} |
198 | - ${GCONF_LIBRARIES} |
199 | - ${DBUS_GLIB_LIBRARIES} |
200 | - ${metacitylibs} |
201 | - ) |
202 | - |
203 | - install ( |
204 | - TARGETS gtk-window-decorator |
205 | - DESTINATION ${COMPIZ_DESTDIR}${exec_prefix} |
206 | - RUNTIME DESTINATION bin |
207 | - ) |
208 | - |
209 | + |
210 | + add_subdirectory (test-cache) |
211 | + add_subdirectory (src) |
212 | add_subdirectory (simple_decorator) |
213 | add_subdirectory (decoration_inspector) |
214 | |
215 | |
216 | === removed file 'gtk/window-decorator/config.h.gtk.in' |
217 | --- gtk/window-decorator/config.h.gtk.in 2011-08-11 08:56:52 +0000 |
218 | +++ gtk/window-decorator/config.h.gtk.in 1970-01-01 00:00:00 +0000 |
219 | @@ -1,25 +0,0 @@ |
220 | -/* Define to 1 if Metacity support is enabled */ |
221 | -#cmakedefine USE_METACITY 1 |
222 | - |
223 | -/* Define to 1 if Gconf support is enabled */ |
224 | -#cmakedefine USE_GCONF 1 |
225 | - |
226 | -/* Define to 1 if you have the `wnck_window_has_name' function. */ |
227 | -#cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1 |
228 | - |
229 | -/* Define to 1 if libwnck version >= 2_18_1 */ |
230 | -#cmakedefine HAVE_LIBWNCK_2_18_1 1 |
231 | - |
232 | -/* Define to 1 if libwnck version >= 2_19_4 */ |
233 | -#cmakedefine HAVE_LIBWNCK_2_19_4 1 |
234 | - |
235 | -/* Define to 1 if metacity version >= 2.15.21 */ |
236 | -#cmakedefine HAVE_METACITY_2_15_21 1 |
237 | - |
238 | -/* Define to 1 if metacity version >= 2.17.0 */ |
239 | -#cmakedefine HAVE_METACITY_2_17_0 1 |
240 | - |
241 | -/* Define to 1 if metacity version >= 2.23.2 */ |
242 | -#cmakedefine HAVE_METACITY_2_23_2 1 |
243 | - |
244 | -#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}" |
245 | |
246 | === added file 'gtk/window-decorator/decoration-test.c' |
247 | --- gtk/window-decorator/decoration-test.c 1970-01-01 00:00:00 +0000 |
248 | +++ gtk/window-decorator/decoration-test.c 2011-08-18 18:06:27 +0000 |
249 | @@ -0,0 +1,540 @@ |
250 | +/* |
251 | + * decoration-test.h |
252 | + * |
253 | + * Copyright (c) 2011 Canonical Ltd. |
254 | + * |
255 | + * This program is free software: you can redistribute it and/or modify it |
256 | + * under the terms of the GNU General Public License as published by the |
257 | + * Free Software Foundation, either version 3 of the License, or (at your |
258 | + * option) any later version. |
259 | + * |
260 | + * This program is distributed in the hope that it will be useful, but |
261 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
262 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
263 | + * General Public License for more details. |
264 | + * |
265 | + * You should have received a copy of the GNU General Public License along |
266 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
267 | + * |
268 | + * Authored by: |
269 | + * Sam Spilsbury <sam.spilsbury@canonical.com> |
270 | + */ |
271 | +#ifndef _GNU_SOURCE |
272 | +#define _GNU_SOURCE |
273 | +#endif |
274 | +#include "decoration-test.h" |
275 | + |
276 | + |
277 | +int fasprintf (char **strret, const char *fmt, ... ) |
278 | +{ |
279 | + char *orig = NULL; |
280 | + int ret = 1; |
281 | + |
282 | + if (*strret) |
283 | + orig = *strret; |
284 | + |
285 | + va_list args; |
286 | + va_start (args, fmt); |
287 | + ret = vasprintf (strret, fmt, args); |
288 | + va_end (args); |
289 | + |
290 | + if (orig) |
291 | + free (orig); |
292 | + |
293 | + return ret; |
294 | +} |
295 | + |
296 | + |
297 | +char * |
298 | +print_gravity (void *d) |
299 | +{ |
300 | + char *str = NULL; |
301 | + int gravity = *((int *) d); |
302 | + fasprintf (&str, ""); |
303 | + |
304 | + if (gravity & GRAVITY_WEST) |
305 | + fasprintf (&str, "%sGRAVITY_WEST ", str); |
306 | + if (gravity & GRAVITY_EAST) |
307 | + fasprintf (&str, "%sGRAVITY_EAST ", str); |
308 | + if (gravity & GRAVITY_NORTH) |
309 | + fasprintf (&str, "%sGRAVITY_NORTH ", str); |
310 | + if (gravity & GRAVITY_SOUTH) |
311 | + fasprintf (&str, "%sGRAVITY_SOUTH ", str); |
312 | + |
313 | + return str; |
314 | +} |
315 | + |
316 | +char * |
317 | +print_stretch (void *d) |
318 | +{ |
319 | + char *str = NULL; |
320 | + int stretch = *((int *) d); |
321 | + fasprintf (&str, ""); |
322 | + |
323 | + if (stretch & STRETCH_X) |
324 | + fasprintf (&str, "%sSTRETCH_X ", str); |
325 | + if (stretch & STRETCH_Y) |
326 | + fasprintf (&str, "%sSTRETCH_Y ", str); |
327 | + |
328 | + return str; |
329 | +} |
330 | + |
331 | +char * |
332 | +print_align (void *d) |
333 | +{ |
334 | + char *str = NULL; |
335 | + int align = *((int *) d); |
336 | + fasprintf (&str, ""); |
337 | + |
338 | + if (align & ALIGN_LEFT) |
339 | + fasprintf (&str, "%sALIGN_LEFT ", str); |
340 | + if (align & ALIGN_RIGHT) |
341 | + fasprintf (&str, "%sALIGN_RIGHT ", str); |
342 | + if (align & ALIGN_TOP) |
343 | + fasprintf (&str, "%sALIGN_TOP ", str); |
344 | + if (align & ALIGN_BOTTOM) |
345 | + fasprintf (&str, "%sALIGN BOTTOM ", str); |
346 | + |
347 | + return str; |
348 | +} |
349 | + |
350 | +char * |
351 | +print_clamp (void *d) |
352 | +{ |
353 | + char *str = NULL; |
354 | + int clamp = *((int *) d); |
355 | + fasprintf (&str, ""); |
356 | + |
357 | + if (clamp & CLAMP_HORZ) |
358 | + fasprintf (&str, "%sCLAMP_HORZ ", str); |
359 | + if (clamp & CLAMP_VERT) |
360 | + fasprintf (&str, "%sCLAMP_VERT ", str); |
361 | + |
362 | + return str; |
363 | +} |
364 | + |
365 | +char * |
366 | +print_frame_type (void *d) |
367 | +{ |
368 | + char *str = NULL; |
369 | + unsigned int frame_type = *((unsigned int *) d); |
370 | + fasprintf (&str, ""); |
371 | + |
372 | + if (frame_type & DECOR_WINDOW_TYPE_NORMAL) |
373 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_NORMAL ", str); |
374 | + if (frame_type & DECOR_WINDOW_TYPE_DIALOG) |
375 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_DIALOG ", str); |
376 | + if (frame_type & DECOR_WINDOW_TYPE_MENU) |
377 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_MENU ", str); |
378 | + if (frame_type & DECOR_WINDOW_TYPE_UTILITY) |
379 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_UTILITY ", str); |
380 | + if (frame_type & DECOR_WINDOW_TYPE_BARE) |
381 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_BARE ", str); |
382 | + if (frame_type & DECOR_WINDOW_TYPE_SWITCHER) |
383 | + fasprintf (&str, "%sDECOR_WINDOW_TYPE_SWITCHER ", str); |
384 | + |
385 | + return str; |
386 | +} |
387 | + |
388 | +char * |
389 | +print_frame_actions (void *d) |
390 | +{ |
391 | + char *str = NULL; |
392 | + unsigned int frame_actions = *((unsigned int *) d); |
393 | + fasprintf (&str, ""); |
394 | + |
395 | + if (frame_actions & DECOR_WINDOW_ACTION_RESIZE_HORZ) |
396 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_RESIZE_HORZ ", str); |
397 | + if (frame_actions & DECOR_WINDOW_ACTION_RESIZE_VERT) |
398 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_RESIZE_VERT ", str); |
399 | + if (frame_actions & DECOR_WINDOW_ACTION_CLOSE) |
400 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_CLOSE ", str); |
401 | + if (frame_actions & DECOR_WINDOW_ACTION_MINIMIZE) |
402 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_MINIMIZE ", str); |
403 | + if (frame_actions & DECOR_WINDOW_ACTION_UNMINIMIZE) |
404 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMINIMIZE ", str); |
405 | + if (frame_actions & DECOR_WINDOW_ACTION_MAXIMIZE_HORZ) |
406 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_MAXIMIZE_HORZ ", str); |
407 | + if (frame_actions & DECOR_WINDOW_ACTION_MAXIMIZE_VERT) |
408 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_MAXIMIZE_VERT ", str); |
409 | + if (frame_actions & DECOR_WINDOW_ACTION_UNMAXIMIZE_HORZ) |
410 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMAXIMIZE_HORZ ", str); |
411 | + if (frame_actions & DECOR_WINDOW_ACTION_UNMAXIMIZE_VERT) |
412 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMAXIMIZE_VERT ", str); |
413 | + if (frame_actions & DECOR_WINDOW_ACTION_SHADE) |
414 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_SHADE ", str); |
415 | + if (frame_actions & DECOR_WINDOW_ACTION_UNSHADE) |
416 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNSHADE ", str); |
417 | + if (frame_actions & DECOR_WINDOW_ACTION_STICK) |
418 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_STICK ", str); |
419 | + if (frame_actions & DECOR_WINDOW_ACTION_UNSTICK) |
420 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNSTICK ", str); |
421 | + if (frame_actions & DECOR_WINDOW_ACTION_FULLSCREEN) |
422 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_FULLSCREEN ", str); |
423 | + if (frame_actions & DECOR_WINDOW_ACTION_ABOVE) |
424 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_ABOVE ", str); |
425 | + if (frame_actions & DECOR_WINDOW_ACTION_BELOW) |
426 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_BELOW ", str); |
427 | + if (frame_actions & DECOR_WINDOW_ACTION_MOVE) |
428 | + fasprintf (&str, "%sDECOR_WINDOW_ACTION_MOVE ", str); |
429 | + |
430 | + return str; |
431 | +} |
432 | + |
433 | +char * |
434 | +print_frame_state (void *d) |
435 | +{ |
436 | + char *str = NULL; |
437 | + unsigned int frame_state = *((unsigned int *) d); |
438 | + fasprintf (&str, ""); |
439 | + |
440 | + if (frame_state & DECOR_WINDOW_STATE_FOCUS) |
441 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_FOCUS ", str); |
442 | + if (frame_state & DECOR_WINDOW_STATE_MAXIMIZED_VERT) |
443 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_MAXIMIZED_VERT ", str); |
444 | + if (frame_state & DECOR_WINDOW_STATE_MAXIMIZED_HORZ) |
445 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_MAXIMIZED_HORZ ", str); |
446 | + if (frame_state & DECOR_WINDOW_STATE_SHADED) |
447 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_SHADED ", str); |
448 | + if (frame_state & DECOR_WINDOW_STATE_COMPOSITED) |
449 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_COMPOSITED ", str); |
450 | + if (frame_state & DECOR_WINDOW_STATE_MODAL) |
451 | + fasprintf (&str, "%sDECOR_WINDOW_STATE_MODAL ", str); |
452 | + |
453 | + return str; |
454 | +} |
455 | + |
456 | +char * |
457 | +print_unsigned_hex (void *d) |
458 | +{ |
459 | + char *str = NULL; |
460 | + unsigned int hex = *((unsigned int *) d); |
461 | + fasprintf (&str, ""); |
462 | + |
463 | + fasprintf (&str, "%s0x%x", str, hex); |
464 | + |
465 | + return str; |
466 | +} |
467 | + |
468 | +char * |
469 | +print_int (void *d) |
470 | +{ |
471 | + char *str = NULL; |
472 | + unsigned int i = *((unsigned int *) d); |
473 | + |
474 | + fasprintf (&str, "%s%i", str, i); |
475 | + |
476 | + return str; |
477 | +} |
478 | + |
479 | +char * |
480 | +print_box (void *d) |
481 | +{ |
482 | + decor_point_t *point = ((decor_point_t *) d); |
483 | + char *str = print_gravity ((void *) &(point->gravity)); |
484 | + fasprintf (&str, ""); |
485 | + |
486 | + fasprintf (&str, "%s : x: %i y: %i", str, point->x, point->y); |
487 | + |
488 | + return str; |
489 | +} |
490 | + |
491 | +char * |
492 | +print_float (void *d) |
493 | +{ |
494 | + char *str = NULL; |
495 | + float f = *((float *) d); |
496 | + |
497 | + fasprintf (&str, "%s%f", str, f); |
498 | + |
499 | + return str; |
500 | +} |
501 | + |
502 | +char * |
503 | +print_extents (void *d) |
504 | +{ |
505 | + decor_extents_t *extents = ((decor_extents_t *) d); |
506 | + char *str = NULL; |
507 | + fasprintf (&str, ""); |
508 | + |
509 | + fasprintf (&str, "%s : left: %i right: %i: top: %i: bottom: %i", str, extents->left, extents->right, extents->top, extents->bottom); |
510 | + |
511 | + return str; |
512 | +} |
513 | + |
514 | +void |
515 | +dump_decoration_data (long int *d_ptr) |
516 | +{ |
517 | + unsigned int i; |
518 | + |
519 | + printf ("size: wrote: %li\n", *d_ptr++); |
520 | + printf ("type: wrote: %li\n", *d_ptr++); |
521 | + printf ("frame_type: wrote: %li\n", *d_ptr++); |
522 | + printf ("frame_state: wrote: 0x%lx\n", *d_ptr++); |
523 | + printf ("frame_actions: wrote: 0x%lx\n", *d_ptr++); |
524 | + printf ("pixmap: wrote: 0x%lx\n", *d_ptr++); |
525 | + |
526 | + printf ("fl: wrote: %li\n", *d_ptr++); |
527 | + printf ("ft: wrote: %li\n", *d_ptr++); |
528 | + printf ("ft: wrote: %li\n", *d_ptr++); |
529 | + printf ("fb: wrote: %li\n", *d_ptr++); |
530 | + printf ("bl: wrote: %li\n", *d_ptr++); |
531 | + printf ("bt: wrote: %li\n", *d_ptr++); |
532 | + printf ("bt: wrote: %li\n", *d_ptr++); |
533 | + printf ("bb: wrote: %li\n", *d_ptr++); |
534 | + |
535 | + printf ("min_width: wrote: %li\n", *d_ptr++); |
536 | + printf ("min_height: wrote: %li\n", *d_ptr++); |
537 | + |
538 | + i = *d_ptr++; |
539 | + printf ("nQuad: wrote: %li\n", *d_ptr++); |
540 | + while (i--) |
541 | + { |
542 | + printf ("quad %i flags: wrote: 0x%lx ", i, *d_ptr++); |
543 | + int gravityv = *d_ptr; |
544 | + char *gravity = print_gravity (&gravityv); |
545 | + int gravity2v = *d_ptr >> 4; |
546 | + char *gravity2 = print_gravity (&gravity2v); |
547 | + int alignv = *d_ptr >> 8; |
548 | + char *align = print_align (&alignv); |
549 | + int clampv = *d_ptr >> 10; |
550 | + char *clamp = print_clamp (&clampv); |
551 | + int stretchv = *d_ptr >> 12; |
552 | + char *stretch = print_stretch (&stretchv); |
553 | + |
554 | + printf ("%s ", gravity); |
555 | + printf ("%s ", gravity2); |
556 | + printf ("%s ", align); |
557 | + printf ("%s ", clamp); |
558 | + printf ("%s ", stretch); |
559 | + printf ("\n"); |
560 | + |
561 | + free (gravity); |
562 | + free (gravity2); |
563 | + free (align); |
564 | + free (clamp); |
565 | + free (stretch); |
566 | + |
567 | + printf ("quad %i p1x: wrote: %li\n", i, *d_ptr++); |
568 | + printf ("quad %i p1y: wrote: %li\n", i, *d_ptr++); |
569 | + printf ("quad %i p2x: wrote: %li\n", i, *d_ptr++); |
570 | + printf ("quad %i p2y: wrote: %li\n", i, *d_ptr++); |
571 | + printf ("quad %i max_width: wrote: %li\n", i, *d_ptr++); |
572 | + printf ("quad %i max_height: wrote: %li\n", i, *d_ptr++); |
573 | + printf ("quad %i matrix x0: wrote: %li\n", i, *d_ptr++); |
574 | + printf ("quad %i matrix y0: wrote: %li\n", i, *d_ptr++); |
575 | + } |
576 | +} |
577 | + |
578 | +void |
579 | +dump_decoration (decoration *d) |
580 | +{ |
581 | + unsigned int i; |
582 | + printf ("decoration * %p contains : \n", d); |
583 | + |
584 | + printf ("frame_type: 0x%x\n", d->frame_type); |
585 | + printf ("frame_state: 0x%x\n", d->frame_state); |
586 | + printf ("frame_actions: 0x%x\n", d->frame_actions); |
587 | + printf ("pixmap: 0x%x\n", (unsigned int) d->p); |
588 | + printf ("frame left: %i\n", d->extents.left); |
589 | + printf ("frame right: %i\n", d->extents.right); |
590 | + printf ("frame top: %i\n", d->extents.top); |
591 | + printf ("frame bottom: %i\n", d->extents.bottom); |
592 | + printf ("input left: %i\n", d->extents.left); |
593 | + printf ("input right: %i\n", d->extents.right); |
594 | + printf ("input top: %i\n", d->extents.top); |
595 | + printf ("input bottom: %i\n", d->extents.bottom); |
596 | + printf ("n quads: %i\n", d->nQuad); |
597 | + |
598 | + for (i = 0; i < d->nQuad; i++) |
599 | + { |
600 | + int gravityv = d->quads[i].p1.gravity; |
601 | + char *gravity = print_gravity (&gravityv); |
602 | + int gravity2v = d->quads[i].p2.gravity; |
603 | + char *gravity2 = print_gravity (&gravity2v); |
604 | + int alignv = d->quads[i].align; |
605 | + char *align = print_align (&alignv); |
606 | + int clampv = d->quads[i].clamp; |
607 | + char *clamp = print_clamp (&clampv); |
608 | + int stretchv = d->quads[i].stretch; |
609 | + char *stretch = print_stretch (&stretchv); |
610 | + |
611 | + printf ("quad %i p1: x: %i\n", i, d->quads[i].p1.x); |
612 | + printf ("quad %i p1: y: %i\n", i, d->quads[i].p1.y); |
613 | + printf ("quad %i p1: gravity: 0x%x ", i, gravityv); |
614 | + printf ("%s ", gravity); |
615 | + printf ("\n"); |
616 | + |
617 | + printf ("quad %i p2: x: %i\n", i, d->quads[i].p2.x); |
618 | + printf ("quad %i p2: y: %i\n", i, d->quads[i].p2.y); |
619 | + printf ("quad %i p2: gravity: 0x%x ", i, gravity2v); |
620 | + printf ("%s ", gravity2); |
621 | + printf ("\n"); |
622 | + |
623 | + printf ("quad %i max_width: %i\n", i, d->quads[i].max_width); |
624 | + printf ("quad %i max_height: %i\n", i, d->quads[i].max_height); |
625 | + |
626 | + printf ("quad %i align: 0x%x :", i, alignv); |
627 | + printf ("%s ", align); |
628 | + printf ("\n"); |
629 | + |
630 | + printf ("quad %i clamp: 0x%x :", i, clampv); |
631 | + printf ("%s ", clamp); |
632 | + printf ("\n"); |
633 | + |
634 | + printf ("quad %i stretch: 0x%x :", i, clampv); |
635 | + printf ("%s ", stretch); |
636 | + printf ("\n"); |
637 | + |
638 | + printf ("\n"); |
639 | + |
640 | + free (gravity); |
641 | + free (gravity2); |
642 | + free (align); |
643 | + free (clamp); |
644 | + free (stretch); |
645 | + |
646 | + } |
647 | +} |
648 | + |
649 | +void |
650 | +destroy_decoration (decoration *d, |
651 | + decor_cache_t *cache) |
652 | +{ |
653 | + if (!decor_cache_remove_subproperty (cache, |
654 | + d->frame_type, |
655 | + d->frame_state, |
656 | + d->frame_actions, |
657 | + d->property)) |
658 | + printf ("can't remove property 0x%x 0x%x 0x%x from %p...\n", d->frame_type, d->frame_state, d->frame_actions, cache->data); |
659 | + |
660 | + free (d); |
661 | +} |
662 | + |
663 | +decoration * |
664 | +load_decoration_from_property (long int *data) |
665 | +{ |
666 | + decoration *d = calloc (1, sizeof (decoration)); |
667 | + |
668 | + /* safe-ish, wouldn't count on it */ |
669 | + d->nQuad = decor_pixmap_property_to_quads (data, &d->p, &d->extents, &d->extents, &d->min_width, &d->min_height, &d->frame_type, &d->frame_state, &d->frame_actions, d->quads); |
670 | + // memcpy (&d->property->data, data, sizeof (long int) * data[1]); |
671 | + |
672 | + return d; |
673 | +} |
674 | + |
675 | +char * |
676 | +data_to_string (long int *data, unsigned int data_size) |
677 | +{ |
678 | + char *string = NULL; |
679 | + int i = 0; |
680 | + |
681 | + fasprintf (&string, ""); |
682 | + |
683 | + for (; i < data_size; i++) |
684 | + fasprintf (&string, "%s%li, ", string, data[i]); |
685 | + |
686 | + return string; |
687 | +} |
688 | + |
689 | +long int * |
690 | +string_to_data (const char *string, unsigned int *data_size) |
691 | +{ |
692 | + char *save; |
693 | + char *tok; |
694 | + char *working; |
695 | + long int *data, *orig_data; |
696 | + |
697 | + working = strdup (string); |
698 | + |
699 | + *data_size = 0; |
700 | + tok = strtok_r (working, ", ", &save); |
701 | + |
702 | + while (tok != NULL) |
703 | + { |
704 | + tok = strtok_r (NULL, ", ", &save); |
705 | + (*data_size)++; |
706 | + } |
707 | + |
708 | + free (working); |
709 | + |
710 | + orig_data = data = calloc (*data_size + 1, sizeof (long int)); |
711 | + working = strdup (string); |
712 | + |
713 | + save = NULL; |
714 | + |
715 | + *data_size = 0; |
716 | + tok = strtok_r (working, ", ", &save); |
717 | + |
718 | + while (tok != NULL) |
719 | + { |
720 | + if (!sscanf (tok, "%li", data)) |
721 | + printf ("couldn't parse %s", tok); |
722 | + |
723 | + tok = strtok_r (NULL, ", ", &save); |
724 | + data++; |
725 | + } |
726 | + |
727 | + free (working); |
728 | + |
729 | + return orig_data; |
730 | +} |
731 | + |
732 | + |
733 | +decoration * |
734 | +create_decoration_from_info (Pixmap p, |
735 | + int el, |
736 | + int er, |
737 | + int et, |
738 | + int eb, |
739 | + int ls, |
740 | + int rs, |
741 | + int ts, |
742 | + int bs, |
743 | + int lcs, |
744 | + int rcs, |
745 | + int tcs, |
746 | + int bcs, |
747 | + int mw, |
748 | + int mh, |
749 | + unsigned int frame_type, |
750 | + unsigned int frame_state, |
751 | + unsigned int frame_actions, |
752 | + decor_cache_t *cache) |
753 | +{ |
754 | + decoration *d = calloc (1, sizeof (decoration)); |
755 | + |
756 | + d->p = p; |
757 | + |
758 | + d->extents.left = el; |
759 | + d->extents.right = er; |
760 | + d->extents.top = et; |
761 | + d->extents.bottom = eb; |
762 | + |
763 | + d->context.extents = d->extents; |
764 | + d->context.left_space = ls; |
765 | + d->context.right_space = rs; |
766 | + d->context.top_space = ts; |
767 | + d->context.bottom_space = bs; |
768 | + d->context.left_corner_space = lcs; |
769 | + d->context.right_corner_space = rcs; |
770 | + d->context.top_corner_space = tcs; |
771 | + d->context.bottom_corner_space = bcs; |
772 | + |
773 | + d->min_width = mw; |
774 | + d->min_height = mh; |
775 | + |
776 | + d->frame_type = frame_type; |
777 | + d->frame_state = frame_state; |
778 | + d->frame_actions = frame_actions; |
779 | + |
780 | + decor_get_default_layout (&d->context, mw, mh, &d->layout); |
781 | + d->nQuad = decor_set_lSrStSbS_window_quads (d->quads, &d->context, &d->layout); |
782 | + d->property = decor_cache_append_pixmap (cache, d->nQuad); |
783 | + |
784 | + decor_subproperty_set_pixmap (d->property, d->p, &d->extents, &d->extents, |
785 | + 0, 0, d->quads, d->nQuad, d->frame_type, |
786 | + d->frame_state, d->frame_actions); |
787 | + |
788 | + return d; |
789 | +} |
790 | |
791 | === removed file 'gtk/window-decorator/decoration-test.c' |
792 | --- gtk/window-decorator/decoration-test.c 2011-08-11 08:56:52 +0000 |
793 | +++ gtk/window-decorator/decoration-test.c 1970-01-01 00:00:00 +0000 |
794 | @@ -1,537 +0,0 @@ |
795 | -/* |
796 | - * decoration-test.h |
797 | - * |
798 | - * Copyright (c) 2011 Canonical Ltd. |
799 | - * |
800 | - * This program is free software: you can redistribute it and/or modify it |
801 | - * under the terms of the GNU General Public License as published by the |
802 | - * Free Software Foundation, either version 3 of the License, or (at your |
803 | - * option) any later version. |
804 | - * |
805 | - * This program is distributed in the hope that it will be useful, but |
806 | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
807 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
808 | - * General Public License for more details. |
809 | - * |
810 | - * You should have received a copy of the GNU General Public License along |
811 | - * with this program. If not, see <http://www.gnu.org/licenses/>. |
812 | - * |
813 | - * Authored by: |
814 | - * Sam Spilsbury <sam.spilsbury@canonical.com> |
815 | - */ |
816 | - |
817 | -#include "decoration-test.h" |
818 | - |
819 | -int fasprintf (char **strret, const char *fmt, ... ) |
820 | -{ |
821 | - char *orig = NULL; |
822 | - int ret = 1; |
823 | - |
824 | - if (*strret) |
825 | - orig = *strret; |
826 | - |
827 | - va_list args; |
828 | - va_start (args, fmt); |
829 | - ret = vasprintf (strret, fmt, args); |
830 | - va_end (args); |
831 | - |
832 | - if (orig) |
833 | - free (orig); |
834 | - |
835 | - return ret; |
836 | -} |
837 | - |
838 | - |
839 | -char * |
840 | -print_gravity (void *d) |
841 | -{ |
842 | - char *str = NULL; |
843 | - int gravity = *((int *) d); |
844 | - fasprintf (&str, ""); |
845 | - |
846 | - if (gravity & GRAVITY_WEST) |
847 | - fasprintf (&str, "%sGRAVITY_WEST ", str); |
848 | - if (gravity & GRAVITY_EAST) |
849 | - fasprintf (&str, "%sGRAVITY_EAST ", str); |
850 | - if (gravity & GRAVITY_NORTH) |
851 | - fasprintf (&str, "%sGRAVITY_NORTH ", str); |
852 | - if (gravity & GRAVITY_SOUTH) |
853 | - fasprintf (&str, "%sGRAVITY_SOUTH ", str); |
854 | - |
855 | - return str; |
856 | -} |
857 | - |
858 | -char * |
859 | -print_stretch (void *d) |
860 | -{ |
861 | - char *str = NULL; |
862 | - int stretch = *((int *) d); |
863 | - fasprintf (&str, ""); |
864 | - |
865 | - if (stretch & STRETCH_X) |
866 | - fasprintf (&str, "%sSTRETCH_X ", str); |
867 | - if (stretch & STRETCH_Y) |
868 | - fasprintf (&str, "%sSTRETCH_Y ", str); |
869 | - |
870 | - return str; |
871 | -} |
872 | - |
873 | -char * |
874 | -print_align (void *d) |
875 | -{ |
876 | - char *str = NULL; |
877 | - int align = *((int *) d); |
878 | - fasprintf (&str, ""); |
879 | - |
880 | - if (align & ALIGN_LEFT) |
881 | - fasprintf (&str, "%sALIGN_LEFT ", str); |
882 | - if (align & ALIGN_RIGHT) |
883 | - fasprintf (&str, "%sALIGN_RIGHT ", str); |
884 | - if (align & ALIGN_TOP) |
885 | - fasprintf (&str, "%sALIGN_TOP ", str); |
886 | - if (align & ALIGN_BOTTOM) |
887 | - fasprintf (&str, "%sALIGN BOTTOM ", str); |
888 | - |
889 | - return str; |
890 | -} |
891 | - |
892 | -char * |
893 | -print_clamp (void *d) |
894 | -{ |
895 | - char *str = NULL; |
896 | - int clamp = *((int *) d); |
897 | - fasprintf (&str, ""); |
898 | - |
899 | - if (clamp & CLAMP_HORZ) |
900 | - fasprintf (&str, "%sCLAMP_HORZ ", str); |
901 | - if (clamp & CLAMP_VERT) |
902 | - fasprintf (&str, "%sCLAMP_VERT ", str); |
903 | - |
904 | - return str; |
905 | -} |
906 | - |
907 | -char * |
908 | -print_frame_type (void *d) |
909 | -{ |
910 | - char *str = NULL; |
911 | - unsigned int frame_type = *((unsigned int *) d); |
912 | - fasprintf (&str, ""); |
913 | - |
914 | - if (frame_type & DECOR_WINDOW_TYPE_NORMAL) |
915 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_NORMAL ", str); |
916 | - if (frame_type & DECOR_WINDOW_TYPE_DIALOG) |
917 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_DIALOG ", str); |
918 | - if (frame_type & DECOR_WINDOW_TYPE_MENU) |
919 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_MENU ", str); |
920 | - if (frame_type & DECOR_WINDOW_TYPE_UTILITY) |
921 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_UTILITY ", str); |
922 | - if (frame_type & DECOR_WINDOW_TYPE_BARE) |
923 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_BARE ", str); |
924 | - if (frame_type & DECOR_WINDOW_TYPE_SWITCHER) |
925 | - fasprintf (&str, "%sDECOR_WINDOW_TYPE_SWITCHER ", str); |
926 | - |
927 | - return str; |
928 | -} |
929 | - |
930 | -char * |
931 | -print_frame_actions (void *d) |
932 | -{ |
933 | - char *str = NULL; |
934 | - unsigned int frame_actions = *((unsigned int *) d); |
935 | - fasprintf (&str, ""); |
936 | - |
937 | - if (frame_actions & DECOR_WINDOW_ACTION_RESIZE_HORZ) |
938 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_RESIZE_HORZ ", str); |
939 | - if (frame_actions & DECOR_WINDOW_ACTION_RESIZE_VERT) |
940 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_RESIZE_VERT ", str); |
941 | - if (frame_actions & DECOR_WINDOW_ACTION_CLOSE) |
942 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_CLOSE ", str); |
943 | - if (frame_actions & DECOR_WINDOW_ACTION_MINIMIZE) |
944 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_MINIMIZE ", str); |
945 | - if (frame_actions & DECOR_WINDOW_ACTION_UNMINIMIZE) |
946 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMINIMIZE ", str); |
947 | - if (frame_actions & DECOR_WINDOW_ACTION_MAXIMIZE_HORZ) |
948 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_MAXIMIZE_HORZ ", str); |
949 | - if (frame_actions & DECOR_WINDOW_ACTION_MAXIMIZE_VERT) |
950 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_MAXIMIZE_VERT ", str); |
951 | - if (frame_actions & DECOR_WINDOW_ACTION_UNMAXIMIZE_HORZ) |
952 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMAXIMIZE_HORZ ", str); |
953 | - if (frame_actions & DECOR_WINDOW_ACTION_UNMAXIMIZE_VERT) |
954 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNMAXIMIZE_VERT ", str); |
955 | - if (frame_actions & DECOR_WINDOW_ACTION_SHADE) |
956 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_SHADE ", str); |
957 | - if (frame_actions & DECOR_WINDOW_ACTION_UNSHADE) |
958 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNSHADE ", str); |
959 | - if (frame_actions & DECOR_WINDOW_ACTION_STICK) |
960 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_STICK ", str); |
961 | - if (frame_actions & DECOR_WINDOW_ACTION_UNSTICK) |
962 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_UNSTICK ", str); |
963 | - if (frame_actions & DECOR_WINDOW_ACTION_FULLSCREEN) |
964 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_FULLSCREEN ", str); |
965 | - if (frame_actions & DECOR_WINDOW_ACTION_ABOVE) |
966 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_ABOVE ", str); |
967 | - if (frame_actions & DECOR_WINDOW_ACTION_BELOW) |
968 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_BELOW ", str); |
969 | - if (frame_actions & DECOR_WINDOW_ACTION_MOVE) |
970 | - fasprintf (&str, "%sDECOR_WINDOW_ACTION_MOVE ", str); |
971 | - |
972 | - return str; |
973 | -} |
974 | - |
975 | -char * |
976 | -print_frame_state (void *d) |
977 | -{ |
978 | - char *str = NULL; |
979 | - unsigned int frame_state = *((unsigned int *) d); |
980 | - fasprintf (&str, ""); |
981 | - |
982 | - if (frame_state & DECOR_WINDOW_STATE_FOCUS) |
983 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_FOCUS ", str); |
984 | - if (frame_state & DECOR_WINDOW_STATE_MAXIMIZED_VERT) |
985 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_MAXIMIZED_VERT ", str); |
986 | - if (frame_state & DECOR_WINDOW_STATE_MAXIMIZED_HORZ) |
987 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_MAXIMIZED_HORZ ", str); |
988 | - if (frame_state & DECOR_WINDOW_STATE_SHADED) |
989 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_SHADED ", str); |
990 | - if (frame_state & DECOR_WINDOW_STATE_COMPOSITED) |
991 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_COMPOSITED ", str); |
992 | - if (frame_state & DECOR_WINDOW_STATE_MODAL) |
993 | - fasprintf (&str, "%sDECOR_WINDOW_STATE_MODAL ", str); |
994 | - |
995 | - return str; |
996 | -} |
997 | - |
998 | -char * |
999 | -print_unsigned_hex (void *d) |
1000 | -{ |
1001 | - char *str = NULL; |
1002 | - unsigned int hex = *((unsigned int *) d); |
1003 | - fasprintf (&str, ""); |
1004 | - |
1005 | - fasprintf (&str, "%s0x%x", str, hex); |
1006 | - |
1007 | - return str; |
1008 | -} |
1009 | - |
1010 | -char * |
1011 | -print_int (void *d) |
1012 | -{ |
1013 | - char *str = NULL; |
1014 | - unsigned int i = *((unsigned int *) d); |
1015 | - |
1016 | - fasprintf (&str, "%s%i", str, i); |
1017 | - |
1018 | - return str; |
1019 | -} |
1020 | - |
1021 | -char * |
1022 | -print_box (void *d) |
1023 | -{ |
1024 | - decor_point_t *point = ((decor_point_t *) d); |
1025 | - char *str = print_gravity ((void *) &(point->gravity)); |
1026 | - fasprintf (&str, ""); |
1027 | - |
1028 | - fasprintf (&str, "%s : x: %i y: %i", str, point->x, point->y); |
1029 | - |
1030 | - return str; |
1031 | -} |
1032 | - |
1033 | -char * |
1034 | -print_float (void *d) |
1035 | -{ |
1036 | - char *str = NULL; |
1037 | - float f = *((float *) d); |
1038 | - |
1039 | - fasprintf (&str, "%s%f", str, f); |
1040 | - |
1041 | - return str; |
1042 | -} |
1043 | - |
1044 | -char * |
1045 | -print_extents (void *d) |
1046 | -{ |
1047 | - decor_extents_t *extents = ((decor_extents_t *) d); |
1048 | - char *str = NULL; |
1049 | - fasprintf (&str, ""); |
1050 | - |
1051 | - fasprintf (&str, "%s : left: %i right: %i: top: %i: bottom: %i", str, extents->left, extents->right, extents->top, extents->bottom); |
1052 | - |
1053 | - return str; |
1054 | -} |
1055 | - |
1056 | -void |
1057 | -dump_decoration_data (long int *d_ptr) |
1058 | -{ |
1059 | - unsigned int i; |
1060 | - |
1061 | - printf ("size: wrote: %li\n", *d_ptr++); |
1062 | - printf ("type: wrote: %li\n", *d_ptr++); |
1063 | - printf ("frame_type: wrote: %li\n", *d_ptr++); |
1064 | - printf ("frame_state: wrote: 0x%lx\n", *d_ptr++); |
1065 | - printf ("frame_actions: wrote: 0x%lx\n", *d_ptr++); |
1066 | - printf ("pixmap: wrote: 0x%lx\n", *d_ptr++); |
1067 | - |
1068 | - printf ("fl: wrote: %li\n", *d_ptr++); |
1069 | - printf ("ft: wrote: %li\n", *d_ptr++); |
1070 | - printf ("ft: wrote: %li\n", *d_ptr++); |
1071 | - printf ("fb: wrote: %li\n", *d_ptr++); |
1072 | - printf ("bl: wrote: %li\n", *d_ptr++); |
1073 | - printf ("bt: wrote: %li\n", *d_ptr++); |
1074 | - printf ("bt: wrote: %li\n", *d_ptr++); |
1075 | - printf ("bb: wrote: %li\n", *d_ptr++); |
1076 | - |
1077 | - printf ("min_width: wrote: %li\n", *d_ptr++); |
1078 | - printf ("min_height: wrote: %li\n", *d_ptr++); |
1079 | - |
1080 | - i = *d_ptr++; |
1081 | - printf ("nQuad: wrote: %li\n", *d_ptr++); |
1082 | - while (i--) |
1083 | - { |
1084 | - printf ("quad %i flags: wrote: 0x%lx ", i, *d_ptr++); |
1085 | - int gravityv = *d_ptr; |
1086 | - char *gravity = print_gravity (&gravityv); |
1087 | - int gravity2v = *d_ptr >> 4; |
1088 | - char *gravity2 = print_gravity (&gravity2v); |
1089 | - int alignv = *d_ptr >> 8; |
1090 | - char *align = print_align (&alignv); |
1091 | - int clampv = *d_ptr >> 10; |
1092 | - char *clamp = print_clamp (&clampv); |
1093 | - int stretchv = *d_ptr >> 12; |
1094 | - char *stretch = print_stretch (&stretchv); |
1095 | - |
1096 | - printf ("%s ", gravity); |
1097 | - printf ("%s ", gravity2); |
1098 | - printf ("%s ", align); |
1099 | - printf ("%s ", clamp); |
1100 | - printf ("%s ", stretch); |
1101 | - printf ("\n"); |
1102 | - |
1103 | - free (gravity); |
1104 | - free (gravity2); |
1105 | - free (align); |
1106 | - free (clamp); |
1107 | - free (stretch); |
1108 | - |
1109 | - printf ("quad %i p1x: wrote: %li\n", i, *d_ptr++); |
1110 | - printf ("quad %i p1y: wrote: %li\n", i, *d_ptr++); |
1111 | - printf ("quad %i p2x: wrote: %li\n", i, *d_ptr++); |
1112 | - printf ("quad %i p2y: wrote: %li\n", i, *d_ptr++); |
1113 | - printf ("quad %i max_width: wrote: %li\n", i, *d_ptr++); |
1114 | - printf ("quad %i max_height: wrote: %li\n", i, *d_ptr++); |
1115 | - printf ("quad %i matrix x0: wrote: %li\n", i, *d_ptr++); |
1116 | - printf ("quad %i matrix y0: wrote: %li\n", i, *d_ptr++); |
1117 | - } |
1118 | -} |
1119 | - |
1120 | -void |
1121 | -dump_decoration (decoration *d) |
1122 | -{ |
1123 | - unsigned int i; |
1124 | - printf ("decoration * %p contains : \n", d); |
1125 | - |
1126 | - printf ("frame_type: 0x%x\n", d->frame_type); |
1127 | - printf ("frame_state: 0x%x\n", d->frame_state); |
1128 | - printf ("frame_actions: 0x%x\n", d->frame_actions); |
1129 | - printf ("pixmap: 0x%x\n", d->p); |
1130 | - printf ("frame left: %i\n", d->extents.left); |
1131 | - printf ("frame right: %i\n", d->extents.right); |
1132 | - printf ("frame top: %i\n", d->extents.top); |
1133 | - printf ("frame bottom: %i\n", d->extents.bottom); |
1134 | - printf ("input left: %i\n", d->extents.left); |
1135 | - printf ("input right: %i\n", d->extents.right); |
1136 | - printf ("input top: %i\n", d->extents.top); |
1137 | - printf ("input bottom: %i\n", d->extents.bottom); |
1138 | - printf ("n quads: %i\n", d->nQuad); |
1139 | - |
1140 | - for (i = 0; i < d->nQuad; i++) |
1141 | - { |
1142 | - int gravityv = d->quads[i].p1.gravity; |
1143 | - char *gravity = print_gravity (&gravityv); |
1144 | - int gravity2v = d->quads[i].p2.gravity; |
1145 | - char *gravity2 = print_gravity (&gravity2v); |
1146 | - int alignv = d->quads[i].align; |
1147 | - char *align = print_align (&alignv); |
1148 | - int clampv = d->quads[i].clamp; |
1149 | - char *clamp = print_clamp (&clampv); |
1150 | - int stretchv = d->quads[i].stretch; |
1151 | - char *stretch = print_stretch (&stretchv); |
1152 | - |
1153 | - printf ("quad %i p1: x: %i\n", i, d->quads[i].p1.x); |
1154 | - printf ("quad %i p1: y: %i\n", i, d->quads[i].p1.y); |
1155 | - printf ("quad %i p1: gravity: 0x%x ", i, gravityv); |
1156 | - printf ("%s ", gravity); |
1157 | - printf ("\n"); |
1158 | - |
1159 | - printf ("quad %i p2: x: %i\n", i, d->quads[i].p2.x); |
1160 | - printf ("quad %i p2: y: %i\n", i, d->quads[i].p2.y); |
1161 | - printf ("quad %i p2: gravity: 0x%x ", i, gravity2v); |
1162 | - printf ("%s ", gravity2); |
1163 | - printf ("\n"); |
1164 | - |
1165 | - printf ("quad %i max_width: %i\n", i, d->quads[i].max_width); |
1166 | - printf ("quad %i max_height: %i\n", i, d->quads[i].max_height); |
1167 | - |
1168 | - printf ("quad %i align: 0x%x :", i, alignv); |
1169 | - printf ("%s ", align); |
1170 | - printf ("\n"); |
1171 | - |
1172 | - printf ("quad %i clamp: 0x%x :", i, clampv); |
1173 | - printf ("%s ", clamp); |
1174 | - printf ("\n"); |
1175 | - |
1176 | - printf ("quad %i stretch: 0x%x :", i, clampv); |
1177 | - printf ("%s ", stretch); |
1178 | - printf ("\n"); |
1179 | - |
1180 | - printf ("\n"); |
1181 | - |
1182 | - free (gravity); |
1183 | - free (gravity2); |
1184 | - free (align); |
1185 | - free (clamp); |
1186 | - free (stretch); |
1187 | - |
1188 | - } |
1189 | -} |
1190 | - |
1191 | -void |
1192 | -destroy_decoration (decoration *d, |
1193 | - decor_cache_t *cache) |
1194 | -{ |
1195 | - if (!decor_cache_remove_subproperty (cache, |
1196 | - d->frame_type, |
1197 | - d->frame_state, |
1198 | - d->frame_actions, |
1199 | - d->property)) |
1200 | - printf ("can't remove property 0x%x 0x%x 0x%x from %p...\n", d->frame_type, d->frame_state, d->frame_actions, cache->data); |
1201 | - |
1202 | - free (d); |
1203 | -} |
1204 | - |
1205 | -decoration * |
1206 | -load_decoration_from_property (long int *data) |
1207 | -{ |
1208 | - decoration *d = calloc (1, sizeof (decoration)); |
1209 | - |
1210 | - /* safe-ish, wouldn't count on it */ |
1211 | - d->nQuad = decor_pixmap_property_to_quads (data, &d->p, &d->extents, &d->extents, &d->min_width, &d->min_height, &d->frame_type, &d->frame_state, &d->frame_actions, d->quads); |
1212 | - // memcpy (&d->property->data, data, sizeof (long int) * data[1]); |
1213 | - |
1214 | - return d; |
1215 | -} |
1216 | - |
1217 | -char * |
1218 | -data_to_string (long int *data, unsigned int data_size) |
1219 | -{ |
1220 | - char *string = NULL; |
1221 | - int i = 0; |
1222 | - |
1223 | - fasprintf (&string, ""); |
1224 | - |
1225 | - for (; i < data_size; i++) |
1226 | - fasprintf (&string, "%s%li, ", string, data[i]); |
1227 | - |
1228 | - return string; |
1229 | -} |
1230 | - |
1231 | -long int * |
1232 | -string_to_data (const char *string, unsigned int *data_size) |
1233 | -{ |
1234 | - char *save; |
1235 | - char *tok; |
1236 | - char *working; |
1237 | - long int *data, *orig_data; |
1238 | - |
1239 | - working = strdup (string); |
1240 | - |
1241 | - *data_size = 0; |
1242 | - tok = strtok_r (working, ", ", &save); |
1243 | - |
1244 | - while (tok != NULL) |
1245 | - { |
1246 | - tok = strtok_r (NULL, ", ", &save); |
1247 | - (*data_size)++; |
1248 | - } |
1249 | - |
1250 | - free (working); |
1251 | - |
1252 | - orig_data = data = calloc (*data_size + 1, sizeof (long int)); |
1253 | - working = strdup (string); |
1254 | - |
1255 | - save = NULL; |
1256 | - |
1257 | - *data_size = 0; |
1258 | - tok = strtok_r (working, ", ", &save); |
1259 | - |
1260 | - while (tok != NULL) |
1261 | - { |
1262 | - if (!sscanf (tok, "%li", data)) |
1263 | - printf ("couldn't parse %s", tok); |
1264 | - |
1265 | - tok = strtok_r (NULL, ", ", &save); |
1266 | - data++; |
1267 | - } |
1268 | - |
1269 | - free (working); |
1270 | - |
1271 | - return orig_data; |
1272 | -} |
1273 | - |
1274 | - |
1275 | -decoration * |
1276 | -create_decoration_from_info (Pixmap p, |
1277 | - int el, |
1278 | - int er, |
1279 | - int et, |
1280 | - int eb, |
1281 | - int ls, |
1282 | - int rs, |
1283 | - int ts, |
1284 | - int bs, |
1285 | - int lcs, |
1286 | - int rcs, |
1287 | - int tcs, |
1288 | - int bcs, |
1289 | - int mw, |
1290 | - int mh, |
1291 | - unsigned int frame_type, |
1292 | - unsigned int frame_state, |
1293 | - unsigned int frame_actions, |
1294 | - decor_cache_t *cache) |
1295 | -{ |
1296 | - decoration *d = calloc (1, sizeof (decoration)); |
1297 | - |
1298 | - d->p = p; |
1299 | - |
1300 | - d->extents.left = el; |
1301 | - d->extents.right = er; |
1302 | - d->extents.top = et; |
1303 | - d->extents.bottom = eb; |
1304 | - |
1305 | - d->context.extents = d->extents; |
1306 | - d->context.left_space = ls; |
1307 | - d->context.right_space = rs; |
1308 | - d->context.top_space = ts; |
1309 | - d->context.bottom_space = bs; |
1310 | - d->context.left_corner_space = lcs; |
1311 | - d->context.right_corner_space = rcs; |
1312 | - d->context.top_corner_space = tcs; |
1313 | - d->context.bottom_corner_space = bcs; |
1314 | - |
1315 | - d->min_width = mw; |
1316 | - d->min_height = mh; |
1317 | - |
1318 | - d->frame_type = frame_type; |
1319 | - d->frame_state = frame_state; |
1320 | - d->frame_actions = frame_actions; |
1321 | - |
1322 | - decor_get_default_layout (&d->context, mw, mh, &d->layout); |
1323 | - d->nQuad = decor_set_lSrStSbS_window_quads (d->quads, &d->context, &d->layout); |
1324 | - d->property = decor_cache_append_pixmap (cache, d->nQuad); |
1325 | - |
1326 | - decor_subproperty_set_pixmap (d->property, d->p, &d->extents, &d->extents, |
1327 | - 0, 0, d->quads, d->nQuad, d->frame_type, |
1328 | - d->frame_state, d->frame_actions); |
1329 | - |
1330 | - return d; |
1331 | -} |
1332 | |
1333 | === modified file 'gtk/window-decorator/decoration-test.h' |
1334 | --- gtk/window-decorator/decoration-test.h 2011-08-11 08:56:52 +0000 |
1335 | +++ gtk/window-decorator/decoration-test.h 2011-08-18 18:06:27 +0000 |
1336 | @@ -23,21 +23,24 @@ |
1337 | #ifndef _COMPIZ_DECORATION_TEST_H |
1338 | #define _COMPIZ_DECORATION_TEST_H |
1339 | |
1340 | -#include "gtk-window-decorator.h" |
1341 | #define _GNU_SOURCE |
1342 | #include <stdio.h> |
1343 | #include <stdarg.h> |
1344 | +#include <decoration.h> |
1345 | +#include <X11/Xlib.h> |
1346 | +#include <X11/Xatom.h> |
1347 | +#include <stdlib.h> |
1348 | |
1349 | typedef struct _decoration |
1350 | { |
1351 | - guint32 frame_type; |
1352 | - guint32 frame_state; |
1353 | - guint32 frame_actions; |
1354 | + unsigned int frame_type; |
1355 | + unsigned int frame_state; |
1356 | + unsigned int frame_actions; |
1357 | decor_extents_t extents; |
1358 | decor_context_t context; |
1359 | decor_layout_t layout; |
1360 | decor_quad_t quads[N_QUADS_MAX]; |
1361 | - guint32 nQuad; |
1362 | + unsigned int nQuad; |
1363 | int min_width; |
1364 | int min_height; |
1365 | Pixmap p; |
1366 | |
1367 | === modified file 'gtk/window-decorator/decoration_inspector/CMakeLists.txt' |
1368 | --- gtk/window-decorator/decoration_inspector/CMakeLists.txt 2011-08-11 08:56:52 +0000 |
1369 | +++ gtk/window-decorator/decoration_inspector/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
1370 | @@ -1,5 +1,7 @@ |
1371 | pkg_check_modules (DECORATION_INSPECTOR REQUIRED gtk+-3.0 libdecoration) |
1372 | -include_directories (${DECORATION_INSPECTOR_INCLUDE_DIRECTORES} ..) |
1373 | +include_directories (${DECORATION_INSPECTOR_INCLUDE_DIRS} |
1374 | + ${compiz_SOURCE_DIR}/include |
1375 | + ..) |
1376 | add_definitions (-DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\") |
1377 | |
1378 | add_executable (decoration_inspector decoration_inspector.c ../decoration-test.c) |
1379 | |
1380 | === modified file 'gtk/window-decorator/decoration_inspector/decoration_inspector.c' |
1381 | --- gtk/window-decorator/decoration_inspector/decoration_inspector.c 2011-08-11 08:56:52 +0000 |
1382 | +++ gtk/window-decorator/decoration_inspector/decoration_inspector.c 2011-08-18 18:06:27 +0000 |
1383 | @@ -20,7 +20,14 @@ |
1384 | * Sam Spilsbury <sam.spilsbury@canonical.com> |
1385 | */ |
1386 | |
1387 | +#ifndef _GNU_SOURCE |
1388 | +#define _GNU_SOURCE |
1389 | +#endif |
1390 | #include <gtk/gtk.h> |
1391 | +#include <gdk/gdk.h> |
1392 | +#include <gdk/gdkx.h> |
1393 | +#include <cairo.h> |
1394 | +#include <cairo-xlib.h> |
1395 | #include "decoration-test.h" |
1396 | |
1397 | GObject *ib1 = NULL; |
1398 | @@ -63,8 +70,6 @@ |
1399 | GdkPixbuf *pb; |
1400 | XVisualInfo visual_info; |
1401 | |
1402 | - printf ("d->p is 0x%x\n", d->p); |
1403 | - |
1404 | XGetGeometry (xdisplay, d->p, &root, &x, &y, &width, &height, &border, &depth); |
1405 | XMatchVisualInfo (xdisplay, DefaultScreen (xdisplay), 32, TrueColor, &visual_info); |
1406 | |
1407 | @@ -150,7 +155,6 @@ |
1408 | cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.3); |
1409 | |
1410 | cairo_move_to (cr, 0, 0); |
1411 | - g_debug ("rect: %i %i %i %i p: %i %i", px + x1, py + y1, px + (x2 - x1), py + (y2 - y1), px, py); |
1412 | cairo_rectangle (cr, (px + x1), (py + y1), (x2 - x1), (y2 - y1)); |
1413 | cairo_fill (cr); |
1414 | |
1415 | @@ -202,8 +206,6 @@ |
1416 | c.y0 -= |
1417 | y1 * c.yy + |
1418 | x1 * c.yx; |
1419 | - |
1420 | - printf ("c for quad %i is :\n xx: %f yx %f\n xy: %f yy: %f\n x0: %f y0: %f\n", nQuad, c.xx, c.yx, c.xy, c.yy, c.x0, c.y0); |
1421 | |
1422 | quad++; |
1423 | } |
1424 | @@ -655,9 +657,6 @@ |
1425 | property_type_combo = gtk_builder_get_object (builder, "property_type_combo"); |
1426 | |
1427 | long *ret = NULL; |
1428 | - const gchar *text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (property_type_combo)); |
1429 | - |
1430 | - g_debug ("%s", text); |
1431 | |
1432 | if (g_strcmp0 ("data", arg) == 0) |
1433 | { |
1434 | @@ -677,8 +676,6 @@ |
1435 | |
1436 | sscanf (window_id_string, "0x%x", &window); |
1437 | |
1438 | - g_debug ("window is 0x%x", window); |
1439 | - |
1440 | if (window) |
1441 | { |
1442 | Display *xdisplay = gdk_x11_display_get_xdisplay (gdk_display_get_default ()); |
1443 | @@ -698,7 +695,9 @@ |
1444 | |
1445 | if (result != Success || !n || !data) |
1446 | { |
1447 | - fprintf (stderr, "failed to read property %i %i (type %i fmt %i)!\n", n, nleft, actual, format); |
1448 | + fprintf (stderr, "failed to read property %li %li (type %i fmt %i)!\n", n, nleft, |
1449 | + (unsigned int) actual, |
1450 | + (unsigned int) format); |
1451 | return NULL; |
1452 | } |
1453 | |
1454 | @@ -737,8 +736,6 @@ |
1455 | GtkTreeIter iter; |
1456 | GtkTreePath *last = gtk_tree_path_copy (path); |
1457 | |
1458 | - g_debug ("activated row"); |
1459 | - |
1460 | if (gtk_tree_model_get_iter (model, &iter, last)) |
1461 | { |
1462 | gint decoration_num; |
1463 | @@ -761,12 +758,13 @@ |
1464 | decoration_num = atoi (str); |
1465 | |
1466 | data = pos = get_decorations_data (builder); |
1467 | + |
1468 | + if (!data) |
1469 | + return; |
1470 | decorations = calloc (decor_property_get_num (data), sizeof (decoration *)); |
1471 | |
1472 | pos += 2; |
1473 | |
1474 | - g_debug ("there are %i decorations", decor_property_get_num (data)); |
1475 | - |
1476 | for (i = 0 ; i < decor_property_get_num (data); i++) |
1477 | { |
1478 | decorations[i] = load_decoration_from_property (pos); |
1479 | @@ -787,7 +785,6 @@ |
1480 | GtkBuilder *builder = (GtkBuilder *) user_data; |
1481 | decoration **decorations; |
1482 | decoration *d; |
1483 | - decor_cache_t *cache = g_object_get_data (G_OBJECT (builder), "all_decoration_data"); |
1484 | long int *data, *pos; |
1485 | unsigned int i, j; |
1486 | GtkTreeStore *store = gtk_tree_store_new (COLUMN_N, G_TYPE_STRING, G_TYPE_STRING); |
1487 | @@ -817,12 +814,14 @@ |
1488 | gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), NULL); |
1489 | |
1490 | data = pos = get_decorations_data (builder); |
1491 | + |
1492 | + if (!data) |
1493 | + return; |
1494 | + |
1495 | decorations = calloc (decor_property_get_num (data), sizeof (decoration *)); |
1496 | |
1497 | pos += 2; |
1498 | |
1499 | - g_debug ("there are %i decorations", decor_property_get_num (data)); |
1500 | - |
1501 | for (i = 0 ; i < decor_property_get_num (data); i++) |
1502 | { |
1503 | decorations[i] = load_decoration_from_property (pos); |
1504 | @@ -836,7 +835,6 @@ |
1505 | |
1506 | asprintf (&label, "Decoration %i:", i); |
1507 | asprintf (&hex_data, "%i", i); |
1508 | - g_debug ("processing: %s", label); |
1509 | gtk_tree_store_append (store, &master_iter, NULL); |
1510 | gtk_tree_store_set (store, &master_iter, COLUMN_LABEL, label, COLUMN_DATA, hex_data, -1); |
1511 | |
1512 | |
1513 | === modified file 'gtk/window-decorator/simple_decorator/CMakeLists.txt' |
1514 | --- gtk/window-decorator/simple_decorator/CMakeLists.txt 2011-08-11 08:56:52 +0000 |
1515 | +++ gtk/window-decorator/simple_decorator/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
1516 | @@ -1,5 +1,7 @@ |
1517 | pkg_check_modules (SIMPLE_DECORATOR REQUIRED x11 cairo-xlib libdecoration libpng) |
1518 | -include_directories (${SIMPLE_DECORATOR_INCLUDE_DIRECTORES} ..) |
1519 | +include_directories (${SIMPLE_DECORATOR_INCLUDE_DIRS} |
1520 | + ${compiz_SOURCE_DIR}/include |
1521 | + ..) |
1522 | add_definitions (-DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\") |
1523 | |
1524 | add_executable (simple-decorator simple-decorator.c ../decoration-test.c) |
1525 | |
1526 | === modified file 'gtk/window-decorator/simple_decorator/simple-decorator.c' |
1527 | --- gtk/window-decorator/simple_decorator/simple-decorator.c 2011-08-11 08:56:52 +0000 |
1528 | +++ gtk/window-decorator/simple_decorator/simple-decorator.c 2011-08-18 18:06:27 +0000 |
1529 | @@ -29,6 +29,10 @@ |
1530 | #include <X11/Xatom.h> |
1531 | #include <cairo/cairo-xlib.h> |
1532 | #include <png.h> |
1533 | +#include <signal.h> |
1534 | + |
1535 | +#define TRUE 1 |
1536 | +#define FALSE 0 |
1537 | |
1538 | typedef struct _simple_decoration { |
1539 | Display *display; |
1540 | |
1541 | === added directory 'gtk/window-decorator/src' |
1542 | === added file 'gtk/window-decorator/src/CMakeLists.txt' |
1543 | --- gtk/window-decorator/src/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1544 | +++ gtk/window-decorator/src/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
1545 | @@ -0,0 +1,155 @@ |
1546 | +include (CheckFunctionExists) |
1547 | +set (CMAKE_REQUIRED_FLAGS ${UNITY_WINDOW_DECORATOR_CFLAGS}) |
1548 | +set (CMAKE_REQUIRED_LIBRARIES ${UNITY_WINDOW_DECORATOR_LIBRARIES}) |
1549 | +list (FIND CMAKE_REQUIRED_FLAGS "-D_REENTRANT" REENTRANT_INDEX) |
1550 | +if (REENTRANT_INDEX) |
1551 | + list (REMOVE_AT CMAKE_REQUIRED_FLAGS REENTRANT_INDEX) |
1552 | + list (APPEND CMAKE_REQUIRED_FLAGS "-D_REENTRANT=1") |
1553 | +endif (REENTRANT_INDEX) |
1554 | +check_function_exists (wnck_window_has_name HAVE_WNCK_WINDOW_HAS_NAME) |
1555 | +set (CMAKE_REQUIRED_FLAGS "") |
1556 | +set (CMAKE_REQUIRED_LIBRARIES "") |
1557 | + |
1558 | +compiz_pkg_check_modules (HAVE_LIBWNCK_2_18_1 libwnck-1.0>=2.18.1) |
1559 | +compiz_pkg_check_modules (HAVE_LIBWNCK_2_19_4 libwnck-1.0>=2.19.4) |
1560 | + |
1561 | +if (BUILD_METACITY) |
1562 | + pkg_check_modules (METACITY libmetacity-private) |
1563 | + if (METACITY_FOUND) |
1564 | + compiz_pkg_check_modules (HAVE_METACITY_2_15_21 libmetacity-private>=2.15.21) |
1565 | + compiz_pkg_check_modules (HAVE_METACITY_2_17_0 libmetacity-private>=2.17.0) |
1566 | + compiz_pkg_check_modules (HAVE_METACITY_2_23_2 libmetacity-private>=2.23.2) |
1567 | + else (METACITY_FOUND) |
1568 | + compiz_set (USE_METACITY 0) |
1569 | + endif (METACITY_FOUND) |
1570 | +endif (BUILD_METACITY) |
1571 | + |
1572 | +if (COMPIZ_BUILD_WITH_RPATH) |
1573 | + set (CMAKE_INSTALL_RPATH ${libdir}) |
1574 | +endif (COMPIZ_BUILD_WITH_RPATH) |
1575 | + |
1576 | +configure_file ( |
1577 | + ${CMAKE_CURRENT_SOURCE_DIR}/config.h.gtk.in |
1578 | + ${CMAKE_CURRENT_BINARY_DIR}/config.h |
1579 | +) |
1580 | + |
1581 | +include_directories ( |
1582 | + ${compiz_SOURCE_DIR}/include |
1583 | + ${CMAKE_CURRENT_BINARY_DIR} |
1584 | + ${UNITY_WINDOW_DECORATOR_INCLUDE_DIRS} |
1585 | + ${METACITY_INCLUDE_DIRS} |
1586 | + ${GCONF_INCLUDE_DIRS} |
1587 | + ${DBUS_GLIB_INCLUDE_DIRS} |
1588 | +) |
1589 | + |
1590 | +add_definitions ( |
1591 | + -DHAVE_CONFIG_H |
1592 | + -DALL_LINGUAS=\"${ALL_LINGUAS}\" |
1593 | + -DLOCALEDIR=\\\"${datadir}/locale\\\" |
1594 | +) |
1595 | + |
1596 | +link_directories ( |
1597 | + ${UNITY_WINDOW_DECORATOR_LIBRARY_DIRS} |
1598 | + ${COMPIZ_LINK_DIRS} |
1599 | +) |
1600 | + |
1601 | +if (USE_GCONF_UNITY_WINDOW_DECORATOR) |
1602 | + |
1603 | + if (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
1604 | + set (SCHEMADIR "${CMAKE_INSTALL_PREFIX}/share/gconf/schemas") |
1605 | + else (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
1606 | + set (SCHEMADIR "${COMPIZ_INSTALL_GCONF_SCHEMA_DIR}") |
1607 | + endif (NOT COMPIZ_INSTALL_GCONF_SCHEMA_DIR) |
1608 | + |
1609 | + set (gwd_schema ${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas) |
1610 | + |
1611 | + compiz_translate_xml ( |
1612 | + ${CMAKE_CURRENT_SOURCE_DIR}/gwd.schemas.in |
1613 | + ${gwd_schema} |
1614 | + ) |
1615 | + |
1616 | + compiz_install_gconf_schema (${CMAKE_CURRENT_BINARY_DIR}/gwd.schemas ${SCHEMADIR}) |
1617 | + |
1618 | +endif (USE_GCONF_UNITY_WINDOW_DECORATOR) |
1619 | + |
1620 | +add_executable (unity-window-decorator |
1621 | + gtk-window-decorator.c |
1622 | + blurprops.c |
1623 | + decorprops.c |
1624 | + cairo.c |
1625 | + gdk.c |
1626 | + switcher.c |
1627 | + metacity.c |
1628 | + events.c |
1629 | + forcequit.c |
1630 | + actionmenu.c |
1631 | + settings.c |
1632 | + util.c |
1633 | + style.c |
1634 | + wnck.c |
1635 | + decorator.c |
1636 | + frames.c |
1637 | + ${gwd_schema} |
1638 | +) |
1639 | + |
1640 | +add_executable (gtk-window-decorator |
1641 | + gtk-window-decorator.c |
1642 | + blurprops.c |
1643 | + decorprops.c |
1644 | + cairo.c |
1645 | + gdk.c |
1646 | + switcher.c |
1647 | + metacity.c |
1648 | + events.c |
1649 | + forcequit.c |
1650 | + actionmenu.c |
1651 | + settings.c |
1652 | + util.c |
1653 | + style.c |
1654 | + wnck.c |
1655 | + decorator.c |
1656 | + frames.c |
1657 | + ${gwd_schema} |
1658 | +) |
1659 | + |
1660 | +if (USE_METACITY) |
1661 | + set (metacitylibs ${METACITY_LIBRARIES}) |
1662 | +endif (USE_METACITY) |
1663 | + |
1664 | +set_target_properties ( |
1665 | + unity-window-decorator PROPERTIES |
1666 | + INSTALL_RPATH_USE_LINK_PATH 0 |
1667 | +) |
1668 | + |
1669 | +target_link_libraries (unity-window-decorator |
1670 | + decoration |
1671 | + ${UNITY_WINDOW_DECORATOR_LIBRARIES} |
1672 | + ${GCONF_LIBRARIES} |
1673 | + ${DBUS_GLIB_LIBRARIES} |
1674 | + ${metacitylibs} |
1675 | +) |
1676 | + |
1677 | +install ( |
1678 | + TARGETS unity-window-decorator |
1679 | + DESTINATION ${COMPIZ_DESTDIR}${exec_prefix} |
1680 | + RUNTIME DESTINATION bin |
1681 | +) |
1682 | + |
1683 | +set_target_properties ( |
1684 | + gtk-window-decorator PROPERTIES |
1685 | + INSTALL_RPATH_USE_LINK_PATH 0 |
1686 | +) |
1687 | + |
1688 | +target_link_libraries (gtk-window-decorator |
1689 | + decoration |
1690 | + ${UNITY_WINDOW_DECORATOR_LIBRARIES} |
1691 | + ${GCONF_LIBRARIES} |
1692 | + ${DBUS_GLIB_LIBRARIES} |
1693 | + ${metacitylibs} |
1694 | +) |
1695 | + |
1696 | +install ( |
1697 | + TARGETS gtk-window-decorator |
1698 | + DESTINATION ${COMPIZ_DESTDIR}${exec_prefix} |
1699 | + RUNTIME DESTINATION bin |
1700 | +) |
1701 | |
1702 | === renamed file 'gtk/window-decorator/actionmenu.c' => 'gtk/window-decorator/src/actionmenu.c' |
1703 | === renamed file 'gtk/window-decorator/blurprops.c' => 'gtk/window-decorator/src/blurprops.c' |
1704 | === renamed file 'gtk/window-decorator/cairo.c' => 'gtk/window-decorator/src/cairo.c' |
1705 | --- gtk/window-decorator/cairo.c 2011-08-11 19:38:07 +0000 |
1706 | +++ gtk/window-decorator/src/cairo.c 2011-08-18 18:06:27 +0000 |
1707 | @@ -131,14 +131,15 @@ |
1708 | } |
1709 | |
1710 | void |
1711 | -draw_shadow_background (GWDDecoration *d, |
1712 | +draw_shadow_background (Picture p, |
1713 | cairo_t *cr, |
1714 | decor_shadow_t *s, |
1715 | - decor_context_t *c) |
1716 | + decor_context_t *c, |
1717 | + decor_layout_t *layout) |
1718 | { |
1719 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); |
1720 | |
1721 | - if (!s || !s->picture ||!d->picture) |
1722 | + if (!s || !s->picture || !p) |
1723 | { |
1724 | cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0); |
1725 | cairo_paint (cr); |
1726 | @@ -147,8 +148,8 @@ |
1727 | { |
1728 | decor_fill_picture_extents_with_shadow (xdisplay, |
1729 | s, c, |
1730 | - d->picture, |
1731 | - &d->border_layout); |
1732 | + p, |
1733 | + layout); |
1734 | } |
1735 | } |
1736 | |
1737 | @@ -348,7 +349,7 @@ |
1738 | cairo_set_line_width (cr, 1.0); |
1739 | |
1740 | if (d->frame->frame_state & DECOR_WINDOW_STATE_COMPOSITED) |
1741 | - draw_shadow_background (d, cr, d->frame->shadow, &d->frame->context); |
1742 | + draw_shadow_background (d->picture, cr, d->frame->shadow, &d->frame->context, &d->border_layout); |
1743 | |
1744 | if (d->frame->frame_state & DECOR_WINDOW_STATE_FOCUS) |
1745 | { |
1746 | |
1747 | === added file 'gtk/window-decorator/src/config.h.gtk.in' |
1748 | --- gtk/window-decorator/src/config.h.gtk.in 1970-01-01 00:00:00 +0000 |
1749 | +++ gtk/window-decorator/src/config.h.gtk.in 2011-08-18 18:06:27 +0000 |
1750 | @@ -0,0 +1,25 @@ |
1751 | +/* Define to 1 if Metacity support is enabled */ |
1752 | +#cmakedefine USE_METACITY 1 |
1753 | + |
1754 | +/* Define to 1 if Gconf support is enabled */ |
1755 | +#cmakedefine USE_GCONF 1 |
1756 | + |
1757 | +/* Define to 1 if you have the `wnck_window_has_name' function. */ |
1758 | +#cmakedefine HAVE_WNCK_WINDOW_HAS_NAME 1 |
1759 | + |
1760 | +/* Define to 1 if libwnck version >= 2_18_1 */ |
1761 | +#cmakedefine HAVE_LIBWNCK_2_18_1 1 |
1762 | + |
1763 | +/* Define to 1 if libwnck version >= 2_19_4 */ |
1764 | +#cmakedefine HAVE_LIBWNCK_2_19_4 1 |
1765 | + |
1766 | +/* Define to 1 if metacity version >= 2.15.21 */ |
1767 | +#cmakedefine HAVE_METACITY_2_15_21 1 |
1768 | + |
1769 | +/* Define to 1 if metacity version >= 2.17.0 */ |
1770 | +#cmakedefine HAVE_METACITY_2_17_0 1 |
1771 | + |
1772 | +/* Define to 1 if metacity version >= 2.23.2 */ |
1773 | +#cmakedefine HAVE_METACITY_2_23_2 1 |
1774 | + |
1775 | +#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}" |
1776 | |
1777 | === renamed file 'gtk/window-decorator/decorator.c' => 'gtk/window-decorator/src/decorator.c' |
1778 | --- gtk/window-decorator/decorator.c 2011-08-11 19:38:07 +0000 |
1779 | +++ gtk/window-decorator/src/decorator.c 2011-08-18 18:06:27 +0000 |
1780 | @@ -87,12 +87,6 @@ |
1781 | frame_update_titlebar_font ((GWDFrame *) value); |
1782 | } |
1783 | |
1784 | -void |
1785 | -update_titlebar_font () |
1786 | -{ |
1787 | - gwd_frames_foreach (update_frames_titlebar_fonts, NULL); |
1788 | -} |
1789 | - |
1790 | |
1791 | /* |
1792 | * update_event_windows |
1793 | @@ -393,13 +387,7 @@ |
1794 | /* Need to get a minimum width for the name */ |
1795 | else if (d->window) |
1796 | { |
1797 | - gint width; |
1798 | - |
1799 | - wnck_window_get_client_window_geometry (d->window->win, |
1800 | - NULL, NULL, |
1801 | - &width, NULL); |
1802 | - |
1803 | - w = width - ICON_SPACE - 2 - d->button_width; |
1804 | + w = d->window->client_geometry.width - ICON_SPACE - 2 - d->button_width; |
1805 | if (w < 1) |
1806 | w = 1; |
1807 | } |
1808 | @@ -634,6 +622,7 @@ |
1809 | d.height = height; |
1810 | d.draw = theme_draw_window_decoration; |
1811 | d.picture = picture; |
1812 | + d.window = NULL; |
1813 | d.frame->context = *c; |
1814 | |
1815 | decor_get_default_layout (&d.frame->context, 1, 1, &d.border_layout); |
1816 | @@ -857,14 +846,6 @@ |
1817 | |
1818 | } |
1819 | |
1820 | -int |
1821 | -update_shadow (void) |
1822 | -{ |
1823 | - gwd_frames_foreach (update_frames_shadows, NULL); |
1824 | - |
1825 | - return 1; |
1826 | -} |
1827 | - |
1828 | /* |
1829 | * populate_type |
1830 | * |
1831 | @@ -1083,10 +1064,6 @@ |
1832 | GList *it = w->decorations; |
1833 | int xp, yp, wp, hp; |
1834 | |
1835 | - /* FIXME: remove */ |
1836 | - guint32 frame_type = populate_frame_type (win); |
1837 | - guint32 frame_state = populate_frame_state (win); |
1838 | - |
1839 | /* force size update */ |
1840 | wnck_window_get_client_window_geometry (w->win, &xp, &yp, &hp, &wp); |
1841 | |
1842 | @@ -1100,24 +1077,17 @@ |
1843 | GWDDecoration *d = (GWDDecoration *) it->data; |
1844 | |
1845 | if (update_window_decoration_size (d, &w->client_geometry, wnck_window_get_name (w->win)) && |
1846 | - frame_type == d->frame->frame_type && |
1847 | - frame_state == d->frame->frame_state && |
1848 | + w->type == d->frame->frame_type && |
1849 | + w->state == d->frame->frame_state && |
1850 | w->frame_window) |
1851 | + { |
1852 | update_event_windows (w->frame_window); |
1853 | + } |
1854 | |
1855 | it = g_list_next (it); |
1856 | } |
1857 | } |
1858 | |
1859 | -static struct timeval this_tv; |
1860 | -static struct timeval last_tv; |
1861 | - |
1862 | -#define print_time(...) \ |
1863 | - gettimeofday (&this_tv, NULL); \ |
1864 | - printf ("TIME DEBUG: time: %li %s", this_tv.tv_usec - last_tv.tv_usec, __VA_ARGS__); \ |
1865 | - last_tv = this_tv; \ |
1866 | - |
1867 | - |
1868 | /* |
1869 | * update_property_on_window |
1870 | * |
1871 | @@ -1129,12 +1099,6 @@ |
1872 | GdkDisplay *gdkdisplay = gdk_display_get_default (); |
1873 | Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay); |
1874 | |
1875 | - gettimeofday (&this_tv, NULL); |
1876 | - |
1877 | - gettimeofday (&this_tv, NULL); |
1878 | - //printf ("TIME DEBUG: %s time: %li on window 0x%x\n", G_STRFUNC, this_tv.tv_usec - last_tv.tv_usec, window->xid); |
1879 | - last_tv = this_tv; |
1880 | - |
1881 | gdk_error_trap_push (); |
1882 | XChangeProperty (xdisplay, window->xid, |
1883 | win_decor_atom, |
1884 | @@ -1143,10 +1107,6 @@ |
1885 | window->cache->size); |
1886 | gdk_display_sync (gdk_display_get_default ()); |
1887 | gdk_error_trap_pop (); |
1888 | - |
1889 | - gettimeofday (&this_tv, NULL); |
1890 | - //printf ("TIME DEBUG: %s done: %li on window 0x%x\n", G_STRFUNC, this_tv.tv_usec - last_tv.tv_usec, window->xid); |
1891 | - last_tv = this_tv; |
1892 | } |
1893 | |
1894 | /* |
1895 | |
1896 | === renamed file 'gtk/window-decorator/decorprops.c' => 'gtk/window-decorator/src/decorprops.c' |
1897 | === renamed file 'gtk/window-decorator/events.c' => 'gtk/window-decorator/src/events.c' |
1898 | --- gtk/window-decorator/events.c 2011-08-12 09:01:24 +0000 |
1899 | +++ gtk/window-decorator/src/events.c 2011-08-18 18:06:27 +0000 |
1900 | @@ -25,11 +25,6 @@ |
1901 | |
1902 | #include "gtk-window-decorator.h" |
1903 | |
1904 | -/* FIXME: This is a hack until we can |
1905 | - * figure out why gdk is giving us events |
1906 | - * twice */ |
1907 | -gulong last_event_serial = 0; |
1908 | - |
1909 | void |
1910 | move_resize_window (WnckWindow *win, |
1911 | int direction, |
1912 | @@ -96,12 +91,18 @@ |
1913 | { |
1914 | GdkCursor* cursor; |
1915 | GdkWindow* window = create_foreign_window (w->frame_window->xid); |
1916 | - cursor = gdk_cursor_new (GDK_LEFT_PTR); |
1917 | - gdk_error_trap_push (); |
1918 | - gdk_window_set_cursor (window, cursor); |
1919 | - gdk_cursor_unref (cursor); |
1920 | - gdk_display_sync (gdk_display_get_default ()); |
1921 | - if (gdk_error_trap_pop ()) |
1922 | + |
1923 | + if (window) |
1924 | + { |
1925 | + cursor = gdk_cursor_new (GDK_LEFT_PTR); |
1926 | + gdk_error_trap_push (); |
1927 | + gdk_window_set_cursor (window, cursor); |
1928 | + gdk_cursor_unref (cursor); |
1929 | + gdk_display_sync (gdk_display_get_default ()); |
1930 | + if (gdk_error_trap_pop ()) |
1931 | + return; |
1932 | + } |
1933 | + else |
1934 | return; |
1935 | } |
1936 | |
1937 | @@ -459,11 +460,16 @@ |
1938 | { |
1939 | GdkCursor* cursor = gdk_cursor_new (GDK_LEFT_PTR); |
1940 | GdkWindow* window = create_foreign_window (w->frame_window->xid); |
1941 | - gdk_error_trap_push (); |
1942 | - gdk_window_set_cursor (window, cursor); |
1943 | - gdk_cursor_unref (cursor); |
1944 | - gdk_display_sync (gdk_display_get_default ()); |
1945 | - if (gdk_error_trap_pop ()) |
1946 | + if (window) |
1947 | + { |
1948 | + gdk_error_trap_push (); |
1949 | + gdk_window_set_cursor (window, cursor); |
1950 | + gdk_cursor_unref (cursor); |
1951 | + gdk_display_sync (gdk_display_get_default ()); |
1952 | + if (gdk_error_trap_pop ()) |
1953 | + return; |
1954 | + } |
1955 | + else |
1956 | return; |
1957 | } |
1958 | |
1959 | @@ -562,13 +568,16 @@ |
1960 | |
1961 | if (cursor) |
1962 | { |
1963 | - GdkWindow* window = create_foreign_window (w->frame_window->xid); |
1964 | - gdk_error_trap_push (); |
1965 | - gdk_window_set_cursor (window, cursor); |
1966 | - gdk_cursor_unref (cursor); |
1967 | - gdk_display_sync (gdk_display_get_default ()); |
1968 | - if (gdk_error_trap_pop ()) |
1969 | - return; |
1970 | + GdkWindow *window = create_foreign_window (w->frame_window->xid); |
1971 | + if (window) |
1972 | + { |
1973 | + gdk_error_trap_push (); |
1974 | + gdk_window_set_cursor (window, cursor); |
1975 | + gdk_cursor_unref (cursor); |
1976 | + gdk_display_sync (gdk_display_get_default ()); |
1977 | + if (gdk_error_trap_pop ()) |
1978 | + return; |
1979 | + } |
1980 | } |
1981 | } |
1982 | |
1983 | @@ -883,45 +892,42 @@ |
1984 | } |
1985 | |
1986 | GdkFilterReturn |
1987 | -event_filter_func (GdkXEvent *gdkxevent, |
1988 | - GdkEvent *event, |
1989 | - gpointer data) |
1990 | +event_handler (GdkXEvent *event, |
1991 | + GdkEvent *gevent, |
1992 | + gpointer data) |
1993 | { |
1994 | GdkDisplay *gdkdisplay; |
1995 | - XEvent *xevent = gdkxevent; |
1996 | gulong xid = 0; |
1997 | Window select = 0; |
1998 | + XEvent *xevent = (XEvent *) event; |
1999 | |
2000 | gdkdisplay = gdk_display_get_default (); |
2001 | |
2002 | - /* Hack, see above */ |
2003 | - if (last_event_serial == xevent->xany.serial) |
2004 | - { |
2005 | - last_event_serial = 0; |
2006 | - return GDK_FILTER_CONTINUE; |
2007 | - } |
2008 | - |
2009 | - last_event_serial = xevent->xany.serial; |
2010 | - |
2011 | switch (xevent->type) { |
2012 | case CreateNotify: |
2013 | { |
2014 | - GdkWindow *toplevel = create_foreign_window (xevent->xcreatewindow.window); |
2015 | - |
2016 | - if (toplevel) |
2017 | + if (xevent->xcreatewindow.parent == gdk_x11_get_default_root_xwindow ()) |
2018 | { |
2019 | - gdk_window_set_events (toplevel, |
2020 | - gdk_window_get_events (toplevel) | |
2021 | - GDK_PROPERTY_CHANGE_MASK | |
2022 | - GDK_FOCUS_CHANGE_MASK); |
2023 | - gdk_window_add_filter (toplevel, event_filter_func, NULL); |
2024 | + GdkWindow *toplevel = create_foreign_window (xevent->xcreatewindow.window); |
2025 | |
2026 | - if (!wnck_window_get (xevent->xcreatewindow.window)) |
2027 | + if (toplevel) |
2028 | { |
2029 | - /* check if the window is a switcher and update accordingly */ |
2030 | - |
2031 | - if (get_window_prop (xevent->xcreatewindow.window, select_window_atom, &select)) |
2032 | - update_switcher_window (xevent->xcreatewindow.window, select); |
2033 | + if (!wnck_window_get (xevent->xcreatewindow.window)) |
2034 | + { |
2035 | + gdk_error_trap_push (); |
2036 | + gdk_window_set_events (toplevel, |
2037 | + gdk_window_get_events (toplevel) | |
2038 | + GDK_PROPERTY_CHANGE_MASK | |
2039 | + GDK_FOCUS_CHANGE_MASK); |
2040 | + gdk_display_sync (gdk_display_get_default ()); |
2041 | + if (gdk_error_trap_pop ()) |
2042 | + g_warning ("X Error while trying to set window events"); |
2043 | + |
2044 | + /* check if the window is a switcher and update accordingly */ |
2045 | + |
2046 | + if (get_window_prop (xevent->xcreatewindow.window, select_window_atom, &select)) |
2047 | + update_switcher_window (xevent->xcreatewindow.window, select); |
2048 | + } |
2049 | } |
2050 | } |
2051 | } |
2052 | @@ -1064,92 +1070,169 @@ |
2053 | unsigned int mask; |
2054 | XButtonEvent eb; |
2055 | |
2056 | + gdk_error_trap_push (); |
2057 | XQueryPointer (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), |
2058 | last_clicked_frame->frame_window->xid, |
2059 | &root, |
2060 | &child, |
2061 | &x_root, &y_root, &x, &y, &mask); |
2062 | - |
2063 | - eb.type = ButtonRelease; |
2064 | - eb.send_event = FALSE; |
2065 | - eb.time = CurrentTime; |
2066 | - eb.x = (double) x; |
2067 | - eb.y = (double) y; |
2068 | - eb.x_root = (double) x_root; |
2069 | - eb.y_root = (double) y_root; |
2070 | - eb.state = 0; |
2071 | - eb.button = 0; |
2072 | - |
2073 | - if (last_clicked_frame) |
2074 | - frame_handle_button_release (&eb, last_clicked_frame); |
2075 | + gdk_display_sync (gdk_display_get_default ()); |
2076 | + if (!gdk_error_trap_pop ()) |
2077 | + { |
2078 | + eb.type = ButtonRelease; |
2079 | + eb.send_event = FALSE; |
2080 | + eb.time = CurrentTime; |
2081 | + eb.x = (double) x; |
2082 | + eb.y = (double) y; |
2083 | + eb.x_root = (double) x_root; |
2084 | + eb.y_root = (double) y_root; |
2085 | + eb.state = 0; |
2086 | + eb.button = 0; |
2087 | + |
2088 | + if (last_clicked_frame) |
2089 | + frame_handle_button_release (&eb, last_clicked_frame); |
2090 | + } |
2091 | } |
2092 | case ButtonPress: |
2093 | { |
2094 | - GWDWindow *w = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xbutton.window)); |
2095 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xbutton.window)); |
2096 | |
2097 | - if (w) |
2098 | + if (fw) |
2099 | { |
2100 | - frame_handle_button_press ((XButtonEvent *) xevent, w); |
2101 | - return GDK_FILTER_REMOVE; |
2102 | + frame_handle_button_press ((XButtonEvent *) xevent, fw->window); |
2103 | } |
2104 | |
2105 | break; |
2106 | } |
2107 | case ButtonRelease: |
2108 | { |
2109 | - GWDWindow *w = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xbutton.window)); |
2110 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xbutton.window)); |
2111 | |
2112 | - if (w) |
2113 | + if (fw) |
2114 | { |
2115 | - frame_handle_button_release ((XButtonEvent *) xevent, w); |
2116 | - return GDK_FILTER_REMOVE; |
2117 | + frame_handle_button_release ((XButtonEvent *) xevent, fw->window); |
2118 | } |
2119 | |
2120 | break; |
2121 | } |
2122 | case MotionNotify: |
2123 | { |
2124 | - GWDWindow *w = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xmotion.window)); |
2125 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xmotion.window)); |
2126 | |
2127 | - if (w) |
2128 | + if (fw) |
2129 | { |
2130 | - frame_handle_motion ((XMotionEvent *) xevent, w); |
2131 | - return GDK_FILTER_REMOVE; |
2132 | - } |
2133 | - |
2134 | + frame_handle_motion ((XMotionEvent *) xevent, fw->window); |
2135 | + } |
2136 | + |
2137 | + break; |
2138 | + } |
2139 | + case LeaveNotify: |
2140 | + { |
2141 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xcrossing.window)); |
2142 | + |
2143 | + if (fw && xevent->xcrossing.mode == NotifyNormal) |
2144 | + { |
2145 | + guint state[BUTTON_NUM]; |
2146 | + memcpy (state, fw->button_states, sizeof (guint) * BUTTON_NUM); |
2147 | + |
2148 | + GWDDecoration *d = gwd_decoration_get (fw->window, |
2149 | + fw->window->type, |
2150 | + fw->window->state, |
2151 | + fw->window->actions); |
2152 | + /* Reset button states as we are no longer in this frame window */ |
2153 | + memset (&fw->button_states, 0, sizeof (guint) * BUTTON_NUM); |
2154 | + |
2155 | + fw->last_entered = NULL; |
2156 | + |
2157 | + if (memcmp (state, fw->button_states, sizeof (guint) * BUTTON_NUM)) |
2158 | + queue_decor_draw (d); |
2159 | + } |
2160 | break; |
2161 | } |
2162 | case DestroyNotify: |
2163 | { |
2164 | - GWDWindow *w = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xdestroywindow.window)); |
2165 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xdestroywindow.window)); |
2166 | |
2167 | /* The parent window went away, we must remove our frame window */ |
2168 | - if (w) |
2169 | + if (fw) |
2170 | { |
2171 | - gboolean safe = FALSE; |
2172 | - |
2173 | - if (xevent->xdestroywindow.window == w->frame_window->container_xid) |
2174 | - safe = TRUE; |
2175 | - |
2176 | - gwd_frame_window_delete (w->frame_window, safe); |
2177 | - w->frame_window = NULL; |
2178 | + /* The reality is that we're racing with gtk to get rid of |
2179 | + * the window before it dies server side, things could get |
2180 | + * hairy here */ |
2181 | + gdk_error_trap_push (); |
2182 | + gwd_frame_window_delete (fw, TRUE); |
2183 | + gdk_error_trap_pop (); |
2184 | + fw->window->frame_window = NULL; |
2185 | } |
2186 | |
2187 | - return GDK_FILTER_REMOVE; |
2188 | break; |
2189 | } |
2190 | case ReparentNotify: |
2191 | { |
2192 | - GWDWindow *w = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xreparent.window)); |
2193 | + GWDFrameWindow *fw = g_hash_table_lookup (frame_table, GINT_TO_POINTER (xevent->xreparent.window)); |
2194 | |
2195 | - /* The parent window went away, we must remove our frame window */ |
2196 | - if (w && xevent->xreparent.parent == gdk_x11_get_default_root_xwindow ()) |
2197 | + /* Compiz unreparented the decoration |
2198 | + * so we must remove our frame window |
2199 | + * as well */ |
2200 | + if (fw) |
2201 | { |
2202 | - gwd_frame_window_delete (w->frame_window, FALSE); |
2203 | - w->frame_window = NULL; |
2204 | + GdkWindow *backing_window = gtk_widget_get_window (GTK_WIDGET (fw->container)); |
2205 | + GdkWindow *compiz_frame_window = create_foreign_window (fw->xid); |
2206 | + |
2207 | + if (xevent->xreparent.parent == gdk_x11_get_default_root_xwindow ()) |
2208 | + { |
2209 | + gwd_frame_window_delete (fw, TRUE); |
2210 | + } |
2211 | + else |
2212 | + { |
2213 | + unsigned int i, j; |
2214 | + static event_callback callback[3][3] = { |
2215 | + { top_left_event, top_event, top_right_event }, |
2216 | + { left_event, title_event, right_event }, |
2217 | + { bottom_left_event, bottom_event, bottom_right_event } |
2218 | + }; |
2219 | + static event_callback button_callback[BUTTON_NUM] = { |
2220 | + close_button_event, |
2221 | + max_button_event, |
2222 | + min_button_event, |
2223 | + menu_button_event, |
2224 | + shade_button_event, |
2225 | + above_button_event, |
2226 | + stick_button_event, |
2227 | + unshade_button_event, |
2228 | + unabove_button_event, |
2229 | + unstick_button_event |
2230 | + }; |
2231 | + |
2232 | + /* Checking if the window is mapped |
2233 | + * seems to help in the case where |
2234 | + * GDK sends the same event multiple times */ |
2235 | + if (compiz_frame_window && |
2236 | + backing_window && |
2237 | + !gdk_window_is_viewable (backing_window)) |
2238 | + { |
2239 | + gdk_window_set_events (compiz_frame_window, |
2240 | + GDK_STRUCTURE_MASK | |
2241 | + GDK_SUBSTRUCTURE_MASK); |
2242 | + gdk_window_set_events (backing_window, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | |
2243 | + GDK_BUTTON_PRESS_MASK | |
2244 | + GDK_BUTTON_RELEASE_MASK | |
2245 | + GDK_LEAVE_NOTIFY_MASK); |
2246 | + |
2247 | + gtk_widget_show_all (GTK_WIDGET (fw->container)); |
2248 | + |
2249 | + for (i = 0; i < 3; i++) |
2250 | + for (j = 0; j < 3; j++) |
2251 | + fw->event_windows[i][j].callback = callback[i][j]; |
2252 | + |
2253 | + for (i = 0; i < BUTTON_NUM; i++) |
2254 | + fw->button_windows[i].callback = button_callback[i]; |
2255 | + |
2256 | + update_event_windows (fw); |
2257 | + } |
2258 | + } |
2259 | } |
2260 | |
2261 | - return GDK_FILTER_REMOVE; |
2262 | break; |
2263 | } |
2264 | case ClientMessage: |
2265 | @@ -1188,6 +1271,7 @@ |
2266 | } |
2267 | } |
2268 | } |
2269 | + break; |
2270 | default: |
2271 | break; |
2272 | } |
2273 | @@ -1196,26 +1280,23 @@ |
2274 | } |
2275 | |
2276 | GdkFilterReturn |
2277 | -selection_event_filter_func (GdkXEvent *gdkxevent, |
2278 | - GdkEvent *event, |
2279 | - gpointer data) |
2280 | +selection_event_handler (GdkXEvent *event, |
2281 | + GdkEvent *gdkevent, |
2282 | + gpointer user_data) |
2283 | { |
2284 | - Display *xdisplay; |
2285 | - GdkDisplay *gdkdisplay; |
2286 | - XEvent *xevent = gdkxevent; |
2287 | - int status; |
2288 | - |
2289 | - gdkdisplay = gdk_display_get_default (); |
2290 | - xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay); |
2291 | - |
2292 | - switch (xevent->type) { |
2293 | + XEvent *xevent = (XEvent *) event; |
2294 | + |
2295 | + switch (xevent->type) |
2296 | + { |
2297 | case SelectionRequest: |
2298 | - decor_handle_selection_request (xdisplay, xevent, dm_sn_timestamp); |
2299 | + decor_handle_selection_request (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), xevent, dm_sn_timestamp); |
2300 | break; |
2301 | case SelectionClear: |
2302 | - status = decor_handle_selection_clear (xdisplay, xevent, 0); |
2303 | + { |
2304 | + int status = decor_handle_selection_clear (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), xevent, 0); |
2305 | if (status == DECOR_SELECTION_GIVE_UP) |
2306 | gtk_main_quit (); |
2307 | + } |
2308 | default: |
2309 | break; |
2310 | } |
2311 | |
2312 | === renamed file 'gtk/window-decorator/forcequit.c' => 'gtk/window-decorator/src/forcequit.c' |
2313 | === renamed file 'gtk/window-decorator/frames.c' => 'gtk/window-decorator/src/frames.c' |
2314 | --- gtk/window-decorator/frames.c 2011-08-11 19:38:07 +0000 |
2315 | +++ gtk/window-decorator/src/frames.c 2011-08-18 18:06:27 +0000 |
2316 | @@ -22,6 +22,8 @@ |
2317 | |
2318 | #include "gtk-window-decorator.h" |
2319 | |
2320 | + |
2321 | + |
2322 | typedef struct _decor_frame_type_info |
2323 | { |
2324 | create_frame_proc create_func; |
2325 | |
2326 | === renamed file 'gtk/window-decorator/gdk.c' => 'gtk/window-decorator/src/gdk.c' |
2327 | === renamed file 'gtk/window-decorator/gtk-window-decorator.c' => 'gtk/window-decorator/src/gtk-window-decorator.c' |
2328 | --- gtk/window-decorator/gtk-window-decorator.c 2011-08-11 19:38:07 +0000 |
2329 | +++ gtk/window-decorator/src/gtk-window-decorator.c 2011-08-18 18:06:27 +0000 |
2330 | @@ -49,8 +49,6 @@ |
2331 | |
2332 | Atom net_wm_state_atom; |
2333 | Atom net_wm_state_modal_atom; |
2334 | - |
2335 | - |
2336 | Time dm_sn_timestamp; |
2337 | |
2338 | struct _cursor cursor[3][3] = { |
2339 | @@ -273,7 +271,7 @@ |
2340 | FALSE); |
2341 | |
2342 | net_wm_state_atom = XInternAtom (xdisplay,"_NET_WM_STATE", 0); |
2343 | - net_wm_state_modal_atom = XInternAtom (xdisplay, "_NET_MW_STATE_MODAL", 0); |
2344 | + net_wm_state_modal_atom = XInternAtom (xdisplay, "_NET_WM_STATE_MODAL", 0); |
2345 | |
2346 | status = decor_acquire_dm_session (xdisplay, |
2347 | gdk_screen_get_number (gdkscreen), |
2348 | @@ -366,7 +364,7 @@ |
2349 | wnck_set_client_type (WNCK_CLIENT_TYPE_PAGER); |
2350 | |
2351 | gdk_window_add_filter (NULL, |
2352 | - selection_event_filter_func, |
2353 | + selection_event_handler, |
2354 | NULL); |
2355 | |
2356 | if (!minimal) |
2357 | @@ -374,25 +372,29 @@ |
2358 | GdkWindow *root = create_foreign_window (gdk_x11_get_default_root_xwindow ()); |
2359 | gwd_default_decorations_window = gwd_window_new (gdk_x11_get_default_root_xwindow ()); |
2360 | |
2361 | - gdk_window_add_filter (NULL, |
2362 | - event_filter_func, |
2363 | - NULL); |
2364 | - |
2365 | + gdk_window_add_filter (NULL, |
2366 | + event_handler, |
2367 | + NULL); |
2368 | + |
2369 | XQueryTree (xdisplay, gdk_x11_get_default_root_xwindow (), |
2370 | &root_ret, &parent_ret, &children, &nchildren); |
2371 | |
2372 | for (i = 0; i < nchildren; i++) |
2373 | { |
2374 | GdkWindow *toplevel = create_foreign_window (children[i]); |
2375 | - |
2376 | /* Need property notify on all windows */ |
2377 | |
2378 | - gdk_window_set_events (toplevel, |
2379 | - gdk_window_get_events (toplevel) | |
2380 | - GDK_PROPERTY_CHANGE_MASK | |
2381 | - GDK_FOCUS_CHANGE_MASK); |
2382 | - |
2383 | - gdk_window_add_filter (toplevel, event_filter_func, NULL); |
2384 | + if (toplevel) |
2385 | + { |
2386 | + gdk_error_trap_push (); |
2387 | + gdk_window_set_events (toplevel, |
2388 | + gdk_window_get_events (toplevel) | |
2389 | + GDK_PROPERTY_CHANGE_MASK | |
2390 | + GDK_FOCUS_CHANGE_MASK); |
2391 | + gdk_display_sync (gdk_display_get_default ()); |
2392 | + if (gdk_error_trap_pop ()) |
2393 | + g_warning ("X Error while trying to set events"); |
2394 | + } |
2395 | } |
2396 | |
2397 | /* Need MapNotify on new windows */ |
2398 | @@ -402,8 +404,8 @@ |
2399 | GDK_VISIBILITY_NOTIFY_MASK | |
2400 | GDK_SUBSTRUCTURE_MASK | |
2401 | GDK_FOCUS_CHANGE_MASK); |
2402 | - |
2403 | - connect_screen (screen); |
2404 | + |
2405 | + connect_screen (screen); |
2406 | } |
2407 | |
2408 | decor_set_dm_check_hint (xdisplay, gdk_screen_get_number (gdkscreen), |
2409 | @@ -428,6 +430,8 @@ |
2410 | if (gwd_default_decorations_window) |
2411 | gwd_window_delete (gwd_default_decorations_window); |
2412 | |
2413 | + gdk_display_sync (gdk_display_get_default ()); |
2414 | + |
2415 | if (switcher_label) |
2416 | g_object_unref (switcher_label); |
2417 | |
2418 | |
2419 | === renamed file 'gtk/window-decorator/gtk-window-decorator.h' => 'gtk/window-decorator/src/gtk-window-decorator.h' |
2420 | --- gtk/window-decorator/gtk-window-decorator.h 2011-08-11 19:38:07 +0000 |
2421 | +++ gtk/window-decorator/src/gtk-window-decorator.h 2011-08-18 18:06:27 +0000 |
2422 | @@ -29,6 +29,10 @@ |
2423 | #include <config.h> |
2424 | #endif |
2425 | |
2426 | +#ifndef _GNU_SOURCE |
2427 | +#define _GNU_SOURCE |
2428 | +#endif |
2429 | + |
2430 | #include "decoration.h" |
2431 | |
2432 | #include <X11/Xlib.h> |
2433 | @@ -69,6 +73,8 @@ |
2434 | #include <gtk/gtk.h> |
2435 | #include <gdk/gdkx.h> |
2436 | #include <gdk/gdk.h> |
2437 | +#include <gdk/gdkpixbuf.h> |
2438 | + |
2439 | |
2440 | #ifdef USE_GCONF |
2441 | #include <gconf/gconf-client.h> |
2442 | @@ -105,6 +111,7 @@ |
2443 | #include <unistd.h> |
2444 | #include <sys/types.h> |
2445 | #include <signal.h> |
2446 | +#include <stdio.h> |
2447 | |
2448 | #include <libintl.h> |
2449 | #define _(x) gettext (x) |
2450 | @@ -416,6 +423,7 @@ |
2451 | event_window button_windows[BUTTON_NUM]; |
2452 | guint button_states[BUTTON_NUM]; |
2453 | GtkWidget *container; |
2454 | + GtkWidget *event_box; |
2455 | event_window *last_entered; |
2456 | Window xid; |
2457 | Window container_xid; |
2458 | @@ -684,16 +692,10 @@ |
2459 | void |
2460 | update_event_windows (GWDFrameWindow *fw); |
2461 | |
2462 | -int |
2463 | -update_shadow (void); |
2464 | - |
2465 | gboolean |
2466 | shadow_property_changed (WnckScreen *screen); |
2467 | |
2468 | void |
2469 | -update_titlebar_font (); |
2470 | - |
2471 | -void |
2472 | update_window_decoration (WnckWindow *win); |
2473 | |
2474 | void |
2475 | @@ -705,6 +707,16 @@ |
2476 | void |
2477 | copy_to_front_buffer (GWDDecoration *d); |
2478 | |
2479 | +void |
2480 | +update_frames_titlebar_fonts (gpointer key, |
2481 | + gpointer value, |
2482 | + gpointer user_data); |
2483 | + |
2484 | +void |
2485 | +update_frames_shadows (gpointer key, |
2486 | + gpointer value, |
2487 | + gpointer user_data); |
2488 | + |
2489 | /* wnck.c*/ |
2490 | |
2491 | void |
2492 | @@ -797,10 +809,11 @@ |
2493 | #define SHADE_BOTTOM (1 << 3) |
2494 | |
2495 | void |
2496 | -draw_shadow_background (GWDDecoration *d, |
2497 | +draw_shadow_background (Picture p, |
2498 | cairo_t *cr, |
2499 | decor_shadow_t *s, |
2500 | - decor_context_t *c); |
2501 | + decor_context_t *c, |
2502 | + decor_layout_t *layout); |
2503 | |
2504 | void |
2505 | draw_window_decoration (GWDDecoration *d); |
2506 | @@ -1148,14 +1161,14 @@ |
2507 | GWDWindow *); |
2508 | |
2509 | GdkFilterReturn |
2510 | -selection_event_filter_func (GdkXEvent *gdkxevent, |
2511 | - GdkEvent *event, |
2512 | - gpointer data); |
2513 | +event_handler (GdkXEvent *event, |
2514 | + GdkEvent *gevent, |
2515 | + gpointer data); |
2516 | |
2517 | GdkFilterReturn |
2518 | -event_filter_func (GdkXEvent *gdkxevent, |
2519 | - GdkEvent *event, |
2520 | - gpointer data); |
2521 | +selection_event_handler (GdkXEvent *event, |
2522 | + GdkEvent *gdkevent, |
2523 | + gpointer user_data); |
2524 | |
2525 | /* forcequit.c */ |
2526 | |
2527 | |
2528 | === renamed file 'gtk/window-decorator/gwd.schemas.in' => 'gtk/window-decorator/src/gwd.schemas.in' |
2529 | === renamed file 'gtk/window-decorator/metacity.c' => 'gtk/window-decorator/src/metacity.c' |
2530 | --- gtk/window-decorator/metacity.c 2011-08-11 19:38:07 +0000 |
2531 | +++ gtk/window-decorator/src/metacity.c 2011-08-18 18:06:27 +0000 |
2532 | @@ -24,7 +24,6 @@ |
2533 | */ |
2534 | |
2535 | #include "gtk-window-decorator.h" |
2536 | -#include "decoration-test.h" |
2537 | |
2538 | #ifdef USE_METACITY |
2539 | |
2540 | @@ -229,7 +228,8 @@ |
2541 | |
2542 | static Region |
2543 | meta_get_top_border_region (const MetaFrameGeometry *fgeom, |
2544 | - int width) |
2545 | + int width, |
2546 | + gboolean clip) |
2547 | { |
2548 | Region corners_xregion, border_xregion; |
2549 | XRectangle xrect; |
2550 | @@ -247,36 +247,38 @@ |
2551 | &bottom_left_radius, |
2552 | &bottom_right_radius); |
2553 | |
2554 | - if (top_left_radius) |
2555 | - { |
2556 | - for (i = 0; i < top_left_radius; i++) |
2557 | - { |
2558 | - w = radius_to_width (top_left_radius, i); |
2559 | - |
2560 | - xrect.x = 0; |
2561 | - xrect.y = i; |
2562 | - xrect.width = w; |
2563 | - xrect.height = 1; |
2564 | - |
2565 | - XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2566 | - } |
2567 | - } |
2568 | - |
2569 | - if (top_right_radius) |
2570 | - { |
2571 | - for (i = 0; i < top_right_radius; i++) |
2572 | - { |
2573 | - w = radius_to_width (top_right_radius, i); |
2574 | - |
2575 | - xrect.x = width - w; |
2576 | - xrect.y = i; |
2577 | - xrect.width = w; |
2578 | - xrect.height = 1; |
2579 | - |
2580 | - XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2581 | - } |
2582 | - } |
2583 | - |
2584 | + if (clip) |
2585 | + { |
2586 | + if (top_left_radius) |
2587 | + { |
2588 | + for (i = 0; i < top_left_radius; i++) |
2589 | + { |
2590 | + w = radius_to_width (top_left_radius, i); |
2591 | + |
2592 | + xrect.x = 0; |
2593 | + xrect.y = i; |
2594 | + xrect.width = w; |
2595 | + xrect.height = 1; |
2596 | + |
2597 | + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2598 | + } |
2599 | + } |
2600 | + |
2601 | + if (top_right_radius) |
2602 | + { |
2603 | + for (i = 0; i < top_right_radius; i++) |
2604 | + { |
2605 | + w = radius_to_width (top_right_radius, i); |
2606 | + |
2607 | + xrect.x = width - w; |
2608 | + xrect.y = i; |
2609 | + xrect.width = w; |
2610 | + xrect.height = 1; |
2611 | + |
2612 | + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2613 | + } |
2614 | + } |
2615 | + } |
2616 | border_xregion = XCreateRegion (); |
2617 | |
2618 | xrect.x = 0; |
2619 | @@ -295,7 +297,8 @@ |
2620 | |
2621 | static Region |
2622 | meta_get_bottom_border_region (const MetaFrameGeometry *fgeom, |
2623 | - int width) |
2624 | + int width, |
2625 | + gboolean clip) |
2626 | { |
2627 | Region corners_xregion, border_xregion; |
2628 | XRectangle xrect; |
2629 | @@ -313,33 +316,36 @@ |
2630 | &bottom_left_radius, |
2631 | &bottom_right_radius); |
2632 | |
2633 | - if (bottom_left_radius) |
2634 | + if (clip) |
2635 | { |
2636 | - for (i = 0; i < bottom_left_radius; i++) |
2637 | + if (bottom_left_radius) |
2638 | { |
2639 | - w = radius_to_width (bottom_left_radius, i); |
2640 | - |
2641 | - xrect.x = 0; |
2642 | - xrect.y = fgeom->bottom_height - i - 1; |
2643 | - xrect.width = w; |
2644 | - xrect.height = 1; |
2645 | - |
2646 | - XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2647 | + for (i = 0; i < bottom_left_radius; i++) |
2648 | + { |
2649 | + w = radius_to_width (bottom_left_radius, i); |
2650 | + |
2651 | + xrect.x = 0; |
2652 | + xrect.y = fgeom->bottom_height - i - 1; |
2653 | + xrect.width = w; |
2654 | + xrect.height = 1; |
2655 | + |
2656 | + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2657 | + } |
2658 | } |
2659 | - } |
2660 | |
2661 | - if (bottom_right_radius) |
2662 | - { |
2663 | - for (i = 0; i < bottom_right_radius; i++) |
2664 | + if (bottom_right_radius) |
2665 | { |
2666 | - w = radius_to_width (bottom_right_radius, i); |
2667 | - |
2668 | - xrect.x = width - w; |
2669 | - xrect.y = fgeom->bottom_height - i - 1; |
2670 | - xrect.width = w; |
2671 | - xrect.height = 1; |
2672 | - |
2673 | - XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2674 | + for (i = 0; i < bottom_right_radius; i++) |
2675 | + { |
2676 | + w = radius_to_width (bottom_right_radius, i); |
2677 | + |
2678 | + xrect.x = width - w; |
2679 | + xrect.y = fgeom->bottom_height - i - 1; |
2680 | + xrect.width = w; |
2681 | + xrect.height = 1; |
2682 | + |
2683 | + XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion); |
2684 | + } |
2685 | } |
2686 | } |
2687 | |
2688 | @@ -519,22 +525,6 @@ |
2689 | DECOR_WINDOW_STATE_MAXIMIZED_VERT))) |
2690 | flags |= (MetaFrameFlags ) META_FRAME_MAXIMIZED; |
2691 | |
2692 | - /* FIXME: do we really need to support all these ? */ |
2693 | - |
2694 | - //if (d->frame->frame_state & DECOR_WINDOW_STATE_STICK) |
2695 | - //flags |= (MetaFrameFlags ) META_FRAME_STUCK; |
2696 | - |
2697 | - //if (d->frame->frame_state & DECOR_WINDOW_STATE_FULLSCREEN) |
2698 | - //flags |= (MetaFrameFlags ) META_FRAME_FULLSCREEN; |
2699 | - |
2700 | - //if (d->frame->frame_state & DECOR_WINDOW_STATE_SHADED) |
2701 | - //flags |= (MetaFrameFlags ) META_FRAME_SHADED; |
2702 | - |
2703 | -#ifdef HAVE_METACITY_2_17_0 |
2704 | - //if (d->frame->frame_state & DECOR_WINDOW_STATE_ABOVE) |
2705 | - //flags |= (MetaFrameFlags ) META_FRAME_ABOVE; |
2706 | -#endif |
2707 | - |
2708 | if (frame_state & DECOR_WINDOW_STATE_FOCUS) |
2709 | flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS; |
2710 | |
2711 | @@ -656,6 +646,43 @@ |
2712 | } |
2713 | |
2714 | void |
2715 | +meta_rounded_rectangle (cairo_t *cr, |
2716 | + double x, |
2717 | + double y, |
2718 | + double w, |
2719 | + double h, |
2720 | + int r_tl, |
2721 | + int r_tr, |
2722 | + int r_bl, |
2723 | + int r_br) |
2724 | +{ |
2725 | + if (r_tl > 0) |
2726 | + cairo_move_to (cr, x + r_tl, y); |
2727 | + else |
2728 | + cairo_move_to (cr, x, y); |
2729 | + |
2730 | + if (r_tr > 0) |
2731 | + cairo_arc (cr, x + w - r_tr, y + r_tr, r_tr, M_PI * 1.5, M_PI * 2.0); |
2732 | + else |
2733 | + cairo_line_to (cr, x + w, y); |
2734 | + |
2735 | + if (r_br > 0) |
2736 | + cairo_arc (cr, x + w - r_br, y + h - r_br, r_br, 0.0, M_PI * 0.5); |
2737 | + else |
2738 | + cairo_line_to (cr, x + w, y + h); |
2739 | + |
2740 | + if (r_bl > 0) |
2741 | + cairo_arc (cr, x + r_bl, y + h - r_bl, r_bl, M_PI * 0.5, M_PI); |
2742 | + else |
2743 | + cairo_line_to (cr, x, y + h); |
2744 | + |
2745 | + if (r_tl > 0) |
2746 | + cairo_arc (cr, x + r_tl, y + r_tl, r_tl, M_PI, M_PI * 1.5); |
2747 | + else |
2748 | + cairo_line_to (cr, x, y); |
2749 | +} |
2750 | + |
2751 | +void |
2752 | meta_draw_window_decoration (GWDDecoration *d) |
2753 | { |
2754 | Display *xdisplay = |
2755 | @@ -669,7 +696,7 @@ |
2756 | MetaFrameType frame_type; |
2757 | MetaTheme *theme; |
2758 | GtkStyle *style; |
2759 | - cairo_t *cr; |
2760 | + cairo_t *bg_cr, *final_cr; |
2761 | gint size, i; |
2762 | GdkRectangle clip, rect; |
2763 | GdkDrawable *drawable; |
2764 | @@ -686,6 +713,14 @@ |
2765 | GdkColor bg_color; |
2766 | double bg_alpha; |
2767 | GdkPixbuf *icon_pixbuf; |
2768 | + int top_left_radius; |
2769 | + int top_right_radius; |
2770 | + int bottom_left_radius; |
2771 | + int bottom_right_radius; |
2772 | + gboolean clip_drawing = d->window ? FALSE : TRUE; |
2773 | + XRenderPictFormat *format; |
2774 | + Picture tmp; |
2775 | + GdkPixmap *tmp_pixmap; |
2776 | |
2777 | if (!d->pixmap || !d->picture) |
2778 | return; |
2779 | @@ -698,13 +733,30 @@ |
2780 | if (settings->decoration_alpha == 1.0) |
2781 | alpha = 1.0; |
2782 | |
2783 | + if (!(d->frame->frame_state & DECOR_WINDOW_STATE_COMPOSITED)) |
2784 | + { |
2785 | + GdkColormap *cmap; |
2786 | + |
2787 | + cmap = get_colormap_for_drawable (GDK_DRAWABLE (d->pixmap)); |
2788 | + tmp_pixmap = create_pixmap (d->width, d->height, d->frame->style_window); |
2789 | + gdk_drawable_set_colormap (GDK_DRAWABLE (tmp_pixmap), cmap); |
2790 | + } |
2791 | + else |
2792 | + tmp_pixmap = create_pixmap (d->width, d->height, d->frame->style_window); |
2793 | + |
2794 | + format = get_format_for_drawable (d, GDK_DRAWABLE (tmp_pixmap)); |
2795 | + tmp = XRenderCreatePicture (xdisplay, GDK_PIXMAP_XID (tmp_pixmap), |
2796 | + format, 0, NULL); |
2797 | + |
2798 | style = gtk_widget_get_style (d->frame->style_window); |
2799 | style_window = d->frame->style_window; |
2800 | |
2801 | - drawable = d->buffer_pixmap ? d->buffer_pixmap : d->pixmap; |
2802 | - cr = gdk_cairo_create (GDK_DRAWABLE (drawable)); |
2803 | + drawable = tmp_pixmap; |
2804 | + bg_cr = gdk_cairo_create (GDK_DRAWABLE (drawable)); |
2805 | + final_cr = gdk_cairo_create (GDK_DRAWABLE (d->buffer_pixmap ? d->buffer_pixmap : d->pixmap)); |
2806 | |
2807 | - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
2808 | + cairo_set_operator (bg_cr, CAIRO_OPERATOR_SOURCE); |
2809 | + cairo_set_operator (final_cr, CAIRO_OPERATOR_SOURCE); |
2810 | |
2811 | theme = meta_theme_get_current (); |
2812 | frame_type = meta_frame_type_from_string (frame_type_string (d->frame->frame_type, d->frame->frame_state)); |
2813 | @@ -715,13 +767,22 @@ |
2814 | meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout, |
2815 | frame_type, &clip); |
2816 | |
2817 | + meta_get_corner_radius (&fgeom, |
2818 | + &top_left_radius, |
2819 | + &top_right_radius, |
2820 | + &bottom_left_radius, |
2821 | + &bottom_right_radius); |
2822 | + |
2823 | /* FIXME: I have no idea why this fixes disappearing titlebars |
2824 | * on windows that have no shadow, but it does */ |
2825 | if (!d->window || |
2826 | (d->frame->frame_state & DECOR_WINDOW_STATE_COMPOSITED && |
2827 | d->frame->shadow && |
2828 | (d->frame->shadow->width || d->frame->shadow->height))) |
2829 | - draw_shadow_background (d, cr, d->frame->shadow, &d->frame->context); |
2830 | + { |
2831 | + draw_shadow_background (tmp, bg_cr, NULL, &d->frame->context, &d->border_layout); |
2832 | + draw_shadow_background (d->picture, final_cr, d->frame->shadow, &d->frame->context, &d->border_layout); |
2833 | + } |
2834 | |
2835 | for (i = 0; i < META_BUTTON_TYPE_LAST; i++) |
2836 | if (d->window && d->window->frame_window) |
2837 | @@ -747,8 +808,6 @@ |
2838 | } |
2839 | #endif |
2840 | |
2841 | - cairo_destroy (cr); |
2842 | - |
2843 | rect.x = 0; |
2844 | rect.y = 0; |
2845 | rect.width = clip.width; |
2846 | @@ -757,7 +816,7 @@ |
2847 | |
2848 | if (rect.width && size) |
2849 | { |
2850 | - XRenderPictFormat *format; |
2851 | + cairo_t *cr; |
2852 | |
2853 | if (!(d->frame->frame_state & DECOR_WINDOW_STATE_COMPOSITED)) |
2854 | { |
2855 | @@ -802,19 +861,40 @@ |
2856 | icon_pixbuf, |
2857 | NULL); |
2858 | |
2859 | - top_region = meta_get_top_border_region (&fgeom, clip.width); |
2860 | + /* clear area around corners */ |
2861 | + cairo_save (cr); |
2862 | + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); |
2863 | + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); |
2864 | + cairo_rectangle (cr, |
2865 | + rect.x, |
2866 | + rect.y, |
2867 | + rect.width, |
2868 | + rect.height); |
2869 | + meta_rounded_rectangle (cr, |
2870 | + rect.x, |
2871 | + rect.y, |
2872 | + rect.width, |
2873 | + rect.height, |
2874 | + top_left_radius, |
2875 | + top_right_radius, |
2876 | + 0, |
2877 | + 0); |
2878 | + cairo_fill (cr); |
2879 | + cairo_restore (cr); |
2880 | + |
2881 | + top_region = meta_get_top_border_region (&fgeom, clip.width, clip_drawing); |
2882 | |
2883 | decor_blend_border_picture (xdisplay, |
2884 | &d->frame->context, |
2885 | src, |
2886 | 0, 0, |
2887 | - d->picture, |
2888 | + tmp, |
2889 | &d->border_layout, |
2890 | BORDER_TOP, |
2891 | top_region, |
2892 | alpha * 0xffff, |
2893 | shade_alpha, |
2894 | - 0); |
2895 | + 0); |
2896 | } |
2897 | |
2898 | if (fgeom.bottom_height) |
2899 | @@ -842,13 +922,33 @@ |
2900 | icon_pixbuf, |
2901 | NULL); |
2902 | |
2903 | - bottom_region = meta_get_bottom_border_region (&fgeom, clip.width); |
2904 | + cairo_save (cr); |
2905 | + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); |
2906 | + cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR); |
2907 | + cairo_rectangle (cr, |
2908 | + rect.x, |
2909 | + rect.y, |
2910 | + rect.width, |
2911 | + rect.height); |
2912 | + meta_rounded_rectangle (cr, |
2913 | + rect.x, |
2914 | + rect.y, |
2915 | + rect.width, |
2916 | + rect.height, |
2917 | + 0, |
2918 | + 0, |
2919 | + bottom_left_radius, |
2920 | + bottom_right_radius); |
2921 | + cairo_fill (cr); |
2922 | + cairo_restore (cr); |
2923 | + |
2924 | + bottom_region = meta_get_bottom_border_region (&fgeom, clip.width, clip_drawing); |
2925 | |
2926 | decor_blend_border_picture (xdisplay, |
2927 | &d->frame->context, |
2928 | src, |
2929 | 0, 0, |
2930 | - d->picture, |
2931 | + tmp, |
2932 | &d->border_layout, |
2933 | BORDER_BOTTOM, |
2934 | bottom_region, |
2935 | @@ -871,7 +971,7 @@ |
2936 | |
2937 | if (size && rect.height) |
2938 | { |
2939 | - XRenderPictFormat *format; |
2940 | + cairo_t *cr; |
2941 | |
2942 | if (d->frame->frame_state & DECOR_WINDOW_STATE_COMPOSITED) |
2943 | { |
2944 | @@ -923,13 +1023,14 @@ |
2945 | &d->frame->context, |
2946 | src, |
2947 | 0, 0, |
2948 | - d->picture, |
2949 | + tmp, |
2950 | &d->border_layout, |
2951 | BORDER_LEFT, |
2952 | left_region, |
2953 | - alpha * 0xffff, |
2954 | + 0xffff, |
2955 | shade_alpha, |
2956 | 0); |
2957 | + |
2958 | } |
2959 | |
2960 | if (fgeom.right_width) |
2961 | @@ -963,22 +1064,40 @@ |
2962 | &d->frame->context, |
2963 | src, |
2964 | 0, 0, |
2965 | - d->picture, |
2966 | + tmp, |
2967 | &d->border_layout, |
2968 | BORDER_RIGHT, |
2969 | right_region, |
2970 | - alpha * 0xffff, |
2971 | + 0xffff, |
2972 | shade_alpha, |
2973 | 0); |
2974 | + |
2975 | } |
2976 | |
2977 | - cairo_destroy (cr); |
2978 | + XRenderComposite (xdisplay, |
2979 | + PictOpOver, |
2980 | + tmp, |
2981 | + None, |
2982 | + d->picture, |
2983 | + 0, |
2984 | + 0, |
2985 | + 0, |
2986 | + 0, |
2987 | + 0, |
2988 | + 0, |
2989 | + d->width, |
2990 | + d->height); |
2991 | + |
2992 | + cairo_destroy (bg_cr); |
2993 | |
2994 | g_object_unref (G_OBJECT (pixmap)); |
2995 | |
2996 | XRenderFreePicture (xdisplay, src); |
2997 | } |
2998 | |
2999 | + g_object_unref (G_OBJECT (tmp_pixmap)); |
3000 | + XRenderFreePicture (xdisplay, tmp); |
3001 | + |
3002 | /* FIXME: Shouldn't need to copy from d->pixmap directly into d->image_box |
3003 | * there should be a way to get from d->buffer_pixmap to d->image_box */ |
3004 | copy_to_front_buffer (d); |
3005 | |
3006 | === renamed file 'gtk/window-decorator/settings.c' => 'gtk/window-decorator/src/settings.c' |
3007 | --- gtk/window-decorator/settings.c 2011-08-11 08:56:52 +0000 |
3008 | +++ gtk/window-decorator/src/settings.c 2011-08-18 18:06:27 +0000 |
3009 | @@ -334,8 +334,6 @@ |
3010 | gwd_decor_frame_unref (frame); |
3011 | } |
3012 | |
3013 | -#warning set_frames_scales |
3014 | - |
3015 | void |
3016 | set_frames_scales (gpointer key, |
3017 | gpointer value, |
3018 | |
3019 | === renamed file 'gtk/window-decorator/style.c' => 'gtk/window-decorator/src/style.c' |
3020 | === renamed file 'gtk/window-decorator/switcher.c' => 'gtk/window-decorator/src/switcher.c' |
3021 | --- gtk/window-decorator/switcher.c 2011-08-11 17:35:20 +0000 |
3022 | +++ gtk/window-decorator/src/switcher.c 2011-08-18 18:06:27 +0000 |
3023 | @@ -112,7 +112,7 @@ |
3024 | |
3025 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
3026 | |
3027 | - draw_shadow_background (d, cr, d->frame->shadow, &d->frame->context); |
3028 | + draw_shadow_background (d->picture, cr, d->frame->shadow, &d->frame->context, &d->border_layout); |
3029 | |
3030 | fill_rounded_rectangle (cr, |
3031 | x1 + 0.5, |
3032 | |
3033 | === renamed file 'gtk/window-decorator/util.c' => 'gtk/window-decorator/src/util.c' |
3034 | --- gtk/window-decorator/util.c 2011-08-11 09:51:45 +0000 |
3035 | +++ gtk/window-decorator/src/util.c 2011-08-18 18:06:27 +0000 |
3036 | @@ -123,6 +123,9 @@ |
3037 | unsigned long n, left; |
3038 | unsigned char *prop_data; |
3039 | Atom *data; |
3040 | + gint err; |
3041 | + |
3042 | + gdk_error_trap_push (); |
3043 | |
3044 | result = XGetWindowProperty (gdk_x11_get_default_xdisplay (), |
3045 | xwindow, |
3046 | @@ -130,6 +133,13 @@ |
3047 | 0L, 1024L, FALSE, XA_ATOM, &actual, &format, |
3048 | &n, &left, &prop_data); |
3049 | |
3050 | + err = gdk_error_trap_pop (); |
3051 | + if (err != Success || result != Success) |
3052 | + { |
3053 | + g_warning ("X Error while trying to fetch property"); |
3054 | + return 0; |
3055 | + } |
3056 | + |
3057 | data = (Atom *) prop_data; |
3058 | |
3059 | if (result == Success && data) |
3060 | |
3061 | === renamed file 'gtk/window-decorator/wnck.c' => 'gtk/window-decorator/src/wnck.c' |
3062 | --- gtk/window-decorator/wnck.c 2011-08-11 19:38:07 +0000 |
3063 | +++ gtk/window-decorator/src/wnck.c 2011-08-18 18:06:27 +0000 |
3064 | @@ -79,7 +79,6 @@ |
3065 | { |
3066 | GWDWindow *w = g_object_get_data (G_OBJECT (win), "decor"); |
3067 | GList *it = w->decorations; |
3068 | - |
3069 | while (it) |
3070 | { |
3071 | GdkPixbuf *pb = wnck_window_get_mini_icon (win); |
3072 | @@ -142,14 +141,12 @@ |
3073 | GList *windows; |
3074 | Window select; |
3075 | |
3076 | - update_shadow (); |
3077 | - gwd_frames_foreach (update_frames_defaults, NULL); |
3078 | gwd_frames_foreach (set_frames_scales, (gpointer) settings->font); |
3079 | - |
3080 | - update_titlebar_font (); |
3081 | - |
3082 | + gwd_frames_foreach (update_frames_titlebar_fonts, NULL); |
3083 | gwd_frames_foreach (update_frames_border_extents, |
3084 | NULL); |
3085 | + gwd_frames_foreach (update_frames_shadows, NULL); |
3086 | + gwd_frames_foreach (update_frames_defaults, NULL); |
3087 | |
3088 | if (minimal) |
3089 | return; |
3090 | @@ -160,6 +157,7 @@ |
3091 | while (windows != NULL) |
3092 | { |
3093 | GWDWindow *w = g_object_get_data (G_OBJECT (windows->data), "decor"); |
3094 | + |
3095 | GList *it = w->decorations; |
3096 | |
3097 | #ifdef USE_METACITY |
3098 | @@ -167,13 +165,13 @@ |
3099 | { |
3100 | GWDDecoration *d = (GWDDecoration *) it->data; |
3101 | if (d->draw == draw_window_decoration || |
3102 | - d->draw == meta_draw_window_decoration) |
3103 | + d->draw == meta_draw_window_decoration) |
3104 | d->draw = theme_draw_window_decoration; |
3105 | it = g_list_next (it); |
3106 | } |
3107 | #endif |
3108 | + update_window_decoration (windows->data); |
3109 | |
3110 | - update_window_decoration (WNCK_WINDOW (windows->data)); |
3111 | windows = windows->next; |
3112 | } |
3113 | |
3114 | @@ -244,9 +242,11 @@ |
3115 | GWDDecoration *d; |
3116 | |
3117 | /* Inhibit the generation of new decorations for |
3118 | - * windows which are not decorated and managed*/ |
3119 | - if (!(window->mwm_prop & (MWM_DECOR_ALL | MWM_DECOR_TITLE)) && |
3120 | - window->win) |
3121 | + * windows which are not decorated and managed |
3122 | + * or destroyed */ |
3123 | + if ((!(window->mwm_prop & (MWM_DECOR_ALL | MWM_DECOR_TITLE)) && |
3124 | + window->win) || |
3125 | + !window->xid) |
3126 | { |
3127 | if (window != gwd_default_decorations_window) |
3128 | { |
3129 | @@ -295,10 +295,10 @@ |
3130 | d->window->icon = update_window_decoration_icon (d->window->icon, |
3131 | icon, |
3132 | d->frame->style_window); |
3133 | - |
3134 | - update_window_decoration_size (d, client_geometry, name); |
3135 | } |
3136 | |
3137 | + update_window_decoration_size (d, client_geometry, name); |
3138 | + |
3139 | /* If this is the default decorations window and the |
3140 | * default implementation is NULL, then it means that |
3141 | * we're in decor_frame_refresh and the defeault implementation |
3142 | @@ -458,6 +458,12 @@ |
3143 | win->force_quit_dialog = NULL; |
3144 | win->xid = xid; |
3145 | win->frame_window = NULL; |
3146 | + memset (&win->client_geometry, 0, sizeof (XRectangle)); |
3147 | + win->mwm_prop = 0; |
3148 | + win->net_wm_state_modal_atom = 0; |
3149 | + win->actions = 0; |
3150 | + win->state = 0; |
3151 | + win->type = DECOR_WINDOW_TYPE_BARE; |
3152 | |
3153 | /* Managed window */ |
3154 | if (win->win) |
3155 | @@ -466,9 +472,20 @@ |
3156 | GdkWindow *client = create_foreign_window (win->xid); |
3157 | int xp, yp, wp, hp; |
3158 | |
3159 | - gdk_window_set_events (client, gdk_window_get_events (client) | |
3160 | - GDK_PROPERTY_CHANGE_MASK); |
3161 | - gdk_window_add_filter (client, event_filter_func, NULL); |
3162 | + gdk_error_trap_push (); |
3163 | + if (client) |
3164 | + gdk_window_set_events (client, gdk_window_get_events (client) | |
3165 | + GDK_PROPERTY_CHANGE_MASK); |
3166 | + |
3167 | + gdk_display_sync (gdk_display_get_default ()); |
3168 | + if (gdk_error_trap_pop () || !client) |
3169 | + { |
3170 | + g_warning ("attempted to create GWDWindow for"\ |
3171 | + "destroyed window 0x%x", (guint32) xid); |
3172 | + win->xid = 0; |
3173 | + return win; |
3174 | + } |
3175 | + |
3176 | wnck_window_get_client_window_geometry (win->win, &xp, &yp, &hp, &wp); |
3177 | |
3178 | win->client_geometry.x = xp; |
3179 | @@ -502,15 +519,22 @@ |
3180 | { |
3181 | g_warning ("attempted to create GWDWindow for"\ |
3182 | "destroyed window 0x%x", (guint32) xid); |
3183 | - |
3184 | - return NULL; |
3185 | - } |
3186 | - |
3187 | - /* always 0 */ |
3188 | - win->actions = 0; |
3189 | - win->state = 0; |
3190 | - win->type = DECOR_WINDOW_TYPE_BARE; |
3191 | - win->mwm_prop = 0; |
3192 | + win->xid = 0; |
3193 | + return win; |
3194 | + } |
3195 | + |
3196 | + if (xid == root) |
3197 | + { |
3198 | + x = 0; |
3199 | + y = 0; |
3200 | + width = 1; |
3201 | + height = 1; |
3202 | + } |
3203 | + |
3204 | + win->client_geometry.x = x; |
3205 | + win->client_geometry.y = y; |
3206 | + win->client_geometry.width = width; |
3207 | + win->client_geometry.height = height; |
3208 | } |
3209 | |
3210 | win->cache = decor_cache_new (); |
3211 | @@ -566,7 +590,10 @@ |
3212 | win->icon = update_window_decoration_icon (win->icon, NULL, NULL); |
3213 | |
3214 | if (win->frame_window) |
3215 | + { |
3216 | gwd_frame_window_delete (win->frame_window, FALSE); |
3217 | + win->frame_window->window = NULL; |
3218 | + } |
3219 | |
3220 | if (win->force_quit_dialog) |
3221 | g_object_unref (G_OBJECT (win->force_quit_dialog)); |
3222 | @@ -599,7 +626,6 @@ |
3223 | GdkColormap *colormap; |
3224 | GdkWindow *compiz_frame_window = create_foreign_window (frame_window); |
3225 | GdkWindow *backing_window; |
3226 | - unsigned int i, j; |
3227 | |
3228 | if (!compiz_frame_window) |
3229 | { |
3230 | @@ -607,83 +633,47 @@ |
3231 | return NULL; |
3232 | } |
3233 | |
3234 | - static event_callback callback[3][3] = { |
3235 | - { top_left_event, top_event, top_right_event }, |
3236 | - { left_event, title_event, right_event }, |
3237 | - { bottom_left_event, bottom_event, bottom_right_event } |
3238 | - }; |
3239 | - static event_callback button_callback[BUTTON_NUM] = { |
3240 | - close_button_event, |
3241 | - max_button_event, |
3242 | - min_button_event, |
3243 | - menu_button_event, |
3244 | - shade_button_event, |
3245 | - above_button_event, |
3246 | - stick_button_event, |
3247 | - unshade_button_event, |
3248 | - unabove_button_event, |
3249 | - unstick_button_event |
3250 | - }; |
3251 | - |
3252 | fw->window = win; |
3253 | fw->xid = frame_window; |
3254 | fw->atom = atom; |
3255 | fw->container = gtk_window_new (GTK_WINDOW_POPUP); |
3256 | + fw->event_box = gtk_event_box_new (); |
3257 | |
3258 | colormap = get_colormap_for_drawable (GDK_DRAWABLE (compiz_frame_window)); |
3259 | gtk_widget_set_colormap (GTK_WIDGET (fw->container), colormap); |
3260 | |
3261 | + g_object_set (G_OBJECT (fw->container), "has-resize-grip", FALSE, NULL); |
3262 | + g_object_set (G_OBJECT (fw->container), "destroy-with-parent", TRUE, NULL); |
3263 | + g_object_set (G_OBJECT (fw->container), "focus-on-map", FALSE, NULL); |
3264 | + g_object_set (G_OBJECT (fw->container), "accept-focus", FALSE, NULL); |
3265 | + gdk_error_trap_push (); |
3266 | gtk_widget_realize (GTK_WIDGET (fw->container)); |
3267 | backing_window = gtk_widget_get_window (GTK_WIDGET (fw->container)); |
3268 | |
3269 | + fw->container_xid = GDK_WINDOW_XID (backing_window); |
3270 | + |
3271 | /* Remove the input shape of the output window */ |
3272 | - gdk_error_trap_push (); |
3273 | - XShapeSelectInput (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), GDK_WINDOW_XID (backing_window), NoEventMask); |
3274 | - XShapeCombineRectangles (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), GDK_WINDOW_XID (backing_window), |
3275 | - ShapeInput, 0, 0, NULL, 0, ShapeSet, 0); |
3276 | - |
3277 | - XSetWindowAttributes attrib; |
3278 | - |
3279 | - /* Don't let events from this window screw up processing */ |
3280 | - attrib.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask; |
3281 | - XChangeWindowAttributes (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), GDK_WINDOW_XID (backing_window), CWDontPropagate, &attrib); |
3282 | - |
3283 | - /* Reparent this window into the backing window */ |
3284 | - XReparentWindow (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), GDK_WINDOW_XID (backing_window), fw->xid, 0, 0); |
3285 | - XLowerWindow (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), GDK_WINDOW_XID (backing_window)); |
3286 | - |
3287 | gdk_display_sync (gdk_display_get_default ()); |
3288 | if (!gdk_error_trap_pop ()) |
3289 | { |
3290 | - gtk_widget_show_all (GTK_WIDGET (fw->container)); |
3291 | - |
3292 | - for (i = 0; i < 3; i++) |
3293 | - for (j = 0; j < 3; j++) |
3294 | - fw->event_windows[i][j].callback = callback[i][j]; |
3295 | - |
3296 | - for (i = 0; i < BUTTON_NUM; i++) |
3297 | - fw->button_windows[i].callback = button_callback[i]; |
3298 | - |
3299 | - fw->container_xid = GDK_WINDOW_XID (backing_window); |
3300 | - |
3301 | - update_event_windows (fw); |
3302 | - |
3303 | - gdk_window_set_events (backing_window, |
3304 | - GDK_STRUCTURE_MASK); |
3305 | gdk_window_set_events (compiz_frame_window, |
3306 | gdk_window_get_events (compiz_frame_window) | |
3307 | - GDK_POINTER_MOTION_MASK | |
3308 | - GDK_BUTTON_PRESS_MASK | |
3309 | - GDK_BUTTON_RELEASE_MASK | |
3310 | - GDK_STRUCTURE_MASK); |
3311 | - gdk_window_add_filter (compiz_frame_window, event_filter_func, NULL); |
3312 | - gdk_window_add_filter (backing_window, event_filter_func, NULL); |
3313 | + GDK_STRUCTURE_MASK | |
3314 | + GDK_SUBSTRUCTURE_MASK); |
3315 | |
3316 | - g_hash_table_insert (frame_table, GINT_TO_POINTER (fw->xid), win); |
3317 | - g_hash_table_insert (frame_table, GINT_TO_POINTER (fw->container_xid), win); |
3318 | + decor_request_embed_window (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), |
3319 | + gdk_x11_get_default_screen (), |
3320 | + win->xid, |
3321 | + fw->container_xid, |
3322 | + fw->xid, |
3323 | + 0, |
3324 | + 0); |
3325 | + g_hash_table_insert (frame_table, GINT_TO_POINTER (fw->xid), fw); |
3326 | + g_hash_table_insert (frame_table, GINT_TO_POINTER (fw->container_xid), fw); |
3327 | } |
3328 | else |
3329 | { |
3330 | + g_warning ("failed to create input window for 0x%x", fw->window->xid); |
3331 | gtk_widget_destroy (GTK_WIDGET (fw->container)); |
3332 | free (fw); |
3333 | return NULL; |
3334 | @@ -693,18 +683,54 @@ |
3335 | } |
3336 | |
3337 | void |
3338 | -gwd_frame_window_delete (GWDFrameWindow *fw, gboolean safe) |
3339 | +gwd_frame_window_delete (GWDFrameWindow *fw, gboolean unreparented) |
3340 | { |
3341 | - |
3342 | - if (!safe && fw->container) |
3343 | - gtk_widget_destroy (GTK_WIDGET (fw->container)); |
3344 | - else if (safe && fw->container) |
3345 | - g_warning ("seems like some buggy application deleted our frame window, trying to work around, but I might leak memory in the process, sorry!"); |
3346 | - |
3347 | - g_hash_table_remove (frame_table, GINT_TO_POINTER (fw->xid)); |
3348 | - g_hash_table_remove (frame_table, GINT_TO_POINTER (fw->container_xid)); |
3349 | - |
3350 | - free (fw); |
3351 | + gboolean safe = FALSE; |
3352 | + |
3353 | + /* Triple check that ... */ |
3354 | + if (!safe) |
3355 | + { |
3356 | + gdk_display_sync (gdk_display_get_default ()); |
3357 | + |
3358 | + XEvent e; |
3359 | + if (XCheckTypedWindowEvent (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), |
3360 | + fw->xid, DestroyNotify, &e)) |
3361 | + { |
3362 | + g_warning ("deleting destroyed window"); |
3363 | + XPutBackEvent (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), &e); |
3364 | + safe = TRUE; |
3365 | + } |
3366 | + } |
3367 | + |
3368 | + /* Wait until the unreparent notification |
3369 | + * comes around */ |
3370 | + if (!unreparented) |
3371 | + { |
3372 | + decor_request_embed_window (gdk_x11_display_get_xdisplay (gdk_display_get_default ()), |
3373 | + gdk_x11_get_default_screen (), |
3374 | + fw->window->xid, |
3375 | + fw->container_xid, |
3376 | + fw->xid, |
3377 | + 0, |
3378 | + 0); |
3379 | + } |
3380 | + else |
3381 | + { |
3382 | + if (last_clicked_frame && |
3383 | + last_clicked_frame->frame_window == fw) |
3384 | + last_clicked_frame = NULL; |
3385 | + |
3386 | + if (fw->container) |
3387 | + gtk_widget_destroy (GTK_WIDGET (fw->container)); |
3388 | + |
3389 | + g_hash_table_remove (frame_table, GINT_TO_POINTER (fw->xid)); |
3390 | + g_hash_table_remove (frame_table, GINT_TO_POINTER (fw->container_xid)); |
3391 | + |
3392 | + if (fw->window) |
3393 | + fw->window->frame_window = NULL; |
3394 | + |
3395 | + free (fw); |
3396 | + } |
3397 | } |
3398 | |
3399 | void |
3400 | @@ -738,9 +764,7 @@ |
3401 | { |
3402 | GWDWindow *w = g_object_get_data (G_OBJECT (win), "decor"); |
3403 | |
3404 | - /* g_object_get_data can return NULL here since |
3405 | - * the window could have just been destroyed */ |
3406 | - |
3407 | + /* On startup this can be NULL */ |
3408 | if (w) |
3409 | { |
3410 | w->state &= ~(DECOR_WINDOW_STATE_FOCUS); |
3411 | @@ -755,7 +779,6 @@ |
3412 | GWDWindow *w = g_object_get_data (G_OBJECT (win), "decor"); |
3413 | |
3414 | w->state |= DECOR_WINDOW_STATE_FOCUS; |
3415 | - |
3416 | gwd_decoration_get (w, w->type, w->state, w->actions); |
3417 | } |
3418 | } |
3419 | |
3420 | === added directory 'gtk/window-decorator/test-cache' |
3421 | === removed file 'gtk/window-decorator/test-cache.c' |
3422 | --- gtk/window-decorator/test-cache.c 2011-08-11 08:56:52 +0000 |
3423 | +++ gtk/window-decorator/test-cache.c 1970-01-01 00:00:00 +0000 |
3424 | @@ -1,116 +0,0 @@ |
3425 | -/* |
3426 | - * test-cache.c |
3427 | - * |
3428 | - * Copyright (c) 2011 Canonical Ltd. |
3429 | - * |
3430 | - * This program is free software: you can redistribute it and/or modify it |
3431 | - * under the terms of the GNU General Public License as published by the |
3432 | - * Free Software Foundation, either version 3 of the License, or (at your |
3433 | - * option) any later version. |
3434 | - * |
3435 | - * This program is distributed in the hope that it will be useful, but |
3436 | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
3437 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3438 | - * General Public License for more details. |
3439 | - * |
3440 | - * You should have received a copy of the GNU General Public License along |
3441 | - * with this program. If not, see <http://www.gnu.org/licenses/>. |
3442 | - * |
3443 | - * Authored by: |
3444 | - * Sam Spilsbury <sam.spilsbury@canonical.com> |
3445 | - */ |
3446 | - |
3447 | -#include "decoration-test.h" |
3448 | - |
3449 | -int main (void) |
3450 | -{ |
3451 | - char *data_string; |
3452 | - decor_cache_t *cache = decor_cache_new (); |
3453 | - decor_subproperty_t *s1, *s2, *s3; |
3454 | - decoration *d1 = NULL; |
3455 | - decoration *d2 = NULL; |
3456 | - decoration *d3 = NULL; |
3457 | - |
3458 | - g_debug ("create decoration 1"); |
3459 | - |
3460 | - d1 = create_decoration_from_info (None, 5, 5, 5, 5, |
3461 | - 10, 10, 10, 10, 5, 5, 5, 5, |
3462 | - 100, 100, |
3463 | - DECOR_WINDOW_TYPE_NORMAL, |
3464 | - DECOR_WINDOW_STATE_FOCUS | |
3465 | - DECOR_WINDOW_STATE_COMPOSITED, |
3466 | - 0, |
3467 | - cache); |
3468 | - |
3469 | - g_debug ("create decoration 2"); |
3470 | - |
3471 | - d2 = create_decoration_from_info (None, 5, 5, 5, 5, |
3472 | - 10, 10, 10, 10, 5, 5, 5, 5, |
3473 | - 100, 100, |
3474 | - DECOR_WINDOW_TYPE_NORMAL, |
3475 | - DECOR_WINDOW_STATE_COMPOSITED, |
3476 | - 0, |
3477 | - cache); |
3478 | - |
3479 | - g_debug ("create decoration 3"); |
3480 | - |
3481 | - d3 = create_decoration_from_info (None, 5, 5, 5, 5, |
3482 | - 10, 10, 10, 10, 5, 5, 5, 5, |
3483 | - 100, 100, |
3484 | - DECOR_WINDOW_TYPE_DIALOG, |
3485 | - DECOR_WINDOW_STATE_COMPOSITED, |
3486 | - 0, |
3487 | - cache); |
3488 | - |
3489 | - g_debug ("Writing pixmap property"); |
3490 | - |
3491 | - dump_decoration_data (d1->property->data); |
3492 | - dump_decoration_data (d2->property->data); |
3493 | - dump_decoration_data (d3->property->data); |
3494 | - |
3495 | - printf ("Property contains : { "); |
3496 | - data_string = data_to_string (cache->data, cache->size); |
3497 | - printf ("%s", data_string); |
3498 | - printf ("}\n"); |
3499 | - free (data_string); |
3500 | - data_string = NULL; |
3501 | - |
3502 | - g_debug ("Reading pixmap property"); |
3503 | - |
3504 | - s1 = d1->property; |
3505 | - free (d1); |
3506 | - |
3507 | - s2 = d2->property; |
3508 | - free (d2); |
3509 | - |
3510 | - s3 = d3->property; |
3511 | - free (d3); |
3512 | - |
3513 | - d1 = load_decoration_from_property (s1->data); |
3514 | - d1->property = s1; |
3515 | - d2 = load_decoration_from_property (s2->data); |
3516 | - d2->property = s2; |
3517 | - d3 = load_decoration_from_property (s3->data); |
3518 | - d3->property = s3; |
3519 | - |
3520 | - dump_decoration (d1); |
3521 | - dump_decoration (d2); |
3522 | - dump_decoration (d3); |
3523 | - |
3524 | - g_debug ("Delete decoration 2"); |
3525 | - destroy_decoration (d2, cache); |
3526 | - |
3527 | - dump_decoration (d1); |
3528 | - dump_decoration (d3); |
3529 | - |
3530 | - g_debug ("Delete decoration 3"); |
3531 | - destroy_decoration (d3, cache); |
3532 | - |
3533 | - dump_decoration (d1); |
3534 | - |
3535 | - g_debug ("Delete decoration 1"); |
3536 | - destroy_decoration (d1, cache); |
3537 | - |
3538 | - decor_cache_destroy (cache); |
3539 | - return 0; |
3540 | -} |
3541 | |
3542 | === added file 'gtk/window-decorator/test-cache/CMakeLists.txt' |
3543 | --- gtk/window-decorator/test-cache/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
3544 | +++ gtk/window-decorator/test-cache/CMakeLists.txt 2011-08-18 18:06:27 +0000 |
3545 | @@ -0,0 +1,9 @@ |
3546 | +pkg_check_modules (TEST_CACHE REQUIRED libdecoration) |
3547 | +include_directories (${TEST_CACHE_INCLUDE_DIRS} |
3548 | + ${compiz_SOURCE_DIR}/include |
3549 | + ..) |
3550 | +add_definitions (-DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\") |
3551 | + |
3552 | +add_executable (test-cache test-cache.c ../decoration-test.c) |
3553 | + |
3554 | +target_link_libraries (test-cache ${TEST_CACHE_LIBRARIES}) |
3555 | |
3556 | === added file 'gtk/window-decorator/test-cache/test-cache.c' |
3557 | --- gtk/window-decorator/test-cache/test-cache.c 1970-01-01 00:00:00 +0000 |
3558 | +++ gtk/window-decorator/test-cache/test-cache.c 2011-08-18 18:06:27 +0000 |
3559 | @@ -0,0 +1,116 @@ |
3560 | +/* |
3561 | + * test-cache.c |
3562 | + * |
3563 | + * Copyright (c) 2011 Canonical Ltd. |
3564 | + * |
3565 | + * This program is free software: you can redistribute it and/or modify it |
3566 | + * under the terms of the GNU General Public License as published by the |
3567 | + * Free Software Foundation, either version 3 of the License, or (at your |
3568 | + * option) any later version. |
3569 | + * |
3570 | + * This program is distributed in the hope that it will be useful, but |
3571 | + * WITHOUT ANY WARRANTY; without even the implied warranty of |
3572 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3573 | + * General Public License for more details. |
3574 | + * |
3575 | + * You should have received a copy of the GNU General Public License along |
3576 | + * with this program. If not, see <http://www.gnu.org/licenses/>. |
3577 | + * |
3578 | + * Authored by: |
3579 | + * Sam Spilsbury <sam.spilsbury@canonical.com> |
3580 | + */ |
3581 | + |
3582 | +#include "decoration-test.h" |
3583 | + |
3584 | +int main (void) |
3585 | +{ |
3586 | + char *data_string; |
3587 | + decor_cache_t *cache = decor_cache_new (); |
3588 | + decor_subproperty_t *s1, *s2, *s3; |
3589 | + decoration *d1 = NULL; |
3590 | + decoration *d2 = NULL; |
3591 | + decoration *d3 = NULL; |
3592 | + |
3593 | + printf ("create decoration 1\n"); |
3594 | + |
3595 | + d1 = create_decoration_from_info (None, 5, 5, 5, 5, |
3596 | + 10, 10, 10, 10, 5, 5, 5, 5, |
3597 | + 100, 100, |
3598 | + DECOR_WINDOW_TYPE_NORMAL, |
3599 | + DECOR_WINDOW_STATE_FOCUS | |
3600 | + DECOR_WINDOW_STATE_COMPOSITED, |
3601 | + 0, |
3602 | + cache); |
3603 | + |
3604 | + printf ("create decoration 2\n"); |
3605 | + |
3606 | + d2 = create_decoration_from_info (None, 5, 5, 5, 5, |
3607 | + 10, 10, 10, 10, 5, 5, 5, 5, |
3608 | + 100, 100, |
3609 | + DECOR_WINDOW_TYPE_NORMAL, |
3610 | + DECOR_WINDOW_STATE_COMPOSITED, |
3611 | + 0, |
3612 | + cache); |
3613 | + |
3614 | + printf ("create decoration 3\n"); |
3615 | + |
3616 | + d3 = create_decoration_from_info (None, 5, 5, 5, 5, |
3617 | + 10, 10, 10, 10, 5, 5, 5, 5, |
3618 | + 100, 100, |
3619 | + DECOR_WINDOW_TYPE_DIALOG, |
3620 | + DECOR_WINDOW_STATE_COMPOSITED, |
3621 | + 0, |
3622 | + cache); |
3623 | + |
3624 | + printf ("Writing pixmap property\n"); |
3625 | + |
3626 | + dump_decoration_data (d1->property->data); |
3627 | + dump_decoration_data (d2->property->data); |
3628 | + dump_decoration_data (d3->property->data); |
3629 | + |
3630 | + printf ("Property contains : { "); |
3631 | + data_string = data_to_string (cache->data, cache->size); |
3632 | + printf ("%s", data_string); |
3633 | + printf ("}\n"); |
3634 | + free (data_string); |
3635 | + data_string = NULL; |
3636 | + |
3637 | + printf ("Reading pixmap property\n"); |
3638 | + |
3639 | + s1 = d1->property; |
3640 | + free (d1); |
3641 | + |
3642 | + s2 = d2->property; |
3643 | + free (d2); |
3644 | + |
3645 | + s3 = d3->property; |
3646 | + free (d3); |
3647 | + |
3648 | + d1 = load_decoration_from_property (s1->data); |
3649 | + d1->property = s1; |
3650 | + d2 = load_decoration_from_property (s2->data); |
3651 | + d2->property = s2; |
3652 | + d3 = load_decoration_from_property (s3->data); |
3653 | + d3->property = s3; |
3654 | + |
3655 | + dump_decoration (d1); |
3656 | + dump_decoration (d2); |
3657 | + dump_decoration (d3); |
3658 | + |
3659 | + printf ("Delete decoration 2\n"); |
3660 | + destroy_decoration (d2, cache); |
3661 | + |
3662 | + dump_decoration (d1); |
3663 | + dump_decoration (d3); |
3664 | + |
3665 | + printf ("Delete decoration 3\n"); |
3666 | + destroy_decoration (d3, cache); |
3667 | + |
3668 | + dump_decoration (d1); |
3669 | + |
3670 | + printf ("Delete decoration 1\n"); |
3671 | + destroy_decoration (d1, cache); |
3672 | + |
3673 | + decor_cache_destroy (cache); |
3674 | + return 0; |
3675 | +} |
3676 | |
3677 | === modified file 'include/decoration.h' |
3678 | --- include/decoration.h 2011-08-11 19:38:07 +0000 |
3679 | +++ include/decoration.h 2011-08-18 18:06:27 +0000 |
3680 | @@ -21,6 +21,8 @@ |
3681 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
3682 | * |
3683 | * Author: David Reveman <davidr@novell.com> |
3684 | + * Frame Cache System: Copyright (c) 2011 Canonical Ltd. |
3685 | + * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
3686 | */ |
3687 | |
3688 | #ifndef _DECORATION_H |
3689 | @@ -40,6 +42,7 @@ |
3690 | #define DECOR_BARE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_BARE" |
3691 | #define DECOR_NORMAL_ATOM_NAME "_COMPIZ_WINDOW_DECOR_NORMAL" |
3692 | #define DECOR_ACTIVE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_ACTIVE" |
3693 | +#define DECOR_REQUEST_EMBED_WINDOW_ATOM_NAME "_COMPIZ_EMBED_DECOR_WINDOW" |
3694 | #define DECOR_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR" |
3695 | #define DECOR_BLUR_ATOM_NAME "_COMPIZ_WM_WINDOW_BLUR_DECOR" |
3696 | #define DECOR_SWITCH_WINDOW_ATOM_NAME "_COMPIZ_SWITCH_SELECT_WINDOW" |
3697 | @@ -226,19 +229,35 @@ |
3698 | int |
3699 | decor_version (void); |
3700 | |
3701 | +/* Allocates a new cache object */ |
3702 | + |
3703 | decor_cache_t * |
3704 | decor_cache_new (); |
3705 | |
3706 | +/* Destroys the cache object */ |
3707 | + |
3708 | void |
3709 | decor_cache_destroy (decor_cache_t *); |
3710 | |
3711 | +/* Appends the size of a window property to a cache |
3712 | + * object, returning a structure representing the |
3713 | + * index of that property inside of the cache */ |
3714 | + |
3715 | decor_subproperty_t * |
3716 | decor_cache_append_window (decor_cache_t *cache); |
3717 | |
3718 | +/* Appends the size of a pixmap property to a cache |
3719 | + * object, returning a structure representing the |
3720 | + * index of that property inside of the cache |
3721 | + * |
3722 | + * nQuad: maximum number of quads allowed in the |
3723 | + * property */ |
3724 | + |
3725 | decor_subproperty_t * |
3726 | decor_cache_append_pixmap (decor_cache_t *cache, |
3727 | unsigned int nQuad); |
3728 | |
3729 | +/* Writes pixmap information to a pixmap subproperty */ |
3730 | void |
3731 | decor_subproperty_set_pixmap (decor_subproperty_t *property, |
3732 | Pixmap pixmap, |
3733 | @@ -252,6 +271,7 @@ |
3734 | unsigned int frame_state, |
3735 | unsigned int frame_actions); |
3736 | |
3737 | +/* Writes window information to a pixmap subproperty */ |
3738 | void |
3739 | decor_subproperty_set_window (decor_subproperty_t *cache, |
3740 | decor_extents_t *input, |
3741 | @@ -276,15 +296,20 @@ |
3742 | int |
3743 | decor_subproperty_get_type (long int *); |
3744 | |
3745 | +/* Retreive the next subproperty index in the data */ |
3746 | long * |
3747 | decor_get_next_subproperty (long int *data, |
3748 | long *property, |
3749 | unsigned int *n); |
3750 | |
3751 | -/* frame_type, frame_state and frame_actions here |
3752 | +/* |
3753 | + * Removes the subproperty specified at the index in property |
3754 | + * from the cache object and reallocates the cache, updating |
3755 | + * the indexes for the other properties automatically |
3756 | + * |
3757 | + * frame_type, frame_state and frame_actions here |
3758 | * are all used for error detection, though maybe |
3759 | * they should be removed in the future */ |
3760 | - |
3761 | int |
3762 | decor_cache_remove_subproperty (decor_cache_t *cache, |
3763 | unsigned int frame_type, |
3764 | @@ -292,6 +317,10 @@ |
3765 | unsigned int frame_actions, |
3766 | decor_subproperty_t *property); |
3767 | |
3768 | +/* |
3769 | + * Reads serialized pixmap property information into |
3770 | + * a set of quads, pixmap and minimum geometry + metadata */ |
3771 | + |
3772 | int |
3773 | decor_pixmap_property_to_quads (long *data, |
3774 | Pixmap *pixmap, |
3775 | @@ -304,6 +333,10 @@ |
3776 | unsigned int *frame_actions, |
3777 | decor_quad_t *quad); |
3778 | |
3779 | +/* |
3780 | + * Reads serialized window property information into |
3781 | + * a set of minimum geometry + metadata */ |
3782 | + |
3783 | int |
3784 | decor_window_property (long *data, |
3785 | decor_extents_t *input, |
3786 | @@ -449,6 +482,12 @@ |
3787 | int height, |
3788 | decor_layout_t *layout); |
3789 | |
3790 | +/* |
3791 | + * Fills the specified picture with the shadow extents |
3792 | + * according to the frame layout information in layout |
3793 | + * and context |
3794 | + */ |
3795 | + |
3796 | void |
3797 | decor_fill_picture_extents_with_shadow (Display *xdisplay, |
3798 | decor_shadow_t *shadow, |
3799 | @@ -468,6 +507,16 @@ |
3800 | unsigned short alpha, |
3801 | int shade_alpha); |
3802 | |
3803 | +/* |
3804 | + * Blends a part of the frame into an existing |
3805 | + * XRenderPicture, clipping by region and |
3806 | + * padding as appropriate. Also applies a |
3807 | + * translucent fade-out to the decoration |
3808 | + * if that was specified |
3809 | + * |
3810 | + * Use ignore_src_alpha to force painting an |
3811 | + * opaque decoration */ |
3812 | + |
3813 | void |
3814 | decor_blend_border_picture (Display *xdisplay, |
3815 | decor_context_t *context, |
3816 | @@ -482,6 +531,21 @@ |
3817 | int shade_alpha, |
3818 | int ignore_src_alpha); |
3819 | |
3820 | +/* |
3821 | + * Convenience function for decorations to request that |
3822 | + * one of their windows be reparented into the frame |
3823 | + * window that compiz gave it. Specify None in |
3824 | + * embed to have the frame unreparented */ |
3825 | + |
3826 | +int |
3827 | +decor_request_embed_window (Display *xdisplay, |
3828 | + int screen, |
3829 | + Window client, |
3830 | + Window embed, |
3831 | + Window frame, |
3832 | + int x_off, |
3833 | + int y_off); |
3834 | + |
3835 | #define DECOR_ACQUIRE_STATUS_SUCCESS 0 |
3836 | #define DECOR_ACQUIRE_STATUS_FAILED 1 |
3837 | #define DECOR_ACQUIRE_STATUS_OTHER_DM_RUNNING 2 |
3838 | |
3839 | === modified file 'libdecoration/decoration.c' |
3840 | --- libdecoration/decoration.c 2011-08-11 19:38:07 +0000 |
3841 | +++ libdecoration/decoration.c 2011-08-18 18:06:27 +0000 |
3842 | @@ -530,7 +530,6 @@ |
3843 | } |
3844 | else |
3845 | { |
3846 | - /* There has to be something better than this ... */ |
3847 | data = data + decor_subproperty_get_size (data); |
3848 | (*n)++; |
3849 | } |
3850 | @@ -3037,6 +3036,38 @@ |
3851 | } |
3852 | |
3853 | int |
3854 | +decor_request_embed_window (Display *xdisplay, |
3855 | + int screen, |
3856 | + Window client, |
3857 | + Window embed, |
3858 | + Window frame, |
3859 | + int x_off, |
3860 | + int y_off) |
3861 | +{ |
3862 | + XEvent event; |
3863 | + Atom embed_window_atom = XInternAtom (xdisplay, |
3864 | + DECOR_REQUEST_EMBED_WINDOW_ATOM_NAME, |
3865 | + 0); |
3866 | + |
3867 | + /* Send client message indicating that we want to embed |
3868 | + * this 'embed' window into the frame for the client */ |
3869 | + event.xclient.type = ClientMessage; |
3870 | + event.xclient.window = client; |
3871 | + event.xclient.message_type = embed_window_atom; |
3872 | + event.xclient.format = 32; |
3873 | + event.xclient.data.l[0] = embed; |
3874 | + event.xclient.data.l[1] = frame; |
3875 | + event.xclient.data.l[2] = x_off; |
3876 | + event.xclient.data.l[3] = y_off; |
3877 | + event.xclient.data.l[4] = 0; |
3878 | + |
3879 | + XSendEvent (xdisplay, XRootWindow (xdisplay, screen), 0, |
3880 | + StructureNotifyMask, &event); |
3881 | + |
3882 | + return 1; |
3883 | +} |
3884 | + |
3885 | +int |
3886 | decor_acquire_dm_session (Display *xdisplay, |
3887 | int screen, |
3888 | const char *name, |
3889 | |
3890 | === modified file 'plugins/decor/src/decor.cpp' |
3891 | --- plugins/decor/src/decor.cpp 2011-08-11 19:39:44 +0000 |
3892 | +++ plugins/decor/src/decor.cpp 2011-08-18 18:06:27 +0000 |
3893 | @@ -42,6 +42,29 @@ |
3894 | |
3895 | COMPIZ_PLUGIN_20090315 (decor, DecorPluginVTable) |
3896 | |
3897 | +/* |
3898 | + * Count the number of bits which are currently |
3899 | + * set in an interger. */ |
3900 | +static unsigned int |
3901 | +numBits (unsigned int i) |
3902 | +{ |
3903 | +#ifdef __GNUC__ |
3904 | + return __builtin_popcount (i); |
3905 | +#else |
3906 | + unsigned int count = 0; |
3907 | + /* software implementation */ |
3908 | + while (i > 0) |
3909 | + { |
3910 | + if (i & 1) |
3911 | + count++; |
3912 | + |
3913 | + i >> 1; |
3914 | + } |
3915 | + |
3916 | + return count; |
3917 | +#endif |
3918 | +} |
3919 | + |
3920 | /* From core */ |
3921 | |
3922 | bool |
3923 | @@ -857,7 +880,7 @@ |
3924 | DecorWindow::matchType (CompWindow *w, |
3925 | unsigned int decorType) |
3926 | { |
3927 | - const unsigned int nTypeStates = 5; |
3928 | + const unsigned int nTypeStates = 4; |
3929 | unsigned int i; |
3930 | struct typestate { |
3931 | unsigned int compFlag; |
3932 | @@ -865,7 +888,8 @@ |
3933 | } typeStates[] = |
3934 | { |
3935 | { CompWindowTypeNormalMask, DECOR_WINDOW_TYPE_NORMAL }, |
3936 | - { CompWindowTypeDialogMask, DECOR_WINDOW_TYPE_DIALOG }, |
3937 | + { CompWindowTypeDialogMask | |
3938 | + CompWindowTypeModalDialogMask, DECOR_WINDOW_TYPE_DIALOG }, |
3939 | { CompWindowTypeMenuMask, DECOR_WINDOW_TYPE_MENU }, |
3940 | { CompWindowTypeUtilMask, DECOR_WINDOW_TYPE_UTILITY} |
3941 | }; |
3942 | @@ -975,7 +999,7 @@ |
3943 | if (DecorWindow::matchType (w, d->frameType)) |
3944 | { |
3945 | /* Prefer the highest number of bits */ |
3946 | - if (matchedType < d->frameType && (!sizeCheck || dw->checkSize (d))) |
3947 | + if (numBits (matchedType) < numBits (d->frameType) && (!sizeCheck || dw->checkSize (d))) |
3948 | { |
3949 | decoration = d; |
3950 | matchedType = d->frameType; |
3951 | @@ -983,7 +1007,7 @@ |
3952 | |
3953 | if (DecorWindow::matchState (w, d->frameState) && (!sizeCheck || dw->checkSize (d))) |
3954 | { |
3955 | - if (matchedState < d->frameState) |
3956 | + if (numBits (matchedState) < numBits (d->frameState)) |
3957 | { |
3958 | decoration = d; |
3959 | matchedState = d->frameState; |
3960 | @@ -991,7 +1015,7 @@ |
3961 | |
3962 | if (DecorWindow::matchActions (w, d->frameActions) && (!sizeCheck || dw->checkSize (d))) |
3963 | { |
3964 | - if (matchedActions < d->frameActions) |
3965 | + if (numBits (matchedActions) < numBits (d->frameActions)) |
3966 | { |
3967 | decoration = d; |
3968 | matchedActions = d->frameActions; |
3969 | @@ -1061,7 +1085,7 @@ |
3970 | if (decorate) |
3971 | { |
3972 | /* Attempt to find a matching */ |
3973 | - decoration = decor.findMatchingDecoration (window, true); |
3974 | + decoration = decor.findMatchingDecoration (window, true); |
3975 | |
3976 | if (!decoration) |
3977 | { |
3978 | @@ -1219,21 +1243,52 @@ |
3979 | Window parent; |
3980 | Window *children; |
3981 | unsigned int nchildren; |
3982 | - XEvent e; |
3983 | - |
3984 | - /* Unreparent all the children of this window first into a |
3985 | - * the root window. Once the property is deleted it is the DM's |
3986 | - * responsibility to get rid of the decoration ... though that may |
3987 | - * come with artifacts */ |
3988 | - if (XCheckTypedWindowEvent (screen->dpy (), inputFrame, DestroyNotify, &e)) |
3989 | - { |
3990 | - XPutBackEvent (screen->dpy (), &e); |
3991 | + std::vector<XEvent> events; |
3992 | + bool pending = true; |
3993 | + bool alive = true; |
3994 | + |
3995 | + /* Check pending events on StructureNotifyMask to see if this frame window |
3996 | + * has already been destroyed, in which case unreparenting its children |
3997 | + * is pointless since the save sets will do that for us |
3998 | + * |
3999 | + * Note: we can't use XCheckTypedEvent here since we also have SubstructureNotifyMask |
4000 | + * on the inputFrame and may recieve DestroyNotify events for its children */ |
4001 | + while (pending) |
4002 | + { |
4003 | + XEvent e; |
4004 | + pending = XCheckWindowEvent (screen->dpy (), inputFrame, StructureNotifyMask, &e); |
4005 | + |
4006 | + if (pending) |
4007 | + { |
4008 | + events.push_back (e); |
4009 | + if (e.type == DestroyNotify && e.xdestroywindow.window == inputFrame) |
4010 | + { |
4011 | + alive = false; |
4012 | + break; |
4013 | + } |
4014 | + } |
4015 | + } |
4016 | + |
4017 | + /* Put all the events back in the queue */ |
4018 | + while (events.size ()) |
4019 | + { |
4020 | + XPutBackEvent (screen->dpy (), &events.back ()); |
4021 | + events.pop_back (); |
4022 | + } |
4023 | + |
4024 | + if (!alive) |
4025 | + { |
4026 | + inputFrame = 0; |
4027 | } |
4028 | else |
4029 | { |
4030 | Status s = XQueryTree (screen->dpy (), inputFrame, &root, |
4031 | &parent, &children, &nchildren); |
4032 | |
4033 | + /* Unreparent all the children of this window first into a |
4034 | + * the root window. Once the property is deleted it is the DM's |
4035 | + * responsibility to get rid of the decoration ... though that may |
4036 | + * come with artifacts */ |
4037 | if (s && nchildren && children) |
4038 | { |
4039 | for (unsigned int i = 0; i < nchildren; i++) |
4040 | @@ -1256,6 +1311,8 @@ |
4041 | inputFrame = None; |
4042 | frameRegion = CompRegion (); |
4043 | |
4044 | + dScreen->frames.erase (inputFrame); |
4045 | + |
4046 | oldX = 0; |
4047 | oldY = 0; |
4048 | oldWidth = 0; |
4049 | @@ -1268,17 +1325,42 @@ |
4050 | Window parent; |
4051 | Window *children; |
4052 | unsigned int nchildren; |
4053 | - XEvent e; |
4054 | + std::vector<XEvent> events; |
4055 | + bool pending = true; |
4056 | + bool alive = true; |
4057 | + |
4058 | + /* Unreparent all the children of this window first into a |
4059 | + * the root window. Once the property is deleted it is the DM's |
4060 | + * responsibility to get rid of the decoration ... though that may |
4061 | + * come with artifacts */ |
4062 | |
4063 | XDamageDestroy (screen->dpy (), frameDamage); |
4064 | |
4065 | - /* Unreparent all the children of this window first into a |
4066 | - * the root window. Once the property is deleted it is the DM's |
4067 | - * responsibility to get rid of the decoration ... though that may |
4068 | - * come with artifacts */ |
4069 | - if (XCheckTypedWindowEvent (screen->dpy (), outputFrame, DestroyNotify, &e)) |
4070 | - { |
4071 | - XPutBackEvent (screen->dpy (), &e); |
4072 | + while (pending) |
4073 | + { |
4074 | + XEvent e; |
4075 | + pending = XCheckWindowEvent (screen->dpy (), outputFrame, StructureNotifyMask, &e); |
4076 | + |
4077 | + if (pending) |
4078 | + { |
4079 | + events.push_back (e); |
4080 | + if (e.type == DestroyNotify && e.xdestroywindow.window == inputFrame) |
4081 | + { |
4082 | + alive = false; |
4083 | + break; |
4084 | + } |
4085 | + } |
4086 | + } |
4087 | + |
4088 | + while (events.size ()) |
4089 | + { |
4090 | + XPutBackEvent (screen->dpy (), &events.back ()); |
4091 | + events.pop_back (); |
4092 | + } |
4093 | + |
4094 | + if (!alive) |
4095 | + { |
4096 | + outputFrame = 0; |
4097 | } |
4098 | else |
4099 | { |
4100 | @@ -1359,9 +1441,8 @@ |
4101 | { |
4102 | XSetWindowAttributes attr; |
4103 | |
4104 | - attr.event_mask = StructureNotifyMask; |
4105 | + attr.event_mask = StructureNotifyMask | SubstructureNotifyMask; |
4106 | attr.override_redirect = true; |
4107 | - |
4108 | /* cough */ |
4109 | /* Yeah, so as it turns out you can't reparent an InputOuput |
4110 | * window into an InputOnly one, which is what some decorators |
4111 | @@ -1387,6 +1468,8 @@ |
4112 | if (screen->XShape ()) |
4113 | XShapeSelectInput (screen->dpy (), inputFrame, ShapeNotifyMask); |
4114 | |
4115 | + dScreen->frames[inputFrame] = this; |
4116 | + |
4117 | oldX = 0; |
4118 | oldY = 0; |
4119 | oldWidth = 0; |
4120 | @@ -1475,7 +1558,7 @@ |
4121 | XSetWindowAttributes attr; |
4122 | |
4123 | attr.background_pixel = 0x0; |
4124 | - attr.event_mask = StructureNotifyMask; |
4125 | + attr.event_mask = StructureNotifyMask | SubstructureNotifyMask; |
4126 | attr.override_redirect = true; |
4127 | |
4128 | outputFrame = XCreateWindow (screen->dpy (), window->frame (), |
4129 | @@ -1796,6 +1879,10 @@ |
4130 | CompWindow *w; |
4131 | |
4132 | switch (event->type) { |
4133 | + case MapRequest: |
4134 | + if (frames.find (event->xmaprequest.parent) != frames.end ()) |
4135 | + XMapWindow (screen->dpy (), event->xmaprequest.window); |
4136 | + break; |
4137 | case DestroyNotify: |
4138 | w = screen->findWindow (event->xdestroywindow.window); |
4139 | if (w) |
4140 | @@ -1803,6 +1890,16 @@ |
4141 | if (w->id () == dmWin) |
4142 | checkForDm (true); |
4143 | } |
4144 | + else |
4145 | + { |
4146 | + if (frames.find (event->xdestroywindow.event) != frames.end ()) |
4147 | + { |
4148 | + DecorWindow *dw = frames[event->xdestroywindow.event]; |
4149 | + |
4150 | + XChangeSaveSet (screen->dpy (), event->xdestroywindow.window, SetModeDelete); |
4151 | + dw->decoratorWindows.remove (event->xdestroywindow.window); |
4152 | + } |
4153 | + } |
4154 | break; |
4155 | case ClientMessage: |
4156 | if (event->xclient.message_type == requestFrameExtentsAtom) |
4157 | @@ -1811,6 +1908,48 @@ |
4158 | if (w) |
4159 | DecorWindow::get (w)->update (true); |
4160 | } |
4161 | + /* The decoration manager requested for us to embed |
4162 | + * one of its frame windows, so do that */ |
4163 | + if (event->xclient.message_type == decorRequestEmbedWindowAtom) |
4164 | + { |
4165 | + w = screen->findWindow (event->xclient.window); |
4166 | + if (w) |
4167 | + { |
4168 | + DecorWindow *dw = DecorWindow::get (w); |
4169 | + Window embed = event->xclient.data.l[0]; |
4170 | + Window frame = event->xclient.data.l[1]; |
4171 | + |
4172 | + if (frame) |
4173 | + { |
4174 | + XChangeSaveSet (screen->dpy (), embed, SetModeInsert); |
4175 | + XReparentWindow (screen->dpy (), |
4176 | + embed, |
4177 | + frame, |
4178 | + 0, |
4179 | + 0); |
4180 | + |
4181 | + dw->decoratorWindows.push_back (embed); |
4182 | + } |
4183 | + /* In case the decoration manager specifies no frame, it doesn't |
4184 | + * wish for this frame window to be embedded anymore */ |
4185 | + else |
4186 | + { |
4187 | + std::list<Window>::iterator it = std::find (dw->decoratorWindows.begin(), |
4188 | + dw->decoratorWindows.end(), |
4189 | + frame); |
4190 | + |
4191 | + if (it != dw->decoratorWindows.end ()) |
4192 | + { |
4193 | + XChangeSaveSet (screen->dpy (), embed, SetModeDelete); |
4194 | + XReparentWindow (screen->dpy (), |
4195 | + embed, |
4196 | + screen->root (), |
4197 | + event->xclient.data.l[1], |
4198 | + event->xclient.data.l[2]); |
4199 | + } |
4200 | + } |
4201 | + } |
4202 | + } |
4203 | default: |
4204 | if (cmActive && |
4205 | event->type == cScreen->damageEvent () + XDamageNotify) |
4206 | @@ -1928,7 +2067,7 @@ |
4207 | break; |
4208 | case DestroyNotify: |
4209 | /* Only for when the client window gets destroyed */ |
4210 | - w = screen->findTopLevelWindow (event->xproperty.window); |
4211 | + w = screen->findTopLevelWindow (event->xdestroywindow.window); |
4212 | if (w) |
4213 | { |
4214 | DECOR_WINDOW (w); |
4215 | @@ -2278,6 +2417,8 @@ |
4216 | XInternAtom (s->dpy (), "_COMPIZ_NET_CM_SHADOW_COLOR", 0); |
4217 | shadowInfoAtom = |
4218 | XInternAtom (s->dpy (), "_COMPIZ_NET_CM_SHADOW_PROPERTIES", 0); |
4219 | + decorRequestEmbedWindowAtom = |
4220 | + XInternAtom (s->dpy (), DECOR_REQUEST_EMBED_WINDOW_ATOM_NAME, 0); |
4221 | |
4222 | windowDefault.texture = NULL; |
4223 | windowDefault.minWidth = 0; |
4224 | |
4225 | === modified file 'plugins/decor/src/decor.h' |
4226 | --- plugins/decor/src/decor.h 2011-08-11 19:38:07 +0000 |
4227 | +++ plugins/decor/src/decor.h 2011-08-18 18:06:27 +0000 |
4228 | @@ -160,6 +160,7 @@ |
4229 | Atom shadowColorAtom; |
4230 | Atom shadowInfoAtom; |
4231 | Atom decorSwitchWindowAtom; |
4232 | + Atom decorRequestEmbedWindowAtom; |
4233 | |
4234 | Window dmWin; |
4235 | int dmSupports; |
4236 | @@ -258,6 +259,8 @@ |
4237 | bool unshading; |
4238 | bool shading; |
4239 | bool isSwitcher; |
4240 | + |
4241 | + std::list<Window> decoratorWindows; |
4242 | }; |
4243 | |
4244 | class DecorPluginVTable : |
+1, have tested and read code, nothing stuck out