Merge lp:~smspillaz/compiz-core/compiz-core.fix_930071 into lp:compiz-core

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 2996
Proposed branch: lp:~smspillaz/compiz-core/compiz-core.fix_930071
Merge into: lp:compiz-core
Diff against target: 180 lines (+36/-33)
2 files modified
gtk/window-decorator/events.c (+1/-9)
gtk/window-decorator/wnck.c (+35/-24)
To merge this branch: bzr merge lp:~smspillaz/compiz-core/compiz-core.fix_930071
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Review via email: mp+92434@code.launchpad.net

Description of the change

Fixes LP #930071

There's a race condition in gtk-window-decorator that would cause some windows to be updated before the decoration was fully realized

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

LGTM (Although most of the diff is unrelated tidy-up)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/window-decorator/events.c'
2--- gtk/window-decorator/events.c 2011-10-13 12:22:14 +0000
3+++ gtk/window-decorator/events.c 2012-02-10 10:30:27 +0000
4@@ -885,14 +885,12 @@
5 GdkEvent *event,
6 gpointer data)
7 {
8- Display *xdisplay;
9 GdkDisplay *gdkdisplay;
10 XEvent *xevent = gdkxevent;
11 gulong xid = 0;
12 Window select = 0;
13
14 gdkdisplay = gdk_display_get_default ();
15- xdisplay = GDK_DISPLAY_XDISPLAY (gdkdisplay);
16
17 switch (xevent->type) {
18 case CreateNotify:
19@@ -1018,13 +1016,7 @@
20 }
21 else
22 {
23- gwd_decor_frame_unref (d->frame);
24- d->frame = NULL;
25-
26- gdk_error_trap_push ();
27- XDeleteProperty (xdisplay, xid, win_decor_atom);
28- gdk_display_sync (gdk_display_get_default ());
29- gdk_error_trap_pop ();
30+ remove_frame_window (win);
31 }
32 }
33 }
34
35=== modified file 'gtk/window-decorator/wnck.c'
36--- gtk/window-decorator/wnck.c 2011-10-13 09:53:38 +0000
37+++ gtk/window-decorator/wnck.c 2012-02-10 10:30:27 +0000
38@@ -588,25 +588,28 @@
39 if (d && d->pixmap)
40 {
41 d->active = wnck_window_is_active (win);
42+
43+ decor_frame_t *frame = d->decorated ? d->frame : gwd_get_decor_frame (get_frame_type (win));
44+
45 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
46 {
47 if (!d->frame_window)
48 {
49 if (d->active)
50 {
51- d->context = &d->frame->max_window_context_active;
52- d->shadow = d->frame->max_border_shadow_active;
53+ d->context = &frame->max_window_context_active;
54+ d->shadow = frame->max_border_shadow_active;
55 }
56 else
57 {
58- d->context = &d->frame->max_window_context_inactive;
59- d->shadow = d->frame->max_border_shadow_inactive;
60+ d->context = &frame->max_window_context_inactive;
61+ d->shadow = frame->max_border_shadow_inactive;
62 }
63- }
64- else
65- {
66+ }
67+ else
68+ {
69 d->shadow = d->frame->max_border_no_shadow;
70- }
71+ }
72 }
73 else
74 {
75@@ -614,13 +617,13 @@
76 {
77 if (d->active)
78 {
79- d->context = &d->frame->window_context_active;
80- d->shadow = d->frame->border_shadow_active;
81+ d->context = &frame->window_context_active;
82+ d->shadow = frame->border_shadow_active;
83 }
84 else
85 {
86- d->context = &d->frame->window_context_inactive;
87- d->shadow = d->frame->border_shadow_inactive;
88+ d->context = &frame->window_context_inactive;
89+ d->shadow = frame->border_shadow_inactive;
90 }
91 }
92 else
93@@ -629,13 +632,16 @@
94 }
95 }
96
97+ if (!d->decorated)
98+ gwd_decor_frame_unref (frame);
99+
100 /* We need to update the decoration size here
101 * since the shadow size might have changed and
102 * in that case the decoration will be redrawn,
103 * however if the shadow size doesn't change
104 * then we need to redraw the decoration anyways
105 * since the image would have changed */
106- if (!update_window_decoration_size (d->win))
107+ if (!update_window_decoration_size (d->win) && d->decorated)
108 queue_decor_draw (d);
109
110 }
111@@ -649,24 +655,26 @@
112 {
113 d->active = wnck_window_is_active (win);
114
115+ decor_frame_t *frame = d->decorated ? d->frame : gwd_get_decor_frame (get_frame_type (win));
116+
117 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
118 {
119 if (!d->frame_window)
120 {
121 if (d->active)
122 {
123- d->context = &d->frame->max_window_context_active;
124- d->shadow = d->frame->max_border_shadow_active;
125+ d->context = &frame->max_window_context_active;
126+ d->shadow = frame->max_border_shadow_active;
127 }
128 else
129 {
130- d->context = &d->frame->max_window_context_inactive;
131- d->shadow = d->frame->max_border_shadow_inactive;
132+ d->context = &frame->max_window_context_inactive;
133+ d->shadow = frame->max_border_shadow_inactive;
134 }
135 }
136 else
137 {
138- d->shadow = d->frame->max_border_no_shadow;
139+ d->shadow = frame->max_border_no_shadow;
140 }
141 }
142 else
143@@ -675,28 +683,31 @@
144 {
145 if (d->active)
146 {
147- d->context = &d->frame->window_context_active;
148- d->shadow = d->frame->border_shadow_active;
149+ d->context = &frame->window_context_active;
150+ d->shadow = frame->border_shadow_active;
151 }
152 else
153 {
154- d->context = &d->frame->window_context_inactive;
155- d->shadow = d->frame->border_shadow_inactive;
156+ d->context = &frame->window_context_inactive;
157+ d->shadow = frame->border_shadow_inactive;
158 }
159 }
160 else
161 {
162- d->shadow = d->frame->border_no_shadow;
163+ d->shadow = frame->border_no_shadow;
164 }
165 }
166
167+ if (!d->decorated)
168+ gwd_decor_frame_unref (frame);
169+
170 /* We need to update the decoration size here
171 * since the shadow size might have changed and
172 * in that case the decoration will be redrawn,
173 * however if the shadow size doesn't change
174 * then we need to redraw the decoration anyways
175 * since the image would have changed */
176- if (!update_window_decoration_size (d->win))
177+ if (!update_window_decoration_size (d->win) && d->decorated)
178 queue_decor_draw (d);
179
180 }

Subscribers

People subscribed via source and target branches