[mutter/wip/frame-synchronization: 4/8] Support properties with lists of XSyncCounter



commit b7829479056f64b39d01c86fa40a5ff91459c102
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.

 src/core/xprops.c |   34 ++++++++++++++++++++++++++++++++--
 src/core/xprops.h |    8 +++++++-
 2 files changed, 39 insertions(+), 3 deletions(-)
---
diff --git a/src/core/xprops.c b/src/core/xprops.c
index afff775..ac31659 100644
--- a/src/core/xprops.c
+++ b/src/core/xprops.c
@@ -580,6 +580,23 @@ 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;
+}
 #endif
 
 gboolean
@@ -1015,6 +1032,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;
             }
@@ -1165,20 +1183,29 @@ meta_prop_get_values (MetaDisplay   *display,
                                         &values[i].v.size_hints.flags))
             values[i].type = META_PROP_VALUE_INVALID;
           break;
-        case META_PROP_VALUE_SYNC_COUNTER:
 #ifdef HAVE_XSYNC
+        case META_PROP_VALUE_SYNC_COUNTER:
           if (!counter_from_results (&results,
                                      &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;
 #else
+        case META_PROP_VALUE_SYNC_COUNTER:
+        case META_PROP_VALUE_SYNC_COUNTER_LIST:
           values[i].type = META_PROP_VALUE_INVALID;
           if (results.prop)
             {
               XFree (results.prop);
               results.prop = NULL;
             }
-#endif
           break;
+#endif
         }
 
     next:
@@ -1231,6 +1258,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;
     }
 }
 
diff --git a/src/core/xprops.h b/src/core/xprops.h
index 928e46b..5a799f8 100644
--- a/src/core/xprops.h
+++ b/src/core/xprops.h
@@ -157,7 +157,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 */
@@ -177,6 +178,11 @@ typedef struct
     XClassHint class_hint;
 #ifdef HAVE_XSYNC
     XSyncCounter xcounter;
+    struct
+    {
+      gulong *counters;
+      int     n_counters;
+    } xcounter_list;
 #endif
     
     struct



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