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