[metacity] support properties with lists of XSyncCounter



commit f08aacbb60a60ad59ca98bc90b444008a39a6955
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jun 8 10:01:30 2011 -0400

    support properties with lists of XSyncCounter
    
    Add META_PROP_VALUE_SYNC_COUNTER_LIST for a property that contains
    multiple XSyncCounter values.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685463

 src/core/xprops.c    |   25 +++++++++++++++++++++++++
 src/include/xprops.h |    9 ++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/src/core/xprops.c b/src/core/xprops.c
index 81267fe..ae45f5f 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -578,6 +578,21 @@ counter_from_results (GetPropertyResults *results,
   return TRUE;
 }
 
+static gboolean
+counter_list_from_results (GetPropertyResults  *results,
+                           XSyncCounter       **counters_p,
+                           int                 *n_counters_p)
+{
+  if (!validate_or_free_results (results, 32, XA_CARDINAL, FALSE))
+    return FALSE;
+
+  *counters_p = (XSyncCounter*) results->prop;
+  *n_counters_p = results->n_items;
+  results->prop = NULL;
+
+  return TRUE;
+}
+
 gboolean
 meta_prop_get_window (MetaDisplay *display,
                       Window       xwindow,
@@ -1033,6 +1048,7 @@ meta_prop_get_values (MetaDisplay   *display,
               values[i].required_type = XA_WM_SIZE_HINTS;
               break;
             case META_PROP_VALUE_SYNC_COUNTER:
+            case META_PROP_VALUE_SYNC_COUNTER_LIST:
               values[i].required_type = XA_CARDINAL;
               break;
             default:
@@ -1190,6 +1206,12 @@ meta_prop_get_values (MetaDisplay   *display,
                                      &values[i].v.xcounter))
             values[i].type = META_PROP_VALUE_INVALID;
           break;
+        case META_PROP_VALUE_SYNC_COUNTER_LIST:
+          if (!counter_list_from_results (&results,
+                                          &values[i].v.xcounter_list.counters,
+                                          &values[i].v.xcounter_list.n_counters))
+            values[i].type = META_PROP_VALUE_INVALID;
+          break;
         default:
           break;
         }
@@ -1244,6 +1266,9 @@ free_value (MetaPropValue *value)
       break;
     case META_PROP_VALUE_SYNC_COUNTER:
       break;
+    case META_PROP_VALUE_SYNC_COUNTER_LIST:
+      meta_XFree (value->v.xcounter_list.counters);
+      break;
     default:
       break;
     }
diff --git a/src/include/xprops.h b/src/include/xprops.h
index e037325..3e6c731 100644
--- a/src/include/xprops.h
+++ b/src/include/xprops.h
@@ -153,7 +153,8 @@ typedef enum
   META_PROP_VALUE_WM_HINTS,
   META_PROP_VALUE_CLASS_HINT,
   META_PROP_VALUE_SIZE_HINTS,
-  META_PROP_VALUE_SYNC_COUNTER /* comes back as CARDINAL */
+  META_PROP_VALUE_SYNC_COUNTER, /* comes back as CARDINAL */
+  META_PROP_VALUE_SYNC_COUNTER_LIST /* comes back as CARDINAL */
 } MetaPropValueType;
 
 /* used to request/return/store property values */
@@ -175,6 +176,12 @@ typedef struct
 
     struct
     {
+      gulong *counters;
+      int     n_counters;
+    } xcounter_list;
+
+    struct
+    {
       XSizeHints   *hints;
       unsigned long flags;
     } size_hints;


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