Commit 7d43bde0 authored by Owen W. Taylor's avatar Owen W. Taylor
Browse files

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
parent 7743c70d
......@@ -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;
}
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment