diff options
author | Victor Kareh <[email protected]> | 2019-05-21 13:37:01 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-06-16 18:12:44 +0200 |
commit | 73f74047e14e0942c403ea59284ace877680bbf9 (patch) | |
tree | b5671be24fea58cf95ddc886d4c176d8e7612fcf /src/core/window-props.c | |
parent | 860f7a6dbc81272c561a1b8d045e5ff61ea0e66a (diff) | |
download | marco-73f74047e14e0942c403ea59284ace877680bbf9.tar.bz2 marco-73f74047e14e0942c403ea59284ace877680bbf9.tar.xz |
window: Parse _GTK_THEME_VARIANT property
Since version 3.0, GTK+ has support for style variants. At the moment,
themes may provide a dark variant, which can be requested by
applications via GtkSettings. The requested variant is exported to
X11 via the _GTK_THEME_VARIANT property - support this property, in
order to pick up the correct style variant in the future.
https://bugzilla.gnome.org/show_bug.cgi?id=645355
NOTE: Patch is adapted for marco.
upstream commit:
https://gitlab.gnome.org/GNOME/metacity/commit/341d0945
Diffstat (limited to 'src/core/window-props.c')
-rw-r--r-- | src/core/window-props.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/window-props.c b/src/core/window-props.c index c3200290..0f492a5e 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1530,6 +1530,28 @@ reload_transient_for (MetaWindow *window, meta_window_queue (window, META_QUEUE_MOVE_RESIZE); } +static void +reload_gtk_theme_variant (MetaWindow *window, + MetaPropValue *value, + gboolean initial) +{ + char *requested_variant = NULL; + char *current_variant = window->gtk_theme_variant; + + if (value->type != META_PROP_VALUE_INVALID) + { + requested_variant = value->v.str; + meta_verbose ("Requested \"%s\" theme variant for window %s.\n", + requested_variant, window->desc); + } + + if (g_strcmp0 (requested_variant, current_variant) != 0) + { + g_free (current_variant); + + window->gtk_theme_variant = g_strdup (requested_variant); + } +} /** * Initialises the property hooks system. Each row in the table named "hooks" * represents an action to take when a property is found on a newly-created @@ -1576,6 +1598,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) { XA_WM_HINTS, META_PROP_VALUE_WM_HINTS, reload_wm_hints }, { XA_WM_TRANSIENT_FOR, META_PROP_VALUE_WINDOW, reload_transient_for }, { display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window }, + { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8, reload_gtk_theme_variant, }, { display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST, reload_gtk_frame_extents }, { 0 }, }; |