Merge lp:~muktupavels/compiz/gwd-spring-cleaning into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Stephen M. Webb
Approved revision: 3946
Merged at revision: 3957
Proposed branch: lp:~muktupavels/compiz/gwd-spring-cleaning
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~muktupavels/compiz/gwd-don-t-unref-wnck-screen
Diff against target: 3709 lines (+1306/-1532)
10 files modified
gtk/window-decorator/cairo.c (+2/-0)
gtk/window-decorator/decorator.c (+75/-75)
gtk/window-decorator/events.c (+34/-7)
gtk/window-decorator/frames.c (+186/-0)
gtk/window-decorator/gtk-window-decorator.c (+0/-16)
gtk/window-decorator/gtk-window-decorator.h (+4/-174)
gtk/window-decorator/metacity.c (+995/-1054)
gtk/window-decorator/switcher.c (+7/-3)
gtk/window-decorator/util.c (+0/-200)
gtk/window-decorator/wnck.c (+3/-3)
To merge this branch: bzr merge lp:~muktupavels/compiz/gwd-spring-cleaning
Reviewer Review Type Date Requested Status
Stephen M. Webb Approve
Review via email: mp+255270@code.launchpad.net

Commit message

Spring cleaning in gtk-window-decorator.

Description of the change

* Remove unused variables
* Convert some functions to static functions
* Reformat metacity.c

To post a comment you must log in.
3946. By Alberts Muktupāvels

Fix copy&paste error.

Revision history for this message
Stephen M. Webb (bregma) wrote :

I would prefer in the future if you would not combine functional changes with trivial formatting changes, it makes it harder to review. Please submit separate merge proposals for each unrelated change.

With the above caveat this change seems OK: it builds correctly and introduces no apparent regression. I am a fan of the smallest possible public API/ABI.

I would like to hold off on merging this change until after the upcoming 0.9.12.2 release since we're currently in stabilization (bugfix only) mode and this change is more appropriate for wide-open mode at the beginning of a release cycle.

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

> I would prefer in the future if you would not combine functional changes with
> trivial formatting changes, it makes it harder to review. Please submit
> separate merge proposals for each unrelated change.
>
> With the above caveat this change seems OK: it builds correctly and
> introduces no apparent regression. I am a fan of the smallest possible public
> API/ABI.
>
> I would like to hold off on merging this change until after the upcoming
> 0.9.12.2 release since we're currently in stabilization (bugfix only) mode and
> this change is more appropriate for wide-open mode at the beginning of a
> release cycle.

Ok.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gtk/window-decorator/cairo.c'
2--- gtk/window-decorator/cairo.c 2014-08-27 18:25:30 +0000
3+++ gtk/window-decorator/cairo.c 2015-04-06 15:01:05 +0000
4@@ -26,6 +26,8 @@
5 #include "gtk-window-decorator.h"
6 #include "gwd-cairo-window-decoration-util.h"
7
8+#define STROKE_ALPHA 0.6f
9+
10 void
11 rounded_rectangle (cairo_t *cr,
12 double x,
13
14=== modified file 'gtk/window-decorator/decorator.c'
15--- gtk/window-decorator/decorator.c 2014-12-19 13:11:03 +0000
16+++ gtk/window-decorator/decorator.c 2015-04-06 15:01:05 +0000
17@@ -25,83 +25,12 @@
18
19 #include "gtk-window-decorator.h"
20
21-decor_frame_t *
22-create_normal_frame (const gchar *type)
23-{
24- decor_frame_t *frame = decor_frame_new (type);
25-
26- decor_context_t _window_context = {
27- { 0, 0, 0, 0 },
28- 6, 6, 4, 6,
29- 0, 0, 0, 0
30- };
31-
32- decor_context_t _max_window_context = {
33- { 0, 0, 0, 0 },
34- 6, 6, 4, 6,
35- 0, 0, 0, 0
36- };
37-
38- decor_context_t _window_context_no_shadow = {
39- { 0, 0, 0, 0 },
40- 6, 6, 4, 6,
41- 0, 0, 0, 0
42- };
43-
44- decor_context_t _max_window_context_no_shadow = {
45- { 0, 0, 0, 0 },
46- 6, 6, 4, 6,
47- 0, 0, 0, 0
48- };
49-
50- decor_extents_t _win_extents = { 6, 6, 6, 6 };
51- decor_extents_t _max_win_extents = { 6, 6, 4, 6 };
52-
53- frame->win_extents = _win_extents;
54- frame->max_win_extents = _max_win_extents;
55- frame->update_shadow = decor_frame_update_shadow;
56- frame->window_context_active = _window_context;
57- frame->window_context_inactive = _window_context;
58- frame->window_context_no_shadow = _window_context_no_shadow;
59- frame->max_window_context_active = _max_window_context;
60- frame->max_window_context_inactive = _max_window_context;
61- frame->max_window_context_no_shadow = _max_window_context_no_shadow;
62-
63- return frame;
64-}
65-
66 void
67 destroy_normal_frame (decor_frame_t *frame)
68 {
69 decor_frame_destroy (frame);
70 }
71
72-decor_frame_t *
73-create_bare_frame (const gchar *type)
74-{
75- decor_frame_t *frame = decor_frame_new (type);
76- decor_context_t _shadow_context = {
77- { 0, 0, 0, 0 },
78- 0, 0, 0, 0,
79- 0, 0, 0, 0,
80- };
81-
82- decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
83-
84- frame->win_extents = _shadow_extents;
85- frame->max_win_extents = _shadow_extents;
86- frame->win_extents = _shadow_extents;
87- frame->window_context_active = _shadow_context;
88- frame->window_context_inactive = _shadow_context;
89- frame->window_context_no_shadow = _shadow_context;
90- frame->max_window_context_active = _shadow_context;
91- frame->max_window_context_inactive = _shadow_context;
92- frame->max_window_context_no_shadow = _shadow_context;
93- frame->update_shadow = bare_frame_update_shadow;
94-
95- return frame;
96-}
97-
98 void
99 destroy_bare_frame (decor_frame_t *frame)
100 {
101@@ -411,7 +340,7 @@
102 * the window name using pango (with 6px padding)
103 * Returns zero if window has no name.
104 */
105-gint
106+static gint
107 max_window_name_width (WnckWindow *win)
108 {
109 decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
110@@ -453,7 +382,7 @@
111 * wnck. Also checks to see if the name has a length (slight optimization)
112 * and re-creates the pango context to re-render the name
113 */
114-void
115+static void
116 update_window_decoration_name (WnckWindow *win)
117 {
118 decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
119@@ -823,7 +752,7 @@
120 *
121 * We do something similar for the maximimzed mode as well
122 */
123-void
124+static void
125 bare_frame_update_shadow (Display *xdisplay,
126 Screen *screen,
127 decor_frame_t *frame,
128@@ -894,7 +823,7 @@
129 NULL);
130 }
131
132-void
133+static void
134 decor_frame_update_shadow (Display *xdisplay,
135 Screen *screen,
136 decor_frame_t *frame,
137@@ -1507,3 +1436,74 @@
138 cairo_set_source_surface (d->cr, d->buffer_surface, 0, 0);
139 cairo_paint (d->cr);
140 }
141+
142+decor_frame_t *
143+create_bare_frame (const gchar *type)
144+{
145+ decor_frame_t *frame = decor_frame_new (type);
146+ decor_context_t _shadow_context = {
147+ { 0, 0, 0, 0 },
148+ 0, 0, 0, 0,
149+ 0, 0, 0, 0,
150+ };
151+
152+ decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
153+
154+ frame->win_extents = _shadow_extents;
155+ frame->max_win_extents = _shadow_extents;
156+ frame->win_extents = _shadow_extents;
157+ frame->window_context_active = _shadow_context;
158+ frame->window_context_inactive = _shadow_context;
159+ frame->window_context_no_shadow = _shadow_context;
160+ frame->max_window_context_active = _shadow_context;
161+ frame->max_window_context_inactive = _shadow_context;
162+ frame->max_window_context_no_shadow = _shadow_context;
163+ frame->update_shadow = bare_frame_update_shadow;
164+
165+ return frame;
166+}
167+
168+decor_frame_t *
169+create_normal_frame (const gchar *type)
170+{
171+ decor_frame_t *frame = decor_frame_new (type);
172+
173+ decor_context_t _window_context = {
174+ { 0, 0, 0, 0 },
175+ 6, 6, 4, 6,
176+ 0, 0, 0, 0
177+ };
178+
179+ decor_context_t _max_window_context = {
180+ { 0, 0, 0, 0 },
181+ 6, 6, 4, 6,
182+ 0, 0, 0, 0
183+ };
184+
185+ decor_context_t _window_context_no_shadow = {
186+ { 0, 0, 0, 0 },
187+ 6, 6, 4, 6,
188+ 0, 0, 0, 0
189+ };
190+
191+ decor_context_t _max_window_context_no_shadow = {
192+ { 0, 0, 0, 0 },
193+ 6, 6, 4, 6,
194+ 0, 0, 0, 0
195+ };
196+
197+ decor_extents_t _win_extents = { 6, 6, 6, 6 };
198+ decor_extents_t _max_win_extents = { 6, 6, 4, 6 };
199+
200+ frame->win_extents = _win_extents;
201+ frame->max_win_extents = _max_win_extents;
202+ frame->update_shadow = decor_frame_update_shadow;
203+ frame->window_context_active = _window_context;
204+ frame->window_context_inactive = _window_context;
205+ frame->window_context_no_shadow = _window_context_no_shadow;
206+ frame->max_window_context_active = _max_window_context;
207+ frame->max_window_context_inactive = _max_window_context;
208+ frame->max_window_context_no_shadow = _max_window_context_no_shadow;
209+
210+ return frame;
211+}
212
213=== modified file 'gtk/window-decorator/events.c'
214--- gtk/window-decorator/events.c 2014-09-07 20:16:51 +0000
215+++ gtk/window-decorator/events.c 2015-04-06 15:01:05 +0000
216@@ -26,7 +26,34 @@
217 #include "gtk-window-decorator.h"
218 #include "gwd-settings-interface.h"
219
220-void
221+#define DOUBLE_CLICK_DISTANCE 8.0f
222+
223+#define WM_MOVERESIZE_SIZE_TOPLEFT 0
224+#define WM_MOVERESIZE_SIZE_TOP 1
225+#define WM_MOVERESIZE_SIZE_TOPRIGHT 2
226+#define WM_MOVERESIZE_SIZE_RIGHT 3
227+#define WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
228+#define WM_MOVERESIZE_SIZE_BOTTOM 5
229+#define WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
230+#define WM_MOVERESIZE_SIZE_LEFT 7
231+#define WM_MOVERESIZE_MOVE 8
232+#define WM_MOVERESIZE_SIZE_KEYBOARD 9
233+#define WM_MOVERESIZE_MOVE_KEYBOARD 10
234+
235+static double
236+square (double x)
237+{
238+ return x * x;
239+}
240+
241+static double
242+dist (double x1, double y1,
243+ double x2, double y2)
244+{
245+ return sqrt (square (x1 - x2) + square (y1 - y2));
246+}
247+
248+static void
249 move_resize_window (WnckWindow *win,
250 int direction,
251 decor_event *gtkwd_event)
252@@ -74,7 +101,7 @@
253 XSync (xdisplay, FALSE);
254 }
255
256-void
257+static void
258 common_button_event (WnckWindow *win,
259 decor_event *gtkwd_event,
260 decor_event_type gtkwd_type,
261@@ -392,7 +419,7 @@
262 }
263 }
264
265-void
266+static void
267 handle_title_button_event (WnckWindow *win,
268 int action,
269 decor_event *gtkwd_event)
270@@ -426,7 +453,7 @@
271 }
272 }
273
274-void
275+static void
276 handle_mouse_wheel_title_event (WnckWindow *win,
277 unsigned int button)
278 {
279@@ -526,7 +553,7 @@
280 }
281 }
282
283-void
284+static void
285 frame_common_event (WnckWindow *win,
286 int direction,
287 decor_event *gtkwd_event,
288@@ -684,7 +711,7 @@
289 }
290 }
291
292-event_callback
293+static event_callback
294 find_event_callback_for_point (decor_t *d,
295 int x,
296 int y,
297@@ -739,7 +766,7 @@
298 return NULL;
299 }
300
301-event_callback
302+static event_callback
303 find_leave_event_callback (decor_t *d)
304 {
305 int i, j;
306
307=== modified file 'gtk/window-decorator/frames.c'
308--- gtk/window-decorator/frames.c 2014-08-27 19:36:32 +0000
309+++ gtk/window-decorator/frames.c 2015-04-06 15:01:05 +0000
310@@ -31,6 +31,192 @@
311 GHashTable *frame_info_table;
312 GHashTable *frames_table;
313
314+/* from clearlooks theme */
315+static void
316+rgb_to_hls (gdouble *r,
317+ gdouble *g,
318+ gdouble *b)
319+{
320+ gdouble min;
321+ gdouble max;
322+ gdouble red;
323+ gdouble green;
324+ gdouble blue;
325+ gdouble h, l, s;
326+ gdouble delta;
327+
328+ red = *r;
329+ green = *g;
330+ blue = *b;
331+
332+ if (red > green)
333+ {
334+ if (red > blue)
335+ max = red;
336+ else
337+ max = blue;
338+
339+ if (green < blue)
340+ min = green;
341+ else
342+ min = blue;
343+ }
344+ else
345+ {
346+ if (green > blue)
347+ max = green;
348+ else
349+ max = blue;
350+
351+ if (red < blue)
352+ min = red;
353+ else
354+ min = blue;
355+ }
356+
357+ l = (max + min) / 2;
358+ s = 0;
359+ h = 0;
360+
361+ if (max != min)
362+ {
363+ if (l <= 0.5)
364+ s = (max - min) / (max + min);
365+ else
366+ s = (max - min) / (2 - max - min);
367+
368+ delta = max -min;
369+ if (red == max)
370+ h = (green - blue) / delta;
371+ else if (green == max)
372+ h = 2 + (blue - red) / delta;
373+ else if (blue == max)
374+ h = 4 + (red - green) / delta;
375+
376+ h *= 60;
377+ if (h < 0.0)
378+ h += 360;
379+ }
380+
381+ *r = h;
382+ *g = l;
383+ *b = s;
384+}
385+
386+static void
387+hls_to_rgb (gdouble *h,
388+ gdouble *l,
389+ gdouble *s)
390+{
391+ gdouble hue;
392+ gdouble lightness;
393+ gdouble saturation;
394+ gdouble m1, m2;
395+ gdouble r, g, b;
396+
397+ lightness = *l;
398+ saturation = *s;
399+
400+ if (lightness <= 0.5)
401+ m2 = lightness * (1 + saturation);
402+ else
403+ m2 = lightness + saturation - lightness * saturation;
404+
405+ m1 = 2 * lightness - m2;
406+
407+ if (saturation == 0)
408+ {
409+ *h = lightness;
410+ *l = lightness;
411+ *s = lightness;
412+ }
413+ else
414+ {
415+ hue = *h + 120;
416+ while (hue > 360)
417+ hue -= 360;
418+ while (hue < 0)
419+ hue += 360;
420+
421+ if (hue < 60)
422+ r = m1 + (m2 - m1) * hue / 60;
423+ else if (hue < 180)
424+ r = m2;
425+ else if (hue < 240)
426+ r = m1 + (m2 - m1) * (240 - hue) / 60;
427+ else
428+ r = m1;
429+
430+ hue = *h;
431+ while (hue > 360)
432+ hue -= 360;
433+ while (hue < 0)
434+ hue += 360;
435+
436+ if (hue < 60)
437+ g = m1 + (m2 - m1) * hue / 60;
438+ else if (hue < 180)
439+ g = m2;
440+ else if (hue < 240)
441+ g = m1 + (m2 - m1) * (240 - hue) / 60;
442+ else
443+ g = m1;
444+
445+ hue = *h - 120;
446+ while (hue > 360)
447+ hue -= 360;
448+ while (hue < 0)
449+ hue += 360;
450+
451+ if (hue < 60)
452+ b = m1 + (m2 - m1) * hue / 60;
453+ else if (hue < 180)
454+ b = m2;
455+ else if (hue < 240)
456+ b = m1 + (m2 - m1) * (240 - hue) / 60;
457+ else
458+ b = m1;
459+
460+ *h = r;
461+ *l = g;
462+ *s = b;
463+ }
464+}
465+
466+static void
467+shade (const decor_color_t *a,
468+ decor_color_t *b,
469+ float k)
470+{
471+ double red;
472+ double green;
473+ double blue;
474+
475+ red = a->r;
476+ green = a->g;
477+ blue = a->b;
478+
479+ rgb_to_hls (&red, &green, &blue);
480+
481+ green *= k;
482+ if (green > 1.0)
483+ green = 1.0;
484+ else if (green < 0.0)
485+ green = 0.0;
486+
487+ blue *= k;
488+ if (blue > 1.0)
489+ blue = 1.0;
490+ else if (blue < 0.0)
491+ blue = 0.0;
492+
493+ hls_to_rgb (&red, &green, &blue);
494+
495+ b->r = red;
496+ b->g = green;
497+ b->b = blue;
498+}
499+
500 static void
501 update_style (GtkWidget *widget)
502 {
503
504=== modified file 'gtk/window-decorator/gtk-window-decorator.c'
505--- gtk/window-decorator/gtk-window-decorator.c 2014-06-24 11:30:38 +0000
506+++ gtk/window-decorator/gtk-window-decorator.c 2015-04-06 15:01:05 +0000
507@@ -36,29 +36,13 @@
508
509 gdouble decoration_alpha = 0.5;
510 #ifdef USE_METACITY
511-MetaButtonLayout meta_button_layout;
512 gboolean meta_button_layout_set = FALSE;
513 #endif
514
515 gboolean minimal = FALSE;
516
517-#define SWITCHER_SPACE 40
518-
519-const float STROKE_ALPHA = 0.6f;
520-
521 const unsigned short ICON_SPACE = 20;
522
523-const float DOUBLE_CLICK_DISTANCE = 8.0f;
524-
525-const float SHADOW_RADIUS = 8.0f;
526-const float SHADOW_OPACITY = 0.5f;
527-const unsigned short SHADOW_OFFSET_X = 1;
528-const unsigned short SHADOW_OFFSET_Y = 1;
529-
530-const float META_OPACITY = 0.75f;
531-
532-const float META_ACTIVE_OPACITY = 1.0f;
533-
534 guint cmdline_options = 0;
535
536 Atom frame_input_window_atom;
537
538=== modified file 'gtk/window-decorator/gtk-window-decorator.h'
539--- gtk/window-decorator/gtk-window-decorator.h 2014-08-27 20:26:15 +0000
540+++ gtk/window-decorator/gtk-window-decorator.h 2015-04-06 15:01:05 +0000
541@@ -78,52 +78,11 @@
542
543 #include <gwd-fwd.h>
544
545-#define DBUS_DEST "org.freedesktop.compiz"
546-#define DBUS_PATH "/org/freedesktop/compiz/decor/screen0"
547-#define DBUS_INTERFACE "org.freedesktop.compiz"
548-#define DBUS_METHOD_GET "get"
549-
550-extern const float STROKE_ALPHA;
551-
552 extern const unsigned short ICON_SPACE;
553
554-extern const float DOUBLE_CLICK_DISTANCE;
555-
556-#define WM_MOVERESIZE_SIZE_TOPLEFT 0
557-#define WM_MOVERESIZE_SIZE_TOP 1
558-#define WM_MOVERESIZE_SIZE_TOPRIGHT 2
559-#define WM_MOVERESIZE_SIZE_RIGHT 3
560-#define WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
561-#define WM_MOVERESIZE_SIZE_BOTTOM 5
562-#define WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
563-#define WM_MOVERESIZE_SIZE_LEFT 7
564-#define WM_MOVERESIZE_MOVE 8
565-#define WM_MOVERESIZE_SIZE_KEYBOARD 9
566-#define WM_MOVERESIZE_MOVE_KEYBOARD 10
567-
568-extern const float SHADOW_RADIUS;
569-extern const float SHADOW_OPACITY;
570-extern const unsigned short SHADOW_OFFSET_X;
571-extern const unsigned short SHADOW_OFFSET_Y;
572-#define SHADOW_COLOR_RED 0x0000
573-#define SHADOW_COLOR_GREEN 0x0000
574-#define SHADOW_COLOR_BLUE 0x0000
575-
576-extern const float META_OPACITY;
577-#define META_SHADE_OPACITY TRUE;
578-extern const float META_ACTIVE_OPACITY;
579-#define META_ACTIVE_SHADE_OPACITY TRUE;
580-
581 #define META_MAXIMIZED (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY | \
582 WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY)
583
584-#define CMDLINE_OPACITY (1 << 0)
585-#define CMDLINE_OPACITY_SHADE (1 << 1)
586-#define CMDLINE_ACTIVE_OPACITY (1 << 2)
587-#define CMDLINE_ACTIVE_OPACITY_SHADE (1 << 3)
588-#define CMDLINE_BLUR (1 << 4)
589-#define CMDLINE_THEME (1 << 5)
590-
591 #define MWM_HINTS_DECORATIONS (1L << 1)
592
593 #define MWM_DECOR_ALL (1L << 0)
594@@ -144,16 +103,13 @@
595
596 extern gboolean minimal;
597
598-#define SWITCHER_SPACE 40
599-
600 extern GWDSettingsNotified *notified;
601-extern GWDSettings *settings;
602+extern GWDSettings *settings;
603 extern GWDSettingsWritable *writable;
604
605 extern gdouble decoration_alpha;
606 #ifdef USE_METACITY
607-extern MetaButtonLayout meta_button_layout;
608-extern gboolean meta_button_layout_set;
609+extern gboolean meta_button_layout_set;
610 #endif
611
612 extern Atom frame_input_window_atom;
613@@ -406,22 +362,11 @@
614 extern XRenderPictFormat *xformat_rgba;
615 extern XRenderPictFormat *xformat_rgb;
616
617-/* gtk-window-decorator.c */
618-
619-double
620-dist (double x1, double y1,
621- double x2, double y2);
622-
623 /* frames.c */
624
625 void
626 initialize_decorations ();
627
628-void
629-update_frames_border_extents (gpointer key,
630- gpointer value,
631- gpointer user_data);
632-
633 decor_frame_t *
634 gwd_get_decor_frame (const gchar *);
635
636@@ -458,30 +403,6 @@
637 void
638 frame_update_titlebar_font (decor_frame_t *frame);
639
640-void
641-bare_frame_update_shadow (Display *xdisplay,
642- Screen *screen,
643- decor_frame_t *frame,
644- decor_shadow_t **shadow_normal,
645- decor_context_t *context_normal,
646- decor_shadow_t **shadow_max,
647- decor_context_t *context_max,
648- decor_shadow_info_t *info,
649- decor_shadow_options_t *opt_shadow,
650- decor_shadow_options_t *opt_no_shadow);
651-
652-void
653-decor_frame_update_shadow (Display *xdisplay,
654- Screen *screen,
655- decor_frame_t *frame,
656- decor_shadow_t **shadow_normal,
657- decor_context_t *context_normal,
658- decor_shadow_t **shadow_max,
659- decor_context_t *context_max,
660- decor_shadow_info_t *info,
661- decor_shadow_options_t *opt_shadow,
662- decor_shadow_options_t *opt_no_shadow);
663-
664 decor_frame_t *
665 create_normal_frame (const gchar *type);
666
667@@ -501,12 +422,6 @@
668 gboolean
669 request_update_window_decoration_size (WnckWindow *win);
670
671-void
672-update_window_decoration_name (WnckWindow *win);
673-
674-gint
675-max_window_name_width (WnckWindow *win);
676-
677 unsigned int
678 populate_frame_type (decor_t *d);
679
680@@ -538,9 +453,6 @@
681 update_titlebar_font ();
682
683 void
684-update_window_decoration_name (WnckWindow *win);
685-
686-void
687 update_window_decoration (WnckWindow *win);
688
689 void
690@@ -561,10 +473,6 @@
691 connect_screen (WnckScreen *screen);
692
693 void
694-window_opened (WnckScreen *screen,
695- WnckWindow *window);
696-
697-void
698 window_closed (WnckScreen *screen,
699 WnckWindow *window);
700
701@@ -580,10 +488,6 @@
702 restack_window (WnckWindow *win,
703 int stack_mode);
704
705-void
706-connect_window (WnckWindow *win);
707-
708-
709 /* blur.c */
710
711 void
712@@ -711,6 +615,7 @@
713 surface_new_from_pixbuf (GdkPixbuf *pixbuf, GtkWidget *parent);
714
715 /* metacity.c */
716+
717 #ifdef USE_METACITY
718
719 MetaFrameType
720@@ -719,18 +624,6 @@
721 void
722 meta_draw_window_decoration (decor_t *d);
723
724-void
725-meta_get_decoration_geometry (decor_t *d,
726- MetaTheme *theme,
727- MetaFrameFlags *flags,
728- MetaFrameGeometry *fgeom,
729- MetaButtonLayout *button_layout,
730- MetaFrameType frame_type,
731- GdkRectangle *clip);
732-
733-void
734-meta_calc_button_size (decor_t *d);
735-
736 gboolean
737 meta_calc_decoration_size (decor_t *d,
738 gint w,
739@@ -749,10 +642,6 @@
740 gint *w,
741 gint *h);
742
743-gboolean
744-meta_button_present (MetaButtonLayout *button_layout,
745- MetaButtonFunction function);
746-
747 void
748 meta_get_event_window_position (decor_t *d,
749 gint i,
750@@ -777,6 +666,7 @@
751 meta_get_shadow (decor_frame_t *, decor_shadow_options_t *opts, gboolean active);
752
753 #endif
754+
755 /* switcher.c */
756
757 #define SWITCHER_ALPHA 0xa0a0
758@@ -799,35 +689,13 @@
759 void
760 destroy_switcher_frame ();
761
762-void
763-draw_switcher_decoration (decor_t *d);
764-
765 gboolean
766 update_switcher_window (Window popup,
767 Window selected);
768
769-decor_t *
770-switcher_window_opened (Window popup, Window selected);
771-
772-void
773-switcher_window_closed ();
774-
775 /* events.c */
776
777 void
778-move_resize_window (WnckWindow *win,
779- int direction,
780- decor_event *gtkwd_event);
781-
782-void
783-common_button_event (WnckWindow *win,
784- decor_event *gtkwd_event,
785- decor_event_type gtkwd_type,
786- int button,
787- int max,
788- char *tooltip);
789-
790-void
791 close_button_event (WnckWindow *win,
792 decor_event *gtkwd_event,
793 decor_event_type gtkwd_type);
794@@ -877,26 +745,11 @@
795 decor_event_type gtkwd_type);
796
797 void
798-handle_title_button_event (WnckWindow *win,
799- int action,
800- decor_event *gtkwd_event);
801-
802-void
803-handle_mouse_wheel_title_event (WnckWindow *win,
804- unsigned int button);
805-
806-void
807 title_event (WnckWindow *win,
808 decor_event *gtkwd_event,
809 decor_event_type gtkwd_type);
810
811 void
812-frame_common_event (WnckWindow *win,
813- int direction,
814- decor_event *gtkwd_event,
815- decor_event_type gtkwd_type);
816-
817-void
818 top_left_event (WnckWindow *win,
819 decor_event *gtkwd_event,
820 decor_event_type gtkwd_type);
821@@ -938,17 +791,6 @@
822 frame_window_realized (GtkWidget *widget,
823 gpointer data);
824
825-event_callback
826-find_event_callback_for_point (decor_t *d,
827- int x,
828- int y,
829- Bool *enter,
830- Bool *leave,
831- BoxPtr *entered_box);
832-
833-event_callback
834-find_leave_event_callback (decor_t *d);
835-
836 void
837 frame_handle_button_press (GtkWidget *widget,
838 GdkEventButton *event,
839@@ -1004,18 +846,6 @@
840
841 /* util.c */
842
843-double
844-square (double x);
845-
846-double
847-dist (double x1, double y1,
848- double x2, double y2);
849-
850-void
851-shade (const decor_color_t *a,
852- decor_color_t *b,
853- float k);
854-
855 gboolean
856 get_window_prop (Window xwindow,
857 Atom atom,
858
859=== modified file 'gtk/window-decorator/metacity.c'
860--- gtk/window-decorator/metacity.c 2015-04-06 15:01:05 +0000
861+++ gtk/window-decorator/metacity.c 2015-04-06 15:01:05 +0000
862@@ -27,86 +27,116 @@
863
864 #ifdef USE_METACITY
865
866+MetaButtonLayout meta_button_layout;
867+
868+static gboolean
869+meta_button_present (MetaButtonLayout *button_layout,
870+ MetaButtonFunction function)
871+{
872+ int i;
873+
874+ for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i)
875+ if (button_layout->left_buttons[i] == function)
876+ return TRUE;
877+
878+ for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i)
879+ if (button_layout->right_buttons[i] == function)
880+ return TRUE;
881+
882+ return FALSE;
883+}
884+
885 static void
886-decor_update_meta_window_property (decor_t *d,
887- MetaTheme *theme,
888- MetaFrameFlags flags,
889- Region top,
890- Region bottom,
891- Region left,
892- Region right)
893+decor_update_meta_window_property (decor_t *d,
894+ MetaTheme *theme,
895+ MetaFrameFlags flags,
896+ Region top,
897+ Region bottom,
898+ Region left,
899+ Region right)
900 {
901- long *data;
902- Display *xdisplay =
903- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
904- gint nQuad;
905- decor_extents_t win_extents, frame_win_extents;
906- decor_extents_t max_win_extents, frame_max_win_extents;
907- decor_quad_t quads[N_QUADS_MAX];
908- unsigned int nOffset = 1;
909- unsigned int frame_type = populate_frame_type (d);
910- unsigned int frame_state = populate_frame_state (d);
911- unsigned int frame_actions = populate_frame_actions (d);
912- gint w, lh, rh;
913- gint top_stretch_offset;
914- gint bottom_stretch_offset;
915- gint left_stretch_offset;
916- gint right_stretch_offset;
917- gint mutter_draggable_border_width = 0;
918+ long *data;
919+ GdkDisplay *display;
920+ Display *xdisplay;
921+ gint nQuad;
922+ decor_extents_t win_extents;
923+ decor_extents_t frame_win_extents;
924+ decor_extents_t max_win_extents;
925+ decor_extents_t frame_max_win_extents;
926+ decor_quad_t quads[N_QUADS_MAX];
927+ unsigned int nOffset;
928+ unsigned int frame_type;
929+ unsigned int frame_state;
930+ unsigned int frame_actions;
931+ gint w;
932+ gint lh;
933+ gint rh;
934+ gint top_stretch_offset;
935+ gint bottom_stretch_offset;
936+ gint left_stretch_offset;
937+ gint right_stretch_offset;
938+ gint mutter_draggable_border_width;
939+
940+ display = gdk_display_get_default ();
941+ xdisplay = gdk_x11_display_get_xdisplay (display);
942+
943+ nOffset = 1;
944+
945+ frame_type = populate_frame_type (d);
946+ frame_state = populate_frame_state (d);
947+ frame_actions = populate_frame_actions (d);
948
949 win_extents = frame_win_extents = d->frame->win_extents;
950 max_win_extents = frame_max_win_extents = d->frame->max_win_extents;
951
952- g_object_get (settings, "draggable-border-width", &mutter_draggable_border_width, NULL);
953+ mutter_draggable_border_width = 0;
954+
955+ g_object_get (settings, "draggable-border-width",
956+ &mutter_draggable_border_width, NULL);
957
958 /* Add the invisible grab area padding, but only for
959 * pixmap type decorations */
960 if (!d->frame_window)
961 {
962- if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
963- {
964- frame_win_extents.left += mutter_draggable_border_width;
965- frame_win_extents.right += mutter_draggable_border_width;
966- frame_max_win_extents.left += mutter_draggable_border_width;
967- frame_max_win_extents.right += mutter_draggable_border_width;
968- }
969+ if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
970+ {
971+ frame_win_extents.left += mutter_draggable_border_width;
972+ frame_win_extents.right += mutter_draggable_border_width;
973+ frame_max_win_extents.left += mutter_draggable_border_width;
974+ frame_max_win_extents.right += mutter_draggable_border_width;
975+ }
976
977- if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
978- {
979- frame_win_extents.bottom += mutter_draggable_border_width;
980- frame_win_extents.top += mutter_draggable_border_width;
981- frame_max_win_extents.bottom += mutter_draggable_border_width;
982- frame_max_win_extents.top += mutter_draggable_border_width;
983- }
984+ if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
985+ {
986+ frame_win_extents.bottom += mutter_draggable_border_width;
987+ frame_win_extents.top += mutter_draggable_border_width;
988+ frame_max_win_extents.bottom += mutter_draggable_border_width;
989+ frame_max_win_extents.top += mutter_draggable_border_width;
990+ }
991 }
992
993 w = d->border_layout.top.x2 - d->border_layout.top.x1 -
994- d->context->left_space - d->context->right_space;
995-
996- if (d->border_layout.rotation)
997- lh = d->border_layout.left.x2 - d->border_layout.left.x1;
998- else
999- lh = d->border_layout.left.y2 - d->border_layout.left.y1;
1000-
1001- if (d->border_layout.rotation)
1002- rh = d->border_layout.right.x2 - d->border_layout.right.x1;
1003- else
1004- rh = d->border_layout.right.y2 - d->border_layout.right.y1;
1005-
1006- left_stretch_offset = lh / 2;
1007- right_stretch_offset = rh / 2;
1008- top_stretch_offset = w - d->button_width - 1;
1009- bottom_stretch_offset = (d->border_layout.bottom.x2 -
1010- d->border_layout.bottom.x1 -
1011- d->context->left_space -
1012- d->context->right_space) / 2;
1013-
1014- nQuad = decor_set_lXrXtXbX_window_quads (quads, d->context,
1015- &d->border_layout,
1016- left_stretch_offset,
1017- right_stretch_offset,
1018- top_stretch_offset,
1019- bottom_stretch_offset);
1020+ d->context->left_space - d->context->right_space;
1021+
1022+ if (d->border_layout.rotation)
1023+ lh = d->border_layout.left.x2 - d->border_layout.left.x1;
1024+ else
1025+ lh = d->border_layout.left.y2 - d->border_layout.left.y1;
1026+
1027+ if (d->border_layout.rotation)
1028+ rh = d->border_layout.right.x2 - d->border_layout.right.x1;
1029+ else
1030+ rh = d->border_layout.right.y2 - d->border_layout.right.y1;
1031+
1032+ left_stretch_offset = lh / 2;
1033+ right_stretch_offset = rh / 2;
1034+ top_stretch_offset = w - d->button_width - 1;
1035+ bottom_stretch_offset = (d->border_layout.bottom.x2 - d->border_layout.bottom.x1 -
1036+ d->context->left_space - d->context->right_space) / 2;
1037+
1038+ nQuad = decor_set_lXrXtXbX_window_quads (quads, d->context, &d->border_layout,
1039+ left_stretch_offset, right_stretch_offset,
1040+ top_stretch_offset, bottom_stretch_offset);
1041
1042 win_extents.top += d->frame->titlebar_height;
1043 frame_win_extents.top += d->frame->titlebar_height;
1044@@ -115,47 +145,44 @@
1045
1046 if (d->frame_window)
1047 {
1048- data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_WINDOW);
1049- decor_gen_window_property (data, nOffset - 1, &win_extents, &max_win_extents, 20, 20,
1050- frame_type, frame_state, frame_actions);
1051+ data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_WINDOW);
1052+ decor_gen_window_property (data, nOffset - 1, &win_extents, &max_win_extents,
1053+ 20, 20, frame_type, frame_state, frame_actions);
1054 }
1055 else
1056 {
1057- data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
1058- decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
1059- &frame_win_extents, &win_extents,
1060- &frame_max_win_extents, &max_win_extents,
1061- ICON_SPACE + d->button_width,
1062- 0,
1063- quads, nQuad, frame_type, frame_state, frame_actions);
1064+ data = decor_alloc_property (nOffset, WINDOW_DECORATION_TYPE_PIXMAP);
1065+ decor_quads_to_property (data, nOffset - 1, cairo_xlib_surface_get_drawable (d->surface),
1066+ &frame_win_extents, &win_extents,
1067+ &frame_max_win_extents, &max_win_extents,
1068+ ICON_SPACE + d->button_width,
1069+ 0, quads, nQuad, frame_type, frame_state, frame_actions);
1070 }
1071
1072 gdk_error_trap_push ();
1073
1074- XChangeProperty (xdisplay, d->prop_xid,
1075- win_decor_atom,
1076- XA_INTEGER,
1077- 32, PropModeReplace, (guchar *) data,
1078- PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
1079- gdk_display_sync (gdk_display_get_default ());
1080+ XChangeProperty (xdisplay, d->prop_xid, win_decor_atom, XA_INTEGER,
1081+ 32, PropModeReplace, (guchar *) data,
1082+ PROP_HEADER_SIZE + BASE_PROP_SIZE + QUAD_PROP_SIZE * N_QUADS_MAX);
1083+ gdk_display_sync (display);
1084+
1085 gdk_error_trap_pop_ignored ();
1086
1087 free (data);
1088
1089- decor_update_blur_property (d,
1090- w, lh,
1091- top, top_stretch_offset,
1092- bottom, bottom_stretch_offset,
1093- left, left_stretch_offset,
1094- right, right_stretch_offset);
1095+ decor_update_blur_property (d, w, lh,
1096+ top, top_stretch_offset,
1097+ bottom, bottom_stretch_offset,
1098+ left, left_stretch_offset,
1099+ right, right_stretch_offset);
1100 }
1101
1102 static void
1103 meta_get_corner_radius (const MetaFrameGeometry *fgeom,
1104- int *top_left_radius,
1105- int *top_right_radius,
1106- int *bottom_left_radius,
1107- int *bottom_right_radius)
1108+ int *top_left_radius,
1109+ int *top_right_radius,
1110+ int *bottom_left_radius,
1111+ int *bottom_right_radius)
1112 {
1113 *top_left_radius = fgeom->top_left_corner_rounded_radius;
1114 *top_right_radius = fgeom->top_right_corner_rounded_radius;
1115@@ -165,7 +192,7 @@
1116
1117 static int
1118 radius_to_width (int radius,
1119- int i)
1120+ int i)
1121 {
1122 float r1 = sqrt (radius) + radius;
1123 float r2 = r1 * r1 - (r1 - (i + 0.5)) * (r1 - (i + 0.5));
1124@@ -175,52 +202,51 @@
1125
1126 static Region
1127 meta_get_top_border_region (const MetaFrameGeometry *fgeom,
1128- int width)
1129+ int width)
1130 {
1131- Region corners_xregion, border_xregion;
1132+ Region corners_xregion;
1133+ Region border_xregion;
1134 XRectangle xrect;
1135- int top_left_radius;
1136- int top_right_radius;
1137- int bottom_left_radius;
1138- int bottom_right_radius;
1139- int w, i;
1140+ int top_left_radius;
1141+ int top_right_radius;
1142+ int bottom_left_radius;
1143+ int bottom_right_radius;
1144+ int w;
1145+ int i;
1146
1147 corners_xregion = XCreateRegion ();
1148
1149- meta_get_corner_radius (fgeom,
1150- &top_left_radius,
1151- &top_right_radius,
1152- &bottom_left_radius,
1153- &bottom_right_radius);
1154+ meta_get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
1155+ &bottom_left_radius, &bottom_right_radius);
1156
1157 if (top_left_radius)
1158 {
1159- for (i = 0; i < top_left_radius; ++i)
1160- {
1161- w = radius_to_width (top_left_radius, i);
1162-
1163- xrect.x = 0;
1164- xrect.y = i;
1165- xrect.width = w;
1166- xrect.height = 1;
1167-
1168- XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1169- }
1170+ for (i = 0; i < top_left_radius; ++i)
1171+ {
1172+ w = radius_to_width (top_left_radius, i);
1173+
1174+ xrect.x = 0;
1175+ xrect.y = i;
1176+ xrect.width = w;
1177+ xrect.height = 1;
1178+
1179+ XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1180+ }
1181 }
1182
1183 if (top_right_radius)
1184 {
1185- for (i = 0; i < top_right_radius; ++i)
1186- {
1187- w = radius_to_width (top_right_radius, i);
1188-
1189- xrect.x = width - w;
1190- xrect.y = i;
1191- xrect.width = w;
1192- xrect.height = 1;
1193-
1194- XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1195- }
1196+ for (i = 0; i < top_right_radius; ++i)
1197+ {
1198+ w = radius_to_width (top_right_radius, i);
1199+
1200+ xrect.x = width - w;
1201+ xrect.y = i;
1202+ xrect.width = w;
1203+ xrect.height = 1;
1204+
1205+ XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1206+ }
1207 }
1208
1209 border_xregion = XCreateRegion ();
1210@@ -241,52 +267,51 @@
1211
1212 static Region
1213 meta_get_bottom_border_region (const MetaFrameGeometry *fgeom,
1214- int width)
1215+ int width)
1216 {
1217- Region corners_xregion, border_xregion;
1218+ Region corners_xregion;
1219+ Region border_xregion;
1220 XRectangle xrect;
1221- int top_left_radius;
1222- int top_right_radius;
1223- int bottom_left_radius;
1224- int bottom_right_radius;
1225- int w, i;
1226+ int top_left_radius;
1227+ int top_right_radius;
1228+ int bottom_left_radius;
1229+ int bottom_right_radius;
1230+ int w;
1231+ int i;
1232
1233 corners_xregion = XCreateRegion ();
1234
1235- meta_get_corner_radius (fgeom,
1236- &top_left_radius,
1237- &top_right_radius,
1238- &bottom_left_radius,
1239- &bottom_right_radius);
1240+ meta_get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
1241+ &bottom_left_radius, &bottom_right_radius);
1242
1243 if (bottom_left_radius)
1244 {
1245- for (i = 0; i < bottom_left_radius; ++i)
1246- {
1247- w = radius_to_width (bottom_left_radius, i);
1248-
1249- xrect.x = 0;
1250- xrect.y = fgeom->bottom_height - i - 1;
1251- xrect.width = w;
1252- xrect.height = 1;
1253-
1254- XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1255- }
1256+ for (i = 0; i < bottom_left_radius; ++i)
1257+ {
1258+ w = radius_to_width (bottom_left_radius, i);
1259+
1260+ xrect.x = 0;
1261+ xrect.y = fgeom->bottom_height - i - 1;
1262+ xrect.width = w;
1263+ xrect.height = 1;
1264+
1265+ XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1266+ }
1267 }
1268
1269 if (bottom_right_radius)
1270 {
1271- for (i = 0; i < bottom_right_radius; ++i)
1272- {
1273- w = radius_to_width (bottom_right_radius, i);
1274-
1275- xrect.x = width - w;
1276- xrect.y = fgeom->bottom_height - i - 1;
1277- xrect.width = w;
1278- xrect.height = 1;
1279-
1280- XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1281- }
1282+ for (i = 0; i < bottom_right_radius; ++i)
1283+ {
1284+ w = radius_to_width (bottom_right_radius, i);
1285+
1286+ xrect.x = width - w;
1287+ xrect.y = fgeom->bottom_height - i - 1;
1288+ xrect.width = w;
1289+ xrect.height = 1;
1290+
1291+ XUnionRectWithRegion (&xrect, corners_xregion, corners_xregion);
1292+ }
1293 }
1294
1295 border_xregion = XCreateRegion ();
1296@@ -307,16 +332,16 @@
1297
1298 static Region
1299 meta_get_left_border_region (const MetaFrameGeometry *fgeom,
1300- int height)
1301+ int height)
1302 {
1303- Region border_xregion;
1304+ Region border_xregion;
1305 XRectangle xrect;
1306
1307 border_xregion = XCreateRegion ();
1308
1309- xrect.x = 0;
1310- xrect.y = 0;
1311- xrect.width = fgeom->left_width;
1312+ xrect.x = 0;
1313+ xrect.y = 0;
1314+ xrect.width = fgeom->left_width;
1315 xrect.height = height - fgeom->top_height - fgeom->bottom_height;
1316
1317 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
1318@@ -326,16 +351,16 @@
1319
1320 static Region
1321 meta_get_right_border_region (const MetaFrameGeometry *fgeom,
1322- int height)
1323+ int height)
1324 {
1325- Region border_xregion;
1326+ Region border_xregion;
1327 XRectangle xrect;
1328
1329 border_xregion = XCreateRegion ();
1330
1331- xrect.x = 0;
1332- xrect.y = 0;
1333- xrect.width = fgeom->right_width;
1334+ xrect.x = 0;
1335+ xrect.y = 0;
1336+ xrect.width = fgeom->right_width;
1337 xrect.height = height - fgeom->top_height - fgeom->bottom_height;
1338
1339 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
1340@@ -348,10 +373,10 @@
1341 {
1342 if (state & IN_EVENT_WINDOW)
1343 {
1344- if (state & PRESSED_EVENT_WINDOW)
1345- return META_BUTTON_STATE_PRESSED;
1346+ if (state & PRESSED_EVENT_WINDOW)
1347+ return META_BUTTON_STATE_PRESSED;
1348
1349- return META_BUTTON_STATE_PRELIGHT;
1350+ return META_BUTTON_STATE_PRELIGHT;
1351 }
1352
1353 return META_BUTTON_STATE_NORMAL;
1354@@ -360,271 +385,245 @@
1355 static MetaButtonType
1356 meta_function_to_type (MetaButtonFunction function)
1357 {
1358- switch (function) {
1359+ switch (function)
1360+ {
1361 case META_BUTTON_FUNCTION_MENU:
1362- return META_BUTTON_TYPE_MENU;
1363+ return META_BUTTON_TYPE_MENU;
1364 case META_BUTTON_FUNCTION_MINIMIZE:
1365- return META_BUTTON_TYPE_MINIMIZE;
1366+ return META_BUTTON_TYPE_MINIMIZE;
1367 case META_BUTTON_FUNCTION_MAXIMIZE:
1368- return META_BUTTON_TYPE_MAXIMIZE;
1369+ return META_BUTTON_TYPE_MAXIMIZE;
1370 case META_BUTTON_FUNCTION_CLOSE:
1371- return META_BUTTON_TYPE_CLOSE;
1372+ return META_BUTTON_TYPE_CLOSE;
1373 case META_BUTTON_FUNCTION_SHADE:
1374- return META_BUTTON_TYPE_SHADE;
1375+ return META_BUTTON_TYPE_SHADE;
1376 case META_BUTTON_FUNCTION_ABOVE:
1377- return META_BUTTON_TYPE_ABOVE;
1378+ return META_BUTTON_TYPE_ABOVE;
1379 case META_BUTTON_FUNCTION_STICK:
1380- return META_BUTTON_TYPE_STICK;
1381+ return META_BUTTON_TYPE_STICK;
1382 case META_BUTTON_FUNCTION_UNSHADE:
1383- return META_BUTTON_TYPE_UNSHADE;
1384+ return META_BUTTON_TYPE_UNSHADE;
1385 case META_BUTTON_FUNCTION_UNABOVE:
1386- return META_BUTTON_TYPE_UNABOVE;
1387+ return META_BUTTON_TYPE_UNABOVE;
1388 case META_BUTTON_FUNCTION_UNSTICK:
1389- return META_BUTTON_TYPE_UNSTICK;
1390+ return META_BUTTON_TYPE_UNSTICK;
1391 default:
1392- break;
1393+ break;
1394 }
1395
1396 return META_BUTTON_TYPE_LAST;
1397 }
1398
1399 static MetaButtonState
1400-meta_button_state_for_button_type (decor_t *d,
1401- MetaButtonType type)
1402+meta_button_state_for_button_type (decor_t *d,
1403+ MetaButtonType type)
1404 {
1405- switch (type) {
1406+ switch (type)
1407+ {
1408 case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
1409- type = meta_function_to_type (meta_button_layout.left_buttons[0]);
1410- break;
1411+ type = meta_function_to_type (meta_button_layout.left_buttons[0]);
1412+ break;
1413 case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
1414- type = meta_function_to_type (meta_button_layout.left_buttons[1]);
1415- break;
1416+ type = meta_function_to_type (meta_button_layout.left_buttons[1]);
1417+ break;
1418 case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
1419- type = meta_function_to_type (meta_button_layout.left_buttons[2]);
1420- break;
1421+ type = meta_function_to_type (meta_button_layout.left_buttons[2]);
1422+ break;
1423 case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
1424- type = meta_function_to_type (meta_button_layout.right_buttons[0]);
1425- break;
1426+ type = meta_function_to_type (meta_button_layout.right_buttons[0]);
1427+ break;
1428 case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
1429- type = meta_function_to_type (meta_button_layout.right_buttons[1]);
1430- break;
1431+ type = meta_function_to_type (meta_button_layout.right_buttons[1]);
1432+ break;
1433 case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
1434- type = meta_function_to_type (meta_button_layout.right_buttons[2]);
1435+ type = meta_function_to_type (meta_button_layout.right_buttons[2]);
1436 default:
1437- break;
1438+ break;
1439 }
1440
1441- switch (type) {
1442+ switch (type)
1443+ {
1444 case META_BUTTON_TYPE_CLOSE:
1445- return meta_button_state (d->button_states[BUTTON_CLOSE]);
1446+ return meta_button_state (d->button_states[BUTTON_CLOSE]);
1447 case META_BUTTON_TYPE_MAXIMIZE:
1448- return meta_button_state (d->button_states[BUTTON_MAX]);
1449+ return meta_button_state (d->button_states[BUTTON_MAX]);
1450 case META_BUTTON_TYPE_MINIMIZE:
1451- return meta_button_state (d->button_states[BUTTON_MIN]);
1452+ return meta_button_state (d->button_states[BUTTON_MIN]);
1453 case META_BUTTON_TYPE_MENU:
1454- return meta_button_state (d->button_states[BUTTON_MENU]);
1455+ return meta_button_state (d->button_states[BUTTON_MENU]);
1456 case META_BUTTON_TYPE_SHADE:
1457- return meta_button_state (d->button_states[BUTTON_SHADE]);
1458+ return meta_button_state (d->button_states[BUTTON_SHADE]);
1459 case META_BUTTON_TYPE_ABOVE:
1460- return meta_button_state (d->button_states[BUTTON_ABOVE]);
1461+ return meta_button_state (d->button_states[BUTTON_ABOVE]);
1462 case META_BUTTON_TYPE_STICK:
1463- return meta_button_state (d->button_states[BUTTON_STICK]);
1464+ return meta_button_state (d->button_states[BUTTON_STICK]);
1465 case META_BUTTON_TYPE_UNSHADE:
1466- return meta_button_state (d->button_states[BUTTON_UNSHADE]);
1467+ return meta_button_state (d->button_states[BUTTON_UNSHADE]);
1468 case META_BUTTON_TYPE_UNABOVE:
1469- return meta_button_state (d->button_states[BUTTON_UNABOVE]);
1470+ return meta_button_state (d->button_states[BUTTON_UNABOVE]);
1471 case META_BUTTON_TYPE_UNSTICK:
1472- return meta_button_state (d->button_states[BUTTON_UNSTICK]);
1473+ return meta_button_state (d->button_states[BUTTON_UNSTICK]);
1474 default:
1475- break;
1476+ break;
1477 }
1478
1479 return META_BUTTON_STATE_NORMAL;
1480 }
1481
1482-void
1483-meta_get_decoration_geometry (decor_t *d,
1484- MetaTheme *theme,
1485- MetaFrameFlags *flags,
1486- MetaFrameGeometry *fgeom,
1487- MetaButtonLayout *button_layout,
1488- MetaFrameType frame_type,
1489- GdkRectangle *clip)
1490+static void
1491+meta_get_decoration_geometry (decor_t *d,
1492+ MetaTheme *theme,
1493+ MetaFrameFlags *flags,
1494+ MetaFrameGeometry *fgeom,
1495+ MetaButtonLayout *button_layout,
1496+ MetaFrameType frame_type)
1497 {
1498-#ifdef HAVE_METACITY_3_14_0
1499- MetaFrameBorders borders;
1500-#endif
1501- gint left_width, right_width, top_height, bottom_height;
1502+ gint client_width;
1503+ gint client_height;
1504
1505 if (!(frame_type < META_FRAME_TYPE_LAST))
1506- frame_type = META_FRAME_TYPE_NORMAL;
1507+ frame_type = META_FRAME_TYPE_NORMAL;
1508
1509 if (meta_button_layout_set)
1510 {
1511- *button_layout = meta_button_layout;
1512+ *button_layout = meta_button_layout;
1513 }
1514 else
1515 {
1516- gint i;
1517-
1518- button_layout->left_buttons[0] = META_BUTTON_FUNCTION_MENU;
1519-
1520- for (i = 1; i < MAX_BUTTONS_PER_CORNER; ++i)
1521- button_layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
1522-
1523- button_layout->right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
1524- button_layout->right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE;
1525- button_layout->right_buttons[2] = META_BUTTON_FUNCTION_CLOSE;
1526-
1527- for (i = 3; i < MAX_BUTTONS_PER_CORNER; ++i)
1528- button_layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
1529+ gint i;
1530+
1531+ button_layout->left_buttons[0] = META_BUTTON_FUNCTION_MENU;
1532+
1533+ for (i = 1; i < MAX_BUTTONS_PER_CORNER; ++i)
1534+ button_layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
1535+
1536+ button_layout->right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
1537+ button_layout->right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE;
1538+ button_layout->right_buttons[2] = META_BUTTON_FUNCTION_CLOSE;
1539+
1540+ for (i = 3; i < MAX_BUTTONS_PER_CORNER; ++i)
1541+ button_layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
1542 }
1543
1544 *flags = 0;
1545
1546 if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
1547- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_DELETE;
1548+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_DELETE;
1549
1550 if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE)
1551- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MINIMIZE;
1552+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MINIMIZE;
1553
1554 if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
1555- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
1556+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
1557
1558 *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MENU;
1559
1560 if (d->actions & WNCK_WINDOW_ACTION_RESIZE)
1561 {
1562- if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
1563- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_VERTICAL_RESIZE;
1564- if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY))
1565- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_HORIZONTAL_RESIZE;
1566+ if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
1567+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_VERTICAL_RESIZE;
1568+ if (!(d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY))
1569+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_HORIZONTAL_RESIZE;
1570 }
1571
1572 if (d->actions & WNCK_WINDOW_ACTION_MOVE)
1573- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MOVE;
1574+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MOVE;
1575
1576 if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
1577- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
1578+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_MAXIMIZE;
1579
1580 if (d->actions & WNCK_WINDOW_ACTION_SHADE)
1581- *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_SHADE;
1582+ *flags |= (MetaFrameFlags ) META_FRAME_ALLOWS_SHADE;
1583
1584 if (d->active)
1585- *flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS;
1586+ *flags |= (MetaFrameFlags ) META_FRAME_HAS_FOCUS;
1587
1588 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
1589- *flags |= (MetaFrameFlags ) META_FRAME_MAXIMIZED;
1590+ *flags |= (MetaFrameFlags ) META_FRAME_MAXIMIZED;
1591
1592 if (d->state & WNCK_WINDOW_STATE_STICKY)
1593- *flags |= (MetaFrameFlags ) META_FRAME_STUCK;
1594+ *flags |= (MetaFrameFlags ) META_FRAME_STUCK;
1595
1596 if (d->state & WNCK_WINDOW_STATE_FULLSCREEN)
1597- *flags |= (MetaFrameFlags ) META_FRAME_FULLSCREEN;
1598+ *flags |= (MetaFrameFlags ) META_FRAME_FULLSCREEN;
1599
1600 if (d->state & WNCK_WINDOW_STATE_SHADED)
1601- *flags |= (MetaFrameFlags ) META_FRAME_SHADED;
1602+ *flags |= (MetaFrameFlags ) META_FRAME_SHADED;
1603
1604 if (d->state & WNCK_WINDOW_STATE_ABOVE)
1605- *flags |= (MetaFrameFlags ) META_FRAME_ABOVE;
1606-
1607-#ifdef HAVE_METACITY_3_14_0
1608- meta_theme_get_frame_borders (theme,
1609- frame_type,
1610- d->frame->text_height,
1611- *flags,
1612- &borders);
1613- top_height = borders.visible.top;
1614- bottom_height = borders.visible.bottom;
1615- left_width = borders.visible.left;
1616- right_width = borders.visible.right;
1617-#else
1618- meta_theme_get_frame_borders (theme,
1619- frame_type,
1620- d->frame->text_height,
1621- *flags,
1622- &top_height,
1623- &bottom_height,
1624- &left_width,
1625- &right_width);
1626-#endif
1627-
1628- clip->x = d->context->left_space - left_width;
1629- clip->y = d->context->top_space - top_height;
1630-
1631- clip->width = d->border_layout.top.x2 - d->border_layout.top.x1;
1632- clip->width -= d->context->right_space + d->context->left_space;
1633+ *flags |= (MetaFrameFlags ) META_FRAME_ABOVE;
1634+
1635+ client_width = d->border_layout.top.x2 - d->border_layout.top.x1;
1636+ client_width -= d->context->right_space + d->context->left_space;
1637
1638 if (d->border_layout.rotation)
1639- clip->height = d->border_layout.left.x2 - d->border_layout.left.x1;
1640+ client_height = d->border_layout.left.x2 - d->border_layout.left.x1;
1641 else
1642- clip->height = d->border_layout.left.y2 - d->border_layout.left.y1;
1643-
1644- meta_theme_calc_geometry (theme,
1645- frame_type,
1646- d->frame->text_height,
1647- *flags,
1648- clip->width,
1649- clip->height,
1650- button_layout,
1651- fgeom);
1652-
1653- clip->width += left_width + right_width;
1654- clip->height += top_height + bottom_height;
1655+ client_height = d->border_layout.left.y2 - d->border_layout.left.y1;
1656+
1657+ meta_theme_calc_geometry (theme, frame_type, d->frame->text_height,
1658+ *flags, client_width, client_height,
1659+ button_layout, fgeom);
1660 }
1661
1662 void
1663 meta_draw_window_decoration (decor_t *d)
1664 {
1665- Display *xdisplay =
1666- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
1667+ GdkDisplay *display;
1668+ Display *xdisplay;
1669 cairo_surface_t *surface;
1670- Picture src;
1671- MetaButtonState button_states [META_BUTTON_TYPE_LAST];
1672- MetaButtonLayout button_layout;
1673+ Picture src;
1674+ MetaButtonState button_states [META_BUTTON_TYPE_LAST];
1675+ MetaButtonLayout button_layout;
1676 MetaFrameGeometry fgeom;
1677- MetaFrameFlags flags;
1678- MetaFrameType frame_type;
1679- MetaTheme *theme;
1680+ MetaFrameFlags flags;
1681+ MetaFrameType frame_type;
1682+ MetaTheme *theme;
1683 GtkStyleContext *context;
1684- cairo_t *cr;
1685- gint i;
1686- GdkRectangle clip;
1687- Region top_region = NULL;
1688- Region bottom_region = NULL;
1689- Region left_region = NULL;
1690- Region right_region = NULL;
1691- gdouble meta_active_opacity, meta_inactive_opacity;
1692- gboolean meta_active_shade_opacity, meta_inactive_shade_opacity;
1693+ cairo_t *cr;
1694+ gint i;
1695+ Region top_region;
1696+ Region bottom_region;
1697+ Region left_region;
1698+ Region right_region;
1699+ gdouble meta_active_opacity;
1700+ gdouble meta_inactive_opacity;
1701+ gboolean meta_active_shade_opacity;
1702+ gboolean meta_inactive_shade_opacity;
1703+ double alpha;
1704+ gboolean shade_alpha;
1705+ MetaFrameStyle *frame_style;
1706+ GtkWidget *style_window;
1707+ GdkRGBA bg_rgba;
1708+
1709+ if (!d->surface || !d->picture)
1710+ return;
1711+
1712+ display = gdk_display_get_default ();
1713+ xdisplay = gdk_x11_display_get_xdisplay (display);
1714+
1715+ top_region = NULL;
1716+ bottom_region = NULL;
1717+ left_region = NULL;
1718+ right_region = NULL;
1719
1720 g_object_get (settings, "metacity-active-opacity", &meta_active_opacity, NULL);
1721 g_object_get (settings, "metacity-inactive-opacity", &meta_inactive_opacity, NULL);
1722 g_object_get (settings, "metacity-active-shade-opacity", &meta_active_shade_opacity, NULL);
1723 g_object_get (settings, "metacity-inactive-shade-opacity", &meta_inactive_shade_opacity, NULL);
1724
1725- double alpha = (d->active) ? meta_active_opacity : meta_inactive_opacity;
1726- gboolean shade_alpha = (d->active) ? meta_active_shade_opacity :
1727- meta_inactive_shade_opacity;
1728- MetaFrameStyle *frame_style;
1729- GtkWidget *style_window;
1730- GdkRGBA bg_rgba;
1731-
1732- if (!d->surface || !d->picture)
1733- return;
1734+ alpha = (d->active) ? meta_active_opacity : meta_inactive_opacity;
1735+ shade_alpha = (d->active) ? meta_active_shade_opacity : meta_inactive_shade_opacity;
1736
1737 if (decoration_alpha == 1.0)
1738- alpha = 1.0;
1739+ alpha = 1.0;
1740
1741 if (cairo_xlib_surface_get_depth (d->surface) == 32)
1742- {
1743- context = gtk_widget_get_style_context (d->frame->style_window_rgba);
1744- style_window = d->frame->style_window_rgba;
1745- }
1746+ style_window = d->frame->style_window_rgba;
1747 else
1748- {
1749- context = gtk_widget_get_style_context (d->frame->style_window_rgb);
1750- style_window = d->frame->style_window_rgb;
1751- }
1752+ style_window = d->frame->style_window_rgb;
1753+
1754+ context = gtk_widget_get_style_context (style_window);
1755
1756 cr = cairo_create (d->buffer_surface ? d->buffer_surface : d->surface);
1757
1758@@ -635,31 +634,28 @@
1759 frame_type = meta_frame_type_from_string (d->frame->type);
1760
1761 if (frame_type == META_FRAME_TYPE_LAST)
1762- frame_type = META_FRAME_TYPE_NORMAL;
1763+ frame_type = META_FRAME_TYPE_NORMAL;
1764
1765 meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
1766- frame_type, &clip);
1767+ frame_type);
1768
1769 if ((d->prop_xid || !d->buffer_surface) && !d->frame_window)
1770- draw_shadow_background (d, cr, d->shadow, d->context);
1771+ draw_shadow_background (d, cr, d->shadow, d->context);
1772
1773 for (i = 0; i < META_BUTTON_TYPE_LAST; ++i)
1774- button_states[i] = meta_button_state_for_button_type (d, i);
1775+ button_states[i] = meta_button_state_for_button_type (d, i);
1776
1777- frame_style = meta_theme_get_frame_style (theme,
1778- frame_type,
1779- flags);
1780+ frame_style = meta_theme_get_frame_style (theme, frame_type, flags);
1781
1782 gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_rgba);
1783 bg_rgba.alpha = 1.0;
1784
1785 if (frame_style->window_background_color)
1786 {
1787- meta_color_spec_render (frame_style->window_background_color,
1788- gtk_widget_get_style_context (style_window),
1789- &bg_rgba);
1790+ meta_color_spec_render (frame_style->window_background_color,
1791+ context, &bg_rgba);
1792
1793- bg_rgba.alpha = frame_style->window_background_alpha / 255.0;
1794+ bg_rgba.alpha = frame_style->window_background_alpha / 255.0;
1795 }
1796
1797 /* Draw something that will be almost invisible to user. This is hacky way
1798@@ -671,152 +667,123 @@
1799
1800 cairo_destroy (cr);
1801
1802- if (d->frame_window)
1803- surface = create_surface (clip.width, clip.height, d->frame->style_window_rgb);
1804- else
1805- surface = create_surface (clip.width, clip.height, d->frame->style_window_rgba);
1806-
1807- cr = cairo_create (surface);
1808- gdk_cairo_set_source_rgba (cr, &bg_rgba);
1809- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1810-
1811- src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),
1812+ if (d->frame_window)
1813+ surface = create_surface (fgeom.width, fgeom.height, d->frame->style_window_rgb);
1814+ else
1815+ surface = create_surface (fgeom.width, fgeom.height, d->frame->style_window_rgba);
1816+
1817+ cr = cairo_create (surface);
1818+ gdk_cairo_set_source_rgba (cr, &bg_rgba);
1819+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1820+
1821+ src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),
1822 get_format_for_surface (d, surface), 0, NULL);
1823
1824 cairo_paint (cr);
1825- meta_theme_draw_frame (theme,
1826- style_window,
1827- cr,
1828- frame_type,
1829- flags,
1830- clip.width - fgeom.left_width - fgeom.right_width,
1831- clip.height - fgeom.top_height - fgeom.bottom_height,
1832- d->layout,
1833- d->frame->text_height,
1834- &button_layout,
1835- button_states,
1836- d->icon_pixbuf,
1837- NULL);
1838+ meta_theme_draw_frame (theme, style_window, cr, frame_type, flags,
1839+ fgeom.width - fgeom.left_width - fgeom.right_width,
1840+ fgeom.height - fgeom.top_height - fgeom.bottom_height,
1841+ d->layout, d->frame->text_height, &button_layout,
1842+ button_states, d->icon_pixbuf, NULL);
1843
1844 if (fgeom.top_height)
1845- {
1846- top_region = meta_get_top_border_region (&fgeom, clip.width);
1847-
1848- decor_blend_border_picture (xdisplay,
1849- d->context,
1850- src,
1851- 0, 0,
1852- d->picture,
1853- &d->border_layout,
1854- BORDER_TOP,
1855- top_region,
1856- alpha * 0xffff,
1857- shade_alpha,
1858- 0);
1859- }
1860-
1861- if (fgeom.bottom_height)
1862- {
1863- bottom_region = meta_get_bottom_border_region (&fgeom, clip.width);
1864-
1865- decor_blend_border_picture (xdisplay,
1866- d->context,
1867- src,
1868- 0, clip.height - fgeom.bottom_height,
1869- d->picture,
1870- &d->border_layout,
1871- BORDER_BOTTOM,
1872- bottom_region,
1873- alpha * 0xffff,
1874- shade_alpha,
1875- 0);
1876-
1877- }
1878-
1879- if (fgeom.left_width)
1880- {
1881- left_region = meta_get_left_border_region (&fgeom, clip.height);
1882-
1883- decor_blend_border_picture (xdisplay,
1884- d->context,
1885- src,
1886- 0, fgeom.top_height,
1887- d->picture,
1888- &d->border_layout,
1889- BORDER_LEFT,
1890- left_region,
1891- alpha * 0xffff,
1892- shade_alpha,
1893- 0);
1894- }
1895-
1896- if (fgeom.right_width)
1897- {
1898- right_region = meta_get_right_border_region (&fgeom, clip.height);
1899-
1900- decor_blend_border_picture (xdisplay,
1901- d->context,
1902- src,
1903- clip.width - fgeom.right_width, fgeom.top_height,
1904- d->picture,
1905- &d->border_layout,
1906- BORDER_RIGHT,
1907- right_region,
1908- alpha * 0xffff,
1909- shade_alpha,
1910- 0);
1911- }
1912-
1913- cairo_destroy (cr);
1914- cairo_surface_destroy (surface);
1915- XRenderFreePicture (xdisplay, src);
1916+ {
1917+ top_region = meta_get_top_border_region (&fgeom, fgeom.width);
1918+
1919+ decor_blend_border_picture (xdisplay, d->context, src,
1920+ 0, 0,
1921+ d->picture, &d->border_layout,
1922+ BORDER_TOP, top_region,
1923+ alpha * 0xffff, shade_alpha, 0);
1924+ }
1925+
1926+ if (fgeom.bottom_height)
1927+ {
1928+ bottom_region = meta_get_bottom_border_region (&fgeom, fgeom.width);
1929+
1930+ decor_blend_border_picture (xdisplay, d->context, src,
1931+ 0, fgeom.height - fgeom.bottom_height,
1932+ d->picture, &d->border_layout,
1933+ BORDER_BOTTOM, bottom_region,
1934+ alpha * 0xffff, shade_alpha, 0);
1935+ }
1936+
1937+ if (fgeom.left_width)
1938+ {
1939+ left_region = meta_get_left_border_region (&fgeom, fgeom.height);
1940+
1941+ decor_blend_border_picture (xdisplay, d->context, src,
1942+ 0, fgeom.top_height,
1943+ d->picture, &d->border_layout,
1944+ BORDER_LEFT, left_region,
1945+ alpha * 0xffff, shade_alpha, 0);
1946+ }
1947+
1948+ if (fgeom.right_width)
1949+ {
1950+ right_region = meta_get_right_border_region (&fgeom, fgeom.height);
1951+
1952+ decor_blend_border_picture (xdisplay, d->context, src,
1953+ fgeom.width - fgeom.right_width, fgeom.top_height,
1954+ d->picture, &d->border_layout,
1955+ BORDER_RIGHT, right_region,
1956+ alpha * 0xffff, shade_alpha, 0);
1957+ }
1958+
1959+ cairo_destroy (cr);
1960+ cairo_surface_destroy (surface);
1961+ XRenderFreePicture (xdisplay, src);
1962
1963 copy_to_front_buffer (d);
1964
1965 if (d->frame_window)
1966 {
1967- GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
1968- GdkPixbuf *pixbuf = gdk_pixbuf_get_from_surface (d->surface, 0, 0, d->width, d->height);
1969-
1970- gtk_image_set_from_pixbuf (GTK_IMAGE (d->decor_image), pixbuf);
1971- g_object_unref (pixbuf);
1972-
1973- gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height);
1974- gdk_window_move (gdk_frame_window,
1975- d->context->left_corner_space - 1,
1976- d->context->top_corner_space - 1);
1977- gdk_window_lower (gdk_frame_window);
1978+ GdkWindow *gdk_frame_window;
1979+ GdkPixbuf *pixbuf;
1980+
1981+ gdk_frame_window = gtk_widget_get_window (d->decor_window);
1982+
1983+ pixbuf = gdk_pixbuf_get_from_surface (d->surface, 0, 0, d->width, d->height);
1984+ gtk_image_set_from_pixbuf (GTK_IMAGE (d->decor_image), pixbuf);
1985+ g_object_unref (pixbuf);
1986+
1987+ gdk_window_move_resize (gdk_frame_window,
1988+ d->context->left_corner_space - 1,
1989+ d->context->top_corner_space - 1,
1990+ d->width,
1991+ d->height);
1992+
1993+ gdk_window_lower (gdk_frame_window);
1994 }
1995
1996 if (d->prop_xid)
1997 {
1998- /* translate from frame to client window space */
1999- if (top_region)
2000- XOffsetRegion (top_region, -fgeom.left_width, -fgeom.top_height);
2001- if (bottom_region)
2002- XOffsetRegion (bottom_region, -fgeom.left_width, 0);
2003- if (left_region)
2004- XOffsetRegion (left_region, -fgeom.left_width, 0);
2005-
2006- decor_update_meta_window_property (d, theme, flags,
2007- top_region,
2008- bottom_region,
2009- left_region,
2010- right_region);
2011- d->prop_xid = 0;
2012+ /* translate from frame to client window space */
2013+ if (top_region)
2014+ XOffsetRegion (top_region, -fgeom.left_width, -fgeom.top_height);
2015+ if (bottom_region)
2016+ XOffsetRegion (bottom_region, -fgeom.left_width, 0);
2017+ if (left_region)
2018+ XOffsetRegion (left_region, -fgeom.left_width, 0);
2019+
2020+ decor_update_meta_window_property (d, theme, flags,
2021+ top_region, bottom_region,
2022+ left_region, right_region);
2023+
2024+ d->prop_xid = 0;
2025 }
2026
2027 if (top_region)
2028- XDestroyRegion (top_region);
2029+ XDestroyRegion (top_region);
2030 if (bottom_region)
2031- XDestroyRegion (bottom_region);
2032+ XDestroyRegion (bottom_region);
2033 if (left_region)
2034- XDestroyRegion (left_region);
2035+ XDestroyRegion (left_region);
2036 if (right_region)
2037- XDestroyRegion (right_region);
2038+ XDestroyRegion (right_region);
2039 }
2040
2041-void
2042+static void
2043 meta_calc_button_size (decor_t *d)
2044 {
2045 MetaTheme *theme;
2046@@ -824,7 +791,6 @@
2047 MetaFrameFlags flags;
2048 MetaFrameGeometry fgeom;
2049 MetaButtonLayout button_layout;
2050- GdkRectangle clip;
2051 MetaFrameBorders borders;
2052 gint mutter_draggable_border_width;
2053 gint i, min_x, x, y, w, h, width;
2054@@ -842,7 +808,7 @@
2055 frame_type = META_FRAME_TYPE_NORMAL;
2056
2057 meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
2058- frame_type, &clip);
2059+ frame_type);
2060 meta_theme_get_frame_borders (theme, frame_type, d->frame->text_height,
2061 flags, &borders);
2062
2063@@ -860,130 +826,131 @@
2064
2065 for (i = 0; i < 3; ++i)
2066 {
2067- static guint button_actions[3] = {
2068- WNCK_WINDOW_ACTION_CLOSE,
2069- WNCK_WINDOW_ACTION_MAXIMIZE,
2070- WNCK_WINDOW_ACTION_MINIMIZE
2071- };
2072+ static guint button_actions[3] = {
2073+ WNCK_WINDOW_ACTION_CLOSE,
2074+ WNCK_WINDOW_ACTION_MAXIMIZE,
2075+ WNCK_WINDOW_ACTION_MINIMIZE
2076+ };
2077
2078- if (d->actions & button_actions[i])
2079- {
2080- if (meta_get_button_position (d, i, width, 256,
2081- &x, &y, &w, &h))
2082- {
2083- if (x > width / 2 && x < min_x)
2084- min_x = x;
2085- }
2086- }
2087+ if (d->actions & button_actions[i])
2088+ {
2089+ if (meta_get_button_position (d, i, width, 256, &x, &y, &w, &h))
2090+ {
2091+ if (x > width / 2 && x < min_x)
2092+ min_x = x;
2093+ }
2094+ }
2095 }
2096
2097 d->button_width = width - min_x;
2098 }
2099
2100+static MetaButtonFunction
2101+button_to_meta_button_function (gint i)
2102+{
2103+ switch (i)
2104+ {
2105+ case BUTTON_MENU:
2106+ return META_BUTTON_FUNCTION_MENU;
2107+ case BUTTON_MIN:
2108+ return META_BUTTON_FUNCTION_MINIMIZE;
2109+ case BUTTON_MAX:
2110+ return META_BUTTON_FUNCTION_MAXIMIZE;
2111+ case BUTTON_CLOSE:
2112+ return META_BUTTON_FUNCTION_CLOSE;
2113+ case BUTTON_SHADE:
2114+ return META_BUTTON_FUNCTION_SHADE;
2115+ case BUTTON_ABOVE:
2116+ return META_BUTTON_FUNCTION_ABOVE;
2117+ case BUTTON_STICK:
2118+ return META_BUTTON_FUNCTION_STICK;
2119+ case BUTTON_UNSHADE:
2120+ return META_BUTTON_FUNCTION_UNSHADE;
2121+ case BUTTON_UNABOVE:
2122+ return META_BUTTON_FUNCTION_UNABOVE;
2123+ case BUTTON_UNSTICK:
2124+ return META_BUTTON_FUNCTION_UNSTICK;
2125+ default:
2126+ break;
2127+ }
2128+
2129+ return META_BUTTON_FUNCTION_LAST;
2130+}
2131+
2132 gboolean
2133-meta_get_button_position (decor_t *d,
2134- gint i,
2135- gint width,
2136- gint height,
2137- gint *x,
2138- gint *y,
2139- gint *w,
2140- gint *h)
2141+meta_get_button_position (decor_t *d,
2142+ gint i,
2143+ gint width,
2144+ gint height,
2145+ gint *x,
2146+ gint *y,
2147+ gint *w,
2148+ gint *h)
2149 {
2150- MetaButtonLayout button_layout;
2151+ MetaButtonLayout button_layout;
2152 MetaFrameGeometry fgeom;
2153- MetaFrameFlags flags;
2154- MetaTheme *theme;
2155-
2156- GdkRectangle clip;
2157-
2158- MetaButtonSpace *space;
2159-
2160- gint mutter_draggable_border_width = 0;
2161-
2162+ MetaFrameFlags flags;
2163+ MetaTheme *theme;
2164+ MetaButtonFunction button_function;
2165+ MetaButtonSpace *space;
2166+ gint mutter_draggable_border_width;
2167+
2168+ mutter_draggable_border_width = 0;
2169 g_object_get (settings, "draggable-border-width", &mutter_draggable_border_width, NULL);
2170
2171 if (!d->context)
2172 {
2173- /* undecorated windows implicitly have no buttons */
2174- return FALSE;
2175+ /* undecorated windows implicitly have no buttons */
2176+ return FALSE;
2177 }
2178
2179 theme = meta_theme_get_current ();
2180
2181 meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
2182- meta_frame_type_from_string (d->frame->type),
2183- &clip);
2184-
2185- switch (i) {
2186+ meta_frame_type_from_string (d->frame->type));
2187+
2188+ button_function = button_to_meta_button_function (i);
2189+ if (!meta_button_present (&button_layout, button_function))
2190+ return FALSE;
2191+
2192+ switch (i)
2193+ {
2194 case BUTTON_MENU:
2195- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_MENU))
2196- return FALSE;
2197-
2198- space = &fgeom.menu_rect;
2199- break;
2200+ space = &fgeom.menu_rect;
2201+ break;
2202 case BUTTON_MIN:
2203- if (!meta_button_present (&button_layout,
2204- META_BUTTON_FUNCTION_MINIMIZE))
2205- return FALSE;
2206-
2207- space = &fgeom.min_rect;
2208- break;
2209+ space = &fgeom.min_rect;
2210+ break;
2211 case BUTTON_MAX:
2212- if (!meta_button_present (&button_layout,
2213- META_BUTTON_FUNCTION_MAXIMIZE))
2214- return FALSE;
2215-
2216- space = &fgeom.max_rect;
2217- break;
2218+ space = &fgeom.max_rect;
2219+ break;
2220 case BUTTON_CLOSE:
2221- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_CLOSE))
2222- return FALSE;
2223-
2224- space = &fgeom.close_rect;
2225- break;
2226+ space = &fgeom.close_rect;
2227+ break;
2228 case BUTTON_SHADE:
2229- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_SHADE))
2230- return FALSE;
2231-
2232- space = &fgeom.shade_rect;
2233- break;
2234+ space = &fgeom.shade_rect;
2235+ break;
2236 case BUTTON_ABOVE:
2237- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_ABOVE))
2238- return FALSE;
2239-
2240- space = &fgeom.above_rect;
2241- break;
2242+ space = &fgeom.above_rect;
2243+ break;
2244 case BUTTON_STICK:
2245- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_STICK))
2246- return FALSE;
2247-
2248- space = &fgeom.stick_rect;
2249- break;
2250+ space = &fgeom.stick_rect;
2251+ break;
2252 case BUTTON_UNSHADE:
2253- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNSHADE))
2254- return FALSE;
2255-
2256- space = &fgeom.unshade_rect;
2257- break;
2258+ space = &fgeom.unshade_rect;
2259+ break;
2260 case BUTTON_UNABOVE:
2261- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNABOVE))
2262- return FALSE;
2263-
2264- space = &fgeom.unabove_rect;
2265- break;
2266+ space = &fgeom.unabove_rect;
2267+ break;
2268 case BUTTON_UNSTICK:
2269- if (!meta_button_present (&button_layout, META_BUTTON_FUNCTION_UNSTICK))
2270- return FALSE;
2271-
2272- space = &fgeom.unstick_rect;
2273- break;
2274+ space = &fgeom.unstick_rect;
2275+ break;
2276 default:
2277- return FALSE;
2278+ return FALSE;
2279 }
2280
2281 if (!space->clickable.width && !space->clickable.height)
2282- return FALSE;
2283+ return FALSE;
2284
2285 *x = space->clickable.x;
2286 *y = space->clickable.y;
2287@@ -992,19 +959,15 @@
2288
2289 if (d->frame_window)
2290 {
2291- *x += d->frame->win_extents.left + 4;
2292- *y += d->frame->win_extents.top + 2;
2293+ *x += d->frame->win_extents.left + 4;
2294+ *y += d->frame->win_extents.top + 2;
2295 }
2296
2297 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
2298- {
2299- *x += mutter_draggable_border_width;
2300- }
2301+ *x += mutter_draggable_border_width;
2302
2303 if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
2304- {
2305- *y += mutter_draggable_border_width;
2306- }
2307+ *y += mutter_draggable_border_width;
2308
2309 return TRUE;
2310 }
2311@@ -1012,14 +975,16 @@
2312 gfloat
2313 meta_get_title_scale (decor_frame_t *frame)
2314 {
2315- MetaTheme *theme = meta_theme_get_current ();
2316- MetaFrameType type;
2317- MetaFrameFlags flags = 0xc33; /* fixme */
2318+ MetaTheme *theme;
2319+ MetaFrameType type;
2320+ MetaFrameFlags flags;
2321
2322+ theme = meta_theme_get_current ();
2323 type = meta_frame_type_from_string (frame->type);
2324+ flags = 0xc33; /* fixme */
2325
2326 if (type == META_FRAME_TYPE_LAST)
2327- return 1.0f;
2328+ return 1.0f;
2329
2330 gfloat scale = meta_theme_get_title_scale (theme, type, flags);
2331
2332@@ -1028,381 +993,367 @@
2333
2334 gboolean
2335 meta_calc_decoration_size (decor_t *d,
2336- gint w,
2337- gint h,
2338- gint name_width,
2339- gint *width,
2340- gint *height)
2341+ gint w,
2342+ gint h,
2343+ gint name_width,
2344+ gint *width,
2345+ gint *height)
2346 {
2347- decor_layout_t layout;
2348+ decor_layout_t layout;
2349 decor_context_t *context;
2350- decor_shadow_t *shadow;
2351+ decor_shadow_t *shadow;
2352
2353 if (!d->decorated)
2354- return FALSE;
2355+ return FALSE;
2356
2357 if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
2358 {
2359- if (!d->frame_window)
2360- {
2361- if (d->active)
2362- {
2363- context = &d->frame->max_window_context_active;
2364- shadow = d->frame->max_border_shadow_active;
2365- }
2366- else
2367- {
2368- context = &d->frame->max_window_context_inactive;
2369- shadow = d->frame->max_border_shadow_inactive;
2370- }
2371- }
2372- else
2373- {
2374- context = &d->frame->max_window_context_no_shadow;
2375- shadow = d->frame->max_border_no_shadow;
2376- }
2377+ if (!d->frame_window)
2378+ {
2379+ if (d->active)
2380+ {
2381+ context = &d->frame->max_window_context_active;
2382+ shadow = d->frame->max_border_shadow_active;
2383+ }
2384+ else
2385+ {
2386+ context = &d->frame->max_window_context_inactive;
2387+ shadow = d->frame->max_border_shadow_inactive;
2388+ }
2389+ }
2390+ else
2391+ {
2392+ context = &d->frame->max_window_context_no_shadow;
2393+ shadow = d->frame->max_border_no_shadow;
2394+ }
2395 }
2396 else
2397 {
2398- if (!d->frame_window)
2399- {
2400- if (d->active)
2401- {
2402- context = &d->frame->window_context_active;
2403- shadow = d->frame->border_shadow_active;
2404- }
2405- else
2406- {
2407- context = &d->frame->window_context_inactive;
2408- shadow = d->frame->border_shadow_inactive;
2409- }
2410- }
2411- else
2412- {
2413- context = &d->frame->window_context_no_shadow;
2414- shadow = d->frame->border_no_shadow;
2415- }
2416+ if (!d->frame_window)
2417+ {
2418+ if (d->active)
2419+ {
2420+ context = &d->frame->window_context_active;
2421+ shadow = d->frame->border_shadow_active;
2422+ }
2423+ else
2424+ {
2425+ context = &d->frame->window_context_inactive;
2426+ shadow = d->frame->border_shadow_inactive;
2427+ }
2428+ }
2429+ else
2430+ {
2431+ context = &d->frame->window_context_no_shadow;
2432+ shadow = d->frame->border_no_shadow;
2433+ }
2434 }
2435
2436 if (!d->frame_window)
2437 {
2438- decor_get_best_layout (context, w, h, &layout);
2439-
2440- if (context != d->context ||
2441- memcmp (&layout, &d->border_layout, sizeof (layout)))
2442- {
2443- *width = layout.width;
2444- *height = layout.height;
2445-
2446- d->border_layout = layout;
2447- d->context = context;
2448- d->shadow = shadow;
2449-
2450- meta_calc_button_size (d);
2451-
2452- return TRUE;
2453- }
2454+ decor_get_best_layout (context, w, h, &layout);
2455+
2456+ if (context != d->context || memcmp (&layout, &d->border_layout, sizeof (layout)))
2457+ {
2458+ *width = layout.width;
2459+ *height = layout.height;
2460+
2461+ d->border_layout = layout;
2462+ d->context = context;
2463+ d->shadow = shadow;
2464+
2465+ meta_calc_button_size (d);
2466+
2467+ return TRUE;
2468+ }
2469 }
2470 else
2471 {
2472- if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
2473- decor_get_default_layout (context, d->client_width,
2474- d->client_height - d->frame->titlebar_height,
2475- &layout);
2476- else
2477- decor_get_default_layout (context, d->client_width,
2478- d->client_height, &layout);
2479-
2480- *width = layout.width;
2481- *height = layout.height;
2482-
2483- d->border_layout = layout;
2484- d->shadow = shadow;
2485- d->context = context;
2486-
2487- meta_calc_button_size (d);
2488-
2489- return TRUE;
2490+ if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
2491+ decor_get_default_layout (context, d->client_width,
2492+ d->client_height - d->frame->titlebar_height,
2493+ &layout);
2494+ else
2495+ decor_get_default_layout (context, d->client_width,
2496+ d->client_height, &layout);
2497+
2498+ *width = layout.width;
2499+ *height = layout.height;
2500+
2501+ d->border_layout = layout;
2502+ d->shadow = shadow;
2503+ d->context = context;
2504+
2505+ meta_calc_button_size (d);
2506+
2507+ return TRUE;
2508 }
2509
2510 return FALSE;
2511 }
2512
2513-gboolean
2514-meta_button_present (MetaButtonLayout *button_layout,
2515- MetaButtonFunction function)
2516-{
2517- int i;
2518-
2519- for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i)
2520- if (button_layout->left_buttons[i] == function)
2521- return TRUE;
2522-
2523- for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i)
2524- if (button_layout->right_buttons[i] == function)
2525- return TRUE;
2526-
2527- return FALSE;
2528-}
2529-
2530 #define TOP_RESIZE_HEIGHT 2
2531 #define RESIZE_EXTENDS 15
2532
2533 void
2534 meta_get_event_window_position (decor_t *d,
2535- gint i,
2536- gint j,
2537- gint width,
2538- gint height,
2539- gint *x,
2540- gint *y,
2541- gint *w,
2542- gint *h)
2543+ gint i,
2544+ gint j,
2545+ gint width,
2546+ gint height,
2547+ gint *x,
2548+ gint *y,
2549+ gint *w,
2550+ gint *h)
2551 {
2552- MetaButtonLayout button_layout;
2553+ MetaButtonLayout button_layout;
2554 MetaFrameGeometry fgeom;
2555- MetaFrameFlags flags;
2556- MetaTheme *theme;
2557- GdkRectangle clip;
2558-
2559- gint mutter_draggable_border_width = 0;
2560-
2561+ MetaFrameFlags flags;
2562+ MetaTheme *theme;
2563+ gint mutter_draggable_border_width;
2564+
2565+ mutter_draggable_border_width = 0;
2566 g_object_get (settings, "draggable-border-width", &mutter_draggable_border_width, NULL);
2567
2568 theme = meta_theme_get_current ();
2569
2570 meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
2571- meta_frame_type_from_string (d->frame->type),
2572- &clip);
2573-
2574- width += fgeom.right_width + fgeom.left_width;
2575- height += fgeom.top_height + fgeom.bottom_height;
2576-
2577- switch (i) {
2578+ meta_frame_type_from_string (d->frame->type));
2579+
2580+ width += fgeom.right_width + fgeom.left_width;
2581+ height += fgeom.top_height + fgeom.bottom_height;
2582+
2583+ switch (i)
2584+ {
2585 case 2: /* bottom */
2586- switch (j) {
2587- case 2: /* bottom right */
2588- if (d->frame_window)
2589- {
2590- *x = width - fgeom.right_width - RESIZE_EXTENDS +
2591- d->frame->win_extents.left + 2;
2592- *y = height - fgeom.bottom_height - RESIZE_EXTENDS +
2593- d->frame->win_extents.top + 2;
2594- }
2595- else
2596- {
2597- *x = width - fgeom.right_width - RESIZE_EXTENDS;
2598- *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
2599- }
2600- *w = fgeom.right_width + RESIZE_EXTENDS;
2601- *h = fgeom.bottom_height + RESIZE_EXTENDS;
2602-
2603- if (!d->frame_window)
2604- {
2605- *x += mutter_draggable_border_width;
2606- *y += mutter_draggable_border_width;
2607- *w += mutter_draggable_border_width;
2608- *h += mutter_draggable_border_width;
2609- }
2610-
2611- break;
2612- case 1: /* bottom */
2613- *x = fgeom.left_width + RESIZE_EXTENDS;
2614- *y = height - fgeom.bottom_height;
2615- if (d->frame_window)
2616- *y += d->frame->win_extents.top + 2;
2617- *w = width - fgeom.left_width - fgeom.right_width -
2618- (2 * RESIZE_EXTENDS);
2619- *h = fgeom.bottom_height;
2620-
2621- if (!d->frame_window)
2622- {
2623- *x -= mutter_draggable_border_width;
2624- *y += mutter_draggable_border_width;
2625- *h += mutter_draggable_border_width;
2626- *w += mutter_draggable_border_width * 2;
2627- }
2628-
2629- break;
2630- case 0: /* bottom left */
2631- default:
2632- *x = 0;
2633- *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
2634- if (d->frame_window)
2635- {
2636- *x += d->frame->win_extents.left + 4;
2637- *y += d->frame->win_extents.bottom + 2;
2638- }
2639- *w = fgeom.left_width + RESIZE_EXTENDS;
2640- *h = fgeom.bottom_height + RESIZE_EXTENDS;
2641-
2642- if (!d->frame_window)
2643- {
2644- *y += mutter_draggable_border_width;
2645- *w += mutter_draggable_border_width;
2646- *h += mutter_draggable_border_width;
2647- }
2648-
2649- break;
2650- }
2651- break;
2652+ switch (j)
2653+ {
2654+ case 2: /* bottom right */
2655+ if (d->frame_window)
2656+ {
2657+ *x = width - fgeom.right_width - RESIZE_EXTENDS +
2658+ d->frame->win_extents.left + 2;
2659+ *y = height - fgeom.bottom_height - RESIZE_EXTENDS +
2660+ d->frame->win_extents.top + 2;
2661+ }
2662+ else
2663+ {
2664+ *x = width - fgeom.right_width - RESIZE_EXTENDS;
2665+ *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
2666+ }
2667+
2668+ *w = fgeom.right_width + RESIZE_EXTENDS;
2669+ *h = fgeom.bottom_height + RESIZE_EXTENDS;
2670+
2671+ if (!d->frame_window)
2672+ {
2673+ *x += mutter_draggable_border_width;
2674+ *y += mutter_draggable_border_width;
2675+ *w += mutter_draggable_border_width;
2676+ *h += mutter_draggable_border_width;
2677+ }
2678+ break;
2679+ case 1: /* bottom */
2680+ *x = fgeom.left_width + RESIZE_EXTENDS;
2681+ *y = height - fgeom.bottom_height;
2682+
2683+ if (d->frame_window)
2684+ *y += d->frame->win_extents.top + 2;
2685+
2686+ *w = width - fgeom.left_width - fgeom.right_width - (2 * RESIZE_EXTENDS);
2687+ *h = fgeom.bottom_height;
2688+
2689+ if (!d->frame_window)
2690+ {
2691+ *x -= mutter_draggable_border_width;
2692+ *y += mutter_draggable_border_width;
2693+ *h += mutter_draggable_border_width;
2694+ *w += mutter_draggable_border_width * 2;
2695+ }
2696+ break;
2697+ case 0: /* bottom left */
2698+ default:
2699+ *x = 0;
2700+ *y = height - fgeom.bottom_height - RESIZE_EXTENDS;
2701+
2702+ if (d->frame_window)
2703+ {
2704+ *x += d->frame->win_extents.left + 4;
2705+ *y += d->frame->win_extents.bottom + 2;
2706+ }
2707+
2708+ *w = fgeom.left_width + RESIZE_EXTENDS;
2709+ *h = fgeom.bottom_height + RESIZE_EXTENDS;
2710+
2711+ if (!d->frame_window)
2712+ {
2713+ *y += mutter_draggable_border_width;
2714+ *w += mutter_draggable_border_width;
2715+ *h += mutter_draggable_border_width;
2716+ }
2717+ break;
2718+ }
2719+ break;
2720 case 1: /* middle */
2721- switch (j) {
2722- case 2: /* right */
2723- *x = width - fgeom.right_width;
2724- *y = fgeom.top_height + RESIZE_EXTENDS;
2725- if (d->frame_window)
2726- *x += d->frame->win_extents.left + 2;
2727- *w = fgeom.right_width;
2728- *h = height - fgeom.top_height - fgeom.bottom_height -
2729- (2 * RESIZE_EXTENDS);
2730-
2731- if (!d->frame_window)
2732- {
2733- *x += mutter_draggable_border_width;
2734- *y += mutter_draggable_border_width;
2735- *w += mutter_draggable_border_width;
2736- *h += mutter_draggable_border_width;
2737- }
2738-
2739-
2740- break;
2741- case 1: /* middle */
2742- *x = fgeom.left_width;
2743- *y = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
2744- *w = width - fgeom.left_width - fgeom.right_width;
2745- *h = height - fgeom.top_titlebar_edge - fgeom.bottom_height;
2746-
2747- if (!d->frame_window)
2748- {
2749- *x += mutter_draggable_border_width;
2750- if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
2751- *y += mutter_draggable_border_width;
2752- }
2753-
2754- break;
2755- case 0: /* left */
2756- default:
2757- *x = 0;
2758- if (d->frame_window)
2759- *x += d->frame->win_extents.left + 4;
2760- *y = fgeom.top_height + RESIZE_EXTENDS;
2761- *w = fgeom.left_width;
2762- *h = height - fgeom.top_height - fgeom.bottom_height -
2763- (2 * RESIZE_EXTENDS);
2764-
2765- if (!d->frame_window)
2766- {
2767- *y += mutter_draggable_border_width;
2768- *h += mutter_draggable_border_width;
2769- *w += mutter_draggable_border_width;
2770- }
2771-
2772-
2773- break;
2774- }
2775- break;
2776+ switch (j)
2777+ {
2778+ case 2: /* right */
2779+ *x = width - fgeom.right_width;
2780+ *y = fgeom.top_height + RESIZE_EXTENDS;
2781+
2782+ if (d->frame_window)
2783+ *x += d->frame->win_extents.left + 2;
2784+
2785+ *w = fgeom.right_width;
2786+ *h = height - fgeom.top_height - fgeom.bottom_height - (2 * RESIZE_EXTENDS);
2787+
2788+ if (!d->frame_window)
2789+ {
2790+ *x += mutter_draggable_border_width;
2791+ *y += mutter_draggable_border_width;
2792+ *w += mutter_draggable_border_width;
2793+ *h += mutter_draggable_border_width;
2794+ }
2795+ break;
2796+ case 1: /* middle */
2797+ *x = fgeom.left_width;
2798+ *y = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
2799+ *w = width - fgeom.left_width - fgeom.right_width;
2800+ *h = height - fgeom.top_titlebar_edge - fgeom.bottom_height;
2801+
2802+ if (!d->frame_window)
2803+ {
2804+ *x += mutter_draggable_border_width;
2805+
2806+ if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
2807+ *y += mutter_draggable_border_width;
2808+ }
2809+ break;
2810+ case 0: /* left */
2811+ default:
2812+ *x = 0;
2813+
2814+ if (d->frame_window)
2815+ *x += d->frame->win_extents.left + 4;
2816+
2817+ *y = fgeom.top_height + RESIZE_EXTENDS;
2818+ *w = fgeom.left_width;
2819+ *h = height - fgeom.top_height - fgeom.bottom_height - (2 * RESIZE_EXTENDS);
2820+
2821+ if (!d->frame_window)
2822+ {
2823+ *y += mutter_draggable_border_width;
2824+ *h += mutter_draggable_border_width;
2825+ *w += mutter_draggable_border_width;
2826+ }
2827+ break;
2828+ }
2829+ break;
2830 case 0: /* top */
2831 default:
2832- switch (j) {
2833- case 2: /* top right */
2834- *x = width - fgeom.right_width - RESIZE_EXTENDS;
2835- *y = 0;
2836- if (d->frame_window)
2837- {
2838- *x += d->frame->win_extents.left + 2;
2839- *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
2840- }
2841- *w = fgeom.right_width + RESIZE_EXTENDS;
2842- *h = fgeom.top_height + RESIZE_EXTENDS;
2843-
2844- if (!d->frame_window)
2845- {
2846- *x += mutter_draggable_border_width;
2847- *w += mutter_draggable_border_width;
2848- *h += mutter_draggable_border_width;
2849- }
2850- break;
2851- case 1: /* top */
2852- *x = fgeom.left_width + RESIZE_EXTENDS;
2853- *y = 0;
2854- if (d->frame_window)
2855- *y += d->frame->win_extents.top + 2;
2856- *w = width - fgeom.left_width - fgeom.right_width -
2857- (2 * RESIZE_EXTENDS);
2858- *h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
2859-
2860- if (!d->frame_window)
2861- {
2862- *x -= mutter_draggable_border_width;
2863- *w += mutter_draggable_border_width * 2;
2864- *h += mutter_draggable_border_width;
2865- }
2866-
2867- break;
2868- case 0: /* top left */
2869- default:
2870- *x = 0;
2871- *y = 0;
2872- if (d->frame_window)
2873- {
2874- *x += d->frame->win_extents.left + 4;
2875- *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
2876- }
2877- *w = fgeom.left_width + RESIZE_EXTENDS;
2878- *h = fgeom.top_height + RESIZE_EXTENDS;
2879-
2880- if (!d->frame_window)
2881- {
2882- *w += mutter_draggable_border_width;
2883- *h += mutter_draggable_border_width;
2884- }
2885-
2886- break;
2887- }
2888+ switch (j)
2889+ {
2890+ case 2: /* top right */
2891+ *x = width - fgeom.right_width - RESIZE_EXTENDS;
2892+ *y = 0;
2893+
2894+ if (d->frame_window)
2895+ {
2896+ *x += d->frame->win_extents.left + 2;
2897+ *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
2898+ }
2899+
2900+ *w = fgeom.right_width + RESIZE_EXTENDS;
2901+ *h = fgeom.top_height + RESIZE_EXTENDS;
2902+
2903+ if (!d->frame_window)
2904+ {
2905+ *x += mutter_draggable_border_width;
2906+ *w += mutter_draggable_border_width;
2907+ *h += mutter_draggable_border_width;
2908+ }
2909+ break;
2910+ case 1: /* top */
2911+ *x = fgeom.left_width + RESIZE_EXTENDS;
2912+ *y = 0;
2913+
2914+ if (d->frame_window)
2915+ *y += d->frame->win_extents.top + 2;
2916+
2917+ *w = width - fgeom.left_width - fgeom.right_width - (2 * RESIZE_EXTENDS);
2918+ *h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
2919+
2920+ if (!d->frame_window)
2921+ {
2922+ *x -= mutter_draggable_border_width;
2923+ *w += mutter_draggable_border_width * 2;
2924+ *h += mutter_draggable_border_width;
2925+ }
2926+ break;
2927+ case 0: /* top left */
2928+ default:
2929+ *x = 0;
2930+ *y = 0;
2931+
2932+ if (d->frame_window)
2933+ {
2934+ *x += d->frame->win_extents.left + 4;
2935+ *y += d->frame->win_extents.top + 2 - fgeom.title_rect.height;
2936+ }
2937+
2938+ *w = fgeom.left_width + RESIZE_EXTENDS;
2939+ *h = fgeom.top_height + RESIZE_EXTENDS;
2940+
2941+ if (!d->frame_window)
2942+ {
2943+ *w += mutter_draggable_border_width;
2944+ *h += mutter_draggable_border_width;
2945+ }
2946+ break;
2947+ }
2948+ break;
2949 }
2950
2951 if (!(flags & META_FRAME_ALLOWS_VERTICAL_RESIZE))
2952 {
2953- /* turn off top and bottom event windows */
2954- if (i == 0 || i == 2)
2955- *w = *h = 0;
2956+ /* turn off top and bottom event windows */
2957+ if (i == 0 || i == 2)
2958+ *w = *h = 0;
2959 }
2960
2961 if (!(flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE))
2962 {
2963- /* turn off left and right event windows */
2964- if (j == 0 || j == 2)
2965- *w = *h = 0;
2966+ /* turn off left and right event windows */
2967+ if (j == 0 || j == 2)
2968+ *w = *h = 0;
2969 }
2970 }
2971
2972-
2973 static MetaButtonFunction
2974 meta_button_function_from_string (const char *str)
2975 {
2976 if (strcmp (str, "menu") == 0)
2977- return META_BUTTON_FUNCTION_MENU;
2978+ return META_BUTTON_FUNCTION_MENU;
2979 else if (strcmp (str, "minimize") == 0)
2980- return META_BUTTON_FUNCTION_MINIMIZE;
2981+ return META_BUTTON_FUNCTION_MINIMIZE;
2982 else if (strcmp (str, "maximize") == 0)
2983- return META_BUTTON_FUNCTION_MAXIMIZE;
2984+ return META_BUTTON_FUNCTION_MAXIMIZE;
2985 else if (strcmp (str, "close") == 0)
2986- return META_BUTTON_FUNCTION_CLOSE;
2987+ return META_BUTTON_FUNCTION_CLOSE;
2988 else if (strcmp (str, "shade") == 0)
2989- return META_BUTTON_FUNCTION_SHADE;
2990+ return META_BUTTON_FUNCTION_SHADE;
2991 else if (strcmp (str, "above") == 0)
2992- return META_BUTTON_FUNCTION_ABOVE;
2993+ return META_BUTTON_FUNCTION_ABOVE;
2994 else if (strcmp (str, "stick") == 0)
2995- return META_BUTTON_FUNCTION_STICK;
2996+ return META_BUTTON_FUNCTION_STICK;
2997 else if (strcmp (str, "unshade") == 0)
2998- return META_BUTTON_FUNCTION_UNSHADE;
2999+ return META_BUTTON_FUNCTION_UNSHADE;
3000 else if (strcmp (str, "unabove") == 0)
3001- return META_BUTTON_FUNCTION_UNABOVE;
3002+ return META_BUTTON_FUNCTION_UNABOVE;
3003 else if (strcmp (str, "unstick") == 0)
3004- return META_BUTTON_FUNCTION_UNSTICK;
3005+ return META_BUTTON_FUNCTION_UNSTICK;
3006 else
3007- return META_BUTTON_FUNCTION_LAST;
3008+ return META_BUTTON_FUNCTION_LAST;
3009 }
3010
3011 static MetaButtonFunction
3012@@ -1411,22 +1362,22 @@
3013 switch (ofwhat)
3014 {
3015 case META_BUTTON_FUNCTION_SHADE:
3016- return META_BUTTON_FUNCTION_UNSHADE;
3017+ return META_BUTTON_FUNCTION_UNSHADE;
3018 case META_BUTTON_FUNCTION_UNSHADE:
3019- return META_BUTTON_FUNCTION_SHADE;
3020+ return META_BUTTON_FUNCTION_SHADE;
3021
3022 case META_BUTTON_FUNCTION_ABOVE:
3023- return META_BUTTON_FUNCTION_UNABOVE;
3024+ return META_BUTTON_FUNCTION_UNABOVE;
3025 case META_BUTTON_FUNCTION_UNABOVE:
3026- return META_BUTTON_FUNCTION_ABOVE;
3027+ return META_BUTTON_FUNCTION_ABOVE;
3028
3029 case META_BUTTON_FUNCTION_STICK:
3030- return META_BUTTON_FUNCTION_UNSTICK;
3031+ return META_BUTTON_FUNCTION_UNSTICK;
3032 case META_BUTTON_FUNCTION_UNSTICK:
3033- return META_BUTTON_FUNCTION_STICK;
3034+ return META_BUTTON_FUNCTION_STICK;
3035
3036 default:
3037- return META_BUTTON_FUNCTION_LAST;
3038+ return META_BUTTON_FUNCTION_LAST;
3039 }
3040 }
3041
3042@@ -1437,20 +1388,20 @@
3043
3044 for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i)
3045 {
3046- layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
3047- layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
3048- layout->left_buttons_has_spacer[i] = FALSE;
3049- layout->right_buttons_has_spacer[i] = FALSE;
3050+ layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
3051+ layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
3052+ layout->left_buttons_has_spacer[i] = FALSE;
3053+ layout->right_buttons_has_spacer[i] = FALSE;
3054 }
3055 }
3056
3057 void
3058 meta_update_button_layout (const char *value)
3059 {
3060- MetaButtonLayout new_layout;
3061+ MetaButtonLayout new_layout;
3062 MetaButtonFunction f;
3063- char **sides;
3064- int i;
3065+ char **sides;
3066+ int i;
3067
3068 meta_initialize_button_layout (&new_layout);
3069
3070@@ -1458,96 +1409,97 @@
3071
3072 if (sides[0] != NULL)
3073 {
3074- char **buttons;
3075- int b;
3076- gboolean used[META_BUTTON_FUNCTION_LAST];
3077-
3078- for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
3079- used[i] = FALSE;
3080-
3081- buttons = g_strsplit (sides[0], ",", -1);
3082-
3083- i = b = 0;
3084- while (buttons[b] != NULL)
3085- {
3086- f = meta_button_function_from_string (buttons[b]);
3087- if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
3088- {
3089- new_layout.left_buttons_has_spacer[i - 1] = TRUE;
3090- f = meta_button_opposite_function (f);
3091-
3092- if (f != META_BUTTON_FUNCTION_LAST)
3093- new_layout.left_buttons_has_spacer[i - 2] = TRUE;
3094- }
3095- else
3096- {
3097- if (f != META_BUTTON_FUNCTION_LAST && !used[f])
3098- {
3099- used[f] = TRUE;
3100- new_layout.left_buttons[i++] = f;
3101-
3102- f = meta_button_opposite_function (f);
3103-
3104- if (f != META_BUTTON_FUNCTION_LAST)
3105- new_layout.left_buttons[i++] = f;
3106-
3107- }
3108- else
3109- {
3110- fprintf (stderr, "%s: Ignoring unknown or already-used "
3111- "button name \"%s\"\n", program_name, buttons[b]);
3112- }
3113- }
3114- ++b;
3115- }
3116-
3117- new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
3118-
3119- g_strfreev (buttons);
3120-
3121- if (sides[1] != NULL)
3122- {
3123- for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
3124- used[i] = FALSE;
3125-
3126- buttons = g_strsplit (sides[1], ",", -1);
3127-
3128- i = b = 0;
3129- while (buttons[b] != NULL)
3130- {
3131- f = meta_button_function_from_string (buttons[b]);
3132- if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
3133- {
3134- new_layout.right_buttons_has_spacer[i - 1] = TRUE;
3135- f = meta_button_opposite_function (f);
3136- if (f != META_BUTTON_FUNCTION_LAST)
3137- new_layout.right_buttons_has_spacer[i - 2] = TRUE;
3138- }
3139- else
3140- {
3141- if (f != META_BUTTON_FUNCTION_LAST && !used[f])
3142- {
3143- used[f] = TRUE;
3144- new_layout.right_buttons[i++] = f;
3145-
3146- f = meta_button_opposite_function (f);
3147-
3148- if (f != META_BUTTON_FUNCTION_LAST)
3149- new_layout.right_buttons[i++] = f;
3150- }
3151- else
3152- {
3153- fprintf (stderr, "%s: Ignoring unknown or "
3154- "already-used button name \"%s\"\n",
3155- program_name, buttons[b]);
3156- }
3157- }
3158- ++b;
3159- }
3160- new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
3161-
3162- g_strfreev (buttons);
3163- }
3164+ char **buttons;
3165+ int b;
3166+ gboolean used[META_BUTTON_FUNCTION_LAST];
3167+
3168+ for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
3169+ used[i] = FALSE;
3170+
3171+ buttons = g_strsplit (sides[0], ",", -1);
3172+
3173+ i = b = 0;
3174+ while (buttons[b] != NULL)
3175+ {
3176+ f = meta_button_function_from_string (buttons[b]);
3177+ if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
3178+ {
3179+ new_layout.left_buttons_has_spacer[i - 1] = TRUE;
3180+ f = meta_button_opposite_function (f);
3181+
3182+ if (f != META_BUTTON_FUNCTION_LAST)
3183+ new_layout.left_buttons_has_spacer[i - 2] = TRUE;
3184+ }
3185+ else
3186+ {
3187+ if (f != META_BUTTON_FUNCTION_LAST && !used[f])
3188+ {
3189+ used[f] = TRUE;
3190+ new_layout.left_buttons[i++] = f;
3191+
3192+ f = meta_button_opposite_function (f);
3193+
3194+ if (f != META_BUTTON_FUNCTION_LAST)
3195+ new_layout.left_buttons[i++] = f;
3196+
3197+ }
3198+ else
3199+ {
3200+ fprintf (stderr, "%s: Ignoring unknown or already-used "
3201+ "button name \"%s\"\n", program_name, buttons[b]);
3202+ }
3203+ }
3204+ ++b;
3205+ }
3206+
3207+ new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
3208+
3209+ g_strfreev (buttons);
3210+
3211+ if (sides[1] != NULL)
3212+ {
3213+ for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
3214+ used[i] = FALSE;
3215+
3216+ buttons = g_strsplit (sides[1], ",", -1);
3217+
3218+ i = b = 0;
3219+ while (buttons[b] != NULL)
3220+ {
3221+ f = meta_button_function_from_string (buttons[b]);
3222+ if (i > 0 && strcmp ("spacer", buttons[b]) == 0)
3223+ {
3224+ new_layout.right_buttons_has_spacer[i - 1] = TRUE;
3225+ f = meta_button_opposite_function (f);
3226+ if (f != META_BUTTON_FUNCTION_LAST)
3227+ new_layout.right_buttons_has_spacer[i - 2] = TRUE;
3228+ }
3229+ else
3230+ {
3231+ if (f != META_BUTTON_FUNCTION_LAST && !used[f])
3232+ {
3233+ used[f] = TRUE;
3234+ new_layout.right_buttons[i++] = f;
3235+
3236+ f = meta_button_opposite_function (f);
3237+
3238+ if (f != META_BUTTON_FUNCTION_LAST)
3239+ new_layout.right_buttons[i++] = f;
3240+ }
3241+ else
3242+ {
3243+ fprintf (stderr, "%s: Ignoring unknown or "
3244+ "already-used button name \"%s\"\n",
3245+ program_name, buttons[b]);
3246+ }
3247+ }
3248+ ++b;
3249+ }
3250+
3251+ new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
3252+
3253+ g_strfreev (buttons);
3254+ }
3255 }
3256
3257 g_strfreev (sides);
3258@@ -1555,42 +1507,38 @@
3259 /* Invert the button layout for RTL languages */
3260 if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
3261 {
3262- MetaButtonLayout rtl_layout;
3263- int j;
3264-
3265- meta_initialize_button_layout (&rtl_layout);
3266-
3267- i = 0;
3268- while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST)
3269- ++i;
3270-
3271- for (j = 0; j < i; ++j)
3272- {
3273- rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
3274- if (j == 0)
3275- rtl_layout.right_buttons_has_spacer[i - 1] =
3276- new_layout.left_buttons_has_spacer[i - j - 1];
3277- else
3278- rtl_layout.right_buttons_has_spacer[j - 1] =
3279- new_layout.left_buttons_has_spacer[i - j - 1];
3280- }
3281-
3282- i = 0;
3283- while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST)
3284- ++i;
3285-
3286- for (j = 0; j < i; ++j)
3287- {
3288- rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
3289- if (j == 0)
3290- rtl_layout.left_buttons_has_spacer[i - 1] =
3291- new_layout.right_buttons_has_spacer[i - j - 1];
3292- else
3293- rtl_layout.left_buttons_has_spacer[j - 1] =
3294- new_layout.right_buttons_has_spacer[i - j - 1];
3295- }
3296-
3297- new_layout = rtl_layout;
3298+ MetaButtonLayout rtl_layout;
3299+ int j;
3300+
3301+ meta_initialize_button_layout (&rtl_layout);
3302+
3303+ i = 0;
3304+ while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST)
3305+ ++i;
3306+
3307+ for (j = 0; j < i; ++j)
3308+ {
3309+ rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
3310+ if (j == 0)
3311+ rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
3312+ else
3313+ rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
3314+ }
3315+
3316+ i = 0;
3317+ while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST)
3318+ ++i;
3319+
3320+ for (j = 0; j < i; ++j)
3321+ {
3322+ rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
3323+ if (j == 0)
3324+ rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
3325+ else
3326+ rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
3327+ }
3328+
3329+ new_layout = rtl_layout;
3330 }
3331
3332 meta_button_layout = new_layout;
3333@@ -1599,37 +1547,36 @@
3334 void
3335 meta_update_border_extents (decor_frame_t *frame)
3336 {
3337- MetaTheme *theme = meta_theme_get_current ();
3338+ MetaTheme *theme;
3339 #ifdef HAVE_METACITY_3_14_0
3340 MetaFrameBorders borders;
3341 #endif
3342+ MetaFrameType frame_type;
3343+ gint top_height;
3344+ gint bottom_height;
3345+ gint left_width;
3346+ gint right_width;
3347
3348 gwd_decor_frame_ref (frame);
3349- MetaFrameType frame_type = meta_frame_type_from_string (frame->type);
3350- gint top_height, bottom_height, left_width, right_width;
3351
3352+ frame_type = meta_frame_type_from_string (frame->type);
3353 if (!(frame_type < META_FRAME_TYPE_LAST))
3354- frame_type = META_FRAME_TYPE_NORMAL;
3355+ frame_type = META_FRAME_TYPE_NORMAL;
3356+
3357+ theme = meta_theme_get_current ();
3358
3359 #ifdef HAVE_METACITY_3_14_0
3360- meta_theme_get_frame_borders (theme,
3361- frame_type,
3362- frame->text_height,
3363- 0,
3364- &borders);
3365+ meta_theme_get_frame_borders (theme, frame_type, frame->text_height,
3366+ 0, &borders);
3367+
3368 top_height = borders.visible.top;
3369 bottom_height = borders.visible.bottom;
3370 left_width = borders.visible.left;
3371 right_width = borders.visible.right;
3372 #else
3373- meta_theme_get_frame_borders (theme,
3374- frame_type,
3375- frame->text_height,
3376- 0,
3377- &top_height,
3378- &bottom_height,
3379- &left_width,
3380- &right_width);
3381+ meta_theme_get_frame_borders (theme, frame_type, frame->text_height,
3382+ 0, &top_height, &bottom_height,
3383+ &left_width, &right_width);
3384 #endif
3385
3386 frame->win_extents.top = frame->win_extents.top;
3387@@ -1640,24 +1587,18 @@
3388 frame->titlebar_height = top_height - frame->win_extents.top;
3389
3390 #ifdef HAVE_METACITY_3_14_0
3391- meta_theme_get_frame_borders (theme,
3392- frame_type,
3393- frame->text_height,
3394- META_FRAME_MAXIMIZED,
3395- &borders);
3396+ meta_theme_get_frame_borders (theme, frame_type, frame->text_height,
3397+ META_FRAME_MAXIMIZED, &borders);
3398+
3399 top_height = borders.visible.top;
3400 bottom_height = borders.visible.bottom;
3401 left_width = borders.visible.left;
3402 right_width = borders.visible.right;
3403 #else
3404- meta_theme_get_frame_borders (theme,
3405- frame_type,
3406- frame->text_height,
3407- META_FRAME_MAXIMIZED,
3408- &top_height,
3409- &bottom_height,
3410- &left_width,
3411- &right_width);
3412+ meta_theme_get_frame_borders (theme, frame_type, frame->text_height,
3413+ META_FRAME_MAXIMIZED,
3414+ &top_height, &bottom_height,
3415+ &left_width, &right_width);
3416 #endif
3417
3418 frame->max_win_extents.top = frame->win_extents.top;
3419
3420=== modified file 'gtk/window-decorator/switcher.c'
3421--- gtk/window-decorator/switcher.c 2014-08-27 18:55:54 +0000
3422+++ gtk/window-decorator/switcher.c 2015-04-06 15:01:05 +0000
3423@@ -25,6 +25,8 @@
3424
3425 #include "gtk-window-decorator.h"
3426
3427+#define SWITCHER_SPACE 40
3428+
3429 decor_frame_t *
3430 create_switcher_frame (const gchar *type)
3431 {
3432@@ -319,7 +321,7 @@
3433 copy_to_front_buffer (d);
3434 }
3435
3436-void
3437+static void
3438 draw_switcher_decoration (decor_t *d)
3439 {
3440 if (d->prop_xid)
3441@@ -328,7 +330,8 @@
3442 draw_switcher_foreground (d);
3443 }
3444
3445-void
3446+#if 0
3447+static void
3448 switcher_window_closed ()
3449 {
3450 decor_t *d = switcher_window;
3451@@ -356,10 +359,11 @@
3452 g_free (switcher_window);
3453 switcher_window = NULL;
3454 }
3455+#endif
3456
3457 /* Switcher is override-redirect now, we need to track
3458 * it separately */
3459-decor_t *
3460+static decor_t *
3461 switcher_window_opened (Window popup, Window window)
3462 {
3463 decor_t *d;
3464
3465=== modified file 'gtk/window-decorator/util.c'
3466--- gtk/window-decorator/util.c 2011-02-21 09:53:08 +0000
3467+++ gtk/window-decorator/util.c 2015-04-06 15:01:05 +0000
3468@@ -21,19 +21,6 @@
3469
3470 #include "gtk-window-decorator.h"
3471
3472-double
3473-square (double x)
3474-{
3475- return x * x;
3476-}
3477-
3478-double
3479-dist (double x1, double y1,
3480- double x2, double y2)
3481-{
3482- return sqrt (square (x1 - x2) + square (y1 - y2));
3483-}
3484-
3485 gboolean
3486 get_window_prop (Window xwindow,
3487 Atom atom,
3488@@ -110,190 +97,3 @@
3489
3490 return decor;
3491 }
3492-
3493-/* from clearlooks theme */
3494-static void
3495-rgb_to_hls (gdouble *r,
3496- gdouble *g,
3497- gdouble *b)
3498-{
3499- gdouble min;
3500- gdouble max;
3501- gdouble red;
3502- gdouble green;
3503- gdouble blue;
3504- gdouble h, l, s;
3505- gdouble delta;
3506-
3507- red = *r;
3508- green = *g;
3509- blue = *b;
3510-
3511- if (red > green)
3512- {
3513- if (red > blue)
3514- max = red;
3515- else
3516- max = blue;
3517-
3518- if (green < blue)
3519- min = green;
3520- else
3521- min = blue;
3522- }
3523- else
3524- {
3525- if (green > blue)
3526- max = green;
3527- else
3528- max = blue;
3529-
3530- if (red < blue)
3531- min = red;
3532- else
3533- min = blue;
3534- }
3535-
3536- l = (max + min) / 2;
3537- s = 0;
3538- h = 0;
3539-
3540- if (max != min)
3541- {
3542- if (l <= 0.5)
3543- s = (max - min) / (max + min);
3544- else
3545- s = (max - min) / (2 - max - min);
3546-
3547- delta = max -min;
3548- if (red == max)
3549- h = (green - blue) / delta;
3550- else if (green == max)
3551- h = 2 + (blue - red) / delta;
3552- else if (blue == max)
3553- h = 4 + (red - green) / delta;
3554-
3555- h *= 60;
3556- if (h < 0.0)
3557- h += 360;
3558- }
3559-
3560- *r = h;
3561- *g = l;
3562- *b = s;
3563-}
3564-
3565-static void
3566-hls_to_rgb (gdouble *h,
3567- gdouble *l,
3568- gdouble *s)
3569-{
3570- gdouble hue;
3571- gdouble lightness;
3572- gdouble saturation;
3573- gdouble m1, m2;
3574- gdouble r, g, b;
3575-
3576- lightness = *l;
3577- saturation = *s;
3578-
3579- if (lightness <= 0.5)
3580- m2 = lightness * (1 + saturation);
3581- else
3582- m2 = lightness + saturation - lightness * saturation;
3583-
3584- m1 = 2 * lightness - m2;
3585-
3586- if (saturation == 0)
3587- {
3588- *h = lightness;
3589- *l = lightness;
3590- *s = lightness;
3591- }
3592- else
3593- {
3594- hue = *h + 120;
3595- while (hue > 360)
3596- hue -= 360;
3597- while (hue < 0)
3598- hue += 360;
3599-
3600- if (hue < 60)
3601- r = m1 + (m2 - m1) * hue / 60;
3602- else if (hue < 180)
3603- r = m2;
3604- else if (hue < 240)
3605- r = m1 + (m2 - m1) * (240 - hue) / 60;
3606- else
3607- r = m1;
3608-
3609- hue = *h;
3610- while (hue > 360)
3611- hue -= 360;
3612- while (hue < 0)
3613- hue += 360;
3614-
3615- if (hue < 60)
3616- g = m1 + (m2 - m1) * hue / 60;
3617- else if (hue < 180)
3618- g = m2;
3619- else if (hue < 240)
3620- g = m1 + (m2 - m1) * (240 - hue) / 60;
3621- else
3622- g = m1;
3623-
3624- hue = *h - 120;
3625- while (hue > 360)
3626- hue -= 360;
3627- while (hue < 0)
3628- hue += 360;
3629-
3630- if (hue < 60)
3631- b = m1 + (m2 - m1) * hue / 60;
3632- else if (hue < 180)
3633- b = m2;
3634- else if (hue < 240)
3635- b = m1 + (m2 - m1) * (240 - hue) / 60;
3636- else
3637- b = m1;
3638-
3639- *h = r;
3640- *l = g;
3641- *s = b;
3642- }
3643-}
3644-
3645-void
3646-shade (const decor_color_t *a,
3647- decor_color_t *b,
3648- float k)
3649-{
3650- double red;
3651- double green;
3652- double blue;
3653-
3654- red = a->r;
3655- green = a->g;
3656- blue = a->b;
3657-
3658- rgb_to_hls (&red, &green, &blue);
3659-
3660- green *= k;
3661- if (green > 1.0)
3662- green = 1.0;
3663- else if (green < 0.0)
3664- green = 0.0;
3665-
3666- blue *= k;
3667- if (blue > 1.0)
3668- blue = 1.0;
3669- else if (blue < 0.0)
3670- blue = 0.0;
3671-
3672- hls_to_rgb (&red, &green, &blue);
3673-
3674- b->r = red;
3675- b->g = green;
3676- b->b = blue;
3677-}
3678-
3679
3680=== modified file 'gtk/window-decorator/wnck.c'
3681--- gtk/window-decorator/wnck.c 2014-06-26 13:34:13 +0000
3682+++ gtk/window-decorator/wnck.c 2015-04-06 15:01:05 +0000
3683@@ -162,7 +162,7 @@
3684 }
3685 }
3686
3687-void
3688+static void
3689 update_frames_border_extents (gpointer key,
3690 gpointer value,
3691 gpointer user_data)
3692@@ -590,7 +590,7 @@
3693 draw_list = g_slist_remove (draw_list, d);
3694 }
3695
3696-void
3697+static void
3698 connect_window (WnckWindow *win)
3699 {
3700 g_signal_connect_object (win, "name_changed",
3701@@ -762,7 +762,7 @@
3702 }
3703 }
3704
3705-void
3706+static void
3707 window_opened (WnckScreen *screen,
3708 WnckWindow *win)
3709 {

Subscribers

People subscribed via source and target branches