forked from AuroraMiddleware/gtk
device: Make axis label a regular string
Atoms are about to die.
This commit is contained in:
parent
b1f11464b6
commit
52b1a46549
@ -46,7 +46,7 @@ typedef struct _GdkAxisInfo GdkAxisInfo;
|
|||||||
|
|
||||||
struct _GdkAxisInfo
|
struct _GdkAxisInfo
|
||||||
{
|
{
|
||||||
GdkAtom label;
|
char *label;
|
||||||
GdkAxisUse use;
|
GdkAxisUse use;
|
||||||
|
|
||||||
gdouble min_axis;
|
gdouble min_axis;
|
||||||
@ -355,10 +355,19 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
|||||||
G_TYPE_NONE, 1, GDK_TYPE_DEVICE_TOOL);
|
G_TYPE_NONE, 1, GDK_TYPE_DEVICE_TOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdk_device_axis_info_clear (gpointer data)
|
||||||
|
{
|
||||||
|
GdkAxisInfo *info = data;
|
||||||
|
|
||||||
|
g_free (info->label);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_device_init (GdkDevice *device)
|
gdk_device_init (GdkDevice *device)
|
||||||
{
|
{
|
||||||
device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
|
device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
|
||||||
|
g_array_set_clear_func (device->axes, gdk_device_axis_info_clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1218,7 +1227,7 @@ gdk_device_get_n_axes (GdkDevice *device)
|
|||||||
* the axes that @device currently has.
|
* the axes that @device currently has.
|
||||||
*
|
*
|
||||||
* Returns: (transfer container) (element-type GdkAtom):
|
* Returns: (transfer container) (element-type GdkAtom):
|
||||||
* A #GList of #GdkAtoms, free with g_list_free().
|
* A #GList of strings, free with g_list_free().
|
||||||
*
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
@ -1246,7 +1255,7 @@ gdk_device_list_axes (GdkDevice *device)
|
|||||||
* gdk_device_get_axis_value: (skip)
|
* gdk_device_get_axis_value: (skip)
|
||||||
* @device: a pointer #GdkDevice.
|
* @device: a pointer #GdkDevice.
|
||||||
* @axes: (array): pointer to an array of axes
|
* @axes: (array): pointer to an array of axes
|
||||||
* @axis_label: #GdkAtom with the axis label.
|
* @axis_label: name of the label
|
||||||
* @value: (out): location to store the found value.
|
* @value: (out): location to store the found value.
|
||||||
*
|
*
|
||||||
* Interprets an array of double as axis values for a given device,
|
* Interprets an array of double as axis values for a given device,
|
||||||
@ -1258,10 +1267,10 @@ gdk_device_list_axes (GdkDevice *device)
|
|||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gdk_device_get_axis_value (GdkDevice *device,
|
gdk_device_get_axis_value (GdkDevice *device,
|
||||||
gdouble *axes,
|
gdouble *axes,
|
||||||
GdkAtom axis_label,
|
const char *axis_label,
|
||||||
gdouble *value)
|
gdouble *value)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
@ -1277,7 +1286,7 @@ gdk_device_get_axis_value (GdkDevice *device,
|
|||||||
|
|
||||||
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
|
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
|
||||||
|
|
||||||
if (axis_info.label != axis_label)
|
if (!g_str_equal (axis_info.label, axis_label))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
@ -1522,7 +1531,7 @@ _gdk_device_reset_axes (GdkDevice *device)
|
|||||||
|
|
||||||
guint
|
guint
|
||||||
_gdk_device_add_axis (GdkDevice *device,
|
_gdk_device_add_axis (GdkDevice *device,
|
||||||
GdkAtom label_atom,
|
const char *label_name,
|
||||||
GdkAxisUse use,
|
GdkAxisUse use,
|
||||||
gdouble min_value,
|
gdouble min_value,
|
||||||
gdouble max_value,
|
gdouble max_value,
|
||||||
@ -1532,7 +1541,7 @@ _gdk_device_add_axis (GdkDevice *device,
|
|||||||
guint pos;
|
guint pos;
|
||||||
|
|
||||||
axis_info.use = use;
|
axis_info.use = use;
|
||||||
axis_info.label = label_atom;
|
axis_info.label = g_strdup (label_name);
|
||||||
axis_info.min_value = min_value;
|
axis_info.min_value = min_value;
|
||||||
axis_info.max_value = max_value;
|
axis_info.max_value = max_value;
|
||||||
axis_info.resolution = resolution;
|
axis_info.resolution = resolution;
|
||||||
@ -1569,7 +1578,7 @@ _gdk_device_add_axis (GdkDevice *device,
|
|||||||
void
|
void
|
||||||
_gdk_device_get_axis_info (GdkDevice *device,
|
_gdk_device_get_axis_info (GdkDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
GdkAtom *label_atom,
|
const char **label_name,
|
||||||
GdkAxisUse *use,
|
GdkAxisUse *use,
|
||||||
gdouble *min_value,
|
gdouble *min_value,
|
||||||
gdouble *max_value,
|
gdouble *max_value,
|
||||||
@ -1582,7 +1591,7 @@ _gdk_device_get_axis_info (GdkDevice *device,
|
|||||||
|
|
||||||
info = &g_array_index (device->axes, GdkAxisInfo, index_);
|
info = &g_array_index (device->axes, GdkAxisInfo, index_);
|
||||||
|
|
||||||
*label_atom = info->label;
|
*label_name = info->label;
|
||||||
*use = info->use;
|
*use = info->use;
|
||||||
*min_value = info->min_value;
|
*min_value = info->min_value;
|
||||||
*max_value = info->max_value;
|
*max_value = info->max_value;
|
||||||
|
Loading…
Reference in New Issue
Block a user