Merge lp:~unity-team/compiz-core/compiz-core.one_property_decor into lp:compiz-core/trunk
- compiz-core.one_property_decor
- Merge into trunk
Proposed by
Sam Spilsbury
Status: | Merged |
---|---|
Merged at revision: | 2751 |
Proposed branch: | lp:~unity-team/compiz-core/compiz-core.one_property_decor |
Merge into: | lp:compiz-core/trunk |
Prerequisite: | lp:~unity-team/compiz-core/compiz-core.bits_and_pieces_2011_05_21 |
Diff against target: |
711 lines (+226/-170) 12 files modified
gtk/window-decorator/decorator.c (+63/-124) gtk/window-decorator/gtk-window-decorator.c (+8/-1) gtk/window-decorator/gtk-window-decorator.h (+2/-3) gtk/window-decorator/wnck.c (+8/-8) include/decoration.h (+0/-1) kde/window-decorator-kde4/decorator.cpp (+9/-2) kde/window-decorator-kde4/decorator.h (+19/-2) kde/window-decorator-kde4/utils.cpp (+0/-2) kde/window-decorator-kde4/window.cpp (+105/-15) kde/window-decorator-kde4/window.h (+1/-1) plugins/decor/src/decor.cpp (+9/-8) plugins/decor/src/decor.h (+2/-3) |
To merge this branch: | bzr merge lp:~unity-team/compiz-core/compiz-core.one_property_decor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jason Smith (community) | Approve | ||
Sam Spilsbury | Pending | ||
Review via email: mp+61801@code.launchpad.net |
Commit message
Fixes LP#795071
Stuff all data into one single property, so that we aren't using two and aren't chained to the idea of having to have an active and inactive default decoration (esp when it might not be necessary, though that optimization hasn't been made yet).
Also add workaround for KDE4 Support.
Description of the change
Stuff all data into one single property, so that we aren't using two and aren't chained to the idea of having to have an active and inactive default decoration (esp when it might not be necessary, though that optimization hasn't been made yet).
Also add workaround for KDE4 Support.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'gtk/window-decorator/decorator.c' |
2 | --- gtk/window-decorator/decorator.c 2011-05-20 16:52:31 +0000 |
3 | +++ gtk/window-decorator/decorator.c 2011-05-20 16:52:31 +0000 |
4 | @@ -1070,15 +1070,12 @@ |
5 | { |
6 | unsigned int frame_state = 0; |
7 | |
8 | - if (!d->win) |
9 | - return frame_state; |
10 | - |
11 | - WnckWindowState win_state = wnck_window_get_state (d->win); |
12 | + WnckWindowState win_state; |
13 | const unsigned int n_state_bits = 3; |
14 | unsigned int i; |
15 | |
16 | if (d->active) |
17 | - frame_state &= DECOR_WINDOW_STATE_FOCUS; |
18 | + frame_state |= DECOR_WINDOW_STATE_FOCUS; |
19 | |
20 | struct typestrings { |
21 | unsigned int wnck_flag; |
22 | @@ -1090,6 +1087,13 @@ |
23 | { WNCK_WINDOW_STATE_SHADED, DECOR_WINDOW_STATE_SHADED } |
24 | }; |
25 | |
26 | + /* Not possible to match further than active or not if there is |
27 | + * no window but FIXME we might want to do that later down the line */ |
28 | + if (!d->win) |
29 | + return frame_state == 0; |
30 | + |
31 | + win_state = wnck_window_get_state (d->win); |
32 | + |
33 | for (i = 0; i < n_state_bits; i++) |
34 | { |
35 | if (win_state & state_bits[i].wnck_flag) |
36 | @@ -1256,11 +1260,11 @@ |
37 | void |
38 | update_default_decorations (GdkScreen *screen) |
39 | { |
40 | - long *active_data, *inactive_data; |
41 | + long *data; |
42 | Window xroot; |
43 | GdkDisplay *gdkdisplay = gdk_display_get_default (); |
44 | Display *xdisplay = gdk_x11_display_get_xdisplay (gdkdisplay); |
45 | - Atom bareAtom, normalAtom, activeAtom; |
46 | + Atom bareAtom, activeAtom; |
47 | decor_frame_t *frame; |
48 | decor_frame_t *bare_frame = gwd_get_decor_frame ("bare"); |
49 | decor_extents_t extents; |
50 | @@ -1269,7 +1273,6 @@ |
51 | xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen)); |
52 | |
53 | bareAtom = XInternAtom (xdisplay, DECOR_BARE_ATOM_NAME, FALSE); |
54 | - normalAtom = XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, FALSE); |
55 | activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE); |
56 | |
57 | if (bare_frame->border_shadow) |
58 | @@ -1302,11 +1305,6 @@ |
59 | if (minimal) |
60 | { |
61 | XChangeProperty (xdisplay, xroot, |
62 | - normalAtom, |
63 | - XA_INTEGER, |
64 | - 32, PropModeReplace, (guchar *) data, |
65 | - PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); |
66 | - XChangeProperty (xdisplay, xroot, |
67 | activeAtom, |
68 | XA_INTEGER, |
69 | 32, PropModeReplace, (guchar *) data, |
70 | @@ -1321,7 +1319,6 @@ |
71 | |
72 | if (minimal) |
73 | { |
74 | - XDeleteProperty (xdisplay, xroot, normalAtom); |
75 | XDeleteProperty (xdisplay, xroot, activeAtom); |
76 | } |
77 | } |
78 | @@ -1335,63 +1332,40 @@ |
79 | XDeleteProperty (xdisplay, xroot, |
80 | activeAtom); |
81 | |
82 | - XDeleteProperty (xdisplay, xroot, |
83 | - normalAtom); |
84 | - |
85 | - active_data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM, WINDOW_DECORATION_TYPE_PIXMAP); |
86 | - inactive_data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM, WINDOW_DECORATION_TYPE_PIXMAP); |
87 | - |
88 | - for (i = 0; i < WINDOW_TYPE_FRAMES_NUM; i++) |
89 | + data = decor_alloc_property (WINDOW_TYPE_FRAMES_NUM * 2, WINDOW_DECORATION_TYPE_PIXMAP); |
90 | + |
91 | + /* All active states and all inactive states */ |
92 | + for (i = 0; i < WINDOW_TYPE_FRAMES_NUM * 2; i++) |
93 | { |
94 | frame = gwd_get_decor_frame (default_frames[i].name); |
95 | extents = frame->win_extents; |
96 | |
97 | - if (default_frames[i].active_d) |
98 | - { |
99 | - if (default_frames[i].active_d->pixmap) |
100 | - g_object_unref (G_OBJECT (default_frames[i].active_d->pixmap)); |
101 | - |
102 | - free (default_frames[i].active_d); |
103 | - } |
104 | - |
105 | - if (default_frames[i].inactive_d) |
106 | - { |
107 | - if (default_frames[i].inactive_d->pixmap) |
108 | - g_object_unref (G_OBJECT (default_frames[i].inactive_d->pixmap)); |
109 | - |
110 | - free (default_frames[i].inactive_d); |
111 | - } |
112 | - |
113 | - default_frames[i].active_d = calloc (1, sizeof (decor_t)); |
114 | - default_frames[i].inactive_d = calloc (1, sizeof (decor_t)); |
115 | - |
116 | - default_frames[i].active_d->context = &frame->window_context; |
117 | - default_frames[i].inactive_d->context = &frame->window_context; |
118 | - default_frames[i].active_d->shadow = frame->border_shadow; |
119 | - default_frames[i].inactive_d->shadow = frame->border_shadow; |
120 | - default_frames[i].active_d->layout = pango_layout_new (frame->pango_context); |
121 | - default_frames[i].inactive_d->layout = pango_layout_new (frame->pango_context); |
122 | - |
123 | - decor_get_default_layout (default_frames[i].active_d->context, 1, 1, &default_frames[i].active_d->border_layout); |
124 | - decor_get_default_layout (default_frames[i].inactive_d->context, 1, 1, &default_frames[i].inactive_d->border_layout); |
125 | - |
126 | - default_frames[i].active_d->width = default_frames[i].active_d->border_layout.width; |
127 | - default_frames[i].active_d->height = default_frames[i].active_d->border_layout.height; |
128 | - |
129 | - default_frames[i].active_d->frame = frame; |
130 | - |
131 | - default_frames[i].inactive_d->width = default_frames[i].inactive_d->border_layout.width; |
132 | - default_frames[i].inactive_d->height = default_frames[i].inactive_d->border_layout.height; |
133 | - |
134 | - default_frames[i].inactive_d->frame = frame; |
135 | + if (default_frames[i].d) |
136 | + { |
137 | + if (default_frames[i].d->pixmap) |
138 | + g_object_unref (G_OBJECT (default_frames[i].d->pixmap)); |
139 | + |
140 | + free (default_frames[i].d); |
141 | + } |
142 | + |
143 | + default_frames[i].d = calloc (1, sizeof (decor_t)); |
144 | + |
145 | + default_frames[i].d->context = &frame->window_context; |
146 | + default_frames[i].d->shadow = frame->border_shadow; |
147 | + default_frames[i].d->layout = pango_layout_new (frame->pango_context); |
148 | + |
149 | + decor_get_default_layout (default_frames[i].d->context, 1, 1, &default_frames[i].d->border_layout); |
150 | + |
151 | + default_frames[i].d->width = default_frames[i].d->border_layout.width; |
152 | + default_frames[i].d->height = default_frames[i].d->border_layout.height; |
153 | + |
154 | + default_frames[i].d->frame = frame; |
155 | + default_frames[i].d->active = i < WINDOW_TYPE_FRAMES_NUM ? TRUE : FALSE; |
156 | |
157 | extents.top += frame->titlebar_height; |
158 | |
159 | - default_frames[i].inactive_d->draw = theme_draw_window_decoration; |
160 | - default_frames[i].active_d->draw = theme_draw_window_decoration; |
161 | - |
162 | - default_frames[i].active_d->pixmap = create_pixmap (default_frames[i].active_d->width, default_frames[i].active_d->height, frame->style_window_rgba); |
163 | - default_frames[i].inactive_d->pixmap = create_pixmap (default_frames[i].active_d->width, default_frames[i].active_d->height, frame->style_window_rgba); |
164 | + default_frames[i].d->draw = theme_draw_window_decoration; |
165 | + default_frames[i].d->pixmap = create_pixmap (default_frames[i].d->width, default_frames[i].d->height, frame->style_window_rgba); |
166 | |
167 | unsigned int j, k; |
168 | |
169 | @@ -1399,61 +1373,34 @@ |
170 | { |
171 | for (k = 0; k < 3; k++) |
172 | { |
173 | - default_frames[i].active_d->event_windows[j][k].window = None; |
174 | - default_frames[i].inactive_d->event_windows[j][k].window = None; |
175 | + default_frames[i].d->event_windows[j][k].window = None; |
176 | } |
177 | } |
178 | |
179 | for (j = 0; j < BUTTON_NUM; j++) |
180 | { |
181 | - default_frames[i].active_d->button_windows[j].window = None; |
182 | - default_frames[i].active_d->button_states[j] = 0; |
183 | - default_frames[i].inactive_d->button_windows[j].window = None; |
184 | - default_frames[i].inactive_d->button_states[j] = 0; |
185 | + default_frames[i].d->button_windows[j].window = None; |
186 | + default_frames[i].d->button_states[j] = 0; |
187 | } |
188 | |
189 | - if (default_frames[i].active_d->pixmap) |
190 | - { |
191 | - gint nQuad; |
192 | - unsigned int frame_type = populate_frame_type (default_frames[i].active_d); |
193 | - unsigned int frame_state = populate_frame_state (default_frames[i].active_d); |
194 | - unsigned int frame_actions = populate_frame_actions (default_frames[i].active_d); |
195 | - decor_quad_t quads[N_QUADS_MAX]; |
196 | - |
197 | - nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].active_d->context, |
198 | - &default_frames[i].active_d->border_layout); |
199 | - |
200 | - default_frames[i].active_d->active = TRUE; |
201 | - default_frames[i].active_d->picture = XRenderCreatePicture (xdisplay, |
202 | - GDK_PIXMAP_XID (default_frames[i].active_d->pixmap), |
203 | - xformat_rgba, 0, NULL); |
204 | - |
205 | - (*default_frames[i].active_d->draw) (default_frames[i].active_d); |
206 | - |
207 | - decor_quads_to_property (active_data, i, GDK_PIXMAP_XID (default_frames[i].active_d->pixmap), |
208 | - &extents, &extents, |
209 | - &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); |
210 | - } |
211 | - |
212 | - if (default_frames[i].inactive_d->pixmap) |
213 | - { |
214 | - gint nQuad; |
215 | - unsigned int frame_type = populate_frame_type (default_frames[i].inactive_d); |
216 | - unsigned int frame_state = populate_frame_state (default_frames[i].inactive_d); |
217 | - unsigned int frame_actions = populate_frame_actions (default_frames[i].inactive_d); |
218 | - decor_quad_t quads[N_QUADS_MAX]; |
219 | - |
220 | - nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].inactive_d->context, |
221 | - &default_frames[i].inactive_d->border_layout); |
222 | - |
223 | - default_frames[i].inactive_d->active = FALSE; |
224 | - default_frames[i].inactive_d->picture = XRenderCreatePicture (xdisplay, |
225 | - GDK_PIXMAP_XID (default_frames[i].inactive_d->pixmap), |
226 | - xformat_rgba, 0, NULL); |
227 | - |
228 | - (*default_frames[i].inactive_d->draw) (default_frames[i].inactive_d); |
229 | - |
230 | - decor_quads_to_property (inactive_data, i, GDK_PIXMAP_XID (default_frames[i].inactive_d->pixmap), |
231 | + if (default_frames[i].d->pixmap) |
232 | + { |
233 | + gint nQuad; |
234 | + unsigned int frame_type = populate_frame_type (default_frames[i].d); |
235 | + unsigned int frame_state = populate_frame_state (default_frames[i].d); |
236 | + unsigned int frame_actions = populate_frame_actions (default_frames[i].d); |
237 | + decor_quad_t quads[N_QUADS_MAX]; |
238 | + |
239 | + nQuad = decor_set_lSrStSbS_window_quads (quads, default_frames[i].d->context, |
240 | + &default_frames[i].d->border_layout); |
241 | + |
242 | + default_frames[i].d->picture = XRenderCreatePicture (xdisplay, |
243 | + GDK_PIXMAP_XID (default_frames[i].d->pixmap), |
244 | + xformat_rgba, 0, NULL); |
245 | + |
246 | + (*default_frames[i].d->draw) (default_frames[i].d); |
247 | + |
248 | + decor_quads_to_property (data, i, GDK_PIXMAP_XID (default_frames[i].d->pixmap), |
249 | &extents, &extents, |
250 | &extents, &extents, 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); |
251 | } |
252 | @@ -1464,18 +1411,10 @@ |
253 | XChangeProperty (xdisplay, xroot, |
254 | activeAtom, |
255 | XA_INTEGER, |
256 | - 32, PropModeAppend, (guchar *) active_data, |
257 | - PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX)); |
258 | - |
259 | - |
260 | - XChangeProperty (xdisplay, xroot, |
261 | - normalAtom, |
262 | - XA_INTEGER, |
263 | - 32, PropModeAppend, (guchar *) inactive_data, |
264 | - PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX)); |
265 | - |
266 | - free (active_data); |
267 | - free (inactive_data); |
268 | + 32, PropModeAppend, (guchar *) data, |
269 | + PROP_HEADER_SIZE + (WINDOW_TYPE_FRAMES_NUM * 2) * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX)); |
270 | + |
271 | + free (data); |
272 | |
273 | gwd_decor_frame_unref (bare_frame); |
274 | } |
275 | |
276 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' |
277 | --- gtk/window-decorator/gtk-window-decorator.c 2011-05-20 16:52:31 +0000 |
278 | +++ gtk/window-decorator/gtk-window-decorator.c 2011-05-20 16:52:31 +0000 |
279 | @@ -83,7 +83,14 @@ |
280 | }; |
281 | |
282 | #define WINDOW_TYPE_FRAMES_NUM 5 |
283 | -struct _default_frame_references default_frames[WINDOW_TYPE_FRAMES_NUM] = { |
284 | +struct _default_frame_references default_frames[WINDOW_TYPE_FRAMES_NUM * 2] = { |
285 | + /* active */ |
286 | + {"normal", NULL }, |
287 | + {"dialog", NULL }, |
288 | + {"modal_dialog", NULL }, |
289 | + {"menu", NULL }, |
290 | + {"utility", NULL}, |
291 | + /* inactive */ |
292 | {"normal", NULL }, |
293 | {"dialog", NULL }, |
294 | {"modal_dialog", NULL }, |
295 | |
296 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' |
297 | --- gtk/window-decorator/gtk-window-decorator.h 2011-05-20 16:52:31 +0000 |
298 | +++ gtk/window-decorator/gtk-window-decorator.h 2011-05-20 16:52:31 +0000 |
299 | @@ -459,9 +459,8 @@ |
300 | struct _default_frame_references |
301 | { |
302 | char *name; |
303 | - decor_t *active_d; |
304 | - decor_t *inactive_d; |
305 | -} extern default_frames[WINDOW_TYPE_FRAMES_NUM]; |
306 | + decor_t *d; |
307 | +} extern default_frames[WINDOW_TYPE_FRAMES_NUM * 2]; |
308 | const gchar * window_type_frames[WINDOW_TYPE_FRAMES_NUM]; |
309 | |
310 | void (*theme_draw_window_decoration) (decor_t *d); |
311 | |
312 | === modified file 'gtk/window-decorator/wnck.c' |
313 | --- gtk/window-decorator/wnck.c 2011-05-20 16:52:31 +0000 |
314 | +++ gtk/window-decorator/wnck.c 2011-05-20 16:52:31 +0000 |
315 | @@ -690,19 +690,19 @@ |
316 | GList *windows; |
317 | |
318 | g_signal_connect_object (G_OBJECT (screen), "active_window_changed", |
319 | - G_CALLBACK (active_window_changed), |
320 | - 0, 0); |
321 | + G_CALLBACK (active_window_changed), |
322 | + 0, 0); |
323 | g_signal_connect_object (G_OBJECT (screen), "window_opened", |
324 | - G_CALLBACK (window_opened), |
325 | - 0, 0); |
326 | + G_CALLBACK (window_opened), |
327 | + 0, 0); |
328 | g_signal_connect_object (G_OBJECT (screen), "window_closed", |
329 | - G_CALLBACK (window_closed), |
330 | - 0, 0); |
331 | + G_CALLBACK (window_closed), |
332 | + 0, 0); |
333 | |
334 | windows = wnck_screen_get_windows (screen); |
335 | while (windows != NULL) |
336 | { |
337 | - window_opened (screen, windows->data); |
338 | - windows = windows->next; |
339 | + window_opened (screen, windows->data); |
340 | + windows = windows->next; |
341 | } |
342 | } |
343 | |
344 | === modified file 'include/decoration.h' |
345 | --- include/decoration.h 2011-05-20 16:52:31 +0000 |
346 | +++ include/decoration.h 2011-05-20 16:52:31 +0000 |
347 | @@ -38,7 +38,6 @@ |
348 | |
349 | #define DECOR_SUPPORTING_DM_CHECK_ATOM_NAME "_COMPIZ_SUPPORTING_DM_CHECK" |
350 | #define DECOR_BARE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_BARE" |
351 | -#define DECOR_NORMAL_ATOM_NAME "_COMPIZ_WINDOW_DECOR_NORMAL" |
352 | #define DECOR_ACTIVE_ATOM_NAME "_COMPIZ_WINDOW_DECOR_ACTIVE" |
353 | #define DECOR_WINDOW_ATOM_NAME "_COMPIZ_WINDOW_DECOR" |
354 | #define DECOR_BLUR_ATOM_NAME "_COMPIZ_WM_WINDOW_BLUR_DECOR" |
355 | |
356 | === modified file 'kde/window-decorator-kde4/decorator.cpp' |
357 | --- kde/window-decorator-kde4/decorator.cpp 2011-05-20 16:52:31 +0000 |
358 | +++ kde/window-decorator-kde4/decorator.cpp 2011-05-20 16:52:31 +0000 |
359 | @@ -63,6 +63,10 @@ |
360 | WId KWD::Decorator::mActiveId; |
361 | decor_shadow_options_t KWD::Decorator::mShadowOptions; |
362 | |
363 | +KWD::Window *KWD::Decorator::mDecorNormal = NULL; |
364 | +KWD::Window *KWD::Decorator::mDecorActive = NULL; |
365 | +KWD::Decorator *KWD::Decorator::mSelf = NULL; |
366 | + |
367 | struct _cursor cursors[3][3] = { |
368 | { C (top_left_corner), C (top_side), C (top_right_corner) }, |
369 | { C (left_side), C (left_ptr), C (right_side) }, |
370 | @@ -88,6 +92,8 @@ |
371 | XSetWindowAttributes attr; |
372 | int i, j; |
373 | |
374 | + mSelf = this; |
375 | + |
376 | mRootInfo = new NETRootInfo (QX11Info::display (), 0); |
377 | |
378 | mActiveId = 0; |
379 | @@ -192,9 +198,10 @@ |
380 | |
381 | updateShadow (); |
382 | |
383 | + /* FIXME: Implement proper decoration lists and remove this */ |
384 | mDecorNormal = new KWD::Window (mCompositeWindow, |
385 | - QX11Info::appRootWindow (), |
386 | - 0, Window::Default); |
387 | + QX11Info::appRootWindow (), |
388 | + 0, Window::Default); |
389 | mDecorActive = new KWD::Window (mCompositeWindow, |
390 | QX11Info::appRootWindow (), |
391 | 0, Window::DefaultActive); |
392 | |
393 | === modified file 'kde/window-decorator-kde4/decorator.h' |
394 | --- kde/window-decorator-kde4/decorator.h 2010-08-20 15:29:13 +0000 |
395 | +++ kde/window-decorator-kde4/decorator.h 2011-05-20 16:52:31 +0000 |
396 | @@ -108,6 +108,21 @@ |
397 | return &mShadowOptions; |
398 | } |
399 | |
400 | + static KWD::Window *defaultNormal () |
401 | + { |
402 | + return mDecorNormal; |
403 | + } |
404 | + |
405 | + static KWD::Window *defaultActive () |
406 | + { |
407 | + return mDecorActive; |
408 | + } |
409 | + |
410 | + static KWD::Decorator *self () |
411 | + { |
412 | + return mSelf; |
413 | + } |
414 | + |
415 | static void sendClientMessage (WId eventWid, |
416 | WId wid, |
417 | Atom atom, |
418 | @@ -152,8 +167,8 @@ |
419 | static NETRootInfo *mRootInfo; |
420 | static WId mActiveId; |
421 | |
422 | - KWD::Window *mDecorNormal; |
423 | - KWD::Window *mDecorActive; |
424 | + static KWD::Window *mDecorNormal; |
425 | + static KWD::Window *mDecorActive; |
426 | QMap <WId, KWD::Window *>mClients; |
427 | QMap <WId, KWD::Window *>mFrames; |
428 | KConfig *mConfig; |
429 | @@ -162,6 +177,8 @@ |
430 | WId mCompositeWindow; |
431 | |
432 | Switcher *mSwitcher; |
433 | + |
434 | + static KWD::Decorator *mSelf; /* XXX: Remove */ |
435 | }; |
436 | } |
437 | |
438 | |
439 | === modified file 'kde/window-decorator-kde4/utils.cpp' |
440 | --- kde/window-decorator-kde4/utils.cpp 2010-10-24 14:42:07 +0000 |
441 | +++ kde/window-decorator-kde4/utils.cpp 2011-05-20 16:52:31 +0000 |
442 | @@ -221,8 +221,6 @@ |
443 | compizShadowColor = |
444 | XInternAtom (xdisplay, "_COMPIZ_NET_CM_SHADOW_COLOR", false); |
445 | netWindowDecor = XInternAtom (xdisplay, DECOR_WINDOW_ATOM_NAME, false); |
446 | - netWindowDecorNormal = |
447 | - XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, false); |
448 | netWindowDecorActive = |
449 | XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, false); |
450 | netWindowDecorBare = |
451 | |
452 | === modified file 'kde/window-decorator-kde4/window.cpp' |
453 | --- kde/window-decorator-kde4/window.cpp 2011-05-20 16:52:31 +0000 |
454 | +++ kde/window-decorator-kde4/window.cpp 2011-05-20 16:52:31 +0000 |
455 | @@ -185,6 +185,8 @@ |
456 | { |
457 | if (mType == DefaultActive) |
458 | return true; |
459 | + else if (mType == Default) |
460 | + return false; |
461 | |
462 | return Decorator::activeId () == mClientId; |
463 | } |
464 | @@ -1004,7 +1006,30 @@ |
465 | if (mPaintRedirector) |
466 | mUpdateProperty = true; |
467 | else |
468 | - updateProperty (); |
469 | + { |
470 | + long *data = NULL; |
471 | + unsigned int propSize = 0; |
472 | + KWD::Window *otherUpdate = NULL; |
473 | + |
474 | + if (mType == Default || mType == DefaultActive) |
475 | + { |
476 | + propSize = 2; |
477 | + data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP); |
478 | + |
479 | + if (mType == Default) |
480 | + otherUpdate = KWD::Decorator::self ()->defaultActive (); |
481 | + else if (mType == DefaultActive) |
482 | + otherUpdate = KWD::Decorator::self ()->defaultNormal (); |
483 | + } |
484 | + |
485 | + data = updateProperty (data, propSize); |
486 | + |
487 | + if (otherUpdate && data) |
488 | + { |
489 | + otherUpdate->updateProperty (data, propSize); |
490 | + free (data); |
491 | + } |
492 | + } |
493 | } |
494 | |
495 | void |
496 | @@ -1111,22 +1136,50 @@ |
497 | } |
498 | } |
499 | |
500 | -void |
501 | -KWD::Window::updateProperty (void) |
502 | +long * |
503 | +KWD::Window::updateProperty (long *data, |
504 | + unsigned int propSize) |
505 | { |
506 | Atom atom = Atoms::netWindowDecor; |
507 | decor_extents_t maxExtents, normExtents; |
508 | decor_quad_t quads[N_QUADS_MAX]; |
509 | + unsigned int nOffset = 1; |
510 | + unsigned int frameType = 0xffffff; |
511 | + unsigned int frameState = 0; |
512 | + unsigned int frameActions = 0; |
513 | int nQuad = 0; |
514 | - unsigned int nOffset = 1, frameType = 0, frameState = 0, frameActions = 0; |
515 | - long *data = NULL; |
516 | int left, right, top, bottom, width, height; |
517 | unsigned int saveState; |
518 | - |
519 | - if (mType == Default) |
520 | - atom = Atoms::netWindowDecorNormal; |
521 | - else if (mType == DefaultActive) |
522 | - atom = Atoms::netWindowDecorActive; |
523 | + bool allocated = false; |
524 | + |
525 | + if (!propSize) |
526 | + propSize = nOffset; |
527 | + |
528 | + /* FIXME: This is essentially a hack to put the default |
529 | + * active and inactive decorations in the same property, |
530 | + * since we take an existing allocated property and return |
531 | + * the data in there and then pass it to the next KWD::Window |
532 | + * to update the property again. That's sub-optimal, but |
533 | + * its the best solution until we implement proper decoration |
534 | + * lists inside of kde4-window-decorator */ |
535 | + |
536 | + if (mType != Normal && mType != Normal2D) |
537 | + { |
538 | + atom = Atoms::netWindowDecorActive; |
539 | + |
540 | + if (mType == Default) |
541 | + { |
542 | + frameState &= ~(DECOR_WINDOW_STATE_FOCUS); |
543 | + nOffset = 2; |
544 | + } |
545 | + else if (mType == DefaultActive) |
546 | + { |
547 | + frameState |= DECOR_WINDOW_STATE_FOCUS; |
548 | + nOffset = 1; |
549 | + } |
550 | + } |
551 | + else if (!propSize) |
552 | + propSize = nOffset; |
553 | |
554 | saveState = mState; |
555 | mState = NET::MaxVert | NET::MaxHoriz; |
556 | @@ -1148,7 +1201,11 @@ |
557 | |
558 | if (mType != Normal2D) |
559 | { |
560 | - data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); |
561 | + if (!data) |
562 | + { |
563 | + allocated = true; |
564 | + data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP); |
565 | + } |
566 | if (mType == Normal) |
567 | { |
568 | decor_quad_t *q = quads; |
569 | @@ -1246,7 +1303,11 @@ |
570 | } |
571 | else |
572 | { |
573 | - data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_WINDOW); |
574 | + if (!data) |
575 | + { |
576 | + allocated = true; |
577 | + data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP); |
578 | + } |
579 | decor_gen_window_property (data, nOffset - 1, &normExtents, &maxExtents, 1, 0, frameType, frameState, frameActions); |
580 | } |
581 | |
582 | @@ -1254,12 +1315,18 @@ |
583 | XChangeProperty (QX11Info::display(), mClientId, atom, |
584 | XA_INTEGER, |
585 | 32, PropModeReplace, (unsigned char *) data, |
586 | - PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); |
587 | + PROP_HEADER_SIZE + propSize * (BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX)); |
588 | KWD::popXError (); |
589 | |
590 | - free (data); |
591 | + if (allocated) |
592 | + { |
593 | + free (data); |
594 | + data = NULL; |
595 | + } |
596 | |
597 | mUpdateProperty = false; |
598 | + |
599 | + return data; |
600 | } |
601 | |
602 | void |
603 | @@ -1874,7 +1941,30 @@ |
604 | } |
605 | |
606 | if (mUpdateProperty) |
607 | - updateProperty (); |
608 | + { |
609 | + long *data = NULL; |
610 | + unsigned int propSize = 0; |
611 | + KWD::Window *otherUpdate = NULL; |
612 | + |
613 | + if (mType == Default || mType == DefaultActive) |
614 | + { |
615 | + propSize = 2; |
616 | + data = decor_alloc_property (propSize, WINDOW_DECORATION_TYPE_PIXMAP); |
617 | + |
618 | + if (mType == Default) |
619 | + otherUpdate = KWD::Decorator::self ()->defaultActive (); |
620 | + else if (mType == DefaultActive) |
621 | + otherUpdate = KWD::Decorator::self ()->defaultNormal (); |
622 | + } |
623 | + |
624 | + data = updateProperty (data, propSize); |
625 | + |
626 | + if (otherUpdate && data) |
627 | + { |
628 | + otherUpdate->updateProperty (data, propSize); |
629 | + free (data); |
630 | + } |
631 | + } |
632 | } |
633 | |
634 | QWidget * |
635 | |
636 | === modified file 'kde/window-decorator-kde4/window.h' |
637 | --- kde/window-decorator-kde4/window.h 2010-02-12 20:11:21 +0000 |
638 | +++ kde/window-decorator-kde4/window.h 2011-05-20 16:52:31 +0000 |
639 | @@ -206,7 +206,7 @@ |
640 | int bottomOffset, |
641 | int leftOffset, |
642 | int rightOffset); |
643 | - void updateProperty (void); |
644 | + long * updateProperty (long *, unsigned int); |
645 | void getWindowProtocols (void); |
646 | |
647 | Options::MouseCommand buttonToCommand (Qt::MouseButtons button); |
648 | |
649 | === modified file 'plugins/decor/src/decor.cpp' |
650 | --- plugins/decor/src/decor.cpp 2011-05-20 16:52:31 +0000 |
651 | +++ plugins/decor/src/decor.cpp 2011-05-20 16:52:31 +0000 |
652 | @@ -558,6 +558,12 @@ |
653 | decoration->maxBorder.top = maxBorder.top; |
654 | decoration->maxBorder.bottom = maxBorder.bottom; |
655 | |
656 | + /* Decoration info */ |
657 | + |
658 | + decoration->frameType = frameType; |
659 | + decoration->frameState = frameState; |
660 | + decoration->frameActions = frameActions; |
661 | + |
662 | decoration->refCount = 1; |
663 | decoration->type = type; |
664 | |
665 | @@ -645,7 +651,7 @@ |
666 | Decoration *d = Decoration::create (id, prop, n, type, i); |
667 | |
668 | if (!d) |
669 | - { |
670 | + { |
671 | XFree (data); |
672 | mList.clear (); |
673 | return false; |
674 | @@ -1067,10 +1073,7 @@ |
675 | !(dScreen->dmSupports & WINDOW_DECORATION_TYPE_WINDOW && |
676 | pixmapFailed)) |
677 | { |
678 | - if (window->id () == screen->activeWindow ()) |
679 | - decoration = dScreen->decor[DECOR_ACTIVE].findMatchingDecoration (window, false); |
680 | - else |
681 | - decoration = dScreen->decor[DECOR_NORMAL].findMatchingDecoration (window, false); |
682 | + decoration = dScreen->decor[DECOR_ACTIVE].findMatchingDecoration (window, false); |
683 | |
684 | if (!decoration) |
685 | compLogMessage ("decor", CompLogLevelWarn, "No default decoration found, placement will not be correct"); |
686 | @@ -2218,9 +2221,7 @@ |
687 | winDecorAtom = |
688 | XInternAtom (s->dpy (), DECOR_WINDOW_ATOM_NAME, 0); |
689 | decorAtom[DECOR_BARE] = |
690 | - XInternAtom (s->dpy (), DECOR_BARE_ATOM_NAME, 0); |
691 | - decorAtom[DECOR_NORMAL] = |
692 | - XInternAtom (s->dpy (), DECOR_NORMAL_ATOM_NAME, 0); |
693 | + XInternAtom (s->dpy (), DECOR_BARE_ATOM_NAME, 0); |
694 | decorAtom[DECOR_ACTIVE] = |
695 | XInternAtom (s->dpy (), DECOR_ACTIVE_ATOM_NAME, 0); |
696 | inputFrameAtom = |
697 | |
698 | === modified file 'plugins/decor/src/decor.h' |
699 | --- plugins/decor/src/decor.h 2011-05-20 16:52:31 +0000 |
700 | +++ plugins/decor/src/decor.h 2011-05-20 16:52:31 +0000 |
701 | @@ -45,9 +45,8 @@ |
702 | |
703 | /* FIXME: Remove */ |
704 | #define DECOR_BARE 0 |
705 | -#define DECOR_NORMAL 1 |
706 | -#define DECOR_ACTIVE 2 |
707 | -#define DECOR_NUM 3 |
708 | +#define DECOR_ACTIVE 1 |
709 | +#define DECOR_NUM 2 |
710 | |
711 | class DecorTexture { |
712 |
+1 code looks good