Merge lp:~muktupavels/compiz/require-libmetacity-3-20 into lp:compiz/0.9.13

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4090
Merged at revision: 4091
Proposed branch: lp:~muktupavels/compiz/require-libmetacity-3-20
Merge into: lp:compiz/0.9.13
Diff against target: 1029 lines (+70/-515)
7 files modified
debian/control (+1/-1)
gtk/CMakeLists.txt (+2/-13)
gtk/config.h.gtk.in (+0/-3)
gtk/window-decorator/gwd-settings-storage.c (+3/-29)
gtk/window-decorator/gwd-theme-metacity.c (+20/-409)
gtk/window-decorator/gwd-theme.c (+0/-13)
gtk/window-decorator/gwd-theme.h (+44/-47)
To merge this branch: bzr merge lp:~muktupavels/compiz/require-libmetacity-3-20
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+304543@code.launchpad.net

Commit message

gtk-window-decorator: require libmetacity 3.20 or newer.

Description of the change

Require libmetacity 3.20 or newer.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

We're after feature freeze, we need an exception to get this landed for yakkety

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

Yakkety will not have Metacity 3.22 so this can wait...

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

Can this now be merged?

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ack!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-05-30 13:28:51 +0000
3+++ debian/control 2016-08-31 17:53:28 +0000
4@@ -22,7 +22,7 @@
5 libglibmm-2.4-dev,
6 libgtk-3-dev,
7 libice-dev (>= 1:1.0.1),
8- libmetacity-dev (>= 1:3.16.0),
9+ libmetacity-dev (>= 1:3.20.0),
10 libpango1.0-dev,
11 libpng-dev,
12 librsvg2-dev,
13
14=== modified file 'gtk/CMakeLists.txt'
15--- gtk/CMakeLists.txt 2016-06-08 18:35:52 +0000
16+++ gtk/CMakeLists.txt 2016-08-31 17:53:28 +0000
17@@ -25,24 +25,13 @@
18 set (CMAKE_REQUIRED_LIBRARIES "")
19
20 if (USE_METACITY)
21- pkg_check_modules (LIBMETACITY libmetacity>=3.19.1)
22+ pkg_check_modules (LIBMETACITY libmetacity>=3.20.0)
23
24 if (LIBMETACITY_FOUND)
25- compiz_set (HAVE_METACITY_3_20_0 1)
26-
27 set (METACITY_INCLUDE_DIRS ${LIBMETACITY_INCLUDE_DIRS})
28 set (METACITY_LIBRARIES ${LIBMETACITY_LIBRARIES})
29 else (LIBMETACITY_FOUND)
30- pkg_check_modules (LIBMETACITY_PRIVATE libmetacity-private>=3.16.0)
31-
32- if (LIBMETACITY_PRIVATE_FOUND)
33- compiz_set (HAVE_METACITY_3_20_0 0)
34-
35- set (METACITY_INCLUDE_DIRS ${LIBMETACITY_PRIVATE_INCLUDE_DIRS})
36- set (METACITY_LIBRARIES ${LIBMETACITY_PRIVATE_LIBRARIES})
37- else (LIBMETACITY_PRIVATE_FOUND)
38- compiz_set (USE_METACITY 0)
39- endif (LIBMETACITY_PRIVATE_FOUND)
40+ compiz_set (USE_METACITY 0)
41 endif (LIBMETACITY_FOUND)
42 endif (USE_METACITY)
43
44
45=== modified file 'gtk/config.h.gtk.in'
46--- gtk/config.h.gtk.in 2016-06-01 16:08:13 +0000
47+++ gtk/config.h.gtk.in 2016-08-31 17:53:28 +0000
48@@ -1,7 +1,4 @@
49 /* Define to 1 if Metacity support is enabled */
50 #cmakedefine USE_METACITY 1
51
52-/* Define to 1 if Metacity version >= 3.20.0 */
53-#cmakedefine HAVE_METACITY_3_20_0 1
54-
55 #define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"
56
57=== modified file 'gtk/window-decorator/gwd-settings-storage.c'
58--- gtk/window-decorator/gwd-settings-storage.c 2016-06-09 20:28:14 +0000
59+++ gtk/window-decorator/gwd-settings-storage.c 2016-08-31 17:53:28 +0000
60@@ -24,7 +24,7 @@
61
62 #include <gtk/gtk.h>
63
64-#ifdef HAVE_METACITY_3_20_0
65+#ifdef USE_METACITY
66 #include <libmetacity/meta-theme.h>
67 #endif
68
69@@ -33,13 +33,7 @@
70
71 static const gchar * ORG_COMPIZ_GWD = "org.compiz.gwd";
72 static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES = "org.gnome.desktop.wm.preferences";
73-
74-#ifdef HAVE_METACITY_3_20_0
75 static const gchar * ORG_GNOME_METACITY_THEME = "org.gnome.metacity.theme";
76-#else
77-static const gchar * ORG_GNOME_METACITY = "org.gnome.metacity";
78-#endif
79-
80 static const gchar * ORG_MATE_MARCO_GENERAL = "org.mate.Marco.general";
81
82 static const gchar * ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS = "use-tooltips";
83@@ -51,12 +45,8 @@
84 static const gchar * ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME = "use-metacity-theme";
85 static const gchar * ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION = "mouse-wheel-action";
86
87-#ifdef HAVE_METACITY_3_20_0
88 static const gchar * ORG_GNOME_METACITY_THEME_NAME = "name";
89 static const gchar * ORG_GNOME_METACITY_THEME_TYPE = "type";
90-#else
91-static const gchar * ORG_GNOME_METACITY_THEME = "theme";
92-#endif
93
94 static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR = "action-double-click-titlebar";
95 static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR = "action-middle-click-titlebar";
96@@ -213,7 +203,6 @@
97 if (storage->current_desktop == GWD_DESKTOP_MATE && storage->marco) {
98 metacity_theme_name = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME);
99 } else if (storage->current_desktop == GWD_DESKTOP_GNOME_FLASHBACK && storage->metacity) {
100-#ifdef HAVE_METACITY_3_20_0
101 metacity_theme_type = g_settings_get_enum (storage->metacity, ORG_GNOME_METACITY_THEME_TYPE);
102
103 if (metacity_theme_type == META_THEME_TYPE_GTK) {
104@@ -221,9 +210,6 @@
105 } else {
106 metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME_NAME);
107 }
108-#else
109- metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME);
110-#endif
111 } else if (storage->desktop) {
112 metacity_theme_name = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME);
113 } else {
114@@ -385,14 +371,9 @@
115 const gchar *key,
116 GWDSettingsStorage *storage)
117 {
118-#ifdef HAVE_METACITY_3_20_0
119 if (strcmp (key, ORG_GNOME_METACITY_THEME_NAME) == 0 ||
120 strcmp (key, ORG_GNOME_METACITY_THEME_TYPE) == 0)
121 update_metacity_theme (storage);
122-#else
123- if (strcmp (key, ORG_GNOME_METACITY_THEME) == 0)
124- update_metacity_theme (storage);
125-#endif
126 }
127
128 static void
129@@ -423,12 +404,12 @@
130 update_button_layout (storage);
131 }
132
133-#ifdef HAVE_METACITY_3_20_0
134 static void
135 gtk_theme_name_changed (GtkSettings *settings,
136 GParamSpec *pspec,
137 GWDSettingsStorage *storage)
138 {
139+#ifdef USE_METACITY
140 MetaThemeType type;
141
142 if (!storage->metacity)
143@@ -438,8 +419,8 @@
144
145 if (type == META_THEME_TYPE_GTK)
146 update_metacity_theme (storage);
147+#endif
148 }
149-#endif
150
151 static void
152 gwd_settings_storage_constructed (GObject *object)
153@@ -573,22 +554,15 @@
154 case GWD_DESKTOP_GNOME_FLASHBACK:
155 storage->gwd = get_settings_no_abort (ORG_COMPIZ_GWD);
156 storage->desktop = get_settings_no_abort (ORG_GNOME_DESKTOP_WM_PREFERENCES);
157-
158-#ifdef HAVE_METACITY_3_20_0
159 storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY_THEME);
160-#else
161- storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY);
162-#endif
163
164 storage->gtk_decoration_layout_id =
165 g_signal_connect (gtk_settings_get_default (), "notify::gtk-decoration-layout",
166 G_CALLBACK (gtk_decoration_layout_changed), storage);
167
168-#ifdef HAVE_METACITY_3_20_0
169 storage->gtk_theme_name_id =
170 g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
171 G_CALLBACK (gtk_theme_name_changed), storage);
172-#endif
173 break;
174
175 case GWD_DESKTOP_MATE:
176
177=== modified file 'gtk/window-decorator/gwd-theme-metacity.c'
178--- gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 16:06:40 +0000
179+++ gtk/window-decorator/gwd-theme-metacity.c 2016-08-31 17:53:28 +0000
180@@ -27,12 +27,7 @@
181
182 #include "config.h"
183
184-#ifdef HAVE_METACITY_3_20_0
185 #include <libmetacity/meta-theme.h>
186-#else
187-#include <metacity-private/theme.h>
188-#include <metacity-private/theme-parser.h>
189-#endif
190
191 #include "gtk-window-decorator.h"
192 #include "gwd-settings.h"
193@@ -40,47 +35,16 @@
194
195 struct _GWDThemeMetacity
196 {
197- GObject parent;
198-
199- MetaTheme *theme;
200-
201-#ifndef HAVE_METACITY_3_20_0
202- GHashTable *style_variants;
203-#endif
204-
205- gulong button_layout_id;
206- MetaButtonLayout button_layout;
207-
208-#ifndef HAVE_METACITY_3_20_0
209- const PangoFontDescription *titlebar_font;
210-#endif
211+ GObject parent;
212+
213+ MetaTheme *theme;
214+
215+ gulong button_layout_id;
216+ MetaButtonLayout button_layout;
217 };
218
219 G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME)
220
221-#ifndef HAVE_METACITY_3_20_0
222-static MetaStyleInfo *
223-get_style_info (GWDThemeMetacity *metacity,
224- decor_t *decor)
225-{
226- const gchar *variant = decor != NULL ? decor->gtk_theme_variant : NULL;
227- const gchar *key = variant != NULL ? variant : "default";
228- MetaStyleInfo *style = g_hash_table_lookup (metacity->style_variants, key);
229-
230- if (style == NULL) {
231- GWDTheme *theme = GWD_THEME (metacity);
232- GtkWidget *style_window = gwd_theme_get_style_window (theme);
233- GdkScreen *screen = gtk_widget_get_screen (style_window);
234-
235- style = meta_theme_create_style_info (screen, variant);
236-
237- g_hash_table_insert (metacity->style_variants, g_strdup (key), style);
238- }
239-
240- return style;
241-}
242-#endif
243-
244 static MetaFrameType
245 frame_type_from_string (const gchar *str)
246 {
247@@ -96,232 +60,14 @@
248 return META_FRAME_TYPE_NORMAL;
249 }
250
251-#ifndef HAVE_METACITY_3_20_0
252-static void
253-initialize_button_layout (MetaButtonLayout *layout)
254-{
255- gint i;
256-
257- for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i) {
258- layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
259- layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
260- layout->left_buttons_has_spacer[i] = FALSE;
261- layout->right_buttons_has_spacer[i] = FALSE;
262- }
263-}
264-
265-static MetaButtonFunction
266-meta_button_function_from_string (const char *str)
267-{
268- if (strcmp (str, "menu") == 0)
269- return META_BUTTON_FUNCTION_MENU;
270- else if (strcmp (str, "appmenu") == 0)
271- return META_BUTTON_FUNCTION_APPMENU;
272- else if (strcmp (str, "minimize") == 0)
273- return META_BUTTON_FUNCTION_MINIMIZE;
274- else if (strcmp (str, "maximize") == 0)
275- return META_BUTTON_FUNCTION_MAXIMIZE;
276- else if (strcmp (str, "close") == 0)
277- return META_BUTTON_FUNCTION_CLOSE;
278- else if (strcmp (str, "shade") == 0)
279- return META_BUTTON_FUNCTION_SHADE;
280- else if (strcmp (str, "above") == 0)
281- return META_BUTTON_FUNCTION_ABOVE;
282- else if (strcmp (str, "stick") == 0)
283- return META_BUTTON_FUNCTION_STICK;
284- else if (strcmp (str, "unshade") == 0)
285- return META_BUTTON_FUNCTION_UNSHADE;
286- else if (strcmp (str, "unabove") == 0)
287- return META_BUTTON_FUNCTION_UNABOVE;
288- else if (strcmp (str, "unstick") == 0)
289- return META_BUTTON_FUNCTION_UNSTICK;
290- else
291- return META_BUTTON_FUNCTION_LAST;
292-}
293-
294-static MetaButtonFunction
295-meta_button_opposite_function (MetaButtonFunction ofwhat)
296-{
297- switch (ofwhat) {
298- case META_BUTTON_FUNCTION_SHADE:
299- return META_BUTTON_FUNCTION_UNSHADE;
300- case META_BUTTON_FUNCTION_UNSHADE:
301- return META_BUTTON_FUNCTION_SHADE;
302-
303- case META_BUTTON_FUNCTION_ABOVE:
304- return META_BUTTON_FUNCTION_UNABOVE;
305- case META_BUTTON_FUNCTION_UNABOVE:
306- return META_BUTTON_FUNCTION_ABOVE;
307-
308- case META_BUTTON_FUNCTION_STICK:
309- return META_BUTTON_FUNCTION_UNSTICK;
310- case META_BUTTON_FUNCTION_UNSTICK:
311- return META_BUTTON_FUNCTION_STICK;
312-
313- default:
314- return META_BUTTON_FUNCTION_LAST;
315- }
316-}
317-#endif
318-
319 static void
320 update_metacity_button_layout_cb (GWDSettings *settings,
321 const gchar *button_layout,
322 GWDThemeMetacity *metacity)
323 {
324-#ifdef HAVE_METACITY_3_20_0
325 gboolean invert = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;
326
327 metacity->button_layout = meta_button_layout_new (button_layout, invert);
328-#else
329- MetaButtonLayout new_layout;
330-
331- initialize_button_layout (&new_layout);
332-
333- if (button_layout != NULL) {
334- gint i;
335- gchar **sides;
336- MetaButtonFunction f;
337-
338- sides = g_strsplit (button_layout, ":", 2);
339-
340- if (sides[0] != NULL) {
341- gchar **buttons;
342- gint b;
343- gboolean used[META_BUTTON_FUNCTION_LAST];
344-
345- for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
346- used[i] = FALSE;
347-
348- buttons = g_strsplit (sides[0], ",", -1);
349-
350- i = b = 0;
351- while (buttons[b] != NULL) {
352- f = meta_button_function_from_string (buttons[b]);
353-
354- if (i > 0 && strcmp ("spacer", buttons[b]) == 0) {
355- new_layout.left_buttons_has_spacer[i - 1] = TRUE;
356- f = meta_button_opposite_function (f);
357-
358- if (f != META_BUTTON_FUNCTION_LAST)
359- new_layout.left_buttons_has_spacer[i - 2] = TRUE;
360- } else {
361- if (f != META_BUTTON_FUNCTION_LAST && !used[f]) {
362- used[f] = TRUE;
363- new_layout.left_buttons[i++] = f;
364-
365- f = meta_button_opposite_function (f);
366-
367- if (f != META_BUTTON_FUNCTION_LAST)
368- new_layout.left_buttons[i++] = f;
369- } else {
370- g_warning ("Ignoring unknown or already-used "
371- "button name \"%s\"", buttons[b]);
372- }
373- }
374-
375- ++b;
376- }
377-
378- new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
379-
380- g_strfreev (buttons);
381-
382- if (sides[1] != NULL) {
383- for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
384- used[i] = FALSE;
385-
386- buttons = g_strsplit (sides[1], ",", -1);
387-
388- i = b = 0;
389- while (buttons[b] != NULL) {
390- f = meta_button_function_from_string (buttons[b]);
391-
392- if (i > 0 && strcmp ("spacer", buttons[b]) == 0) {
393- new_layout.right_buttons_has_spacer[i - 1] = TRUE;
394- f = meta_button_opposite_function (f);
395-
396- if (f != META_BUTTON_FUNCTION_LAST)
397- new_layout.right_buttons_has_spacer[i - 2] = TRUE;
398- } else {
399- if (f != META_BUTTON_FUNCTION_LAST && !used[f]) {
400- used[f] = TRUE;
401- new_layout.right_buttons[i++] = f;
402-
403- f = meta_button_opposite_function (f);
404-
405- if (f != META_BUTTON_FUNCTION_LAST)
406- new_layout.right_buttons[i++] = f;
407- } else {
408- g_warning ("Ignoring unknown or already-used "
409- "button name \"%s\"", buttons[b]);
410- }
411- }
412-
413- ++b;
414- }
415-
416- new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
417-
418- g_strfreev (buttons);
419- }
420- }
421-
422- g_strfreev (sides);
423-
424- /* Invert the button layout for RTL languages */
425- if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) {
426- MetaButtonLayout rtl_layout;
427- gint j;
428-
429- initialize_button_layout (&rtl_layout);
430-
431- i = 0;
432- while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST)
433- ++i;
434-
435- for (j = 0; j < i; ++j) {
436- rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
437-
438- if (j == 0)
439- rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
440- else
441- rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
442- }
443-
444- i = 0;
445- while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST)
446- ++i;
447-
448- for (j = 0; j < i; ++j) {
449- rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
450-
451- if (j == 0)
452- rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
453- else
454- rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
455- }
456-
457- new_layout = rtl_layout;
458- }
459- } else {
460- gint i;
461-
462- new_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU;
463-
464- for (i = 1; i < MAX_BUTTONS_PER_CORNER; ++i)
465- new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
466-
467- new_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
468- new_layout.right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE;
469- new_layout.right_buttons[2] = META_BUTTON_FUNCTION_CLOSE;
470-
471- for (i = 3; i < MAX_BUTTONS_PER_CORNER; ++i)
472- new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
473- }
474-
475- metacity->button_layout = new_layout;
476-#endif
477 }
478
479 static MetaButtonType
480@@ -447,8 +193,7 @@
481 }
482
483 static Region
484-get_top_border_region (const MetaFrameGeometry *fgeom,
485- gint width)
486+get_top_border_region (const MetaFrameGeometry *fgeom)
487 {
488 Region corners_xregion;
489 Region border_xregion;
490@@ -459,6 +204,7 @@
491 gint bottom_right_radius;
492 gint w;
493 gint i;
494+ gint width;
495 gint height;
496
497 corners_xregion = XCreateRegion ();
498@@ -466,7 +212,7 @@
499 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
500 &bottom_left_radius, &bottom_right_radius);
501
502- width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
503+ width = fgeom->width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
504 height = fgeom->borders.visible.top;
505
506 if (top_left_radius) {
507@@ -511,8 +257,7 @@
508 }
509
510 static Region
511-get_bottom_border_region (const MetaFrameGeometry *fgeom,
512- gint width)
513+get_bottom_border_region (const MetaFrameGeometry *fgeom)
514 {
515 Region corners_xregion;
516 Region border_xregion;
517@@ -523,6 +268,7 @@
518 gint bottom_right_radius;
519 gint w;
520 gint i;
521+ gint width;
522 gint height;
523
524 corners_xregion = XCreateRegion ();
525@@ -530,7 +276,7 @@
526 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
527 &bottom_left_radius, &bottom_right_radius);
528
529- width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
530+ width = fgeom->width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
531 height = fgeom->borders.visible.bottom;
532
533 if (bottom_left_radius) {
534@@ -575,8 +321,7 @@
535 }
536
537 static Region
538-get_left_border_region (const MetaFrameGeometry *fgeom,
539- gint height)
540+get_left_border_region (const MetaFrameGeometry *fgeom)
541 {
542 Region border_xregion;
543 XRectangle xrect;
544@@ -586,7 +331,7 @@
545 xrect.x = 0;
546 xrect.y = 0;
547 xrect.width = fgeom->borders.visible.left;
548- xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom;
549+ xrect.height = fgeom->height - fgeom->borders.total.top - fgeom->borders.total.bottom;
550
551 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
552
553@@ -594,8 +339,7 @@
554 }
555
556 static Region
557-get_right_border_region (const MetaFrameGeometry *fgeom,
558- gint height)
559+get_right_border_region (const MetaFrameGeometry *fgeom)
560 {
561 Region border_xregion;
562 XRectangle xrect;
563@@ -605,7 +349,7 @@
564 xrect.x = 0;
565 xrect.y = 0;
566 xrect.width = fgeom->borders.visible.right;
567- xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom;
568+ xrect.height = fgeom->height - fgeom->borders.total.top - fgeom->borders.total.bottom;
569
570 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
571
572@@ -652,13 +396,8 @@
573 MetaFrameBorders borders;
574
575 tmp_flags = flags & ~META_FRAME_MAXIMIZED;
576-#ifdef HAVE_METACITY_3_20_0
577 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,
578 type, tmp_flags, &borders);
579-#else
580- meta_theme_get_frame_borders (metacity->theme, get_style_info (metacity, d),
581- type, d->frame->text_height, tmp_flags, &borders);
582-#endif
583
584 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {
585 frame_win_extents.left += borders.invisible.left;
586@@ -671,13 +410,8 @@
587 }
588
589 tmp_flags = flags | META_FRAME_MAXIMIZED;
590-#ifdef HAVE_METACITY_3_20_0
591 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,
592 type, tmp_flags, &borders);
593-#else
594- meta_theme_get_frame_borders (metacity->theme, get_style_info (metacity, d),
595- type, d->frame->text_height, tmp_flags, &borders);
596-#endif
597
598 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {
599 frame_max_win_extents.left += borders.invisible.left;
600@@ -807,15 +541,9 @@
601 else
602 client_height = decor->border_layout.left.y2 - decor->border_layout.left.y1;
603
604-#ifdef HAVE_METACITY_3_20_0
605 meta_theme_calc_geometry (metacity->theme, decor->gtk_theme_variant,
606 frame_type, *flags, client_width, client_height,
607 &metacity->button_layout, fgeom);
608-#else
609- meta_theme_calc_geometry (metacity->theme, get_style_info (metacity, decor),
610- frame_type, decor->frame->text_height, *flags, client_width,
611- client_height, &metacity->button_layout, fgeom);
612-#endif
613 }
614
615 static void
616@@ -915,12 +643,8 @@
617 {
618 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
619 const gchar *metacity_theme_name = gwd_settings_get_metacity_theme_name (settings);
620-#ifdef HAVE_METACITY_3_20_0
621 gint metacity_theme_type = gwd_settings_get_metacity_theme_type (settings);
622 GError *error = NULL;
623-#else
624- MetaTheme *theme;
625-#endif
626
627 /* metacity_theme can be NULL only in one case - if user has disabled
628 * metacity theme with use-metacity-theme setting. In that case
629@@ -928,7 +652,6 @@
630 */
631 g_assert (metacity_theme_name != NULL);
632
633-#ifdef HAVE_METACITY_3_20_0
634 if (metacity_theme_type == -1)
635 metacity_theme_type = META_THEME_TYPE_METACITY;
636
637@@ -943,25 +666,6 @@
638
639 return FALSE;
640 }
641-#else
642-
643- /* meta_theme_get_current returns the last good theme, so we will try to
644- * load theme manually to know that theme is 100% valid.
645- */
646- theme = meta_theme_load (metacity_theme_name, NULL);
647- if (theme == NULL)
648- return FALSE;
649-
650- /* We can not use this manually loaded theme because Metacity internaly
651- * also use meta_theme_get_current wich in this case will return NULL,
652- * boom - segfault...
653- */
654- meta_theme_free (theme);
655-
656- /* If we are here then we know that this will not fail. */
657- meta_theme_set_current (metacity_theme_name, TRUE);
658- metacity->theme = meta_theme_get_current ();
659-#endif
660
661 return TRUE;
662 }
663@@ -997,11 +701,7 @@
664 {
665 GWDThemeMetacity *metacity = GWD_THEME_METACITY (object);
666
667-#ifdef HAVE_METACITY_3_20_0
668 g_clear_object (&metacity->theme);
669-#else
670- g_clear_pointer (&metacity->style_variants, g_hash_table_destroy);
671-#endif
672
673 if (metacity->button_layout_id != 0) {
674 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
675@@ -1010,10 +710,6 @@
676 metacity->button_layout_id = 0;
677 }
678
679-#ifndef HAVE_METACITY_3_20_0
680- metacity->titlebar_font = NULL;
681-#endif
682-
683 G_OBJECT_CLASS (gwd_theme_metacity_parent_class)->dispose (object);
684 }
685
686@@ -1022,11 +718,7 @@
687 {
688 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
689
690-#ifdef HAVE_METACITY_3_20_0
691 meta_theme_invalidate (metacity->theme);
692-#else
693- g_hash_table_remove_all (metacity->style_variants);
694-#endif
695 }
696
697 static void
698@@ -1038,10 +730,6 @@
699 GdkDisplay *display = gdk_display_get_default ();
700 Display *xdisplay = gdk_x11_display_get_xdisplay (display);
701 GtkWidget *style_window = gwd_theme_get_style_window (theme);
702-#ifndef HAVE_METACITY_3_20_0
703- MetaStyleInfo *style_info = get_style_info (metacity, decor);
704- GtkStyleContext *context = gtk_widget_get_style_context (style_window);
705-#endif
706 cairo_surface_t *surface;
707 Picture src;
708 MetaButtonState button_states [META_BUTTON_TYPE_LAST];
709@@ -1056,10 +744,6 @@
710 Region right_region;
711 double alpha;
712 gboolean shade_alpha;
713-#ifndef HAVE_METACITY_3_20_0
714- MetaFrameStyle *frame_style;
715- GdkRGBA bg_rgba;
716-#endif
717
718 if (!decor->surface || !decor->picture)
719 return;
720@@ -1094,20 +778,6 @@
721 for (i = 0; i < META_BUTTON_TYPE_LAST; ++i)
722 button_states[i] = meta_button_state_for_button_type (metacity, decor, i);
723
724-#ifndef HAVE_METACITY_3_20_0
725- frame_style = meta_theme_get_frame_style (metacity->theme, frame_type, flags);
726-
727- gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_rgba);
728- bg_rgba.alpha = 1.0;
729-
730- if (frame_style->window_background_color) {
731- meta_color_spec_render (frame_style->window_background_color,
732- context, &bg_rgba);
733-
734- bg_rgba.alpha = frame_style->window_background_alpha / 255.0;
735- }
736-#endif
737-
738 /* Draw something that will be almost invisible to user. This is hacky way
739 * to fix invisible decorations. */
740 cairo_set_source_rgba (cr, 0, 0, 0, 0.01);
741@@ -1118,34 +788,19 @@
742 cairo_destroy (cr);
743
744 surface = create_surface (fgeom.width, fgeom.height, style_window);
745-
746 cr = cairo_create (surface);
747
748-#ifndef HAVE_METACITY_3_20_0
749- gdk_cairo_set_source_rgba (cr, &bg_rgba);
750- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
751- cairo_paint (cr);
752-#endif
753-
754 src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),
755 xformat_rgba, 0, NULL);
756
757-#ifdef HAVE_METACITY_3_20_0
758 meta_theme_draw_frame (metacity->theme, decor->gtk_theme_variant, cr, frame_type, flags,
759 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,
760 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,
761 decor->name, &metacity->button_layout,
762 button_states, decor->icon_pixbuf, NULL);
763-#else
764- meta_theme_draw_frame (metacity->theme, style_info, cr, frame_type, flags,
765- fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,
766- fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,
767- decor->layout, decor->frame->text_height, &metacity->button_layout,
768- button_states, decor->icon_pixbuf, NULL);
769-#endif
770
771 if (fgeom.borders.visible.top) {
772- top_region = get_top_border_region (&fgeom, fgeom.width);
773+ top_region = get_top_border_region (&fgeom);
774
775 decor_blend_border_picture (xdisplay, decor->context, src,
776 fgeom.borders.invisible.left,
777@@ -1156,7 +811,7 @@
778 }
779
780 if (fgeom.borders.visible.bottom) {
781- bottom_region = get_bottom_border_region (&fgeom, fgeom.width);
782+ bottom_region = get_bottom_border_region (&fgeom);
783
784 decor_blend_border_picture (xdisplay, decor->context, src,
785 fgeom.borders.invisible.left,
786@@ -1167,7 +822,7 @@
787 }
788
789 if (fgeom.borders.visible.left) {
790- left_region = get_left_border_region (&fgeom, fgeom.height);
791+ left_region = get_left_border_region (&fgeom);
792
793 decor_blend_border_picture (xdisplay, decor->context, src,
794 fgeom.borders.invisible.left,
795@@ -1178,7 +833,7 @@
796 }
797
798 if (fgeom.borders.visible.right) {
799- right_region = get_right_border_region (&fgeom, fgeom.height);
800+ right_region = get_right_border_region (&fgeom);
801
802 decor_blend_border_picture (xdisplay, decor->context, src,
803 fgeom.width - fgeom.borders.total.right,
804@@ -1278,35 +933,21 @@
805 decor_frame_t *frame)
806 {
807 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
808-#ifndef HAVE_METACITY_3_20_0
809- MetaStyleInfo *style_info = get_style_info (metacity, NULL);
810-#endif
811 MetaFrameType frame_type = frame_type_from_string (frame->type);
812 MetaFrameBorders borders;
813
814 gwd_decor_frame_ref (frame);
815
816-#ifdef HAVE_METACITY_3_20_0
817 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,
818 0, &borders);
819-#else
820- meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
821- frame->text_height, 0, &borders);
822-#endif
823
824 frame->win_extents.top = borders.visible.top;
825 frame->win_extents.bottom = borders.visible.bottom;
826 frame->win_extents.left = borders.visible.left;
827 frame->win_extents.right = borders.visible.right;
828
829-#ifdef HAVE_METACITY_3_20_0
830 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,
831 META_FRAME_MAXIMIZED, &borders);
832-#else
833- meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
834- frame->text_height, META_FRAME_MAXIMIZED,
835- &borders);
836-#endif
837
838 frame->max_win_extents.top = borders.visible.top;
839 frame->max_win_extents.bottom = borders.visible.bottom;
840@@ -1521,32 +1162,7 @@
841 {
842 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
843
844-#ifdef HAVE_METACITY_3_20_0
845 meta_theme_set_titlebar_font (metacity->theme, titlebar_font);
846-#else
847- metacity->titlebar_font = titlebar_font;
848-#endif
849-}
850-
851-static PangoFontDescription *
852-gwd_theme_metacity_get_titlebar_font (GWDTheme *theme,
853- decor_frame_t *frame)
854-{
855-#ifdef HAVE_METACITY_3_20_0
856- return NULL;
857-#else
858- GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
859- MetaStyleInfo *style_info = get_style_info (metacity, NULL);
860- PangoFontDescription *font_desc = meta_style_info_create_font_desc (style_info);
861- MetaFrameType type = frame_type_from_string (frame->type);
862- MetaFrameFlags flags = 0xc33; /* FIXME */
863- MetaFrameStyle *style = meta_theme_get_frame_style (metacity->theme, type, flags);
864-
865- pango_font_description_merge (font_desc, metacity->titlebar_font, TRUE);
866- meta_frame_style_apply_scale (style, font_desc);
867-
868- return font_desc;
869-#endif
870 }
871
872 static void
873@@ -1565,16 +1181,11 @@
874 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;
875 theme_class->get_button_position = gwd_theme_metacity_get_button_position;
876 theme_class->update_titlebar_font = gwd_theme_metacity_update_titlebar_font;
877- theme_class->get_titlebar_font = gwd_theme_metacity_get_titlebar_font;
878 }
879
880 static void
881 gwd_theme_metacity_init (GWDThemeMetacity *metacity)
882 {
883-#ifndef HAVE_METACITY_3_20_0
884- metacity->style_variants = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
885- (GDestroyNotify) meta_style_info_unref);
886-#endif
887 }
888
889 /**
890
891=== modified file 'gtk/window-decorator/gwd-theme.c'
892--- gtk/window-decorator/gwd-theme.c 2016-06-09 16:00:00 +0000
893+++ gtk/window-decorator/gwd-theme.c 2016-08-31 17:53:28 +0000
894@@ -248,13 +248,6 @@
895 {
896 }
897
898-static PangoFontDescription *
899-gwd_theme_real_get_titlebar_font (GWDTheme *theme,
900- decor_frame_t *frame)
901-{
902- return NULL;
903-}
904-
905 static void
906 gwd_theme_class_init (GWDThemeClass *theme_class)
907 {
908@@ -275,7 +268,6 @@
909 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;
910 theme_class->get_button_position = gwd_theme_real_get_button_position;
911 theme_class->update_titlebar_font = gwd_theme_real_update_titlebar_font;
912- theme_class->get_titlebar_font = gwd_theme_real_get_titlebar_font;
913
914 properties[PROP_SETTINGS] =
915 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",
916@@ -433,11 +425,6 @@
917 GWDThemePrivate *priv = gwd_theme_get_instance_private (theme);
918 GtkStyleContext *context = gtk_widget_get_style_context (priv->style_window);
919
920- /* Check if Metacity or Cairo will create titlebar font */
921- font_desc = GWD_THEME_GET_CLASS (theme)->get_titlebar_font (theme, frame);
922- if (font_desc)
923- return font_desc;
924-
925 /* Check if non-system font is in use */
926 if (priv->titlebar_font)
927 return pango_font_description_copy (priv->titlebar_font);
928
929=== modified file 'gtk/window-decorator/gwd-theme.h'
930--- gtk/window-decorator/gwd-theme.h 2016-06-09 15:47:07 +0000
931+++ gtk/window-decorator/gwd-theme.h 2016-08-31 17:53:28 +0000
932@@ -37,53 +37,50 @@
933 {
934 GObjectClass parent_class;
935
936- void (* style_updated) (GWDTheme *theme);
937-
938- void (* get_shadow) (GWDTheme *theme,
939- decor_frame_t *frame,
940- decor_shadow_options_t *options,
941- gboolean active);
942-
943- void (* draw_window_decoration) (GWDTheme *theme,
944- decor_t *decor);
945-
946- gboolean (* calc_decoration_size) (GWDTheme *theme,
947- decor_t *decor,
948- gint w,
949- gint h,
950- gint name_width,
951- gint *width,
952- gint *height);
953-
954- void (* update_border_extents) (GWDTheme *theme,
955- decor_frame_t *frame);
956-
957- void (* get_event_window_position) (GWDTheme *theme,
958- decor_t *decor,
959- gint i,
960- gint j,
961- gint width,
962- gint height,
963- gint *x,
964- gint *y,
965- gint *w,
966- gint *h);
967-
968- gboolean (* get_button_position) (GWDTheme *theme,
969- decor_t *decor,
970- gint i,
971- gint width,
972- gint height,
973- gint *x,
974- gint *y,
975- gint *w,
976- gint *h);
977-
978- void (* update_titlebar_font) (GWDTheme *theme,
979- const PangoFontDescription *titlebar_font);
980-
981- PangoFontDescription * (* get_titlebar_font) (GWDTheme *theme,
982- decor_frame_t *frame);
983+ void (* style_updated) (GWDTheme *theme);
984+
985+ void (* get_shadow) (GWDTheme *theme,
986+ decor_frame_t *frame,
987+ decor_shadow_options_t *options,
988+ gboolean active);
989+
990+ void (* draw_window_decoration) (GWDTheme *theme,
991+ decor_t *decor);
992+
993+ gboolean (* calc_decoration_size) (GWDTheme *theme,
994+ decor_t *decor,
995+ gint w,
996+ gint h,
997+ gint name_width,
998+ gint *width,
999+ gint *height);
1000+
1001+ void (* update_border_extents) (GWDTheme *theme,
1002+ decor_frame_t *frame);
1003+
1004+ void (* get_event_window_position) (GWDTheme *theme,
1005+ decor_t *decor,
1006+ gint i,
1007+ gint j,
1008+ gint width,
1009+ gint height,
1010+ gint *x,
1011+ gint *y,
1012+ gint *w,
1013+ gint *h);
1014+
1015+ gboolean (* get_button_position) (GWDTheme *theme,
1016+ decor_t *decor,
1017+ gint i,
1018+ gint width,
1019+ gint height,
1020+ gint *x,
1021+ gint *y,
1022+ gint *w,
1023+ gint *h);
1024+
1025+ void (* update_titlebar_font) (GWDTheme *theme,
1026+ const PangoFontDescription *titlebar_font);
1027 };
1028
1029 typedef enum

Subscribers

People subscribed via source and target branches