[metacity] window: Parse _GTK_THEME_VARIANT property
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] window: Parse _GTK_THEME_VARIANT property
- Date: Wed, 8 Oct 2014 18:30:18 +0000 (UTC)
commit 341d0945db4bea8e28df4ebf1b569bad7999fe80
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Mar 19 10:31:25 2011 +0100
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.
src/core/atomnames.h | 1 +
src/core/window-private.h | 1 +
src/core/window-props.c | 29 +++++++++++++++++++++++++++++
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 43293f0..9e20cf5 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 5668d92..a98cee3 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 505bcef..586fb99 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 a7c7d5a..2c829e9 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]