[mutter] window: Add wm-class property and notify it when changed.



commit 64f37a3769952d93829a014b282425df1477591b
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Mar 3 04:01:04 2011 -0500

    window: Add wm-class property and notify it when changed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=649315

 src/core/window-props.c |    2 ++
 src/core/window.c       |   14 +++++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 7affb96..94b5a94 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -845,6 +845,8 @@ reload_wm_class (MetaWindow    *window,
 
       if (value->v.class_hint.res_class)
         window->res_class = g_strdup (value->v.class_hint.res_class);
+
+      g_object_notify (G_OBJECT (window), "wm-class");
     }
 
   meta_verbose ("Window %s class: '%s' name: '%s'\n",
diff --git a/src/core/window.c b/src/core/window.c
index 471070a..97cbb73 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -155,7 +155,8 @@ enum {
   PROP_DEMANDS_ATTENTION,
   PROP_URGENT,
   PROP_MUTTER_HINTS,
-  PROP_APPEARS_FOCUSED
+  PROP_APPEARS_FOCUSED,
+  PROP_WM_CLASS
 };
 
 enum
@@ -247,6 +248,9 @@ meta_window_get_property(GObject         *object,
     case PROP_APPEARS_FOCUSED:
       g_value_set_boolean (value, meta_window_appears_focused (win));
       break;
+    case PROP_WM_CLASS:
+      g_value_set_string (value, win->res_class);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -382,6 +386,14 @@ meta_window_class_init (MetaWindowClass *klass)
                                                          FALSE,
                                                          G_PARAM_READABLE));
 
+  g_object_class_install_property (object_class,
+                                   PROP_WM_CLASS,
+                                   g_param_spec_string ("wm-class",
+                                                        "WM_CLASS",
+                                                        "Contents of the WM_CLASS property of this window",
+                                                        NULL,
+                                                        G_PARAM_READABLE));
+
   window_signals[WORKSPACE_CHANGED] =
     g_signal_new ("workspace-changed",
                   G_TYPE_FROM_CLASS (object_class),



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