From 7d43bde019d8f1217001e8e507d49baa003b4748 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 8 Jun 2011 10:01:30 -0400 Subject: [PATCH] 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 | 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 afff775db..ac3165932 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 928e46be9..5a799f80c 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