[mutter] Fix property notifications for certain properties



commit d810315884ab40758e785df90824b0e97b07dc77
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Jun 15 13:24:43 2009 -0400

    Fix property notifications for certain properties
    
    If a property has a reload function, but the standard property-fetching
    mechanism isn't used (hooks->type == META_PROP_VALUE_INVALID), then the
    a logic error (introduced in January) caused the hook to never be run.
    
    This meant that changes to struts and icons weren't noticed.
    
    Same as: http://bugzilla.gnome.org/show_bug.cgi?id=572573
    The fix here is different in detail from that applied to Metacity, but
    similar in spirit.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=585980

 src/core/window-props.c |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/core/window-props.c b/src/core/window-props.c
index 716c3aa..2b99494 100644
--- a/src/core/window-props.c
+++ b/src/core/window-props.c
@@ -63,12 +63,13 @@ typedef struct MetaWindowPropHooks
   ReloadValueFunc reload_func;
 } MetaWindowPropHooks;
 
-static void init_prop_value            (MetaDisplay   *display,
-                                        Atom           property,
-                                        MetaPropValue *value);
-static void reload_prop_value          (MetaWindow    *window,
-                                        MetaPropValue *value,
-                                        gboolean       initial);
+static void init_prop_value            (MetaDisplay         *display,
+                                        MetaWindowPropHooks *hooks,
+                                        MetaPropValue       *value);
+static void reload_prop_value          (MetaWindow          *window,
+                                        MetaWindowPropHooks *hooks,
+                                        MetaPropValue       *value,
+                                        gboolean             initial);
 static MetaWindowPropHooks* find_hooks (MetaDisplay *display,
                                         Atom         property);
 
@@ -122,7 +123,8 @@ meta_window_reload_properties_from_xwindow (MetaWindow *window,
   i = 0;
   while (i < n_properties)
     {
-      init_prop_value (window->display, properties[i], &values[i]);
+      MetaWindowPropHooks *hooks = find_hooks (window->display, properties[i]);
+      init_prop_value (window->display, hooks, &values[i]);
       ++i;
     }
   
@@ -132,7 +134,8 @@ meta_window_reload_properties_from_xwindow (MetaWindow *window,
   i = 0;
   while (i < n_properties)
     {
-      reload_prop_value (window, &values[i], initial);
+      MetaWindowPropHooks *hooks = find_hooks (window->display, properties[i]);
+      reload_prop_value (window, hooks, &values[i], initial);
       
       ++i;
     }
@@ -144,31 +147,28 @@ meta_window_reload_properties_from_xwindow (MetaWindow *window,
 
 /* Fill in the MetaPropValue used to get the value of "property" */
 static void
-init_prop_value (MetaDisplay   *display,
-                 Atom           property,
-                 MetaPropValue *value)
+init_prop_value (MetaDisplay         *display,
+                 MetaWindowPropHooks *hooks,
+                 MetaPropValue       *value)
 {
-  MetaWindowPropHooks *hooks = find_hooks (display, property);
-
   if (!hooks || hooks->type == META_PROP_VALUE_INVALID)
     {
-  value->type = META_PROP_VALUE_INVALID;
-  value->atom = None;
+      value->type = META_PROP_VALUE_INVALID;
+      value->atom = None;
     }
   else
     {
       value->type = hooks->type;
-      value->atom = property;
+      value->atom = hooks->property;
     }
 }
 
 static void
-reload_prop_value (MetaWindow    *window,
-                   MetaPropValue *value,
-                   gboolean       initial)
+reload_prop_value (MetaWindow          *window,
+                   MetaWindowPropHooks *hooks,
+                   MetaPropValue       *value,
+                   gboolean             initial)
 {
-  MetaWindowPropHooks *hooks = find_hooks (window->display, value->atom);
-  
   if (hooks && hooks->reload_func != NULL)
     (* hooks->reload_func) (window, value, initial);
 }



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