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
=== modified file 'debian/control'
--- debian/control 2016-05-30 13:28:51 +0000
+++ debian/control 2016-08-31 17:53:28 +0000
@@ -22,7 +22,7 @@
22 libglibmm-2.4-dev,22 libglibmm-2.4-dev,
23 libgtk-3-dev,23 libgtk-3-dev,
24 libice-dev (>= 1:1.0.1), 24 libice-dev (>= 1:1.0.1),
25 libmetacity-dev (>= 1:3.16.0),25 libmetacity-dev (>= 1:3.20.0),
26 libpango1.0-dev,26 libpango1.0-dev,
27 libpng-dev,27 libpng-dev,
28 librsvg2-dev, 28 librsvg2-dev,
2929
=== modified file 'gtk/CMakeLists.txt'
--- gtk/CMakeLists.txt 2016-06-08 18:35:52 +0000
+++ gtk/CMakeLists.txt 2016-08-31 17:53:28 +0000
@@ -25,24 +25,13 @@
25 set (CMAKE_REQUIRED_LIBRARIES "")25 set (CMAKE_REQUIRED_LIBRARIES "")
2626
27 if (USE_METACITY)27 if (USE_METACITY)
28 pkg_check_modules (LIBMETACITY libmetacity>=3.19.1)28 pkg_check_modules (LIBMETACITY libmetacity>=3.20.0)
2929
30 if (LIBMETACITY_FOUND)30 if (LIBMETACITY_FOUND)
31 compiz_set (HAVE_METACITY_3_20_0 1)
32
33 set (METACITY_INCLUDE_DIRS ${LIBMETACITY_INCLUDE_DIRS})31 set (METACITY_INCLUDE_DIRS ${LIBMETACITY_INCLUDE_DIRS})
34 set (METACITY_LIBRARIES ${LIBMETACITY_LIBRARIES})32 set (METACITY_LIBRARIES ${LIBMETACITY_LIBRARIES})
35 else (LIBMETACITY_FOUND)33 else (LIBMETACITY_FOUND)
36 pkg_check_modules (LIBMETACITY_PRIVATE libmetacity-private>=3.16.0)34 compiz_set (USE_METACITY 0)
37
38 if (LIBMETACITY_PRIVATE_FOUND)
39 compiz_set (HAVE_METACITY_3_20_0 0)
40
41 set (METACITY_INCLUDE_DIRS ${LIBMETACITY_PRIVATE_INCLUDE_DIRS})
42 set (METACITY_LIBRARIES ${LIBMETACITY_PRIVATE_LIBRARIES})
43 else (LIBMETACITY_PRIVATE_FOUND)
44 compiz_set (USE_METACITY 0)
45 endif (LIBMETACITY_PRIVATE_FOUND)
46 endif (LIBMETACITY_FOUND)35 endif (LIBMETACITY_FOUND)
47 endif (USE_METACITY)36 endif (USE_METACITY)
4837
4938
=== modified file 'gtk/config.h.gtk.in'
--- gtk/config.h.gtk.in 2016-06-01 16:08:13 +0000
+++ gtk/config.h.gtk.in 2016-08-31 17:53:28 +0000
@@ -1,7 +1,4 @@
1/* Define to 1 if Metacity support is enabled */1/* Define to 1 if Metacity support is enabled */
2#cmakedefine USE_METACITY 12#cmakedefine USE_METACITY 1
33
4/* Define to 1 if Metacity version >= 3.20.0 */
5#cmakedefine HAVE_METACITY_3_20_0 1
6
7#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"4#define GETTEXT_PACKAGE "${GETTEXT_PACKAGE}"
85
=== modified file 'gtk/window-decorator/gwd-settings-storage.c'
--- gtk/window-decorator/gwd-settings-storage.c 2016-06-09 20:28:14 +0000
+++ gtk/window-decorator/gwd-settings-storage.c 2016-08-31 17:53:28 +0000
@@ -24,7 +24,7 @@
2424
25#include <gtk/gtk.h>25#include <gtk/gtk.h>
2626
27#ifdef HAVE_METACITY_3_20_027#ifdef USE_METACITY
28#include <libmetacity/meta-theme.h>28#include <libmetacity/meta-theme.h>
29#endif29#endif
3030
@@ -33,13 +33,7 @@
3333
34static const gchar * ORG_COMPIZ_GWD = "org.compiz.gwd";34static const gchar * ORG_COMPIZ_GWD = "org.compiz.gwd";
35static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES = "org.gnome.desktop.wm.preferences";35static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES = "org.gnome.desktop.wm.preferences";
36
37#ifdef HAVE_METACITY_3_20_0
38static const gchar * ORG_GNOME_METACITY_THEME = "org.gnome.metacity.theme";36static const gchar * ORG_GNOME_METACITY_THEME = "org.gnome.metacity.theme";
39#else
40static const gchar * ORG_GNOME_METACITY = "org.gnome.metacity";
41#endif
42
43static const gchar * ORG_MATE_MARCO_GENERAL = "org.mate.Marco.general";37static const gchar * ORG_MATE_MARCO_GENERAL = "org.mate.Marco.general";
4438
45static const gchar * ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS = "use-tooltips";39static const gchar * ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS = "use-tooltips";
@@ -51,12 +45,8 @@
51static const gchar * ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME = "use-metacity-theme";45static const gchar * ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME = "use-metacity-theme";
52static const gchar * ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION = "mouse-wheel-action";46static const gchar * ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION = "mouse-wheel-action";
5347
54#ifdef HAVE_METACITY_3_20_0
55static const gchar * ORG_GNOME_METACITY_THEME_NAME = "name";48static const gchar * ORG_GNOME_METACITY_THEME_NAME = "name";
56static const gchar * ORG_GNOME_METACITY_THEME_TYPE = "type";49static const gchar * ORG_GNOME_METACITY_THEME_TYPE = "type";
57#else
58static const gchar * ORG_GNOME_METACITY_THEME = "theme";
59#endif
6050
61static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR = "action-double-click-titlebar";51static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR = "action-double-click-titlebar";
62static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR = "action-middle-click-titlebar";52static const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR = "action-middle-click-titlebar";
@@ -213,7 +203,6 @@
213 if (storage->current_desktop == GWD_DESKTOP_MATE && storage->marco) {203 if (storage->current_desktop == GWD_DESKTOP_MATE && storage->marco) {
214 metacity_theme_name = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME);204 metacity_theme_name = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME);
215 } else if (storage->current_desktop == GWD_DESKTOP_GNOME_FLASHBACK && storage->metacity) {205 } else if (storage->current_desktop == GWD_DESKTOP_GNOME_FLASHBACK && storage->metacity) {
216#ifdef HAVE_METACITY_3_20_0
217 metacity_theme_type = g_settings_get_enum (storage->metacity, ORG_GNOME_METACITY_THEME_TYPE);206 metacity_theme_type = g_settings_get_enum (storage->metacity, ORG_GNOME_METACITY_THEME_TYPE);
218207
219 if (metacity_theme_type == META_THEME_TYPE_GTK) {208 if (metacity_theme_type == META_THEME_TYPE_GTK) {
@@ -221,9 +210,6 @@
221 } else {210 } else {
222 metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME_NAME);211 metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME_NAME);
223 }212 }
224#else
225 metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME);
226#endif
227 } else if (storage->desktop) {213 } else if (storage->desktop) {
228 metacity_theme_name = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME);214 metacity_theme_name = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME);
229 } else {215 } else {
@@ -385,14 +371,9 @@
385 const gchar *key,371 const gchar *key,
386 GWDSettingsStorage *storage)372 GWDSettingsStorage *storage)
387{373{
388#ifdef HAVE_METACITY_3_20_0
389 if (strcmp (key, ORG_GNOME_METACITY_THEME_NAME) == 0 ||374 if (strcmp (key, ORG_GNOME_METACITY_THEME_NAME) == 0 ||
390 strcmp (key, ORG_GNOME_METACITY_THEME_TYPE) == 0)375 strcmp (key, ORG_GNOME_METACITY_THEME_TYPE) == 0)
391 update_metacity_theme (storage);376 update_metacity_theme (storage);
392#else
393 if (strcmp (key, ORG_GNOME_METACITY_THEME) == 0)
394 update_metacity_theme (storage);
395#endif
396}377}
397378
398static void379static void
@@ -423,12 +404,12 @@
423 update_button_layout (storage);404 update_button_layout (storage);
424}405}
425406
426#ifdef HAVE_METACITY_3_20_0
427static void407static void
428gtk_theme_name_changed (GtkSettings *settings,408gtk_theme_name_changed (GtkSettings *settings,
429 GParamSpec *pspec,409 GParamSpec *pspec,
430 GWDSettingsStorage *storage)410 GWDSettingsStorage *storage)
431{411{
412#ifdef USE_METACITY
432 MetaThemeType type;413 MetaThemeType type;
433414
434 if (!storage->metacity)415 if (!storage->metacity)
@@ -438,8 +419,8 @@
438419
439 if (type == META_THEME_TYPE_GTK)420 if (type == META_THEME_TYPE_GTK)
440 update_metacity_theme (storage);421 update_metacity_theme (storage);
422#endif
441}423}
442#endif
443424
444static void425static void
445gwd_settings_storage_constructed (GObject *object)426gwd_settings_storage_constructed (GObject *object)
@@ -573,22 +554,15 @@
573 case GWD_DESKTOP_GNOME_FLASHBACK:554 case GWD_DESKTOP_GNOME_FLASHBACK:
574 storage->gwd = get_settings_no_abort (ORG_COMPIZ_GWD);555 storage->gwd = get_settings_no_abort (ORG_COMPIZ_GWD);
575 storage->desktop = get_settings_no_abort (ORG_GNOME_DESKTOP_WM_PREFERENCES);556 storage->desktop = get_settings_no_abort (ORG_GNOME_DESKTOP_WM_PREFERENCES);
576
577#ifdef HAVE_METACITY_3_20_0
578 storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY_THEME);557 storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY_THEME);
579#else
580 storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY);
581#endif
582558
583 storage->gtk_decoration_layout_id =559 storage->gtk_decoration_layout_id =
584 g_signal_connect (gtk_settings_get_default (), "notify::gtk-decoration-layout",560 g_signal_connect (gtk_settings_get_default (), "notify::gtk-decoration-layout",
585 G_CALLBACK (gtk_decoration_layout_changed), storage);561 G_CALLBACK (gtk_decoration_layout_changed), storage);
586562
587#ifdef HAVE_METACITY_3_20_0
588 storage->gtk_theme_name_id =563 storage->gtk_theme_name_id =
589 g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",564 g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
590 G_CALLBACK (gtk_theme_name_changed), storage);565 G_CALLBACK (gtk_theme_name_changed), storage);
591#endif
592 break;566 break;
593567
594 case GWD_DESKTOP_MATE:568 case GWD_DESKTOP_MATE:
595569
=== modified file 'gtk/window-decorator/gwd-theme-metacity.c'
--- gtk/window-decorator/gwd-theme-metacity.c 2016-06-09 16:06:40 +0000
+++ gtk/window-decorator/gwd-theme-metacity.c 2016-08-31 17:53:28 +0000
@@ -27,12 +27,7 @@
2727
28#include "config.h"28#include "config.h"
2929
30#ifdef HAVE_METACITY_3_20_0
31#include <libmetacity/meta-theme.h>30#include <libmetacity/meta-theme.h>
32#else
33#include <metacity-private/theme.h>
34#include <metacity-private/theme-parser.h>
35#endif
3631
37#include "gtk-window-decorator.h"32#include "gtk-window-decorator.h"
38#include "gwd-settings.h"33#include "gwd-settings.h"
@@ -40,47 +35,16 @@
4035
41struct _GWDThemeMetacity36struct _GWDThemeMetacity
42{37{
43 GObject parent;38 GObject parent;
4439
45 MetaTheme *theme;40 MetaTheme *theme;
4641
47#ifndef HAVE_METACITY_3_20_042 gulong button_layout_id;
48 GHashTable *style_variants;43 MetaButtonLayout button_layout;
49#endif
50
51 gulong button_layout_id;
52 MetaButtonLayout button_layout;
53
54#ifndef HAVE_METACITY_3_20_0
55 const PangoFontDescription *titlebar_font;
56#endif
57};44};
5845
59G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME)46G_DEFINE_TYPE (GWDThemeMetacity, gwd_theme_metacity, GWD_TYPE_THEME)
6047
61#ifndef HAVE_METACITY_3_20_0
62static MetaStyleInfo *
63get_style_info (GWDThemeMetacity *metacity,
64 decor_t *decor)
65{
66 const gchar *variant = decor != NULL ? decor->gtk_theme_variant : NULL;
67 const gchar *key = variant != NULL ? variant : "default";
68 MetaStyleInfo *style = g_hash_table_lookup (metacity->style_variants, key);
69
70 if (style == NULL) {
71 GWDTheme *theme = GWD_THEME (metacity);
72 GtkWidget *style_window = gwd_theme_get_style_window (theme);
73 GdkScreen *screen = gtk_widget_get_screen (style_window);
74
75 style = meta_theme_create_style_info (screen, variant);
76
77 g_hash_table_insert (metacity->style_variants, g_strdup (key), style);
78 }
79
80 return style;
81}
82#endif
83
84static MetaFrameType48static MetaFrameType
85frame_type_from_string (const gchar *str)49frame_type_from_string (const gchar *str)
86{50{
@@ -96,232 +60,14 @@
96 return META_FRAME_TYPE_NORMAL;60 return META_FRAME_TYPE_NORMAL;
97}61}
9862
99#ifndef HAVE_METACITY_3_20_0
100static void
101initialize_button_layout (MetaButtonLayout *layout)
102{
103 gint i;
104
105 for (i = 0; i < MAX_BUTTONS_PER_CORNER; ++i) {
106 layout->left_buttons[i] = META_BUTTON_FUNCTION_LAST;
107 layout->right_buttons[i] = META_BUTTON_FUNCTION_LAST;
108 layout->left_buttons_has_spacer[i] = FALSE;
109 layout->right_buttons_has_spacer[i] = FALSE;
110 }
111}
112
113static MetaButtonFunction
114meta_button_function_from_string (const char *str)
115{
116 if (strcmp (str, "menu") == 0)
117 return META_BUTTON_FUNCTION_MENU;
118 else if (strcmp (str, "appmenu") == 0)
119 return META_BUTTON_FUNCTION_APPMENU;
120 else if (strcmp (str, "minimize") == 0)
121 return META_BUTTON_FUNCTION_MINIMIZE;
122 else if (strcmp (str, "maximize") == 0)
123 return META_BUTTON_FUNCTION_MAXIMIZE;
124 else if (strcmp (str, "close") == 0)
125 return META_BUTTON_FUNCTION_CLOSE;
126 else if (strcmp (str, "shade") == 0)
127 return META_BUTTON_FUNCTION_SHADE;
128 else if (strcmp (str, "above") == 0)
129 return META_BUTTON_FUNCTION_ABOVE;
130 else if (strcmp (str, "stick") == 0)
131 return META_BUTTON_FUNCTION_STICK;
132 else if (strcmp (str, "unshade") == 0)
133 return META_BUTTON_FUNCTION_UNSHADE;
134 else if (strcmp (str, "unabove") == 0)
135 return META_BUTTON_FUNCTION_UNABOVE;
136 else if (strcmp (str, "unstick") == 0)
137 return META_BUTTON_FUNCTION_UNSTICK;
138 else
139 return META_BUTTON_FUNCTION_LAST;
140}
141
142static MetaButtonFunction
143meta_button_opposite_function (MetaButtonFunction ofwhat)
144{
145 switch (ofwhat) {
146 case META_BUTTON_FUNCTION_SHADE:
147 return META_BUTTON_FUNCTION_UNSHADE;
148 case META_BUTTON_FUNCTION_UNSHADE:
149 return META_BUTTON_FUNCTION_SHADE;
150
151 case META_BUTTON_FUNCTION_ABOVE:
152 return META_BUTTON_FUNCTION_UNABOVE;
153 case META_BUTTON_FUNCTION_UNABOVE:
154 return META_BUTTON_FUNCTION_ABOVE;
155
156 case META_BUTTON_FUNCTION_STICK:
157 return META_BUTTON_FUNCTION_UNSTICK;
158 case META_BUTTON_FUNCTION_UNSTICK:
159 return META_BUTTON_FUNCTION_STICK;
160
161 default:
162 return META_BUTTON_FUNCTION_LAST;
163 }
164}
165#endif
166
167static void63static void
168update_metacity_button_layout_cb (GWDSettings *settings,64update_metacity_button_layout_cb (GWDSettings *settings,
169 const gchar *button_layout,65 const gchar *button_layout,
170 GWDThemeMetacity *metacity)66 GWDThemeMetacity *metacity)
171{67{
172#ifdef HAVE_METACITY_3_20_0
173 gboolean invert = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;68 gboolean invert = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL;
17469
175 metacity->button_layout = meta_button_layout_new (button_layout, invert);70 metacity->button_layout = meta_button_layout_new (button_layout, invert);
176#else
177 MetaButtonLayout new_layout;
178
179 initialize_button_layout (&new_layout);
180
181 if (button_layout != NULL) {
182 gint i;
183 gchar **sides;
184 MetaButtonFunction f;
185
186 sides = g_strsplit (button_layout, ":", 2);
187
188 if (sides[0] != NULL) {
189 gchar **buttons;
190 gint b;
191 gboolean used[META_BUTTON_FUNCTION_LAST];
192
193 for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
194 used[i] = FALSE;
195
196 buttons = g_strsplit (sides[0], ",", -1);
197
198 i = b = 0;
199 while (buttons[b] != NULL) {
200 f = meta_button_function_from_string (buttons[b]);
201
202 if (i > 0 && strcmp ("spacer", buttons[b]) == 0) {
203 new_layout.left_buttons_has_spacer[i - 1] = TRUE;
204 f = meta_button_opposite_function (f);
205
206 if (f != META_BUTTON_FUNCTION_LAST)
207 new_layout.left_buttons_has_spacer[i - 2] = TRUE;
208 } else {
209 if (f != META_BUTTON_FUNCTION_LAST && !used[f]) {
210 used[f] = TRUE;
211 new_layout.left_buttons[i++] = f;
212
213 f = meta_button_opposite_function (f);
214
215 if (f != META_BUTTON_FUNCTION_LAST)
216 new_layout.left_buttons[i++] = f;
217 } else {
218 g_warning ("Ignoring unknown or already-used "
219 "button name \"%s\"", buttons[b]);
220 }
221 }
222
223 ++b;
224 }
225
226 new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
227
228 g_strfreev (buttons);
229
230 if (sides[1] != NULL) {
231 for (i = 0; i < META_BUTTON_FUNCTION_LAST; ++i)
232 used[i] = FALSE;
233
234 buttons = g_strsplit (sides[1], ",", -1);
235
236 i = b = 0;
237 while (buttons[b] != NULL) {
238 f = meta_button_function_from_string (buttons[b]);
239
240 if (i > 0 && strcmp ("spacer", buttons[b]) == 0) {
241 new_layout.right_buttons_has_spacer[i - 1] = TRUE;
242 f = meta_button_opposite_function (f);
243
244 if (f != META_BUTTON_FUNCTION_LAST)
245 new_layout.right_buttons_has_spacer[i - 2] = TRUE;
246 } else {
247 if (f != META_BUTTON_FUNCTION_LAST && !used[f]) {
248 used[f] = TRUE;
249 new_layout.right_buttons[i++] = f;
250
251 f = meta_button_opposite_function (f);
252
253 if (f != META_BUTTON_FUNCTION_LAST)
254 new_layout.right_buttons[i++] = f;
255 } else {
256 g_warning ("Ignoring unknown or already-used "
257 "button name \"%s\"", buttons[b]);
258 }
259 }
260
261 ++b;
262 }
263
264 new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
265
266 g_strfreev (buttons);
267 }
268 }
269
270 g_strfreev (sides);
271
272 /* Invert the button layout for RTL languages */
273 if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) {
274 MetaButtonLayout rtl_layout;
275 gint j;
276
277 initialize_button_layout (&rtl_layout);
278
279 i = 0;
280 while (new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST)
281 ++i;
282
283 for (j = 0; j < i; ++j) {
284 rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
285
286 if (j == 0)
287 rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
288 else
289 rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
290 }
291
292 i = 0;
293 while (new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST)
294 ++i;
295
296 for (j = 0; j < i; ++j) {
297 rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
298
299 if (j == 0)
300 rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
301 else
302 rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
303 }
304
305 new_layout = rtl_layout;
306 }
307 } else {
308 gint i;
309
310 new_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU;
311
312 for (i = 1; i < MAX_BUTTONS_PER_CORNER; ++i)
313 new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
314
315 new_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE;
316 new_layout.right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE;
317 new_layout.right_buttons[2] = META_BUTTON_FUNCTION_CLOSE;
318
319 for (i = 3; i < MAX_BUTTONS_PER_CORNER; ++i)
320 new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
321 }
322
323 metacity->button_layout = new_layout;
324#endif
325}71}
32672
327static MetaButtonType73static MetaButtonType
@@ -447,8 +193,7 @@
447}193}
448194
449static Region195static Region
450get_top_border_region (const MetaFrameGeometry *fgeom,196get_top_border_region (const MetaFrameGeometry *fgeom)
451 gint width)
452{197{
453 Region corners_xregion;198 Region corners_xregion;
454 Region border_xregion;199 Region border_xregion;
@@ -459,6 +204,7 @@
459 gint bottom_right_radius;204 gint bottom_right_radius;
460 gint w;205 gint w;
461 gint i;206 gint i;
207 gint width;
462 gint height;208 gint height;
463209
464 corners_xregion = XCreateRegion ();210 corners_xregion = XCreateRegion ();
@@ -466,7 +212,7 @@
466 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,212 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
467 &bottom_left_radius, &bottom_right_radius);213 &bottom_left_radius, &bottom_right_radius);
468214
469 width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;215 width = fgeom->width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
470 height = fgeom->borders.visible.top;216 height = fgeom->borders.visible.top;
471217
472 if (top_left_radius) {218 if (top_left_radius) {
@@ -511,8 +257,7 @@
511}257}
512258
513static Region259static Region
514get_bottom_border_region (const MetaFrameGeometry *fgeom,260get_bottom_border_region (const MetaFrameGeometry *fgeom)
515 gint width)
516{261{
517 Region corners_xregion;262 Region corners_xregion;
518 Region border_xregion;263 Region border_xregion;
@@ -523,6 +268,7 @@
523 gint bottom_right_radius;268 gint bottom_right_radius;
524 gint w;269 gint w;
525 gint i;270 gint i;
271 gint width;
526 gint height;272 gint height;
527273
528 corners_xregion = XCreateRegion ();274 corners_xregion = XCreateRegion ();
@@ -530,7 +276,7 @@
530 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,276 get_corner_radius (fgeom, &top_left_radius, &top_right_radius,
531 &bottom_left_radius, &bottom_right_radius);277 &bottom_left_radius, &bottom_right_radius);
532278
533 width = width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;279 width = fgeom->width - fgeom->borders.invisible.left - fgeom->borders.invisible.right;
534 height = fgeom->borders.visible.bottom;280 height = fgeom->borders.visible.bottom;
535281
536 if (bottom_left_radius) {282 if (bottom_left_radius) {
@@ -575,8 +321,7 @@
575}321}
576322
577static Region323static Region
578get_left_border_region (const MetaFrameGeometry *fgeom,324get_left_border_region (const MetaFrameGeometry *fgeom)
579 gint height)
580{325{
581 Region border_xregion;326 Region border_xregion;
582 XRectangle xrect;327 XRectangle xrect;
@@ -586,7 +331,7 @@
586 xrect.x = 0;331 xrect.x = 0;
587 xrect.y = 0;332 xrect.y = 0;
588 xrect.width = fgeom->borders.visible.left;333 xrect.width = fgeom->borders.visible.left;
589 xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom;334 xrect.height = fgeom->height - fgeom->borders.total.top - fgeom->borders.total.bottom;
590335
591 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);336 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
592337
@@ -594,8 +339,7 @@
594}339}
595340
596static Region341static Region
597get_right_border_region (const MetaFrameGeometry *fgeom,342get_right_border_region (const MetaFrameGeometry *fgeom)
598 gint height)
599{343{
600 Region border_xregion;344 Region border_xregion;
601 XRectangle xrect;345 XRectangle xrect;
@@ -605,7 +349,7 @@
605 xrect.x = 0;349 xrect.x = 0;
606 xrect.y = 0;350 xrect.y = 0;
607 xrect.width = fgeom->borders.visible.right;351 xrect.width = fgeom->borders.visible.right;
608 xrect.height = height - fgeom->borders.total.top - fgeom->borders.total.bottom;352 xrect.height = fgeom->height - fgeom->borders.total.top - fgeom->borders.total.bottom;
609353
610 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);354 XUnionRectWithRegion (&xrect, border_xregion, border_xregion);
611355
@@ -652,13 +396,8 @@
652 MetaFrameBorders borders;396 MetaFrameBorders borders;
653397
654 tmp_flags = flags & ~META_FRAME_MAXIMIZED;398 tmp_flags = flags & ~META_FRAME_MAXIMIZED;
655#ifdef HAVE_METACITY_3_20_0
656 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,399 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,
657 type, tmp_flags, &borders);400 type, tmp_flags, &borders);
658#else
659 meta_theme_get_frame_borders (metacity->theme, get_style_info (metacity, d),
660 type, d->frame->text_height, tmp_flags, &borders);
661#endif
662401
663 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {402 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {
664 frame_win_extents.left += borders.invisible.left;403 frame_win_extents.left += borders.invisible.left;
@@ -671,13 +410,8 @@
671 }410 }
672411
673 tmp_flags = flags | META_FRAME_MAXIMIZED;412 tmp_flags = flags | META_FRAME_MAXIMIZED;
674#ifdef HAVE_METACITY_3_20_0
675 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,413 meta_theme_get_frame_borders (metacity->theme, d->gtk_theme_variant,
676 type, tmp_flags, &borders);414 type, tmp_flags, &borders);
677#else
678 meta_theme_get_frame_borders (metacity->theme, get_style_info (metacity, d),
679 type, d->frame->text_height, tmp_flags, &borders);
680#endif
681415
682 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {416 if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) {
683 frame_max_win_extents.left += borders.invisible.left;417 frame_max_win_extents.left += borders.invisible.left;
@@ -807,15 +541,9 @@
807 else541 else
808 client_height = decor->border_layout.left.y2 - decor->border_layout.left.y1;542 client_height = decor->border_layout.left.y2 - decor->border_layout.left.y1;
809543
810#ifdef HAVE_METACITY_3_20_0
811 meta_theme_calc_geometry (metacity->theme, decor->gtk_theme_variant,544 meta_theme_calc_geometry (metacity->theme, decor->gtk_theme_variant,
812 frame_type, *flags, client_width, client_height,545 frame_type, *flags, client_width, client_height,
813 &metacity->button_layout, fgeom);546 &metacity->button_layout, fgeom);
814#else
815 meta_theme_calc_geometry (metacity->theme, get_style_info (metacity, decor),
816 frame_type, decor->frame->text_height, *flags, client_width,
817 client_height, &metacity->button_layout, fgeom);
818#endif
819}547}
820548
821static void549static void
@@ -915,12 +643,8 @@
915{643{
916 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));644 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
917 const gchar *metacity_theme_name = gwd_settings_get_metacity_theme_name (settings);645 const gchar *metacity_theme_name = gwd_settings_get_metacity_theme_name (settings);
918#ifdef HAVE_METACITY_3_20_0
919 gint metacity_theme_type = gwd_settings_get_metacity_theme_type (settings);646 gint metacity_theme_type = gwd_settings_get_metacity_theme_type (settings);
920 GError *error = NULL;647 GError *error = NULL;
921#else
922 MetaTheme *theme;
923#endif
924648
925 /* metacity_theme can be NULL only in one case - if user has disabled649 /* metacity_theme can be NULL only in one case - if user has disabled
926 * metacity theme with use-metacity-theme setting. In that case650 * metacity theme with use-metacity-theme setting. In that case
@@ -928,7 +652,6 @@
928 */652 */
929 g_assert (metacity_theme_name != NULL);653 g_assert (metacity_theme_name != NULL);
930654
931#ifdef HAVE_METACITY_3_20_0
932 if (metacity_theme_type == -1)655 if (metacity_theme_type == -1)
933 metacity_theme_type = META_THEME_TYPE_METACITY;656 metacity_theme_type = META_THEME_TYPE_METACITY;
934657
@@ -943,25 +666,6 @@
943666
944 return FALSE;667 return FALSE;
945 }668 }
946#else
947
948 /* meta_theme_get_current returns the last good theme, so we will try to
949 * load theme manually to know that theme is 100% valid.
950 */
951 theme = meta_theme_load (metacity_theme_name, NULL);
952 if (theme == NULL)
953 return FALSE;
954
955 /* We can not use this manually loaded theme because Metacity internaly
956 * also use meta_theme_get_current wich in this case will return NULL,
957 * boom - segfault...
958 */
959 meta_theme_free (theme);
960
961 /* If we are here then we know that this will not fail. */
962 meta_theme_set_current (metacity_theme_name, TRUE);
963 metacity->theme = meta_theme_get_current ();
964#endif
965669
966 return TRUE;670 return TRUE;
967}671}
@@ -997,11 +701,7 @@
997{701{
998 GWDThemeMetacity *metacity = GWD_THEME_METACITY (object);702 GWDThemeMetacity *metacity = GWD_THEME_METACITY (object);
999703
1000#ifdef HAVE_METACITY_3_20_0
1001 g_clear_object (&metacity->theme);704 g_clear_object (&metacity->theme);
1002#else
1003 g_clear_pointer (&metacity->style_variants, g_hash_table_destroy);
1004#endif
1005705
1006 if (metacity->button_layout_id != 0) {706 if (metacity->button_layout_id != 0) {
1007 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));707 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
@@ -1010,10 +710,6 @@
1010 metacity->button_layout_id = 0;710 metacity->button_layout_id = 0;
1011 }711 }
1012712
1013#ifndef HAVE_METACITY_3_20_0
1014 metacity->titlebar_font = NULL;
1015#endif
1016
1017 G_OBJECT_CLASS (gwd_theme_metacity_parent_class)->dispose (object);713 G_OBJECT_CLASS (gwd_theme_metacity_parent_class)->dispose (object);
1018}714}
1019715
@@ -1022,11 +718,7 @@
1022{718{
1023 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);719 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
1024720
1025#ifdef HAVE_METACITY_3_20_0
1026 meta_theme_invalidate (metacity->theme);721 meta_theme_invalidate (metacity->theme);
1027#else
1028 g_hash_table_remove_all (metacity->style_variants);
1029#endif
1030}722}
1031723
1032static void724static void
@@ -1038,10 +730,6 @@
1038 GdkDisplay *display = gdk_display_get_default ();730 GdkDisplay *display = gdk_display_get_default ();
1039 Display *xdisplay = gdk_x11_display_get_xdisplay (display);731 Display *xdisplay = gdk_x11_display_get_xdisplay (display);
1040 GtkWidget *style_window = gwd_theme_get_style_window (theme);732 GtkWidget *style_window = gwd_theme_get_style_window (theme);
1041#ifndef HAVE_METACITY_3_20_0
1042 MetaStyleInfo *style_info = get_style_info (metacity, decor);
1043 GtkStyleContext *context = gtk_widget_get_style_context (style_window);
1044#endif
1045 cairo_surface_t *surface;733 cairo_surface_t *surface;
1046 Picture src;734 Picture src;
1047 MetaButtonState button_states [META_BUTTON_TYPE_LAST];735 MetaButtonState button_states [META_BUTTON_TYPE_LAST];
@@ -1056,10 +744,6 @@
1056 Region right_region;744 Region right_region;
1057 double alpha;745 double alpha;
1058 gboolean shade_alpha;746 gboolean shade_alpha;
1059#ifndef HAVE_METACITY_3_20_0
1060 MetaFrameStyle *frame_style;
1061 GdkRGBA bg_rgba;
1062#endif
1063747
1064 if (!decor->surface || !decor->picture)748 if (!decor->surface || !decor->picture)
1065 return;749 return;
@@ -1094,20 +778,6 @@
1094 for (i = 0; i < META_BUTTON_TYPE_LAST; ++i)778 for (i = 0; i < META_BUTTON_TYPE_LAST; ++i)
1095 button_states[i] = meta_button_state_for_button_type (metacity, decor, i);779 button_states[i] = meta_button_state_for_button_type (metacity, decor, i);
1096780
1097#ifndef HAVE_METACITY_3_20_0
1098 frame_style = meta_theme_get_frame_style (metacity->theme, frame_type, flags);
1099
1100 gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &bg_rgba);
1101 bg_rgba.alpha = 1.0;
1102
1103 if (frame_style->window_background_color) {
1104 meta_color_spec_render (frame_style->window_background_color,
1105 context, &bg_rgba);
1106
1107 bg_rgba.alpha = frame_style->window_background_alpha / 255.0;
1108 }
1109#endif
1110
1111 /* Draw something that will be almost invisible to user. This is hacky way781 /* Draw something that will be almost invisible to user. This is hacky way
1112 * to fix invisible decorations. */782 * to fix invisible decorations. */
1113 cairo_set_source_rgba (cr, 0, 0, 0, 0.01);783 cairo_set_source_rgba (cr, 0, 0, 0, 0.01);
@@ -1118,34 +788,19 @@
1118 cairo_destroy (cr);788 cairo_destroy (cr);
1119789
1120 surface = create_surface (fgeom.width, fgeom.height, style_window);790 surface = create_surface (fgeom.width, fgeom.height, style_window);
1121
1122 cr = cairo_create (surface);791 cr = cairo_create (surface);
1123792
1124#ifndef HAVE_METACITY_3_20_0
1125 gdk_cairo_set_source_rgba (cr, &bg_rgba);
1126 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1127 cairo_paint (cr);
1128#endif
1129
1130 src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),793 src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),
1131 xformat_rgba, 0, NULL);794 xformat_rgba, 0, NULL);
1132795
1133#ifdef HAVE_METACITY_3_20_0
1134 meta_theme_draw_frame (metacity->theme, decor->gtk_theme_variant, cr, frame_type, flags,796 meta_theme_draw_frame (metacity->theme, decor->gtk_theme_variant, cr, frame_type, flags,
1135 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,797 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,
1136 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,798 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,
1137 decor->name, &metacity->button_layout,799 decor->name, &metacity->button_layout,
1138 button_states, decor->icon_pixbuf, NULL);800 button_states, decor->icon_pixbuf, NULL);
1139#else
1140 meta_theme_draw_frame (metacity->theme, style_info, cr, frame_type, flags,
1141 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,
1142 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,
1143 decor->layout, decor->frame->text_height, &metacity->button_layout,
1144 button_states, decor->icon_pixbuf, NULL);
1145#endif
1146801
1147 if (fgeom.borders.visible.top) {802 if (fgeom.borders.visible.top) {
1148 top_region = get_top_border_region (&fgeom, fgeom.width);803 top_region = get_top_border_region (&fgeom);
1149804
1150 decor_blend_border_picture (xdisplay, decor->context, src,805 decor_blend_border_picture (xdisplay, decor->context, src,
1151 fgeom.borders.invisible.left,806 fgeom.borders.invisible.left,
@@ -1156,7 +811,7 @@
1156 }811 }
1157812
1158 if (fgeom.borders.visible.bottom) {813 if (fgeom.borders.visible.bottom) {
1159 bottom_region = get_bottom_border_region (&fgeom, fgeom.width);814 bottom_region = get_bottom_border_region (&fgeom);
1160815
1161 decor_blend_border_picture (xdisplay, decor->context, src,816 decor_blend_border_picture (xdisplay, decor->context, src,
1162 fgeom.borders.invisible.left,817 fgeom.borders.invisible.left,
@@ -1167,7 +822,7 @@
1167 }822 }
1168823
1169 if (fgeom.borders.visible.left) {824 if (fgeom.borders.visible.left) {
1170 left_region = get_left_border_region (&fgeom, fgeom.height);825 left_region = get_left_border_region (&fgeom);
1171826
1172 decor_blend_border_picture (xdisplay, decor->context, src,827 decor_blend_border_picture (xdisplay, decor->context, src,
1173 fgeom.borders.invisible.left,828 fgeom.borders.invisible.left,
@@ -1178,7 +833,7 @@
1178 }833 }
1179834
1180 if (fgeom.borders.visible.right) {835 if (fgeom.borders.visible.right) {
1181 right_region = get_right_border_region (&fgeom, fgeom.height);836 right_region = get_right_border_region (&fgeom);
1182837
1183 decor_blend_border_picture (xdisplay, decor->context, src,838 decor_blend_border_picture (xdisplay, decor->context, src,
1184 fgeom.width - fgeom.borders.total.right,839 fgeom.width - fgeom.borders.total.right,
@@ -1278,35 +933,21 @@
1278 decor_frame_t *frame)933 decor_frame_t *frame)
1279{934{
1280 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);935 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
1281#ifndef HAVE_METACITY_3_20_0
1282 MetaStyleInfo *style_info = get_style_info (metacity, NULL);
1283#endif
1284 MetaFrameType frame_type = frame_type_from_string (frame->type);936 MetaFrameType frame_type = frame_type_from_string (frame->type);
1285 MetaFrameBorders borders;937 MetaFrameBorders borders;
1286938
1287 gwd_decor_frame_ref (frame);939 gwd_decor_frame_ref (frame);
1288940
1289#ifdef HAVE_METACITY_3_20_0
1290 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,941 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,
1291 0, &borders);942 0, &borders);
1292#else
1293 meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
1294 frame->text_height, 0, &borders);
1295#endif
1296943
1297 frame->win_extents.top = borders.visible.top;944 frame->win_extents.top = borders.visible.top;
1298 frame->win_extents.bottom = borders.visible.bottom;945 frame->win_extents.bottom = borders.visible.bottom;
1299 frame->win_extents.left = borders.visible.left;946 frame->win_extents.left = borders.visible.left;
1300 frame->win_extents.right = borders.visible.right;947 frame->win_extents.right = borders.visible.right;
1301948
1302#ifdef HAVE_METACITY_3_20_0
1303 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,949 meta_theme_get_frame_borders (metacity->theme, NULL, frame_type,
1304 META_FRAME_MAXIMIZED, &borders);950 META_FRAME_MAXIMIZED, &borders);
1305#else
1306 meta_theme_get_frame_borders (metacity->theme, style_info, frame_type,
1307 frame->text_height, META_FRAME_MAXIMIZED,
1308 &borders);
1309#endif
1310951
1311 frame->max_win_extents.top = borders.visible.top;952 frame->max_win_extents.top = borders.visible.top;
1312 frame->max_win_extents.bottom = borders.visible.bottom;953 frame->max_win_extents.bottom = borders.visible.bottom;
@@ -1521,32 +1162,7 @@
1521{1162{
1522 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);1163 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
15231164
1524#ifdef HAVE_METACITY_3_20_0
1525 meta_theme_set_titlebar_font (metacity->theme, titlebar_font);1165 meta_theme_set_titlebar_font (metacity->theme, titlebar_font);
1526#else
1527 metacity->titlebar_font = titlebar_font;
1528#endif
1529}
1530
1531static PangoFontDescription *
1532gwd_theme_metacity_get_titlebar_font (GWDTheme *theme,
1533 decor_frame_t *frame)
1534{
1535#ifdef HAVE_METACITY_3_20_0
1536 return NULL;
1537#else
1538 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
1539 MetaStyleInfo *style_info = get_style_info (metacity, NULL);
1540 PangoFontDescription *font_desc = meta_style_info_create_font_desc (style_info);
1541 MetaFrameType type = frame_type_from_string (frame->type);
1542 MetaFrameFlags flags = 0xc33; /* FIXME */
1543 MetaFrameStyle *style = meta_theme_get_frame_style (metacity->theme, type, flags);
1544
1545 pango_font_description_merge (font_desc, metacity->titlebar_font, TRUE);
1546 meta_frame_style_apply_scale (style, font_desc);
1547
1548 return font_desc;
1549#endif
1550}1166}
15511167
1552static void1168static void
@@ -1565,16 +1181,11 @@
1565 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;1181 theme_class->get_event_window_position = gwd_theme_metacity_get_event_window_position;
1566 theme_class->get_button_position = gwd_theme_metacity_get_button_position;1182 theme_class->get_button_position = gwd_theme_metacity_get_button_position;
1567 theme_class->update_titlebar_font = gwd_theme_metacity_update_titlebar_font;1183 theme_class->update_titlebar_font = gwd_theme_metacity_update_titlebar_font;
1568 theme_class->get_titlebar_font = gwd_theme_metacity_get_titlebar_font;
1569}1184}
15701185
1571static void1186static void
1572gwd_theme_metacity_init (GWDThemeMetacity *metacity)1187gwd_theme_metacity_init (GWDThemeMetacity *metacity)
1573{1188{
1574#ifndef HAVE_METACITY_3_20_0
1575 metacity->style_variants = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
1576 (GDestroyNotify) meta_style_info_unref);
1577#endif
1578}1189}
15791190
1580/**1191/**
15811192
=== modified file 'gtk/window-decorator/gwd-theme.c'
--- gtk/window-decorator/gwd-theme.c 2016-06-09 16:00:00 +0000
+++ gtk/window-decorator/gwd-theme.c 2016-08-31 17:53:28 +0000
@@ -248,13 +248,6 @@
248{248{
249}249}
250250
251static PangoFontDescription *
252gwd_theme_real_get_titlebar_font (GWDTheme *theme,
253 decor_frame_t *frame)
254{
255 return NULL;
256}
257
258static void251static void
259gwd_theme_class_init (GWDThemeClass *theme_class)252gwd_theme_class_init (GWDThemeClass *theme_class)
260{253{
@@ -275,7 +268,6 @@
275 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;268 theme_class->get_event_window_position = gwd_theme_real_get_event_window_position;
276 theme_class->get_button_position = gwd_theme_real_get_button_position;269 theme_class->get_button_position = gwd_theme_real_get_button_position;
277 theme_class->update_titlebar_font = gwd_theme_real_update_titlebar_font;270 theme_class->update_titlebar_font = gwd_theme_real_update_titlebar_font;
278 theme_class->get_titlebar_font = gwd_theme_real_get_titlebar_font;
279271
280 properties[PROP_SETTINGS] =272 properties[PROP_SETTINGS] =
281 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",273 g_param_spec_object ("settings", "GWDSettings", "GWDSettings",
@@ -433,11 +425,6 @@
433 GWDThemePrivate *priv = gwd_theme_get_instance_private (theme);425 GWDThemePrivate *priv = gwd_theme_get_instance_private (theme);
434 GtkStyleContext *context = gtk_widget_get_style_context (priv->style_window);426 GtkStyleContext *context = gtk_widget_get_style_context (priv->style_window);
435427
436 /* Check if Metacity or Cairo will create titlebar font */
437 font_desc = GWD_THEME_GET_CLASS (theme)->get_titlebar_font (theme, frame);
438 if (font_desc)
439 return font_desc;
440
441 /* Check if non-system font is in use */428 /* Check if non-system font is in use */
442 if (priv->titlebar_font)429 if (priv->titlebar_font)
443 return pango_font_description_copy (priv->titlebar_font);430 return pango_font_description_copy (priv->titlebar_font);
444431
=== modified file 'gtk/window-decorator/gwd-theme.h'
--- gtk/window-decorator/gwd-theme.h 2016-06-09 15:47:07 +0000
+++ gtk/window-decorator/gwd-theme.h 2016-08-31 17:53:28 +0000
@@ -37,53 +37,50 @@
37{37{
38 GObjectClass parent_class;38 GObjectClass parent_class;
3939
40 void (* style_updated) (GWDTheme *theme);40 void (* style_updated) (GWDTheme *theme);
4141
42 void (* get_shadow) (GWDTheme *theme,42 void (* get_shadow) (GWDTheme *theme,
43 decor_frame_t *frame,43 decor_frame_t *frame,
44 decor_shadow_options_t *options,44 decor_shadow_options_t *options,
45 gboolean active);45 gboolean active);
4646
47 void (* draw_window_decoration) (GWDTheme *theme,47 void (* draw_window_decoration) (GWDTheme *theme,
48 decor_t *decor);48 decor_t *decor);
4949
50 gboolean (* calc_decoration_size) (GWDTheme *theme,50 gboolean (* calc_decoration_size) (GWDTheme *theme,
51 decor_t *decor,51 decor_t *decor,
52 gint w,52 gint w,
53 gint h,53 gint h,
54 gint name_width,54 gint name_width,
55 gint *width,55 gint *width,
56 gint *height);56 gint *height);
5757
58 void (* update_border_extents) (GWDTheme *theme,58 void (* update_border_extents) (GWDTheme *theme,
59 decor_frame_t *frame);59 decor_frame_t *frame);
6060
61 void (* get_event_window_position) (GWDTheme *theme,61 void (* get_event_window_position) (GWDTheme *theme,
62 decor_t *decor,62 decor_t *decor,
63 gint i,63 gint i,
64 gint j,64 gint j,
65 gint width,65 gint width,
66 gint height,66 gint height,
67 gint *x,67 gint *x,
68 gint *y,68 gint *y,
69 gint *w,69 gint *w,
70 gint *h);70 gint *h);
7171
72 gboolean (* get_button_position) (GWDTheme *theme,72 gboolean (* get_button_position) (GWDTheme *theme,
73 decor_t *decor,73 decor_t *decor,
74 gint i,74 gint i,
75 gint width,75 gint width,
76 gint height,76 gint height,
77 gint *x,77 gint *x,
78 gint *y,78 gint *y,
79 gint *w,79 gint *w,
80 gint *h);80 gint *h);
8181
82 void (* update_titlebar_font) (GWDTheme *theme,82 void (* update_titlebar_font) (GWDTheme *theme,
83 const PangoFontDescription *titlebar_font);83 const PangoFontDescription *titlebar_font);
84
85 PangoFontDescription * (* get_titlebar_font) (GWDTheme *theme,
86 decor_frame_t *frame);
87};84};
8885
89typedef enum86typedef enum

Subscribers

People subscribed via source and target branches