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
This commit is contained in:
Owen W. Taylor 2011-06-08 10:01:30 -04:00
parent 7743c70d47
commit 7d43bde019
2 changed files with 39 additions and 3 deletions

View File

@ -580,6 +580,23 @@ counter_from_results (GetPropertyResults *results,
return TRUE; 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 #endif
gboolean gboolean
@ -1015,6 +1032,7 @@ meta_prop_get_values (MetaDisplay *display,
values[i].required_type = XA_WM_SIZE_HINTS; values[i].required_type = XA_WM_SIZE_HINTS;
break; break;
case META_PROP_VALUE_SYNC_COUNTER: case META_PROP_VALUE_SYNC_COUNTER:
case META_PROP_VALUE_SYNC_COUNTER_LIST:
values[i].required_type = XA_CARDINAL; values[i].required_type = XA_CARDINAL;
break; break;
} }
@ -1165,20 +1183,29 @@ meta_prop_get_values (MetaDisplay *display,
&values[i].v.size_hints.flags)) &values[i].v.size_hints.flags))
values[i].type = META_PROP_VALUE_INVALID; values[i].type = META_PROP_VALUE_INVALID;
break; break;
case META_PROP_VALUE_SYNC_COUNTER:
#ifdef HAVE_XSYNC #ifdef HAVE_XSYNC
case META_PROP_VALUE_SYNC_COUNTER:
if (!counter_from_results (&results, if (!counter_from_results (&results,
&values[i].v.xcounter)) &values[i].v.xcounter))
values[i].type = META_PROP_VALUE_INVALID; 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 #else
case META_PROP_VALUE_SYNC_COUNTER:
case META_PROP_VALUE_SYNC_COUNTER_LIST:
values[i].type = META_PROP_VALUE_INVALID; values[i].type = META_PROP_VALUE_INVALID;
if (results.prop) if (results.prop)
{ {
XFree (results.prop); XFree (results.prop);
results.prop = NULL; results.prop = NULL;
} }
#endif
break; break;
#endif
} }
next: next:
@ -1231,6 +1258,9 @@ free_value (MetaPropValue *value)
break; break;
case META_PROP_VALUE_SYNC_COUNTER: case META_PROP_VALUE_SYNC_COUNTER:
break; break;
case META_PROP_VALUE_SYNC_COUNTER_LIST:
meta_XFree (value->v.xcounter_list.counters);
break;
} }
} }

View File

@ -157,7 +157,8 @@ typedef enum
META_PROP_VALUE_WM_HINTS, META_PROP_VALUE_WM_HINTS,
META_PROP_VALUE_CLASS_HINT, META_PROP_VALUE_CLASS_HINT,
META_PROP_VALUE_SIZE_HINTS, 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; } MetaPropValueType;
/* used to request/return/store property values */ /* used to request/return/store property values */
@ -177,6 +178,11 @@ typedef struct
XClassHint class_hint; XClassHint class_hint;
#ifdef HAVE_XSYNC #ifdef HAVE_XSYNC
XSyncCounter xcounter; XSyncCounter xcounter;
struct
{
gulong *counters;
int n_counters;
} xcounter_list;
#endif #endif
struct struct