Merge lp:~muktupavels/compiz/gwd-cleanup into lp:compiz/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
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Review via email: mp+296768@code.launchpad.net

Commit message

gtk-window-decorator: more code cleanup.

To post a comment you must log in.
lp:~muktupavels/compiz/gwd-cleanup updated
4061. By Alberts Muktupāvels

Remove also gdk_flush.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

LGTM otherwise

lp:~muktupavels/compiz/gwd-cleanup updated
4062. By Alberts Muktupāvels

Use function to get titlebar height in GWDThemeCairo.

Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

Updated.

lp:~muktupavels/compiz/gwd-cleanup 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 add_executable (gtk-window-decorator
6 gtk-window-decorator.c
7 blurprops.c
8- decorprops.c
9 cairo.c
10 frames.c
11 gdk.c
12
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 gdk_flush ();
18
19 /* Handle failure */
20- if (!surface || gdk_error_trap_pop ())
21+ if (gdk_error_trap_pop () || !surface)
22 {
23 if (surface)
24 cairo_surface_destroy (surface);
25@@ -597,7 +597,7 @@
26 gdk_flush ();
27
28 /* Handle failure */
29- if (!buffer_surface || gdk_error_trap_pop ())
30+ if (gdk_error_trap_pop () || !buffer_surface)
31 {
32 if (buffer_surface)
33 cairo_surface_destroy (buffer_surface);
34@@ -846,13 +846,13 @@
35 1, 1,
36 frame->win_extents.left,
37 frame->win_extents.right,
38- frame->win_extents.top + frame->titlebar_height,
39+ frame->win_extents.top,
40 frame->win_extents.bottom,
41 frame->win_extents.left -
42 TRANSLUCENT_CORNER_SIZE,
43 frame->win_extents.right -
44 TRANSLUCENT_CORNER_SIZE,
45- frame->win_extents.top + frame->titlebar_height -
46+ frame->win_extents.top -
47 TRANSLUCENT_CORNER_SIZE,
48 frame->win_extents.bottom -
49 TRANSLUCENT_CORNER_SIZE,
50@@ -877,12 +877,11 @@
51 1, 1,
52 frame->max_win_extents.left,
53 frame->max_win_extents.right,
54- frame->max_win_extents.top + frame->max_titlebar_height,
55+ frame->max_win_extents.top,
56 frame->max_win_extents.bottom,
57 frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
58 frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
59- frame->max_win_extents.top + frame->max_titlebar_height -
60- TRANSLUCENT_CORNER_SIZE,
61+ frame->max_win_extents.top - TRANSLUCENT_CORNER_SIZE,
62 frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
63 opt_no_shadow, /* No shadow when maximized */
64 context_max,
65@@ -1328,8 +1327,6 @@
66 default_frames[i].d->frame = frame;
67 default_frames[i].d->active = i < WINDOW_TYPE_FRAMES_NUM ? TRUE : FALSE;
68
69- extents.top += frame->titlebar_height;
70-
71 default_frames[i].d->draw = draw_window_decoration;
72 default_frames[i].d->surface = create_native_surface_and_wrap (default_frames[i].d->width,
73 default_frames[i].d->height,
74
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-/*
80- * Copyright © 2006 Novell, Inc.
81- *
82- * This library is free software; you can redistribute it and/or
83- * modify it under the terms of the GNU Lesser General Public
84- * License as published by the Free Software Foundation; either
85- * version 2 of the License, or (at your option) any later version.
86- *
87- * This library is distributed in the hope that it will be useful,
88- * but WITHOUT ANY WARRANTY; without even the implied warranty of
89- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
90- * Lesser General Public License for more details.
91- *
92- * You should have received a copy of the GNU Lesser General Public
93- * License along with this library; if not, write to the
94- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
95- * Boston, MA 02111-1307, USA.
96- *
97- * Author: David Reveman <davidr@novell.com>
98- *
99- * 2D Mode: Copyright © 2010 Sam Spilsbury <smspillaz@gmail.com>
100- * Frames Management: Copright © 2011 Canonical Ltd.
101- * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com>
102- */
103-
104-#include "gtk-window-decorator.h"
105-
106-void
107-decor_update_window_property (decor_t *d)
108-{
109- long *data;
110- Display *xdisplay =
111- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
112- decor_extents_t extents = d->frame->win_extents;
113- gint nQuad;
114- unsigned int nOffset = 1;
115- unsigned int frame_type = populate_frame_type (d);
116- unsigned int frame_state = populate_frame_state (d);
117- unsigned int frame_actions = populate_frame_actions (d);
118- decor_quad_t quads[N_QUADS_MAX];
119- int w, h;
120- gint stretch_offset;
121- REGION top, bottom, left, right;
122-
123- w = d->border_layout.top.x2 - d->border_layout.top.x1 -
124- d->context->left_space - d->context->right_space;
125-
126- if (d->border_layout.rotation)
127- h = d->border_layout.left.x2 - d->border_layout.left.x1;
128- else
129- h = d->border_layout.left.y2 - d->border_layout.left.y1;
130-
131- stretch_offset = w - d->button_width - 1;
132-
133- nQuad = decor_set_lSrStXbS_window_quads (quads, d->context,
134- &d->border_layout,
135- stretch_offset);
136-
137- extents.top += d->frame->titlebar_height;
138-
139- data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
140- decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
141- &extents, &extents,
142- &extents, &extents,
143- ICON_SPACE + d->button_width,
144- 0,
145- quads, nQuad, frame_type, frame_state, frame_actions);
146-
147- gdk_error_trap_push ();
148- XChangeProperty (xdisplay, d->prop_xid,
149- win_decor_atom,
150- XA_INTEGER,
151- 32, PropModeReplace, (guchar *) data,
152- PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
153- gdk_display_sync (gdk_display_get_default ());
154- gdk_error_trap_pop_ignored ();
155-
156- top.rects = &top.extents;
157- top.numRects = top.size = 1;
158-
159- top.extents.x1 = -extents.left;
160- top.extents.y1 = -extents.top;
161- top.extents.x2 = w + extents.right;
162- top.extents.y2 = 0;
163-
164- bottom.rects = &bottom.extents;
165- bottom.numRects = bottom.size = 1;
166-
167- bottom.extents.x1 = -extents.left;
168- bottom.extents.y1 = 0;
169- bottom.extents.x2 = w + extents.right;
170- bottom.extents.y2 = extents.bottom;
171-
172- left.rects = &left.extents;
173- left.numRects = left.size = 1;
174-
175- left.extents.x1 = -extents.left;
176- left.extents.y1 = 0;
177- left.extents.x2 = 0;
178- left.extents.y2 = h;
179-
180- right.rects = &right.extents;
181- right.numRects = right.size = 1;
182-
183- right.extents.x1 = 0;
184- right.extents.y1 = 0;
185- right.extents.x2 = extents.right;
186- right.extents.y2 = h;
187-
188- decor_update_blur_property (d,
189- w, h,
190- &top, stretch_offset,
191- &bottom, w / 2,
192- &left, h / 2,
193- &right, h / 2);
194-
195- free (data);
196-}
197-
198-void
199-decor_update_switcher_property (decor_t *d)
200-{
201- long *data;
202- Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
203- gint nQuad;
204- decor_quad_t quads[N_QUADS_MAX];
205- unsigned int nOffset = 1;
206- unsigned int frame_type = populate_frame_type (d);
207- unsigned int frame_state = populate_frame_state (d);
208- unsigned int frame_actions = populate_frame_actions (d);
209- GtkStyleContext *context;
210- GdkRGBA fg;
211- long fgColor[4];
212-
213- nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active,
214- &d->border_layout,
215- d->border_layout.top.x2 -
216- d->border_layout.top.x1 -
217- d->frame->window_context_active.extents.left -
218- d->frame->window_context_active.extents.right -
219- 32);
220-
221- data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
222- decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
223- &d->frame->win_extents, &d->frame->win_extents,
224- &d->frame->win_extents, &d->frame->win_extents,
225- 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);
226-
227- context = gtk_widget_get_style_context (d->frame->style_window_rgba);
228-
229- gtk_style_context_save (context);
230- gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
231- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
232- gtk_style_context_restore (context);
233-
234- fgColor[0] = fg.red;
235- fgColor[1] = fg.green;
236- fgColor[2] = fg.blue;
237- fgColor[3] = SWITCHER_ALPHA;
238-
239- gdk_error_trap_push ();
240- XChangeProperty (xdisplay, d->prop_xid,
241- win_decor_atom,
242- XA_INTEGER,
243- 32, PropModeReplace, (guchar *) data,
244- PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
245- XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom,
246- XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4);
247- gdk_display_sync (gdk_display_get_default ());
248- gdk_error_trap_pop_ignored ();
249-
250- free (data);
251-}
252
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
258 frame->type = strdup (type);
259 frame->refcount = 0;
260- frame->titlebar_height = 17;
261- frame->max_titlebar_height = 17;
262 frame->border_shadow_active = NULL;
263 frame->border_shadow_inactive = NULL;
264 frame->max_border_shadow_active = NULL;
265
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 struct _decor_frame {
271 decor_extents_t win_extents;
272 decor_extents_t max_win_extents;
273- int titlebar_height;
274- int max_titlebar_height;
275 decor_shadow_t *border_shadow_active;
276 decor_shadow_t *border_shadow_inactive;
277 decor_shadow_t *max_border_shadow_active;
278@@ -442,14 +440,6 @@
279 Region right_region,
280 int right_offset);
281
282-/* decorprops.c */
283-
284-void
285-decor_update_window_property (decor_t *d);
286-
287-void
288-decor_update_switcher_property (decor_t *d);
289-
290 /* cairo.c */
291
292 #define CORNER_TOPLEFT (1 << 0)
293
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
299 G_DEFINE_TYPE (GWDThemeCairo, gwd_theme_cairo, GWD_TYPE_THEME)
300
301+static gint
302+get_titlebar_height (decor_frame_t *frame)
303+{
304+ return frame->text_height < 17 ? 17 : frame->text_height;
305+}
306+
307+static void
308+decor_update_window_property (decor_t *d)
309+{
310+ GdkDisplay *display = gdk_display_get_default ();
311+ Display *xdisplay = gdk_x11_display_get_xdisplay (display);
312+ decor_extents_t extents = d->frame->win_extents;
313+ unsigned int nOffset = 1;
314+ unsigned int frame_type = populate_frame_type (d);
315+ unsigned int frame_state = populate_frame_state (d);
316+ unsigned int frame_actions = populate_frame_actions (d);
317+ long *data;
318+ gint nQuad;
319+ decor_quad_t quads[N_QUADS_MAX];
320+ int w, h;
321+ gint stretch_offset;
322+ REGION top, bottom, left, right;
323+
324+ w = d->border_layout.top.x2 - d->border_layout.top.x1 -
325+ d->context->left_space - d->context->right_space;
326+
327+ if (d->border_layout.rotation)
328+ h = d->border_layout.left.x2 - d->border_layout.left.x1;
329+ else
330+ h = d->border_layout.left.y2 - d->border_layout.left.y1;
331+
332+ stretch_offset = w - d->button_width - 1;
333+
334+ nQuad = decor_set_lSrStXbS_window_quads (quads, d->context,
335+ &d->border_layout,
336+ stretch_offset);
337+
338+ data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
339+ decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
340+ &extents, &extents,
341+ &extents, &extents,
342+ ICON_SPACE + d->button_width,
343+ 0,
344+ quads, nQuad, frame_type, frame_state, frame_actions);
345+
346+ gdk_error_trap_push ();
347+ XChangeProperty (xdisplay, d->prop_xid, win_decor_atom, XA_INTEGER,
348+ 32, PropModeReplace, (guchar *) data,
349+ PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
350+ gdk_display_sync (display);
351+ gdk_error_trap_pop_ignored ();
352+
353+ top.rects = &top.extents;
354+ top.numRects = top.size = 1;
355+
356+ top.extents.x1 = -extents.left;
357+ top.extents.y1 = -extents.top;
358+ top.extents.x2 = w + extents.right;
359+ top.extents.y2 = 0;
360+
361+ bottom.rects = &bottom.extents;
362+ bottom.numRects = bottom.size = 1;
363+
364+ bottom.extents.x1 = -extents.left;
365+ bottom.extents.y1 = 0;
366+ bottom.extents.x2 = w + extents.right;
367+ bottom.extents.y2 = extents.bottom;
368+
369+ left.rects = &left.extents;
370+ left.numRects = left.size = 1;
371+
372+ left.extents.x1 = -extents.left;
373+ left.extents.y1 = 0;
374+ left.extents.x2 = 0;
375+ left.extents.y2 = h;
376+
377+ right.rects = &right.extents;
378+ right.numRects = right.size = 1;
379+
380+ right.extents.x1 = 0;
381+ right.extents.y1 = 0;
382+ right.extents.x2 = extents.right;
383+ right.extents.y2 = h;
384+
385+ decor_update_blur_property (d, w, h, &top, stretch_offset,
386+ &bottom, w / 2, &left, h / 2, &right, h / 2);
387+
388+ free (data);
389+}
390+
391 static void
392 button_state_offsets (gdouble x,
393 gdouble y,
394@@ -243,6 +333,7 @@
395 gint corners = SHADE_LEFT | SHADE_RIGHT | SHADE_TOP | SHADE_BOTTOM;
396 gint top;
397 gint button_x;
398+ gint titlebar_height;
399
400 if (!decor->surface)
401 return;
402@@ -275,10 +366,10 @@
403
404 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
405
406- top = decor->frame->win_extents.top + decor->frame->titlebar_height;
407+ top = decor->frame->win_extents.top;
408
409 x1 = decor->context->left_space - decor->frame->win_extents.left;
410- y1 = decor->context->top_space - decor->frame->win_extents.top - decor->frame->titlebar_height;
411+ y1 = decor->context->top_space - decor->frame->win_extents.top;
412 x2 = decor->width - decor->context->right_space + decor->frame->win_extents.right;
413 y2 = decor->height - decor->context->bottom_space + decor->frame->win_extents.bottom;
414
415@@ -474,10 +565,11 @@
416 cairo_set_line_width (cr, 2.0);
417
418 button_x = decor->width - decor->context->right_space - 13;
419+ titlebar_height = get_titlebar_height (decor->frame);
420
421 if (decor->actions & WNCK_WINDOW_ACTION_CLOSE) {
422 button_state_offsets (button_x,
423- y1 - 3.0 + decor->frame->titlebar_height / 2,
424+ y1 - 3.0 + titlebar_height / 2,
425 decor->button_states[BUTTON_CLOSE], &x, &y);
426
427 button_x -= 17;
428@@ -499,7 +591,7 @@
429
430 if (decor->actions & WNCK_WINDOW_ACTION_MAXIMIZE) {
431 button_state_offsets (button_x,
432- y1 - 3.0 + decor->frame->titlebar_height / 2,
433+ y1 - 3.0 + titlebar_height / 2,
434 decor->button_states[BUTTON_MAX], &x, &y);
435
436 button_x -= 17;
437@@ -538,7 +630,7 @@
438
439 if (decor->actions & WNCK_WINDOW_ACTION_MINIMIZE) {
440 button_state_offsets (button_x,
441- y1 - 3.0 + decor->frame->titlebar_height / 2,
442+ y1 - 3.0 + titlebar_height / 2,
443 decor->button_states[BUTTON_MIN], &x, &y);
444
445 button_x -= 17;
446@@ -565,7 +657,7 @@
447 if (decor->active) {
448 cairo_move_to (cr,
449 decor->context->left_space + 21.0,
450- y1 + 2.0 + (decor->frame->titlebar_height - decor->frame->text_height) / 2.0);
451+ y1 + 2.0 + (titlebar_height - decor->frame->text_height) / 2.0);
452
453 fg.alpha = STROKE_ALPHA;
454 gdk_cairo_set_source_rgba (cr, &fg);
455@@ -581,7 +673,7 @@
456
457 cairo_move_to (cr,
458 decor->context->left_space + 21.0,
459- y1 + 2.0 + (decor->frame->titlebar_height - decor->frame->text_height) / 2.0);
460+ y1 + 2.0 + (titlebar_height - decor->frame->text_height) / 2.0);
461
462 pango_cairo_show_layout (cr, decor->layout);
463 }
464@@ -589,7 +681,7 @@
465 if (decor->icon) {
466 cairo_translate (cr,
467 decor->context->left_space + 1,
468- y1 - 5.0 + decor->frame->titlebar_height / 2);
469+ y1 - 5.0 + titlebar_height / 2);
470 cairo_set_source (cr, decor->icon);
471 cairo_rectangle (cr, 0.0, 0.0, 16.0, 16.0);
472 cairo_clip (cr);
473@@ -669,15 +761,16 @@
474 {
475 decor_extents_t win_extents = { 6, 6, 10, 6 };
476 decor_extents_t max_win_extents = { 6, 6, 4, 6 };
477+ gint titlebar_height = get_titlebar_height (frame);
478
479 frame = gwd_decor_frame_ref (frame);
480
481+ win_extents.top += titlebar_height;
482+ max_win_extents.top += titlebar_height;
483+
484 frame->win_extents = win_extents;
485 frame->max_win_extents = max_win_extents;
486
487- frame->titlebar_height = frame->max_titlebar_height =
488- (frame->text_height < 17) ? 17 : frame->text_height;
489-
490 gwd_decor_frame_unref (frame);
491 }
492
493@@ -693,9 +786,11 @@
494 gint *w,
495 gint *h)
496 {
497+ gint titlebar_height = get_titlebar_height (decor->frame);
498+
499 *x = pos[i][j].x + pos[i][j].xw * width;
500 *y = pos[i][j].y +
501- pos[i][j].yh * height + pos[i][j].yth * (decor->frame->titlebar_height - 17);
502+ pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
503
504 if ((decor->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) && (j == 0 || j == 2)) {
505 *w = 0;
506@@ -707,7 +802,7 @@
507 *h = 0;
508 } else {
509 *h = pos[i][j].h +
510- pos[i][j].hh * height + pos[i][j].hth * (decor->frame->titlebar_height - 17);
511+ pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17);
512 }
513 }
514
515@@ -722,16 +817,16 @@
516 gint *w,
517 gint *h)
518 {
519+ gint titlebar_height = get_titlebar_height (decor->frame);
520+
521 if (i > BUTTON_MENU)
522 return FALSE;
523
524 *x = bpos[i].x + bpos[i].xw * width;
525- *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth *
526- (decor->frame->titlebar_height - 17);
527+ *y = bpos[i].y + bpos[i].yh * height + bpos[i].yth * (titlebar_height - 17);
528
529 *w = bpos[i].w + bpos[i].ww * width;
530- *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth +
531- (decor->frame->titlebar_height - 17);
532+ *h = bpos[i].h + bpos[i].hh * height + bpos[i].hth + (titlebar_height - 17);
533
534 /* hack to position multiple buttons on the right */
535 if (i != BUTTON_MENU) {
536
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 left_stretch_offset, right_stretch_offset,
542 top_stretch_offset, bottom_stretch_offset);
543
544- win_extents.top += d->frame->titlebar_height;
545- frame_win_extents.top += d->frame->titlebar_height;
546- max_win_extents.top += d->frame->max_titlebar_height;
547- frame_max_win_extents.top += d->frame->max_titlebar_height;
548-
549 data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
550 decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
551 &frame_win_extents, &win_extents,
552@@ -1183,24 +1178,20 @@
553 meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
554 frame->text_height, 0, &borders);
555
556- frame->win_extents.top = frame->win_extents.top;
557+ frame->win_extents.top = borders.visible.top;
558 frame->win_extents.bottom = borders.visible.bottom;
559 frame->win_extents.left = borders.visible.left;
560 frame->win_extents.right = borders.visible.right;
561
562- frame->titlebar_height = borders.visible.top - frame->win_extents.top;
563-
564 meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
565 frame->text_height, META_FRAME_MAXIMIZED,
566 &borders);
567
568- frame->max_win_extents.top = frame->win_extents.top;
569+ frame->max_win_extents.top = borders.visible.top;
570 frame->max_win_extents.bottom = borders.visible.bottom;
571 frame->max_win_extents.left = borders.visible.left;
572 frame->max_win_extents.right = borders.visible.right;
573
574- frame->max_titlebar_height = borders.visible.top - frame->max_win_extents.top;
575-
576 meta_style_info_unref (style_info);
577
578 gwd_decor_frame_unref (frame);
579
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
585 #define SWITCHER_SPACE 40
586
587+static void
588+decor_update_switcher_property (decor_t *d)
589+{
590+ long *data;
591+ Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
592+ gint nQuad;
593+ decor_quad_t quads[N_QUADS_MAX];
594+ unsigned int nOffset = 1;
595+ unsigned int frame_type = populate_frame_type (d);
596+ unsigned int frame_state = populate_frame_state (d);
597+ unsigned int frame_actions = populate_frame_actions (d);
598+ GtkStyleContext *context;
599+ GdkRGBA fg;
600+ long fgColor[4];
601+
602+ nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context_active,
603+ &d->border_layout,
604+ d->border_layout.top.x2 -
605+ d->border_layout.top.x1 -
606+ d->frame->window_context_active.extents.left -
607+ d->frame->window_context_active.extents.right -
608+ 32);
609+
610+ data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
611+ decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
612+ &d->frame->win_extents, &d->frame->win_extents,
613+ &d->frame->win_extents, &d->frame->win_extents,
614+ 0, 0, quads, nQuad, frame_type, frame_state, frame_actions);
615+
616+ context = gtk_widget_get_style_context (d->frame->style_window_rgba);
617+
618+ gtk_style_context_save (context);
619+ gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
620+ gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
621+ gtk_style_context_restore (context);
622+
623+ fgColor[0] = fg.red;
624+ fgColor[1] = fg.green;
625+ fgColor[2] = fg.blue;
626+ fgColor[3] = SWITCHER_ALPHA;
627+
628+ gdk_error_trap_push ();
629+ XChangeProperty (xdisplay, d->prop_xid,
630+ win_decor_atom,
631+ XA_INTEGER,
632+ 32, PropModeReplace, (guchar *) data,
633+ PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
634+ XChangeProperty (xdisplay, d->prop_xid, switcher_fg_atom,
635+ XA_INTEGER, 32, PropModeReplace, (guchar *) fgColor, 4);
636+ gdk_display_sync (gdk_display_get_default ());
637+ gdk_error_trap_pop_ignored ();
638+
639+ free (data);
640+}
641+
642 decor_frame_t *
643 create_switcher_frame (const gchar *type)
644 {

Subscribers

People subscribed via source and target branches