Merge lp:~muktupavels/compiz/gwd-metacity-theme-type-setting into lp:compiz/0.9.12

Proposed by Alberts Muktupāvels
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4058
Merged at revision: 4053
Proposed branch: lp:~muktupavels/compiz/gwd-metacity-theme-type-setting
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~muktupavels/compiz/gwd-improve-settings-storage
Diff against target: 575 lines (+104/-102)
9 files modified
gtk/window-decorator/gdk.c (+0/-9)
gtk/window-decorator/gtk-window-decorator.c (+3/-2)
gtk/window-decorator/gtk-window-decorator.h (+0/-3)
gtk/window-decorator/gwd-settings-storage.c (+10/-6)
gtk/window-decorator/gwd-settings.c (+52/-36)
gtk/window-decorator/gwd-settings.h (+10/-5)
gtk/window-decorator/gwd-theme-metacity.c (+18/-31)
gtk/window-decorator/gwd-theme-metacity.h (+0/-2)
gtk/window-decorator/tests/test_gwd_settings.cpp (+11/-8)
To merge this branch: bzr merge lp:~muktupavels/compiz/gwd-metacity-theme-type-setting
Reviewer Review Type Date Requested Status
Sam Spilsbury Approve
Review via email: mp+296256@code.launchpad.net

Commit message

gtk-window-decorator: add new metacity-theme-type setting in GWDSettings.

Add new metacity-theme-type setting. Currently this is unused, but will be used with Metacity 3.20.

Description of the change

Add new metacity-theme-type setting. Currently this is unused, but will be used with Metacity 3.20.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) :
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :

Updated.

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

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'gtk/window-decorator/gdk.c'
--- gtk/window-decorator/gdk.c 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/gdk.c 2016-06-02 03:25:46 +0000
@@ -21,15 +21,6 @@
2121
22#include "gtk-window-decorator.h"22#include "gtk-window-decorator.h"
2323
24GdkWindow *
25create_gdk_window (Window xframe)
26{
27 GdkDisplay *display = gdk_display_get_default ();
28 GdkWindow *window = gdk_x11_window_foreign_new_for_display (display, xframe);
29
30 return window;
31}
32
33cairo_surface_t *24cairo_surface_t *
34create_native_surface_and_wrap (int w,25create_native_surface_and_wrap (int w,
35 int h,26 int h,
3627
=== modified file 'gtk/window-decorator/gtk-window-decorator.c'
--- gtk/window-decorator/gtk-window-decorator.c 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/gtk-window-decorator.c 2016-06-02 03:25:46 +0000
@@ -147,12 +147,13 @@
147147
148static void148static void
149update_metacity_theme_cb (GWDSettings *settings,149update_metacity_theme_cb (GWDSettings *settings,
150 const gchar *metacity_theme,150 gint metacity_theme_type,
151 const gchar *metacity_theme_name,
151 gpointer user_data)152 gpointer user_data)
152{153{
153 GWDThemeType type = GWD_THEME_TYPE_CAIRO;154 GWDThemeType type = GWD_THEME_TYPE_CAIRO;
154155
155 if (metacity_theme != NULL)156 if (metacity_theme_name != NULL)
156 type = GWD_THEME_TYPE_METACITY;157 type = GWD_THEME_TYPE_METACITY;
157158
158 g_set_object (&gwd_theme, gwd_theme_new (type, settings));159 g_set_object (&gwd_theme, gwd_theme_new (type, settings));
159160
=== modified file 'gtk/window-decorator/gtk-window-decorator.h'
--- gtk/window-decorator/gtk-window-decorator.h 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/gtk-window-decorator.h 2016-06-02 03:25:46 +0000
@@ -493,9 +493,6 @@
493493
494/* gdk.c */494/* gdk.c */
495495
496GdkWindow *
497create_gdk_window (Window xframe);
498
499cairo_surface_t *496cairo_surface_t *
500create_surface (int w,497create_surface (int w,
501 int h,498 int h,
502499
=== modified file 'gtk/window-decorator/gwd-settings-storage.c'
--- gtk/window-decorator/gwd-settings-storage.c 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/gwd-settings-storage.c 2016-06-02 03:25:46 +0000
@@ -185,25 +185,29 @@
185update_metacity_theme (GWDSettingsStorage *storage)185update_metacity_theme (GWDSettingsStorage *storage)
186{186{
187 gboolean use_metacity_theme;187 gboolean use_metacity_theme;
188 gchar *theme;188 gint metacity_theme_type;
189 gchar *metacity_theme_name;
189190
190 if (!storage->gwd)191 if (!storage->gwd)
191 return;192 return;
192193
193 use_metacity_theme = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME);194 use_metacity_theme = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME);
195 metacity_theme_type = METACITY_THEME_TYPE_DEFAULT;
194196
195 if (storage->current_desktop == GWD_DESKTOP_MATE && storage->marco) {197 if (storage->current_desktop == GWD_DESKTOP_MATE && storage->marco) {
196 theme = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME);198 metacity_theme_name = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME);
197 } else if (storage->current_desktop == GWD_DESKTOP_GNOME_FLASHBACK && storage->metacity) {199 } else if (storage->current_desktop == GWD_DESKTOP_GNOME_FLASHBACK && storage->metacity) {
198 theme = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME);200 metacity_theme_name = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME);
199 } else if (storage->desktop) {201 } else if (storage->desktop) {
200 theme = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME);202 metacity_theme_name = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME);
201 } else {203 } else {
202 return;204 return;
203 }205 }
204206
205 gwd_settings_metacity_theme_changed (storage->settings, use_metacity_theme, theme);207 gwd_settings_metacity_theme_changed (storage->settings, use_metacity_theme,
206 g_free (theme);208 metacity_theme_type, metacity_theme_name);
209
210 g_free (metacity_theme_name);
207}211}
208212
209void213void
210214
=== modified file 'gtk/window-decorator/gwd-settings.c'
--- gtk/window-decorator/gwd-settings.c 2016-05-21 20:34:55 +0000
+++ gtk/window-decorator/gwd-settings.c 2016-06-02 03:25:46 +0000
@@ -43,7 +43,8 @@
4343
44const gint BLUR_TYPE_DEFAULT = BLUR_TYPE_NONE;44const gint BLUR_TYPE_DEFAULT = BLUR_TYPE_NONE;
4545
46const gchar *METACITY_THEME_DEFAULT = "Adwaita";46const gchar *METACITY_THEME_NAME_DEFAULT = "Adwaita";
47const gint METACITY_THEME_TYPE_DEFAULT = -1;
47const gdouble METACITY_ACTIVE_OPACITY_DEFAULT = 1.0;48const gdouble METACITY_ACTIVE_OPACITY_DEFAULT = 1.0;
48const gdouble METACITY_INACTIVE_OPACITY_DEFAULT = 0.75;49const gdouble METACITY_INACTIVE_OPACITY_DEFAULT = 0.75;
49const gboolean METACITY_ACTIVE_SHADE_OPACITY_DEFAULT = TRUE;50const gboolean METACITY_ACTIVE_SHADE_OPACITY_DEFAULT = TRUE;
@@ -71,7 +72,8 @@
71 GObject parent;72 GObject parent;
7273
73 gint blur_type;74 gint blur_type;
74 gchar *metacity_theme;75 gchar *metacity_theme_name;
76 gint metacity_theme_type;
75 guint cmdline_opts;77 guint cmdline_opts;
7678
77 decor_shadow_options_t active_shadow;79 decor_shadow_options_t active_shadow;
@@ -97,7 +99,7 @@
97 PROP_0,99 PROP_0,
98100
99 PROP_BLUR_TYPE,101 PROP_BLUR_TYPE,
100 PROP_METACITY_THEME,102 PROP_METACITY_THEME_NAME,
101 PROP_CMDLINE_OPTIONS,103 PROP_CMDLINE_OPTIONS,
102104
103 LAST_PROP105 LAST_PROP
@@ -134,8 +136,8 @@
134static void136static void
135update_metacity_theme (GWDSettings *settings)137update_metacity_theme (GWDSettings *settings)
136{138{
137 g_signal_emit (settings, settings_signals[UPDATE_METACITY_THEME],139 g_signal_emit (settings, settings_signals[UPDATE_METACITY_THEME], 0,
138 0, settings->metacity_theme);140 settings->metacity_theme_type, settings->metacity_theme_name);
139}141}
140142
141static void143static void
@@ -245,7 +247,7 @@
245247
246 settings = GWD_SETTINGS (object);248 settings = GWD_SETTINGS (object);
247249
248 g_clear_pointer (&settings->metacity_theme, g_free);250 g_clear_pointer (&settings->metacity_theme_name, g_free);
249 g_clear_pointer (&settings->metacity_button_layout, g_free);251 g_clear_pointer (&settings->metacity_button_layout, g_free);
250 g_clear_pointer (&settings->titlebar_font, g_free);252 g_clear_pointer (&settings->titlebar_font, g_free);
251253
@@ -271,9 +273,9 @@
271 settings->blur_type = g_value_get_int (value);273 settings->blur_type = g_value_get_int (value);
272 break;274 break;
273275
274 case PROP_METACITY_THEME:276 case PROP_METACITY_THEME_NAME:
275 g_free (settings->metacity_theme);277 g_free (settings->metacity_theme_name);
276 settings->metacity_theme = g_value_dup_string (value);278 settings->metacity_theme_name = g_value_dup_string (value);
277 break;279 break;
278280
279 default:281 default:
@@ -299,11 +301,11 @@
299 BLUR_TYPE_NONE,301 BLUR_TYPE_NONE,
300 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);302 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
301303
302 properties[PROP_METACITY_THEME] =304 properties[PROP_METACITY_THEME_NAME] =
303 g_param_spec_string ("metacity-theme",305 g_param_spec_string ("metacity-theme-name",
304 "Metacity Theme",306 "Metacity Theme Name",
305 "Metacity Theme Setting",307 "Metacity Theme Name",
306 METACITY_THEME_DEFAULT,308 METACITY_THEME_NAME_DEFAULT,
307 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);309 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
308310
309 properties[PROP_CMDLINE_OPTIONS] =311 properties[PROP_CMDLINE_OPTIONS] =
@@ -328,12 +330,14 @@
328 settings_signals[UPDATE_METACITY_THEME] =330 settings_signals[UPDATE_METACITY_THEME] =
329 g_signal_new ("update-metacity-theme",331 g_signal_new ("update-metacity-theme",
330 GWD_TYPE_SETTINGS, G_SIGNAL_RUN_LAST,332 GWD_TYPE_SETTINGS, G_SIGNAL_RUN_LAST,
331 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING);333 0, NULL, NULL, NULL, G_TYPE_NONE, 2,
334 G_TYPE_INT, G_TYPE_STRING);
332335
333 settings_signals[UPDATE_METACITY_BUTTON_LAYOUT] =336 settings_signals[UPDATE_METACITY_BUTTON_LAYOUT] =
334 g_signal_new ("update-metacity-button-layout",337 g_signal_new ("update-metacity-button-layout",
335 GWD_TYPE_SETTINGS, G_SIGNAL_RUN_LAST,338 GWD_TYPE_SETTINGS, G_SIGNAL_RUN_LAST,
336 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING);339 0, NULL, NULL, NULL, G_TYPE_NONE, 1,
340 G_TYPE_STRING);
337}341}
338342
339static void343static void
@@ -355,7 +359,8 @@
355 settings->inactive_shadow.shadow_color[1] = 0;359 settings->inactive_shadow.shadow_color[1] = 0;
356 settings->inactive_shadow.shadow_color[2] = 0;360 settings->inactive_shadow.shadow_color[2] = 0;
357 settings->blur_type = BLUR_TYPE_DEFAULT;361 settings->blur_type = BLUR_TYPE_DEFAULT;
358 settings->metacity_theme = g_strdup (METACITY_THEME_DEFAULT);362 settings->metacity_theme_name = g_strdup (METACITY_THEME_NAME_DEFAULT);
363 settings->metacity_theme_type = METACITY_THEME_TYPE_DEFAULT;
359 settings->metacity_active_opacity = METACITY_ACTIVE_OPACITY_DEFAULT;364 settings->metacity_active_opacity = METACITY_ACTIVE_OPACITY_DEFAULT;
360 settings->metacity_inactive_opacity = METACITY_INACTIVE_OPACITY_DEFAULT;365 settings->metacity_inactive_opacity = METACITY_INACTIVE_OPACITY_DEFAULT;
361 settings->metacity_active_shade_opacity = METACITY_ACTIVE_SHADE_OPACITY_DEFAULT;366 settings->metacity_active_shade_opacity = METACITY_ACTIVE_SHADE_OPACITY_DEFAULT;
@@ -378,22 +383,24 @@
378}383}
379384
380GWDSettings *385GWDSettings *
381gwd_settings_new (gint blur,386gwd_settings_new (gint blur_type,
382 const gchar *metacity_theme)387 const gchar *metacity_theme_name)
383{388{
384 guint cmdline_opts;389 guint cmdline_opts = 0;
385390
386 cmdline_opts = 0;391 if (blur_type != BLUR_TYPE_UNSET)
387
388 if (blur != BLUR_TYPE_UNSET)
389 cmdline_opts |= CMDLINE_BLUR;392 cmdline_opts |= CMDLINE_BLUR;
393 else
394 blur_type = BLUR_TYPE_DEFAULT;
390395
391 if (metacity_theme != NULL)396 if (metacity_theme_name != NULL)
392 cmdline_opts |= CMDLINE_THEME;397 cmdline_opts |= CMDLINE_THEME;
398 else
399 metacity_theme_name = METACITY_THEME_NAME_DEFAULT;
393400
394 return g_object_new (GWD_TYPE_SETTINGS,401 return g_object_new (GWD_TYPE_SETTINGS,
395 "blur-type", blur != BLUR_TYPE_UNSET ? blur : BLUR_TYPE_DEFAULT,402 "blur-type", blur_type,
396 "metacity-theme", metacity_theme ? metacity_theme : METACITY_THEME_DEFAULT,403 "metacity-theme-name", metacity_theme_name,
397 "cmdline-options", cmdline_opts,404 "cmdline-options", cmdline_opts,
398 NULL);405 NULL);
399}406}
@@ -411,9 +418,15 @@
411}418}
412419
413const gchar *420const gchar *
414gwd_settings_get_metacity_theme (GWDSettings *settings)421gwd_settings_get_metacity_theme_name (GWDSettings *settings)
415{422{
416 return settings->metacity_theme;423 return settings->metacity_theme_name;
424}
425
426gint
427gwd_settings_get_metacity_theme_type (GWDSettings *settings)
428{
429 return settings->metacity_theme_type;
417}430}
418431
419const gchar *432const gchar *
@@ -614,20 +627,23 @@
614gboolean627gboolean
615gwd_settings_metacity_theme_changed (GWDSettings *settings,628gwd_settings_metacity_theme_changed (GWDSettings *settings,
616 gboolean use_metacity_theme,629 gboolean use_metacity_theme,
617 const gchar *metacity_theme)630 gint metacity_theme_type,
631 const gchar *metacity_theme_name)
618{632{
619 if (settings->cmdline_opts & CMDLINE_THEME)633 if (settings->cmdline_opts & CMDLINE_THEME)
620 return FALSE;634 return FALSE;
621635
622 if (use_metacity_theme) {636 if (use_metacity_theme) {
623 if (g_strcmp0 (metacity_theme, settings->metacity_theme) == 0)637 if (g_strcmp0 (metacity_theme_name, settings->metacity_theme_name) == 0 &&
638 metacity_theme_type == settings->metacity_theme_type)
624 return FALSE;639 return FALSE;
625640
626 g_free (settings->metacity_theme);641 g_free (settings->metacity_theme_name);
627 settings->metacity_theme = g_strdup (metacity_theme);642 settings->metacity_theme_name = g_strdup (metacity_theme_name);
643 settings->metacity_theme_type = metacity_theme_type;
628 } else {644 } else {
629 g_free (settings->metacity_theme);645 g_free (settings->metacity_theme_name);
630 settings->metacity_theme = NULL;646 settings->metacity_theme_name = NULL;
631 }647 }
632648
633 append_to_notify_funcs (settings, update_metacity_theme);649 append_to_notify_funcs (settings, update_metacity_theme);
634650
=== modified file 'gtk/window-decorator/gwd-settings.h'
--- gtk/window-decorator/gwd-settings.h 2016-05-21 16:08:47 +0000
+++ gtk/window-decorator/gwd-settings.h 2016-06-02 03:25:46 +0000
@@ -69,7 +69,8 @@
6969
70extern const gint BLUR_TYPE_DEFAULT;70extern const gint BLUR_TYPE_DEFAULT;
7171
72extern const gchar *METACITY_THEME_DEFAULT;72extern const gchar *METACITY_THEME_NAME_DEFAULT;
73extern const gint METACITY_THEME_TYPE_DEFAULT;
73extern const gdouble METACITY_ACTIVE_OPACITY_DEFAULT;74extern const gdouble METACITY_ACTIVE_OPACITY_DEFAULT;
74extern const gdouble METACITY_INACTIVE_OPACITY_DEFAULT;75extern const gdouble METACITY_INACTIVE_OPACITY_DEFAULT;
75extern const gboolean METACITY_ACTIVE_SHADE_OPACITY_DEFAULT;76extern const gboolean METACITY_ACTIVE_SHADE_OPACITY_DEFAULT;
@@ -88,8 +89,8 @@
88G_DECLARE_FINAL_TYPE (GWDSettings, gwd_settings, GWD, SETTINGS, GObject)89G_DECLARE_FINAL_TYPE (GWDSettings, gwd_settings, GWD, SETTINGS, GObject)
8990
90GWDSettings *91GWDSettings *
91gwd_settings_new (gint blur,92gwd_settings_new (gint blur_type,
92 const gchar *metacity_theme);93 const gchar *metacity_theme_name);
9394
94gint95gint
95gwd_settings_get_blur_type (GWDSettings *settings);96gwd_settings_get_blur_type (GWDSettings *settings);
@@ -98,7 +99,10 @@
98gwd_settings_get_metacity_button_layout (GWDSettings *settings);99gwd_settings_get_metacity_button_layout (GWDSettings *settings);
99100
100const gchar *101const gchar *
101gwd_settings_get_metacity_theme (GWDSettings *settings);102gwd_settings_get_metacity_theme_name (GWDSettings *settings);
103
104gint
105gwd_settings_get_metacity_theme_type (GWDSettings *settings);
102106
103const gchar *107const gchar *
104gwd_settings_get_titlebar_font (GWDSettings *settings);108gwd_settings_get_titlebar_font (GWDSettings *settings);
@@ -166,7 +170,8 @@
166gboolean170gboolean
167gwd_settings_metacity_theme_changed (GWDSettings *settings,171gwd_settings_metacity_theme_changed (GWDSettings *settings,
168 gboolean use_metacity_theme,172 gboolean use_metacity_theme,
169 const gchar *metacity_theme);173 gint metacity_theme_type,
174 const gchar *metacity_theme_name);
170175
171gboolean176gboolean
172gwd_settings_opacity_changed (GWDSettings *settings,177gwd_settings_opacity_changed (GWDSettings *settings,
173178
=== modified file 'gtk/window-decorator/gwd-theme-metacity.c'
--- gtk/window-decorator/gwd-theme-metacity.c 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/gwd-theme-metacity.c 2016-06-02 03:25:46 +0000
@@ -27,6 +27,7 @@
2727
28#include "config.h"28#include "config.h"
2929
30#include <metacity-private/theme.h>
30#include <metacity-private/theme-parser.h>31#include <metacity-private/theme-parser.h>
3132
32#include "gtk-window-decorator.h"33#include "gtk-window-decorator.h"
@@ -196,7 +197,7 @@
196 new_layout.right_buttons[i++] = f;197 new_layout.right_buttons[i++] = f;
197 } else {198 } else {
198 g_warning ("Ignoring unknown or already-used "199 g_warning ("Ignoring unknown or already-used "
199 "button name \"%s\"", buttons[b]);200 "button name \"%s\"", buttons[b]);
200 }201 }
201 }202 }
202203
@@ -598,13 +599,10 @@
598599
599 /* Add the invisible grab area padding */600 /* Add the invisible grab area padding */
600 {601 {
601 GdkScreen *screen;602 GdkScreen *screen = gtk_widget_get_screen (d->frame->style_window_rgba);
602 MetaStyleInfo *style_info;603 MetaStyleInfo *style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant);
603 MetaFrameBorders borders;604 MetaFrameBorders borders;
604605
605 screen = gtk_widget_get_screen (d->frame->style_window_rgba);
606 style_info = meta_theme_create_style_info (screen, d->gtk_theme_variant);
607
608 meta_theme_get_frame_borders (theme, style_info, type,606 meta_theme_get_frame_borders (theme, style_info, type,
609 d->frame->text_height,607 d->frame->text_height,
610 flags, &borders);608 flags, &borders);
@@ -686,8 +684,8 @@
686 MetaFrameGeometry *fgeom,684 MetaFrameGeometry *fgeom,
687 MetaFrameType frame_type)685 MetaFrameType frame_type)
688{686{
689 GdkScreen *screen;687 GdkScreen *screen = gtk_widget_get_screen (decor->frame->style_window_rgba);
690 MetaStyleInfo *style_info;688 MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant);
691 gint client_width;689 gint client_width;
692 gint client_height;690 gint client_height;
693691
@@ -750,9 +748,6 @@
750 else748 else
751 client_height = decor->border_layout.left.y2 - decor->border_layout.left.y1;749 client_height = decor->border_layout.left.y2 - decor->border_layout.left.y1;
752750
753 screen = gtk_widget_get_screen (decor->frame->style_window_rgba);
754 style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant);
755
756 meta_theme_calc_geometry (metacity->theme, style_info, frame_type,751 meta_theme_calc_geometry (metacity->theme, style_info, frame_type,
757 decor->frame->text_height, *flags, client_width,752 decor->frame->text_height, *flags, client_width,
758 client_height, &metacity->button_layout, fgeom);753 client_height, &metacity->button_layout, fgeom);
@@ -858,19 +853,19 @@
858setup_theme (GWDThemeMetacity *metacity)853setup_theme (GWDThemeMetacity *metacity)
859{854{
860 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));855 GWDSettings *settings = gwd_theme_get_settings (GWD_THEME (metacity));
861 const gchar *metacity_theme = gwd_settings_get_metacity_theme (settings);856 const gchar *metacity_theme_name = gwd_settings_get_metacity_theme_name (settings);
862 MetaTheme *theme;857 MetaTheme *theme;
863858
864 /* metacity_theme can be NULL only in one case - if user has disabled859 /* metacity_theme can be NULL only in one case - if user has disabled
865 * metacity theme with use-metacity-theme setting. In that case860 * metacity theme with use-metacity-theme setting. In that case
866 * GWDThemeCairo will be created / should be created.861 * GWDThemeCairo will be created / should be created.
867 */862 */
868 g_assert (metacity_theme != NULL);863 g_assert (metacity_theme_name != NULL);
869864
870 /* meta_theme_get_current returns the last good theme, so we will try to865 /* meta_theme_get_current returns the last good theme, so we will try to
871 * load theme manually to know that theme is 100% valid.866 * load theme manually to know that theme is 100% valid.
872 */867 */
873 theme = meta_theme_load (metacity_theme, NULL);868 theme = meta_theme_load (metacity_theme_name, NULL);
874 if (theme == NULL)869 if (theme == NULL)
875 return FALSE;870 return FALSE;
876871
@@ -881,7 +876,7 @@
881 meta_theme_free (theme);876 meta_theme_free (theme);
882877
883 /* If we are here then we know that this will not fail. */878 /* If we are here then we know that this will not fail. */
884 meta_theme_set_current (metacity_theme, TRUE);879 meta_theme_set_current (metacity_theme_name, TRUE);
885 metacity->theme = meta_theme_get_current ();880 metacity->theme = meta_theme_get_current ();
886881
887 return TRUE;882 return TRUE;
@@ -934,17 +929,18 @@
934{929{
935 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);930 GWDThemeMetacity *metacity = GWD_THEME_METACITY (theme);
936 GWDSettings *settings = gwd_theme_get_settings (gwd_theme);931 GWDSettings *settings = gwd_theme_get_settings (gwd_theme);
937 GdkDisplay *display;932 GdkDisplay *display = gdk_display_get_default ();
938 GdkScreen *screen;933 Display *xdisplay = gdk_x11_display_get_xdisplay (display);
939 Display *xdisplay;934 GdkScreen *screen = gtk_widget_get_screen (decor->frame->style_window_rgba);
935 MetaStyleInfo *style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant);
936 GtkWidget *style_window = decor->frame->style_window_rgba;
937 GtkStyleContext *context = gtk_widget_get_style_context (style_window);
940 cairo_surface_t *surface;938 cairo_surface_t *surface;
941 Picture src;939 Picture src;
942 MetaButtonState button_states [META_BUTTON_TYPE_LAST];940 MetaButtonState button_states [META_BUTTON_TYPE_LAST];
943 MetaFrameGeometry fgeom;941 MetaFrameGeometry fgeom;
944 MetaFrameFlags flags;942 MetaFrameFlags flags;
945 MetaFrameType frame_type;943 MetaFrameType frame_type;
946 MetaStyleInfo *style_info;
947 GtkStyleContext *context;
948 cairo_t *cr;944 cairo_t *cr;
949 gint i;945 gint i;
950 Region top_region;946 Region top_region;
@@ -954,15 +950,11 @@
954 double alpha;950 double alpha;
955 gboolean shade_alpha;951 gboolean shade_alpha;
956 MetaFrameStyle *frame_style;952 MetaFrameStyle *frame_style;
957 GtkWidget *style_window;
958 GdkRGBA bg_rgba;953 GdkRGBA bg_rgba;
959954
960 if (!decor->surface || !decor->picture)955 if (!decor->surface || !decor->picture)
961 return;956 return;
962957
963 display = gdk_display_get_default ();
964 xdisplay = gdk_x11_display_get_xdisplay (display);
965
966 top_region = NULL;958 top_region = NULL;
967 bottom_region = NULL;959 bottom_region = NULL;
968 left_region = NULL;960 left_region = NULL;
@@ -979,9 +971,6 @@
979 if (decoration_alpha == 1.0)971 if (decoration_alpha == 1.0)
980 alpha = 1.0;972 alpha = 1.0;
981973
982 style_window = decor->frame->style_window_rgba;
983 context = gtk_widget_get_style_context (style_window);
984
985 cr = cairo_create (decor->buffer_surface ? decor->buffer_surface : decor->surface);974 cr = cairo_create (decor->buffer_surface ? decor->buffer_surface : decor->surface);
986975
987 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);976 cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
@@ -1023,16 +1012,14 @@
1023 surface = create_surface (fgeom.width, fgeom.height, decor->frame->style_window_rgba);1012 surface = create_surface (fgeom.width, fgeom.height, decor->frame->style_window_rgba);
10241013
1025 cr = cairo_create (surface);1014 cr = cairo_create (surface);
1015
1026 gdk_cairo_set_source_rgba (cr, &bg_rgba);1016 gdk_cairo_set_source_rgba (cr, &bg_rgba);
1027 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);1017 cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1018 cairo_paint (cr);
10281019
1029 src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),1020 src = XRenderCreatePicture (xdisplay, cairo_xlib_surface_get_drawable (surface),
1030 xformat_rgba, 0, NULL);1021 xformat_rgba, 0, NULL);
10311022
1032 screen = gtk_widget_get_screen (decor->frame->style_window_rgba);
1033 style_info = meta_theme_create_style_info (screen, decor->gtk_theme_variant);
1034
1035 cairo_paint (cr);
1036 meta_theme_draw_frame (metacity->theme, style_info, cr, frame_type, flags,1023 meta_theme_draw_frame (metacity->theme, style_info, cr, frame_type, flags,
1037 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,1024 fgeom.width - fgeom.borders.total.left - fgeom.borders.total.right,
1038 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,1025 fgeom.height - fgeom.borders.total.top - fgeom.borders.total.bottom,
10391026
=== modified file 'gtk/window-decorator/gwd-theme-metacity.h'
--- gtk/window-decorator/gwd-theme-metacity.h 2016-05-26 07:19:33 +0000
+++ gtk/window-decorator/gwd-theme-metacity.h 2016-06-02 03:25:46 +0000
@@ -20,8 +20,6 @@
20#ifndef GWD_THEME_METACITY_H20#ifndef GWD_THEME_METACITY_H
21#define GWD_THEME_METACITY_H21#define GWD_THEME_METACITY_H
2222
23#include <metacity-private/theme.h>
24
25#include "gwd-settings.h"23#include "gwd-settings.h"
26#include "gwd-theme.h"24#include "gwd-theme.h"
2725
2826
=== modified file 'gtk/window-decorator/tests/test_gwd_settings.cpp'
--- gtk/window-decorator/tests/test_gwd_settings.cpp 2016-06-02 03:25:46 +0000
+++ gtk/window-decorator/tests/test_gwd_settings.cpp 2016-06-02 03:25:46 +0000
@@ -39,8 +39,6 @@
3939
40#include <gtest_unspecified_bool_type_matcher.h>40#include <gtest_unspecified_bool_type_matcher.h>
4141
42#include "compiz_gwd_tests.h"
43
44#include "gwd-settings.h"42#include "gwd-settings.h"
4543
46using ::testing::Eq;44using ::testing::Eq;
@@ -166,7 +164,8 @@
166 }164 }
167165
168 static void updateMetacityThemeCb (GWDSettings *settings,166 static void updateMetacityThemeCb (GWDSettings *settings,
169 const gchar *metacity_theme,167 gint metacity_theme_type,
168 const gchar *metacity_theme_name,
170 GWDMockSettingsNotifiedGMock *gmock)169 GWDMockSettingsNotifiedGMock *gmock)
171 {170 {
172 gmock->updateMetacityTheme ();171 gmock->updateMetacityTheme ();
@@ -378,9 +377,10 @@
378 EXPECT_CALL (*mGMockNotified, updateDecorations ());377 EXPECT_CALL (*mGMockNotified, updateDecorations ());
379 EXPECT_TRUE (gwd_settings_metacity_theme_changed (mSettings.get (),378 EXPECT_TRUE (gwd_settings_metacity_theme_changed (mSettings.get (),
380 testing_values::USE_METACITY_THEME_VALUE,379 testing_values::USE_METACITY_THEME_VALUE,
380 METACITY_THEME_TYPE_DEFAULT,
381 testing_values::METACITY_THEME_VALUE.c_str ()));381 testing_values::METACITY_THEME_VALUE.c_str ()));
382382
383 EXPECT_THAT (gwd_settings_get_metacity_theme (mSettings.get ()),383 EXPECT_THAT (gwd_settings_get_metacity_theme_name (mSettings.get ()),
384 IsStringsEqual (testing_values::METACITY_THEME_VALUE.c_str ()));384 IsStringsEqual (testing_values::METACITY_THEME_VALUE.c_str ()));
385}385}
386386
@@ -391,9 +391,10 @@
391 EXPECT_CALL (*mGMockNotified, updateMetacityTheme ());391 EXPECT_CALL (*mGMockNotified, updateMetacityTheme ());
392 EXPECT_CALL (*mGMockNotified, updateDecorations ());392 EXPECT_CALL (*mGMockNotified, updateDecorations ());
393 EXPECT_TRUE (gwd_settings_metacity_theme_changed (mSettings.get (), FALSE,393 EXPECT_TRUE (gwd_settings_metacity_theme_changed (mSettings.get (), FALSE,
394 METACITY_THEME_DEFAULT));394 METACITY_THEME_TYPE_DEFAULT,
395 METACITY_THEME_NAME_DEFAULT));
395396
396 EXPECT_THAT (gwd_settings_get_metacity_theme (mSettings.get ()),397 EXPECT_THAT (gwd_settings_get_metacity_theme_name (mSettings.get ()),
397 IsStringsEqual (metacityTheme));398 IsStringsEqual (metacityTheme));
398}399}
399400
@@ -401,7 +402,8 @@
401{402{
402 EXPECT_FALSE (gwd_settings_metacity_theme_changed (mSettings.get (),403 EXPECT_FALSE (gwd_settings_metacity_theme_changed (mSettings.get (),
403 testing_values::USE_METACITY_THEME_VALUE,404 testing_values::USE_METACITY_THEME_VALUE,
404 METACITY_THEME_DEFAULT));405 METACITY_THEME_TYPE_DEFAULT,
406 METACITY_THEME_NAME_DEFAULT));
405}407}
406408
407TEST_F(GWDSettingsTest, TestMetacityThemeSetCommandLine)409TEST_F(GWDSettingsTest, TestMetacityThemeSetCommandLine)
@@ -413,9 +415,10 @@
413415
414 EXPECT_FALSE (gwd_settings_metacity_theme_changed (mSettings.get (),416 EXPECT_FALSE (gwd_settings_metacity_theme_changed (mSettings.get (),
415 testing_values::USE_METACITY_THEME_VALUE,417 testing_values::USE_METACITY_THEME_VALUE,
418 METACITY_THEME_TYPE_DEFAULT,
416 testing_values::METACITY_THEME_VALUE.c_str ()));419 testing_values::METACITY_THEME_VALUE.c_str ()));
417420
418 EXPECT_THAT (gwd_settings_get_metacity_theme (mSettings.get ()),421 EXPECT_THAT (gwd_settings_get_metacity_theme_name (mSettings.get ()),
419 IsStringsEqual (metacityTheme));422 IsStringsEqual (metacityTheme));
420}423}
421424

Subscribers

People subscribed via source and target branches