[mutter] window: Parse _GTK_THEME_VARIANT property



commit 4f3b03e13b9916728d621ebde8f4eb56cb15563b
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

 src/core/window-private.h |    1 +
 src/core/window-props.c   |   27 +++++++++++++++++++++++++++
 src/core/window.c         |    1 +
 src/meta/atomnames.h      |    1 +
 4 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 7909943..3f7d882 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -99,6 +99,7 @@ struct _MetaWindow
   char *wm_client_machine;
   char *startup_id;
   char *mutter_hints;
+  char *gtk_theme_variant;
 
   int net_wm_pid;
   
diff --git a/src/core/window-props.c b/src/core/window-props.c
index ccea6b3..3ea5336 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -1517,6 +1517,32 @@ reload_transient_for (MetaWindow    *window,
     meta_window_propagate_focus_appearance (window, TRUE);
 }
 
+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))
+    {
+      g_free (current_variant);
+
+      if (requested_variant)
+        window->gtk_theme_variant = g_strdup (requested_variant);
+      else
+        window->gtk_theme_variant = NULL;
+    }
+}
+
 /**
  * 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
@@ -1569,6 +1595,7 @@ meta_display_init_window_prop_hooks (MetaDisplay *display)
     { display->atom__NET_WM_STATE,     META_PROP_VALUE_ATOM_LIST, reload_net_wm_state,     TRUE,  FALSE },
     { display->atom__MOTIF_WM_HINTS,   META_PROP_VALUE_MOTIF_HINTS, reload_mwm_hints,      TRUE,  FALSE },
     { XA_WM_TRANSIENT_FOR,             META_PROP_VALUE_WINDOW,    reload_transient_for,    TRUE,  FALSE },
+    { display->atom__GTK_THEME_VARIANT, META_PROP_VALUE_UTF8,     reload_gtk_theme_variant, TRUE, FALSE },
     { display->atom__NET_WM_USER_TIME_WINDOW, META_PROP_VALUE_WINDOW, reload_net_wm_user_time_window, TRUE, FALSE },
     { display->atom_WM_STATE,          META_PROP_VALUE_INVALID,  NULL,                     FALSE, FALSE },
     { display->atom__NET_WM_ICON,      META_PROP_VALUE_INVALID,  reload_net_wm_icon,       FALSE, FALSE },
diff --git a/src/core/window.c b/src/core/window.c
index 1540c28..471070a 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -195,6 +195,7 @@ meta_window_finalize (GObject *object)
   g_free (window->title);
   g_free (window->icon_name);
   g_free (window->desc);
+  g_free (window->gtk_theme_variant);
 }
 
 static void
diff --git a/src/meta/atomnames.h b/src/meta/atomnames.h
index 0120496..bcdbd40 100644
--- a/src/meta/atomnames.h
+++ b/src/meta/atomnames.h
@@ -58,6 +58,7 @@ item(_MUTTER_RELOAD_THEME_MESSAGE)
 item(_MUTTER_SET_KEYBINDINGS_MESSAGE)
 item(_MUTTER_TOGGLE_VERBOSE)
 item(_MUTTER_HINTS)
+item(_GTK_THEME_VARIANT)
 item(_GNOME_WM_KEYBINDINGS)
 item(_GNOME_PANEL_ACTION)
 item(_GNOME_PANEL_ACTION_MAIN_MENU)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]