Merge lp:~muktupavels/compiz/gwd-cleanup into lp:compiz/0.9.12
- gwd-cleanup
- Merge into 0.9.12
Proposed by
Alberts Muktupāvels
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 4064 |
Merged at revision: | 4055 |
Proposed branch: | lp:~muktupavels/compiz/gwd-cleanup |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gwd-meta-frame-type-from-string-removed |
Diff against target: |
644 lines (+175/-223) 8 files modified
gtk/window-decorator/CMakeLists.txt (+0/-1) gtk/window-decorator/decorator.c (+6/-9) gtk/window-decorator/decorprops.c (+0/-173) gtk/window-decorator/frames.c (+0/-2) gtk/window-decorator/gtk-window-decorator.h (+0/-10) gtk/window-decorator/gwd-theme-cairo.c (+112/-17) gtk/window-decorator/gwd-theme-metacity.c (+2/-11) gtk/window-decorator/switcher.c (+55/-0) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gwd-cleanup |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Approve | ||
Review via email: mp+296768@code.launchpad.net |
Commit message
gtk-window-
Description of the change
To post a comment you must log in.
- 4061. By Alberts Muktupāvels
-
Remove also gdk_flush.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : | # |
- 4062. By Alberts Muktupāvels
-
Use function to get titlebar height in GWDThemeCairo.
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote : | # |
Updated.
- 4063. By Alberts Muktupāvels
-
Add back gdk_flush and gdk_display_sync.
- 4064. By Alberts Muktupāvels
-
Use existing variable.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : | # |
Great, thanks :)
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/CMakeLists.txt' | |||
2 | --- gtk/window-decorator/CMakeLists.txt 2016-05-21 11:06:24 +0000 | |||
3 | +++ gtk/window-decorator/CMakeLists.txt 2016-06-09 14:54:36 +0000 | |||
4 | @@ -66,7 +66,6 @@ | |||
5 | 66 | add_executable (gtk-window-decorator | 66 | add_executable (gtk-window-decorator |
6 | 67 | gtk-window-decorator.c | 67 | gtk-window-decorator.c |
7 | 68 | blurprops.c | 68 | blurprops.c |
8 | 69 | decorprops.c | ||
9 | 70 | cairo.c | 69 | cairo.c |
10 | 71 | frames.c | 70 | frames.c |
11 | 72 | gdk.c | 71 | gdk.c |
12 | 73 | 72 | ||
13 | === modified file 'gtk/window-decorator/decorator.c' | |||
14 | --- gtk/window-decorator/decorator.c 2016-05-26 21:20:20 +0000 | |||
15 | +++ gtk/window-decorator/decorator.c 2016-06-09 14:54:36 +0000 | |||
16 | @@ -583,7 +583,7 @@ | |||
17 | 583 | gdk_flush (); | 583 | gdk_flush (); |
18 | 584 | 584 | ||
19 | 585 | /* Handle failure */ | 585 | /* Handle failure */ |
21 | 586 | if (!surface || gdk_error_trap_pop ()) | 586 | if (gdk_error_trap_pop () || !surface) |
22 | 587 | { | 587 | { |
23 | 588 | if (surface) | 588 | if (surface) |
24 | 589 | cairo_surface_destroy (surface); | 589 | cairo_surface_destroy (surface); |
25 | @@ -597,7 +597,7 @@ | |||
26 | 597 | gdk_flush (); | 597 | gdk_flush (); |
27 | 598 | 598 | ||
28 | 599 | /* Handle failure */ | 599 | /* Handle failure */ |
30 | 600 | if (!buffer_surface || gdk_error_trap_pop ()) | 600 | if (gdk_error_trap_pop () || !buffer_surface) |
31 | 601 | { | 601 | { |
32 | 602 | if (buffer_surface) | 602 | if (buffer_surface) |
33 | 603 | cairo_surface_destroy (buffer_surface); | 603 | cairo_surface_destroy (buffer_surface); |
34 | @@ -846,13 +846,13 @@ | |||
35 | 846 | 1, 1, | 846 | 1, 1, |
36 | 847 | frame->win_extents.left, | 847 | frame->win_extents.left, |
37 | 848 | frame->win_extents.right, | 848 | frame->win_extents.right, |
39 | 849 | frame->win_extents.top + frame->titlebar_height, | 849 | frame->win_extents.top, |
40 | 850 | frame->win_extents.bottom, | 850 | frame->win_extents.bottom, |
41 | 851 | frame->win_extents.left - | 851 | frame->win_extents.left - |
42 | 852 | TRANSLUCENT_CORNER_SIZE, | 852 | TRANSLUCENT_CORNER_SIZE, |
43 | 853 | frame->win_extents.right - | 853 | frame->win_extents.right - |
44 | 854 | TRANSLUCENT_CORNER_SIZE, | 854 | TRANSLUCENT_CORNER_SIZE, |
46 | 855 | frame->win_extents.top + frame->titlebar_height - | 855 | frame->win_extents.top - |
47 | 856 | TRANSLUCENT_CORNER_SIZE, | 856 | TRANSLUCENT_CORNER_SIZE, |
48 | 857 | frame->win_extents.bottom - | 857 | frame->win_extents.bottom - |
49 | 858 | TRANSLUCENT_CORNER_SIZE, | 858 | TRANSLUCENT_CORNER_SIZE, |
50 | @@ -877,12 +877,11 @@ | |||
51 | 877 | 1, 1, | 877 | 1, 1, |
52 | 878 | frame->max_win_extents.left, | 878 | frame->max_win_extents.left, |
53 | 879 | frame->max_win_extents.right, | 879 | frame->max_win_extents.right, |
55 | 880 | frame->max_win_extents.top + frame->max_titlebar_height, | 880 | frame->max_win_extents.top, |
56 | 881 | frame->max_win_extents.bottom, | 881 | frame->max_win_extents.bottom, |
57 | 882 | frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE, | 882 | frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE, |
58 | 883 | frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE, | 883 | frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE, |
61 | 884 | frame->max_win_extents.top + frame->max_titlebar_height - | 884 | frame->max_win_extents.top - TRANSLUCENT_CORNER_SIZE, |
60 | 885 | TRANSLUCENT_CORNER_SIZE, | ||
62 | 886 | frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE, | 885 | frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE, |
63 | 887 | opt_no_shadow, /* No shadow when maximized */ | 886 | opt_no_shadow, /* No shadow when maximized */ |
64 | 888 | context_max, | 887 | context_max, |
65 | @@ -1328,8 +1327,6 @@ | |||
66 | 1328 | default_frames[i].d->frame = frame; | 1327 | default_frames[i].d->frame = frame; |
67 | 1329 | default_frames[i].d->active = i < WINDOW_TYPE_FRAMES_NUM ? TRUE : FALSE; | 1328 | default_frames[i].d->active = i < WINDOW_TYPE_FRAMES_NUM ? TRUE : FALSE; |
68 | 1330 | 1329 | ||
69 | 1331 | extents.top += frame->titlebar_height; | ||
70 | 1332 | |||
71 | 1333 | default_frames[i].d->draw = draw_window_decoration; | 1330 | default_frames[i].d->draw = draw_window_decoration; |
72 | 1334 | default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width, | 1331 | default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width, |
73 | 1335 | default_frames[i].d->height, | 1332 | default_frames[i].d->height, |
74 | 1336 | 1333 | ||
75 | === removed file 'gtk/window-decorator/decorprops.c' | |||
76 | --- gtk/window-decorator/decorprops.c 2016-05-26 19:52:15 +0000 | |||
77 | +++ gtk/window-decorator/decorprops.c 1970-01-01 00:00:00 +0000 | |||
78 | @@ -1,173 +0,0 @@ | |||
79 | 1 | /* | ||
80 | 2 | * Copyright © 2006 Novell, Inc. | ||
81 | 3 | * | ||
82 | 4 | * This library is free software; you can redistribute it and/or | ||
83 | 5 | * modify it under the terms of the GNU Lesser General Public | ||
84 | 6 | * License as published by the Free Software Foundation; either | ||
85 | 7 | * version 2 of the License, or (at your option) any later version. | ||
86 | 8 | * | ||
87 | 9 | * This library is distributed in the hope that it will be useful, | ||
88 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
89 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
90 | 12 | * Lesser General Public License for more details. | ||
91 | 13 | * | ||
92 | 14 | * You should have received a copy of the GNU Lesser General Public | ||
93 | 15 | * License along with this library; if not, write to the | ||
94 | 16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
95 | 17 | * Boston, MA 02111-1307, USA. | ||
96 | 18 | * | ||
97 | 19 | * Author: David Reveman <davidr@novell.com> | ||
98 | 20 | * | ||
99 | 21 | * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com> | ||
100 | 22 | * Frames Management: Copright © 2011 Canonical Ltd. | ||
101 | 23 | * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> | ||
102 | 24 | */ | ||
103 | 25 | |||
104 | 26 | #include "gtk-window-decorator.h" | ||
105 | 27 | |||
106 | 28 | void | ||
107 | 29 | decor_update_window_property (decor_t *d) | ||
108 | 30 | { | ||
109 | 31 | long *data; | ||
110 | 32 | Display *xdisplay = | ||
111 | 33 | GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
112 | 34 | decor_extents_t extents = d->frame->win_extents; | ||
113 | 35 | gint nQuad; | ||
114 | 36 | unsigned int nOffset = 1; | ||
115 | 37 | unsigned int frame_type = populate_frame_type (d); | ||
116 | 38 | unsigned int frame_state = populate_frame_state (d); | ||
117 | 39 | unsigned int frame_actions = populate_frame_actions (d); | ||
118 | 40 | decor_quad_t quads[N_QUADS_MAX]; | ||
119 | 41 | int w, h; | ||
120 | 42 | gint stretch_offset; | ||
121 | 43 | REGION top, bottom, left, right; | ||
122 | 44 | |||
123 | 45 | w = d->border_layout.top.x2 - d->border_layout.top.x1 - | ||
124 | 46 | d->context->left_space - d->context->right_space; | ||
125 | 47 | |||
126 | 48 | if (d->border_layout.rotation) | ||
127 | 49 | h = d->border_layout.left.x2 - d->border_layout.left.x1; | ||
128 | 50 | else | ||
129 | 51 | h = d->border_layout.left.y2 - d->border_layout.left.y1; | ||
130 | 52 | |||
131 | 53 | stretch_offset = w - d->button_width - 1; | ||
132 | 54 | |||
133 | 55 | nQuad = decor_set_lSrStXbS_window_quads (quads, d->context, | ||
134 | 56 | &d->border_layout, | ||
135 | 57 | stretch_offset); | ||
136 | 58 | |||
137 | 59 | extents.top += d->frame->titlebar_height; | ||
138 | 60 | |||
139 | 61 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | ||
140 | 62 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | ||
141 | 63 | &extents, &extents, | ||
142 | 64 | &extents, &extents, | ||
143 | 65 | ICON_SPACE + d->button_width, | ||
144 | 66 | 0, | ||
145 | 67 | quads, nQuad, frame_type, frame_state, frame_actions); | ||
146 | 68 | |||
147 | 69 | gdk_error_trap_push (); | ||
148 | 70 | XChangeProperty (xdisplay, d->prop_xid, | ||
149 | 71 | win_decor_atom, | ||
150 | 72 | XA_INTEGER, | ||
151 | 73 | 32, PropModeReplace, (guchar *) data, | ||
152 | 74 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); | ||
153 | 75 | gdk_display_sync (gdk_display_get_default ()); | ||
154 | 76 | gdk_error_trap_pop_ignored (); | ||
155 | 77 | |||
156 | 78 | top.rects = &top.extents; | ||
157 | 79 | top.numRects = top.size = 1; | ||
158 | 80 | |||
159 | 81 | top.extents.x1 = -extents.left; | ||
160 | 82 | top.extents.y1 = -extents.top; | ||
161 | 83 | top.extents.x2 = w + extents.right; | ||
162 | 84 | top.extents.y2 = 0; | ||
163 | 85 | |||
164 | 86 | bottom.rects = &bottom.extents; | ||
165 | 87 | bottom.numRects = bottom.size = 1; | ||
166 | 88 | |||
167 | 89 | bottom.extents.x1 = -extents.left; | ||
168 | 90 | bottom.extents.y1 = 0; | ||
169 | 91 | bottom.extents.x2 = w + extents.right; | ||
170 | 92 | bottom.extents.y2 = extents.bottom; | ||
171 | 93 | |||
172 | 94 | left.rects = &left.extents; | ||
173 | 95 | left.numRects = left.size = 1; | ||
174 | 96 | |||
175 | 97 | left.extents.x1 = -extents.left; | ||
176 | 98 | left.extents.y1 = 0; | ||
177 | 99 | left.extents.x2 = 0; | ||
178 | 100 | left.extents.y2 = h; | ||
179 | 101 | |||
180 | 102 | right.rects = &right.extents; | ||
181 | 103 | right.numRects = right.size = 1; | ||
182 | 104 | |||
183 | 105 | right.extents.x1 = 0; | ||
184 | 106 | right.extents.y1 = 0; | ||
185 | 107 | right.extents.x2 = extents.right; | ||
186 | 108 | right.extents.y2 = h; | ||
187 | 109 | |||
188 | 110 | decor_update_blur_property (d, | ||
189 | 111 | w, h, | ||
190 | 112 | &top, stretch_offset, | ||
191 | 113 | &bottom, w / 2, | ||
192 | 114 | &left, h / 2, | ||
193 | 115 | &right, h / 2); | ||
194 | 116 | |||
195 | 117 | free (data); | ||
196 | 118 | } | ||
197 | 119 | |||
198 | 120 | void | ||
199 | 121 | decor_update_switcher_property (decor_t *d) | ||
200 | 122 | { | ||
201 | 123 | long *data; | ||
202 | 124 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
203 | 125 | gint nQuad; | ||
204 | 126 | decor_quad_t quads[N_QUADS_MAX]; | ||
205 | 127 | unsigned int nOffset = 1; | ||
206 | 128 | unsigned int frame_type = populate_frame_type (d); | ||
207 | 129 | unsigned int frame_state = populate_frame_state (d); | ||
208 | 130 | unsigned int frame_actions = populate_frame_actions (d); | ||
209 | 131 | GtkStyleContext *context; | ||
210 | 132 | GdkRGBA fg; | ||
211 | 133 | long fgColor[4]; | ||
212 | 134 | |||
213 | 135 | nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active, | ||
214 | 136 | &d->border_layout, | ||
215 | 137 | d->border_layout.top.x2 - | ||
216 | 138 | d->border_layout.top.x1 - | ||
217 | 139 | d->frame->window_context_active.extents.left - | ||
218 | 140 | d->frame->window_context_active.extents.right - | ||
219 | 141 | 32); | ||
220 | 142 | |||
221 | 143 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | ||
222 | 144 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | ||
223 | 145 | &d->frame->win_extents, &d->frame->win_extents, | ||
224 | 146 | &d->frame->win_extents, &d->frame->win_extents, | ||
225 | 147 | 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); | ||
226 | 148 | |||
227 | 149 | context = gtk_widget_get_style_context (d->frame->style_window_rgba); | ||
228 | 150 | |||
229 | 151 | gtk_style_context_save (context); | ||
230 | 152 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | ||
231 | 153 | gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg); | ||
232 | 154 | gtk_style_context_restore (context); | ||
233 | 155 | |||
234 | 156 | fgColor[0] = fg.red; | ||
235 | 157 | fgColor[1] = fg.green; | ||
236 | 158 | fgColor[2] = fg.blue; | ||
237 | 159 | fgColor[3] = SWITCHER_ALPHA; | ||
238 | 160 | |||
239 | 161 | gdk_error_trap_push (); | ||
240 | 162 | XChangeProperty (xdisplay, d->prop_xid, | ||
241 | 163 | win_decor_atom, | ||
242 | 164 | XA_INTEGER, | ||
243 | 165 | 32, PropModeReplace, (guchar *) data, | ||
244 | 166 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); | ||
245 | 167 | XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom, | ||
246 | 168 | XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4); | ||
247 | 169 | gdk_display_sync (gdk_display_get_default ()); | ||
248 | 170 | gdk_error_trap_pop_ignored (); | ||
249 | 171 | |||
250 | 172 | free (data); | ||
251 | 173 | } | ||
252 | 174 | 0 | ||
253 | === modified file 'gtk/window-decorator/frames.c' | |||
254 | --- gtk/window-decorator/frames.c 2016-06-01 11:29:21 +0000 | |||
255 | +++ gtk/window-decorator/frames.c 2016-06-09 14:54:36 +0000 | |||
256 | @@ -437,8 +437,6 @@ | |||
257 | 437 | 437 | ||
258 | 438 | frame->type = strdup (type); | 438 | frame->type = strdup (type); |
259 | 439 | frame->refcount = 0; | 439 | frame->refcount = 0; |
260 | 440 | frame->titlebar_height = 17; | ||
261 | 441 | frame->max_titlebar_height = 17; | ||
262 | 442 | frame->border_shadow_active = NULL; | 440 | frame->border_shadow_active = NULL; |
263 | 443 | frame->border_shadow_inactive = NULL; | 441 | frame->border_shadow_inactive = NULL; |
264 | 444 | frame->max_border_shadow_active = NULL; | 442 | frame->max_border_shadow_active = NULL; |
265 | 445 | 443 | ||
266 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' | |||
267 | --- gtk/window-decorator/gtk-window-decorator.h 2016-06-09 14:54:36 +0000 | |||
268 | +++ gtk/window-decorator/gtk-window-decorator.h 2016-06-09 14:54:36 +0000 | |||
269 | @@ -209,8 +209,6 @@ | |||
270 | 209 | struct _decor_frame { | 209 | struct _decor_frame { |
271 | 210 | decor_extents_t win_extents; | 210 | decor_extents_t win_extents; |
272 | 211 | decor_extents_t max_win_extents; | 211 | decor_extents_t max_win_extents; |
273 | 212 | int titlebar_height; | ||
274 | 213 | int max_titlebar_height; | ||
275 | 214 | decor_shadow_t *border_shadow_active; | 212 | decor_shadow_t *border_shadow_active; |
276 | 215 | decor_shadow_t *border_shadow_inactive; | 213 | decor_shadow_t *border_shadow_inactive; |
277 | 216 | decor_shadow_t *max_border_shadow_active; | 214 | decor_shadow_t *max_border_shadow_active; |
278 | @@ -442,14 +440,6 @@ | |||
279 | 442 | Region right_region, | 440 | Region right_region, |
280 | 443 | int right_offset); | 441 | int right_offset); |
281 | 444 | 442 | ||
282 | 445 | /* decorprops.c */ | ||
283 | 446 | |||
284 | 447 | void | ||
285 | 448 | decor_update_window_property (decor_t *d); | ||
286 | 449 | |||
287 | 450 | void | ||
288 | 451 | decor_update_switcher_property (decor_t *d); | ||
289 | 452 | |||
290 | 453 | /* cairo.c */ | 443 | /* cairo.c */ |
291 | 454 | 444 | ||
292 | 455 | #define CORNER_TOPLEFT (1 << 0) | 445 | #define CORNER_TOPLEFT (1 << 0) |
293 | 456 | 446 | ||
294 | === modified file 'gtk/window-decorator/gwd-theme-cairo.c' | |||
295 | --- gtk/window-decorator/gwd-theme-cairo.c 2016-05-26 19:52:15 +0000 | |||
296 | +++ gtk/window-decorator/gwd-theme-cairo.c 2016-06-09 14:54:36 +0000 | |||
297 | @@ -38,6 +38,96 @@ | |||
298 | 38 | 38 | ||
299 | 39 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) | 39 | G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME) |
300 | 40 | 40 | ||
301 | 41 | static gint | ||
302 | 42 | get_titlebar_height (decor_frame_t *frame) | ||
303 | 43 | { | ||
304 | 44 | return frame->text_height < 17 ? 17 : frame->text_height; | ||
305 | 45 | } | ||
306 | 46 | |||
307 | 47 | static void | ||
308 | 48 | decor_update_window_property (decor_t *d) | ||
309 | 49 | { | ||
310 | 50 | GdkDisplay *display = gdk_display_get_default (); | ||
311 | 51 | Display *xdisplay = gdk_x11_display_get_xdisplay (display); | ||
312 | 52 | decor_extents_t extents = d->frame->win_extents; | ||
313 | 53 | unsigned int nOffset = 1; | ||
314 | 54 | unsigned int frame_type = populate_frame_type (d); | ||
315 | 55 | unsigned int frame_state = populate_frame_state (d); | ||
316 | 56 | unsigned int frame_actions = populate_frame_actions (d); | ||
317 | 57 | long *data; | ||
318 | 58 | gint nQuad; | ||
319 | 59 | decor_quad_t quads[N_QUADS_MAX]; | ||
320 | 60 | int w, h; | ||
321 | 61 | gint stretch_offset; | ||
322 | 62 | REGION top, bottom, left, right; | ||
323 | 63 | |||
324 | 64 | w = d->border_layout.top.x2 - d->border_layout.top.x1 - | ||
325 | 65 | d->context->left_space - d->context->right_space; | ||
326 | 66 | |||
327 | 67 | if (d->border_layout.rotation) | ||
328 | 68 | h = d->border_layout.left.x2 - d->border_layout.left.x1; | ||
329 | 69 | else | ||
330 | 70 | h = d->border_layout.left.y2 - d->border_layout.left.y1; | ||
331 | 71 | |||
332 | 72 | stretch_offset = w - d->button_width - 1; | ||
333 | 73 | |||
334 | 74 | nQuad = decor_set_lSrStXbS_window_quads (quads, d->context, | ||
335 | 75 | &d->border_layout, | ||
336 | 76 | stretch_offset); | ||
337 | 77 | |||
338 | 78 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | ||
339 | 79 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | ||
340 | 80 | &extents, &extents, | ||
341 | 81 | &extents, &extents, | ||
342 | 82 | ICON_SPACE + d->button_width, | ||
343 | 83 | 0, | ||
344 | 84 | quads, nQuad, frame_type, frame_state, frame_actions); | ||
345 | 85 | |||
346 | 86 | gdk_error_trap_push (); | ||
347 | 87 | XChangeProperty (xdisplay, d->prop_xid, win_decor_atom, XA_INTEGER, | ||
348 | 88 | 32, PropModeReplace, (guchar *) data, | ||
349 | 89 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); | ||
350 | 90 | gdk_display_sync (display); | ||
351 | 91 | gdk_error_trap_pop_ignored (); | ||
352 | 92 | |||
353 | 93 | top.rects = &top.extents; | ||
354 | 94 | top.numRects = top.size = 1; | ||
355 | 95 | |||
356 | 96 | top.extents.x1 = -extents.left; | ||
357 | 97 | top.extents.y1 = -extents.top; | ||
358 | 98 | top.extents.x2 = w + extents.right; | ||
359 | 99 | top.extents.y2 = 0; | ||
360 | 100 | |||
361 | 101 | bottom.rects = &bottom.extents; | ||
362 | 102 | bottom.numRects = bottom.size = 1; | ||
363 | 103 | |||
364 | 104 | bottom.extents.x1 = -extents.left; | ||
365 | 105 | bottom.extents.y1 = 0; | ||
366 | 106 | bottom.extents.x2 = w + extents.right; | ||
367 | 107 | bottom.extents.y2 = extents.bottom; | ||
368 | 108 | |||
369 | 109 | left.rects = &left.extents; | ||
370 | 110 | left.numRects = left.size = 1; | ||
371 | 111 | |||
372 | 112 | left.extents.x1 = -extents.left; | ||
373 | 113 | left.extents.y1 = 0; | ||
374 | 114 | left.extents.x2 = 0; | ||
375 | 115 | left.extents.y2 = h; | ||
376 | 116 | |||
377 | 117 | right.rects = &right.extents; | ||
378 | 118 | right.numRects = right.size = 1; | ||
379 | 119 | |||
380 | 120 | right.extents.x1 = 0; | ||
381 | 121 | right.extents.y1 = 0; | ||
382 | 122 | right.extents.x2 = extents.right; | ||
383 | 123 | right.extents.y2 = h; | ||
384 | 124 | |||
385 | 125 | decor_update_blur_property (d, w, h, &top, stretch_offset, | ||
386 | 126 | &bottom, w / 2, &left, h / 2, &right, h / 2); | ||
387 | 127 | |||
388 | 128 | free (data); | ||
389 | 129 | } | ||
390 | 130 | |||
391 | 41 | static void | 131 | static void |
392 | 42 | button_state_offsets (gdouble x, | 132 | button_state_offsets (gdouble x, |
393 | 43 | gdouble y, | 133 | gdouble y, |
394 | @@ -243,6 +333,7 @@ | |||
395 | 243 | gint corners = SHADE_LEFT | SHADE_RIGHT | SHADE_TOP | SHADE_BOTTOM; | 333 | gint corners = SHADE_LEFT | SHADE_RIGHT | SHADE_TOP | SHADE_BOTTOM; |
396 | 244 | gint top; | 334 | gint top; |
397 | 245 | gint button_x; | 335 | gint button_x; |
398 | 336 | gint titlebar_height; | ||
399 | 246 | 337 | ||
400 | 247 | if (!decor->surface) | 338 | if (!decor->surface) |
401 | 248 | return; | 339 | return; |
402 | @@ -275,10 +366,10 @@ | |||
403 | 275 | 366 | ||
404 | 276 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); | 367 | cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); |
405 | 277 | 368 | ||
407 | 278 | top = decor->frame->win_extents.top + decor->frame->titlebar_height; | 369 | top = decor->frame->win_extents.top; |
408 | 279 | 370 | ||
409 | 280 | x1 = decor->context->left_space - decor->frame->win_extents.left; | 371 | x1 = decor->context->left_space - decor->frame->win_extents.left; |
411 | 281 | y1 = decor->context->top_space - decor->frame->win_extents.top - decor->frame->titlebar_height; | 372 | y1 = decor->context->top_space - decor->frame->win_extents.top; |
412 | 282 | x2 = decor->width - decor->context->right_space + decor->frame->win_extents.right; | 373 | x2 = decor->width - decor->context->right_space + decor->frame->win_extents.right; |
413 | 283 | y2 = decor->height - decor->context->bottom_space + decor->frame->win_extents.bottom; | 374 | y2 = decor->height - decor->context->bottom_space + decor->frame->win_extents.bottom; |
414 | 284 | 375 | ||
415 | @@ -474,10 +565,11 @@ | |||
416 | 474 | cairo_set_line_width (cr, 2.0); | 565 | cairo_set_line_width (cr, 2.0); |
417 | 475 | 566 | ||
418 | 476 | button_x = decor->width - decor->context->right_space - 13; | 567 | button_x = decor->width - decor->context->right_space - 13; |
419 | 568 | titlebar_height = get_titlebar_height (decor->frame); | ||
420 | 477 | 569 | ||
421 | 478 | if (decor->actions & WNCK_WINDOW_ACTION_CLOSE) { | 570 | if (decor->actions & WNCK_WINDOW_ACTION_CLOSE) { |
422 | 479 | button_state_offsets (button_x, | 571 | button_state_offsets (button_x, |
424 | 480 | y1 - 3.0 + decor->frame->titlebar_height / 2, | 572 | y1 - 3.0 + titlebar_height / 2, |
425 | 481 | decor->button_states[BUTTON_CLOSE], &x, &y); | 573 | decor->button_states[BUTTON_CLOSE], &x, &y); |
426 | 482 | 574 | ||
427 | 483 | button_x -= 17; | 575 | button_x -= 17; |
428 | @@ -499,7 +591,7 @@ | |||
429 | 499 | 591 | ||
430 | 500 | if (decor->actions & WNCK_WINDOW_ACTION_MAXIMIZE) { | 592 | if (decor->actions & WNCK_WINDOW_ACTION_MAXIMIZE) { |
431 | 501 | button_state_offsets (button_x, | 593 | button_state_offsets (button_x, |
433 | 502 | y1 - 3.0 + decor->frame->titlebar_height / 2, | 594 | y1 - 3.0 + titlebar_height / 2, |
434 | 503 | decor->button_states[BUTTON_MAX], &x, &y); | 595 | decor->button_states[BUTTON_MAX], &x, &y); |
435 | 504 | 596 | ||
436 | 505 | button_x -= 17; | 597 | button_x -= 17; |
437 | @@ -538,7 +630,7 @@ | |||
438 | 538 | 630 | ||
439 | 539 | if (decor->actions & WNCK_WINDOW_ACTION_MINIMIZE) { | 631 | if (decor->actions & WNCK_WINDOW_ACTION_MINIMIZE) { |
440 | 540 | button_state_offsets (button_x, | 632 | button_state_offsets (button_x, |
442 | 541 | y1 - 3.0 + decor->frame->titlebar_height / 2, | 633 | y1 - 3.0 + titlebar_height / 2, |
443 | 542 | decor->button_states[BUTTON_MIN], &x, &y); | 634 | decor->button_states[BUTTON_MIN], &x, &y); |
444 | 543 | 635 | ||
445 | 544 | button_x -= 17; | 636 | button_x -= 17; |
446 | @@ -565,7 +657,7 @@ | |||
447 | 565 | if (decor->active) { | 657 | if (decor->active) { |
448 | 566 | cairo_move_to (cr, | 658 | cairo_move_to (cr, |
449 | 567 | decor->context->left_space + 21.0, | 659 | decor->context->left_space + 21.0, |
451 | 568 | y1 + 2.0 + (decor->frame->titlebar_height - decor->frame->text_height) / 2.0); | 660 | y1 + 2.0 + (titlebar_height - decor->frame->text_height) / 2.0); |
452 | 569 | 661 | ||
453 | 570 | fg.alpha = STROKE_ALPHA; | 662 | fg.alpha = STROKE_ALPHA; |
454 | 571 | gdk_cairo_set_source_rgba (cr, &fg); | 663 | gdk_cairo_set_source_rgba (cr, &fg); |
455 | @@ -581,7 +673,7 @@ | |||
456 | 581 | 673 | ||
457 | 582 | cairo_move_to (cr, | 674 | cairo_move_to (cr, |
458 | 583 | decor->context->left_space + 21.0, | 675 | decor->context->left_space + 21.0, |
460 | 584 | y1 + 2.0 + (decor->frame->titlebar_height - decor->frame->text_height) / 2.0); | 676 | y1 + 2.0 + (titlebar_height - decor->frame->text_height) / 2.0); |
461 | 585 | 677 | ||
462 | 586 | pango_cairo_show_layout (cr, decor->layout); | 678 | pango_cairo_show_layout (cr, decor->layout); |
463 | 587 | } | 679 | } |
464 | @@ -589,7 +681,7 @@ | |||
465 | 589 | if (decor->icon) { | 681 | if (decor->icon) { |
466 | 590 | cairo_translate (cr, | 682 | cairo_translate (cr, |
467 | 591 | decor->context->left_space + 1, | 683 | decor->context->left_space + 1, |
469 | 592 | y1 - 5.0 + decor->frame->titlebar_height / 2); | 684 | y1 - 5.0 + titlebar_height / 2); |
470 | 593 | cairo_set_source (cr, decor->icon); | 685 | cairo_set_source (cr, decor->icon); |
471 | 594 | cairo_rectangle (cr, 0.0, 0.0, 16.0, 16.0); | 686 | cairo_rectangle (cr, 0.0, 0.0, 16.0, 16.0); |
472 | 595 | cairo_clip (cr); | 687 | cairo_clip (cr); |
473 | @@ -669,15 +761,16 @@ | |||
474 | 669 | { | 761 | { |
475 | 670 | decor_extents_t win_extents = { 6, 6, 10, 6 }; | 762 | decor_extents_t win_extents = { 6, 6, 10, 6 }; |
476 | 671 | decor_extents_t max_win_extents = { 6, 6, 4, 6 }; | 763 | decor_extents_t max_win_extents = { 6, 6, 4, 6 }; |
477 | 764 | gint titlebar_height = get_titlebar_height (frame); | ||
478 | 672 | 765 | ||
479 | 673 | frame = gwd_decor_frame_ref (frame); | 766 | frame = gwd_decor_frame_ref (frame); |
480 | 674 | 767 | ||
481 | 768 | win_extents.top += titlebar_height; | ||
482 | 769 | max_win_extents.top += titlebar_height; | ||
483 | 770 | |||
484 | 675 | frame->win_extents = win_extents; | 771 | frame->win_extents = win_extents; |
485 | 676 | frame->max_win_extents = max_win_extents; | 772 | frame->max_win_extents = max_win_extents; |
486 | 677 | 773 | ||
487 | 678 | frame->titlebar_height = frame->max_titlebar_height = | ||
488 | 679 | (frame->text_height < 17) ? 17 : frame->text_height; | ||
489 | 680 | |||
490 | 681 | gwd_decor_frame_unref (frame); | 774 | gwd_decor_frame_unref (frame); |
491 | 682 | } | 775 | } |
492 | 683 | 776 | ||
493 | @@ -693,9 +786,11 @@ | |||
494 | 693 | gint *w, | 786 | gint *w, |
495 | 694 | gint *h) | 787 | gint *h) |
496 | 695 | { | 788 | { |
497 | 789 | gint titlebar_height = get_titlebar_height (decor->frame); | ||
498 | 790 | |||
499 | 696 | *x = pos[i][j].x + pos[i][j].xw * width; | 791 | *x = pos[i][j].x + pos[i][j].xw * width; |
500 | 697 | *y = pos[i][j].y + | 792 | *y = pos[i][j].y + |
502 | 698 | pos[i][j].yh * height + pos[i][j].yth * (decor->frame->titlebar_height - 17); | 793 | pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17); |
503 | 699 | 794 | ||
504 | 700 | if ((decor->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) && (j == 0 || j == 2)) { | 795 | if ((decor->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) && (j == 0 || j == 2)) { |
505 | 701 | *w = 0; | 796 | *w = 0; |
506 | @@ -707,7 +802,7 @@ | |||
507 | 707 | *h = 0; | 802 | *h = 0; |
508 | 708 | } else { | 803 | } else { |
509 | 709 | *h = pos[i][j].h + | 804 | *h = pos[i][j].h + |
511 | 710 | pos[i][j].hh * height + pos[i][j].hth * (decor->frame->titlebar_height - 17); | 805 | pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17); |
512 | 711 | } | 806 | } |
513 | 712 | } | 807 | } |
514 | 713 | 808 | ||
515 | @@ -722,16 +817,16 @@ | |||
516 | 722 | gint *w, | 817 | gint *w, |
517 | 723 | gint *h) | 818 | gint *h) |
518 | 724 | { | 819 | { |
519 | 820 | gint titlebar_height = get_titlebar_height (decor->frame); | ||
520 | 821 | |||
521 | 725 | if (i > BUTTON_MENU) | 822 | if (i > BUTTON_MENU) |
522 | 726 | return FALSE; | 823 | return FALSE; |
523 | 727 | 824 | ||
524 | 728 | *x = bpos[i].x + bpos[i].xw * width; | 825 | *x = bpos[i].x + bpos[i].xw * width; |
527 | 729 | *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * | 826 | *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * (titlebar_height - 17); |
526 | 730 | (decor->frame->titlebar_height - 17); | ||
528 | 731 | 827 | ||
529 | 732 | *w = bpos[i].w + bpos[i].ww * width; | 828 | *w = bpos[i].w + bpos[i].ww * width; |
532 | 733 | *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth + | 829 | *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth + (titlebar_height - 17); |
531 | 734 | (decor->frame->titlebar_height - 17); | ||
533 | 735 | 830 | ||
534 | 736 | /* hack to position multiple buttons on the right */ | 831 | /* hack to position multiple buttons on the right */ |
535 | 737 | if (i != BUTTON_MENU) { | 832 | if (i != BUTTON_MENU) { |
536 | 738 | 833 | ||
537 | === modified file 'gtk/window-decorator/gwd-theme-metacity.c' | |||
538 | --- gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 14:54:36 +0000 | |||
539 | +++ gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 14:54:36 +0000 | |||
540 | @@ -662,11 +662,6 @@ | |||
541 | 662 | left_stretch_offset, right_stretch_offset, | 662 | left_stretch_offset, right_stretch_offset, |
542 | 663 | top_stretch_offset, bottom_stretch_offset); | 663 | top_stretch_offset, bottom_stretch_offset); |
543 | 664 | 664 | ||
544 | 665 | win_extents.top += d->frame->titlebar_height; | ||
545 | 666 | frame_win_extents.top += d->frame->titlebar_height; | ||
546 | 667 | max_win_extents.top += d->frame->max_titlebar_height; | ||
547 | 668 | frame_max_win_extents.top += d->frame->max_titlebar_height; | ||
548 | 669 | |||
549 | 670 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | 665 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); |
550 | 671 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | 666 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), |
551 | 672 | &frame_win_extents, &win_extents, | 667 | &frame_win_extents, &win_extents, |
552 | @@ -1183,24 +1178,20 @@ | |||
553 | 1183 | meta_theme_get_frame_borders (metacity->theme, style_info, frame_type, | 1178 | meta_theme_get_frame_borders (metacity->theme, style_info, frame_type, |
554 | 1184 | frame->text_height, 0, &borders); | 1179 | frame->text_height, 0, &borders); |
555 | 1185 | 1180 | ||
557 | 1186 | frame->win_extents.top = frame->win_extents.top; | 1181 | frame->win_extents.top = borders.visible.top; |
558 | 1187 | frame->win_extents.bottom = borders.visible.bottom; | 1182 | frame->win_extents.bottom = borders.visible.bottom; |
559 | 1188 | frame->win_extents.left = borders.visible.left; | 1183 | frame->win_extents.left = borders.visible.left; |
560 | 1189 | frame->win_extents.right = borders.visible.right; | 1184 | frame->win_extents.right = borders.visible.right; |
561 | 1190 | 1185 | ||
562 | 1191 | frame->titlebar_height = borders.visible.top - frame->win_extents.top; | ||
563 | 1192 | |||
564 | 1193 | meta_theme_get_frame_borders (metacity->theme, style_info, frame_type, | 1186 | meta_theme_get_frame_borders (metacity->theme, style_info, frame_type, |
565 | 1194 | frame->text_height, META_FRAME_MAXIMIZED, | 1187 | frame->text_height, META_FRAME_MAXIMIZED, |
566 | 1195 | &borders); | 1188 | &borders); |
567 | 1196 | 1189 | ||
569 | 1197 | frame->max_win_extents.top = frame->win_extents.top; | 1190 | frame->max_win_extents.top = borders.visible.top; |
570 | 1198 | frame->max_win_extents.bottom = borders.visible.bottom; | 1191 | frame->max_win_extents.bottom = borders.visible.bottom; |
571 | 1199 | frame->max_win_extents.left = borders.visible.left; | 1192 | frame->max_win_extents.left = borders.visible.left; |
572 | 1200 | frame->max_win_extents.right = borders.visible.right; | 1193 | frame->max_win_extents.right = borders.visible.right; |
573 | 1201 | 1194 | ||
574 | 1202 | frame->max_titlebar_height = borders.visible.top - frame->max_win_extents.top; | ||
575 | 1203 | |||
576 | 1204 | meta_style_info_unref (style_info); | 1195 | meta_style_info_unref (style_info); |
577 | 1205 | 1196 | ||
578 | 1206 | gwd_decor_frame_unref (frame); | 1197 | gwd_decor_frame_unref (frame); |
579 | 1207 | 1198 | ||
580 | === modified file 'gtk/window-decorator/switcher.c' | |||
581 | --- gtk/window-decorator/switcher.c 2016-05-26 20:11:19 +0000 | |||
582 | +++ gtk/window-decorator/switcher.c 2016-06-09 14:54:36 +0000 | |||
583 | @@ -27,6 +27,61 @@ | |||
584 | 27 | 27 | ||
585 | 28 | #define SWITCHER_SPACE 40 | 28 | #define SWITCHER_SPACE 40 |
586 | 29 | 29 | ||
587 | 30 | static void | ||
588 | 31 | decor_update_switcher_property (decor_t *d) | ||
589 | 32 | { | ||
590 | 33 | long *data; | ||
591 | 34 | Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); | ||
592 | 35 | gint nQuad; | ||
593 | 36 | decor_quad_t quads[N_QUADS_MAX]; | ||
594 | 37 | unsigned int nOffset = 1; | ||
595 | 38 | unsigned int frame_type = populate_frame_type (d); | ||
596 | 39 | unsigned int frame_state = populate_frame_state (d); | ||
597 | 40 | unsigned int frame_actions = populate_frame_actions (d); | ||
598 | 41 | GtkStyleContext *context; | ||
599 | 42 | GdkRGBA fg; | ||
600 | 43 | long fgColor[4]; | ||
601 | 44 | |||
602 | 45 | nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active, | ||
603 | 46 | &d->border_layout, | ||
604 | 47 | d->border_layout.top.x2 - | ||
605 | 48 | d->border_layout.top.x1 - | ||
606 | 49 | d->frame->window_context_active.extents.left - | ||
607 | 50 | d->frame->window_context_active.extents.right - | ||
608 | 51 | 32); | ||
609 | 52 | |||
610 | 53 | data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP); | ||
611 | 54 | decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface), | ||
612 | 55 | &d->frame->win_extents, &d->frame->win_extents, | ||
613 | 56 | &d->frame->win_extents, &d->frame->win_extents, | ||
614 | 57 | 0, 0, quads, nQuad, frame_type, frame_state, frame_actions); | ||
615 | 58 | |||
616 | 59 | context = gtk_widget_get_style_context (d->frame->style_window_rgba); | ||
617 | 60 | |||
618 | 61 | gtk_style_context_save (context); | ||
619 | 62 | gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL); | ||
620 | 63 | gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg); | ||
621 | 64 | gtk_style_context_restore (context); | ||
622 | 65 | |||
623 | 66 | fgColor[0] = fg.red; | ||
624 | 67 | fgColor[1] = fg.green; | ||
625 | 68 | fgColor[2] = fg.blue; | ||
626 | 69 | fgColor[3] = SWITCHER_ALPHA; | ||
627 | 70 | |||
628 | 71 | gdk_error_trap_push (); | ||
629 | 72 | XChangeProperty (xdisplay, d->prop_xid, | ||
630 | 73 | win_decor_atom, | ||
631 | 74 | XA_INTEGER, | ||
632 | 75 | 32, PropModeReplace, (guchar *) data, | ||
633 | 76 | PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX); | ||
634 | 77 | XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom, | ||
635 | 78 | XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4); | ||
636 | 79 | gdk_display_sync (gdk_display_get_default ()); | ||
637 | 80 | gdk_error_trap_pop_ignored (); | ||
638 | 81 | |||
639 | 82 | free (data); | ||
640 | 83 | } | ||
641 | 84 | |||
642 | 30 | decor_frame_t * | 85 | decor_frame_t * |
643 | 31 | create_switcher_frame (const gchar *type) | 86 | create_switcher_frame (const gchar *type) |
644 | 32 | { | 87 | { |
LGTM otherwise