diff options
author | Florian Müllner <fmuellner@gnome.org> | 2011-03-19 10:31:25 +0100 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2014-10-08 18:17:57 +0300 |
commit | 341d0945db4bea8e28df4ebf1b569bad7999fe80 (patch) | |
tree | 37a9d580ce2f357d2d65ee88edf5f8c309f4923b | |
parent | 5f9a26f1de7af633b05c7fbe656f9c845207259d (diff) | |
download | metacity-341d0945db4bea8e28df4ebf1b569bad7999fe80.tar.gz |
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 metacity.
-rw-r--r-- | src/core/atomnames.h | 1 | ||||
-rw-r--r-- | src/core/window-private.h | 1 | ||||
-rw-r--r-- | src/core/window-props.c | 29 | ||||
-rw-r--r-- | src/core/window.c | 2 |
4 files changed, 33 insertions, 0 deletions
diff --git a/src/core/atomnames.h b/src/core/atomnames.h index 43293f0c..9e20cf58 100644 --- a/src/core/atomnames.h +++ b/src/core/atomnames.h @@ -57,6 +57,7 @@ item(_METACITY_RELOAD_THEME_MESSAGE) item(_METACITY_SET_KEYBINDINGS_MESSAGE) item(_METACITY_SET_MOUSEMODS_MESSAGE) item(_METACITY_TOGGLE_VERBOSE) +item(_GTK_THEME_VARIANT) item(_GTK_FRAME_EXTENTS) item(_GNOME_PANEL_ACTION) item(_GNOME_PANEL_ACTION_MAIN_MENU) diff --git a/src/core/window-private.h b/src/core/window-private.h index 5668d92f..a98cee36 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -114,6 +114,7 @@ struct _MetaWindow char *sm_client_id; char *wm_client_machine; char *startup_id; + char *gtk_theme_variant; int net_wm_pid; diff --git a/src/core/window-props.c b/src/core/window-props.c index 505bcefa..586fb996 100644 --- a/src/core/window-props.c +++ b/src/core/window-props.c @@ -1627,6 +1627,29 @@ 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 @@ -1748,6 +1771,12 @@ meta_display_init_window_prop_hooks (MetaDisplay *display) LOAD_INIT }, { + display->atom__GTK_THEME_VARIANT, + META_PROP_VALUE_UTF8, + reload_gtk_theme_variant, + LOAD_INIT + }, + { display->atom__GTK_FRAME_EXTENTS, META_PROP_VALUE_CARDINAL_LIST, reload_gtk_frame_extents, diff --git a/src/core/window.c b/src/core/window.c index a7c7d5a6..2c829e9b 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -536,6 +536,7 @@ meta_window_new_with_attrs (MetaDisplay *display, window->sm_client_id = NULL; window->wm_client_machine = NULL; window->startup_id = NULL; + window->gtk_theme_variant = NULL; window->net_wm_pid = -1; @@ -1175,6 +1176,7 @@ meta_window_free (MetaWindow *window, g_free (window->title); g_free (window->icon_name); g_free (window->desc); + g_free (window->gtk_theme_variant); g_free (window); } |