Merge branch 'device-cleanup' into 'master'

Device cleanup

See merge request GNOME/gtk!2068
This commit is contained in:
Matthias Clasen 2020-06-10 13:06:13 +00:00
commit bdd6ae3252
10 changed files with 48 additions and 321 deletions

View File

@ -357,9 +357,6 @@ gdk_device_get_name
gdk_device_get_vendor_id gdk_device_get_vendor_id
gdk_device_get_product_id gdk_device_get_product_id
gdk_device_get_source gdk_device_get_source
gdk_device_set_key
gdk_device_get_key
gdk_device_set_axis_use
gdk_device_get_axis_use gdk_device_get_axis_use
gdk_device_get_associated_device gdk_device_get_associated_device
gdk_device_list_slave_devices gdk_device_list_slave_devices
@ -367,7 +364,6 @@ gdk_device_get_device_type
gdk_device_get_display gdk_device_get_display
gdk_device_get_has_cursor gdk_device_get_has_cursor
gdk_device_get_n_axes gdk_device_get_n_axes
gdk_device_get_n_keys
gdk_device_get_axes gdk_device_get_axes
gdk_device_get_seat gdk_device_get_seat
gdk_device_get_num_touches gdk_device_get_num_touches

View File

@ -73,8 +73,8 @@ gdk_broadway_device_init (GdkBroadwayDevice *device_core)
device = GDK_DEVICE (device_core); device = GDK_DEVICE (device_core);
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
} }
static void static void

View File

@ -51,9 +51,7 @@ typedef struct _GdkAxisInfo GdkAxisInfo;
struct _GdkAxisInfo struct _GdkAxisInfo
{ {
char *label;
GdkAxisUse use; GdkAxisUse use;
gdouble min_axis; gdouble min_axis;
gdouble max_axis; gdouble max_axis;
gdouble min_value; gdouble min_value;
@ -366,19 +364,10 @@ 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
@ -393,7 +382,6 @@ gdk_device_finalize (GObject *object)
} }
g_clear_pointer (&device->name, g_free); g_clear_pointer (&device->name, g_free);
g_clear_pointer (&device->keys, g_free);
g_clear_pointer (&device->vendor_id, g_free); g_clear_pointer (&device->vendor_id, g_free);
g_clear_pointer (&device->product_id, g_free); g_clear_pointer (&device->product_id, g_free);
@ -684,79 +672,6 @@ gdk_device_get_source (GdkDevice *device)
return device->source; return device->source;
} }
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
*
* Returns the number of keys the device currently has.
*
* Returns: the number of keys.
**/
gint
gdk_device_get_n_keys (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->num_keys;
}
/**
* gdk_device_get_key:
* @device: a #GdkDevice.
* @index_: the index of the macro button to get.
* @keyval: (out): return value for the keyval.
* @modifiers: (out): return value for modifiers.
*
* If @index_ has a valid keyval, this function will return %TRUE
* and fill in @keyval and @modifiers with the keyval settings.
*
* Returns: %TRUE if keyval is set for @index.
**/
gboolean
gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
GdkModifierType *modifiers)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (index_ < device->num_keys, FALSE);
if (!device->keys[index_].keyval &&
!device->keys[index_].modifiers)
return FALSE;
if (keyval)
*keyval = device->keys[index_].keyval;
if (modifiers)
*modifiers = device->keys[index_].modifiers;
return TRUE;
}
/**
* gdk_device_set_key:
* @device: a #GdkDevice
* @index_: the index of the macro button to set
* @keyval: the keyval to generate
* @modifiers: the modifiers to set
*
* Specifies the X key event to generate when a macro button of a device
* is pressed.
**/
void
gdk_device_set_key (GdkDevice *device,
guint index_,
guint keyval,
GdkModifierType modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (index_ < device->num_keys);
device->keys[index_].keyval = keyval;
device->keys[index_].modifiers = modifiers;
}
/** /**
* gdk_device_get_axis_use: * gdk_device_get_axis_use:
* @device: a pointer #GdkDevice. * @device: a pointer #GdkDevice.
@ -781,47 +696,6 @@ gdk_device_get_axis_use (GdkDevice *device,
return info->use; return info->use;
} }
/**
* gdk_device_set_axis_use:
* @device: a pointer #GdkDevice
* @index_: the index of the axis
* @use: specifies how the axis is used
*
* Specifies how an axis of a device is used.
**/
void
gdk_device_set_axis_use (GdkDevice *device,
guint index_,
GdkAxisUse use)
{
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (index_ < device->axes->len);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
info->use = use;
switch ((guint) use)
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
info->min_axis = 0;
info->max_axis = 0;
break;
case GDK_AXIS_XTILT:
case GDK_AXIS_YTILT:
info->min_axis = -1;
info->max_axis = 1;
break;
default:
info->min_axis = 0;
info->max_axis = 1;
break;
}
}
/** /**
* gdk_device_get_display: * gdk_device_get_display:
* @device: a #GdkDevice * @device: a #GdkDevice
@ -987,89 +861,6 @@ gdk_device_get_n_axes (GdkDevice *device)
return device->axes->len; return device->axes->len;
} }
/**
* gdk_device_get_axis_names:
* @device: a #GdkDevice
*
* Returns a null-terminated array of strings, containing the labels for
* the axes that @device currently has.
* If the device has no axes, %NULL is returned.
*
* Returns: (nullable) (transfer full): A null-terminated string array,
* free with g_strfreev().
**/
char **
gdk_device_get_axis_names (GdkDevice *device)
{
GPtrArray *axes;
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
if (device->axes->len == 0)
return NULL;
axes = g_ptr_array_new ();
for (i = 0; i < device->axes->len; i++)
{
GdkAxisInfo axis_info;
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
g_ptr_array_add (axes, g_strdup (axis_info.label));
}
g_ptr_array_add (axes, NULL);
return (char **) g_ptr_array_free (axes, FALSE);
}
/**
* gdk_device_get_axis_value: (skip)
* @device: a pointer #GdkDevice.
* @axes: (array): pointer to an array of axes
* @axis_label: name of the label
* @value: (out): location to store the found value.
*
* Interprets an array of double as axis values for a given device,
* and locates the value in the array for a given axis label, as returned
* by gdk_device_get_axes()
*
* Returns: %TRUE if the given axis use was found, otherwise %FALSE.
**/
gboolean
gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes,
const char *axis_label,
gdouble *value)
{
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
for (i = 0; i < device->axes->len; i++)
{
GdkAxisInfo axis_info;
axis_info = g_array_index (device->axes, GdkAxisInfo, i);
if (!g_str_equal (axis_info.label, axis_label))
continue;
if (value)
*value = axes[i];
return TRUE;
}
return FALSE;
}
/** /**
* gdk_device_get_axis: (skip) * gdk_device_get_axis: (skip)
* @device: a #GdkDevice * @device: a #GdkDevice
@ -1206,7 +997,6 @@ _gdk_device_reset_axes (GdkDevice *device)
guint guint
_gdk_device_add_axis (GdkDevice *device, _gdk_device_add_axis (GdkDevice *device,
const char *label_name,
GdkAxisUse use, GdkAxisUse use,
gdouble min_value, gdouble min_value,
gdouble max_value, gdouble max_value,
@ -1216,7 +1006,6 @@ _gdk_device_add_axis (GdkDevice *device,
guint pos; guint pos;
axis_info.use = use; axis_info.use = use;
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;
@ -1252,12 +1041,11 @@ _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_,
const char **label_name, GdkAxisUse *use,
GdkAxisUse *use, gdouble *min_value,
gdouble *min_value, gdouble *max_value,
gdouble *max_value, gdouble *resolution)
gdouble *resolution)
{ {
GdkAxisInfo *info; GdkAxisInfo *info;
@ -1266,23 +1054,12 @@ _gdk_device_get_axis_info (GdkDevice *device,
info = &g_array_index (device->axes, GdkAxisInfo, index_); info = &g_array_index (device->axes, GdkAxisInfo, index_);
*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;
*resolution = info->resolution; *resolution = info->resolution;
} }
void
_gdk_device_set_keys (GdkDevice *device,
guint num_keys)
{
g_free (device->keys);
device->num_keys = num_keys;
device->keys = g_new0 (GdkDeviceKey, num_keys);
}
static GdkAxisInfo * static GdkAxisInfo *
find_axis_info (GArray *array, find_axis_info (GArray *array,
GdkAxisUse use) GdkAxisUse use)
@ -1303,10 +1080,10 @@ find_axis_info (GArray *array,
gboolean gboolean
_gdk_device_translate_surface_coord (GdkDevice *device, _gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,
guint index_, guint index_,
gdouble value, gdouble value,
gdouble *axis_value) gdouble *axis_value)
{ {
GdkAxisInfo axis_info; GdkAxisInfo axis_info;
GdkAxisInfo *axis_info_x, *axis_info_y; GdkAxisInfo *axis_info_x, *axis_info_y;

View File

@ -115,26 +115,9 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device); GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
GdkModifierType *modifiers);
GDK_AVAILABLE_IN_ALL
void gdk_device_set_key (GdkDevice *device,
guint index_,
guint keyval,
GdkModifierType modifiers);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device, GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_); guint index_);
GDK_AVAILABLE_IN_ALL
void gdk_device_set_axis_use (GdkDevice *device,
guint index_,
GdkAxisUse use);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
@ -150,11 +133,8 @@ GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_axes (GdkDevice *device); gint gdk_device_get_n_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
char ** gdk_device_get_axis_names (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_axis_value (GdkDevice *device, gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes, gdouble *axes,
const char *axis_label,
gdouble *value); gdouble *value);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@ -31,13 +31,6 @@ G_BEGIN_DECLS
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass)) #define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
typedef struct _GdkDeviceClass GdkDeviceClass; typedef struct _GdkDeviceClass GdkDeviceClass;
typedef struct _GdkDeviceKey GdkDeviceKey;
struct _GdkDeviceKey
{
guint keyval;
GdkModifierType modifiers;
};
struct _GdkDevice struct _GdkDevice
{ {
@ -46,9 +39,7 @@ struct _GdkDevice
gchar *name; gchar *name;
GdkInputSource source; GdkInputSource source;
gboolean has_cursor; gboolean has_cursor;
gint num_keys;
GdkAxisFlags axis_flags; GdkAxisFlags axis_flags;
GdkDeviceKey *keys;
GdkDisplay *display; GdkDisplay *display;
/* Paired master for master, /* Paired master for master,
* associated master for slaves * associated master for slaves
@ -106,21 +97,16 @@ void _gdk_device_set_associated_device (GdkDevice *device,
void _gdk_device_reset_axes (GdkDevice *device); void _gdk_device_reset_axes (GdkDevice *device);
guint _gdk_device_add_axis (GdkDevice *device, guint _gdk_device_add_axis (GdkDevice *device,
const char *label_atom,
GdkAxisUse use, GdkAxisUse use,
gdouble min_value, gdouble min_value,
gdouble max_value, gdouble max_value,
gdouble resolution); gdouble resolution);
void _gdk_device_get_axis_info (GdkDevice *device, void _gdk_device_get_axis_info (GdkDevice *device,
guint index, guint index,
const char**label_atom, GdkAxisUse *use,
GdkAxisUse *use, gdouble *min_value,
gdouble *min_value, gdouble *max_value,
gdouble *max_value, gdouble *resolution);
gdouble *resolution);
void _gdk_device_set_keys (GdkDevice *device,
guint num_keys);
gboolean _gdk_device_translate_surface_coord (GdkDevice *device, gboolean _gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *surface, GdkSurface *surface,

View File

@ -832,8 +832,8 @@ gdk_wayland_device_init (GdkWaylandDevice *device_core)
device = GDK_DEVICE (device_core); device = GDK_DEVICE (device_core);
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
} }
static gint static gint
@ -3386,42 +3386,42 @@ gdk_wayland_device_tablet_clone_tool_axes (GdkWaylandTabletData *tablet,
g_object_freeze_notify (G_OBJECT (tablet->current_device)); g_object_freeze_notify (G_OBJECT (tablet->current_device));
_gdk_device_reset_axes (tablet->current_device); _gdk_device_reset_axes (tablet->current_device);
_gdk_device_add_axis (tablet->current_device, NULL, GDK_AXIS_X, 0, 0, 0); _gdk_device_add_axis (tablet->current_device, GDK_AXIS_X, 0, 0, 0);
_gdk_device_add_axis (tablet->current_device, NULL, GDK_AXIS_Y, 0, 0, 0); _gdk_device_add_axis (tablet->current_device, GDK_AXIS_Y, 0, 0, 0);
if (tool->tool_axes & (GDK_AXIS_FLAG_XTILT | GDK_AXIS_FLAG_YTILT)) if (tool->tool_axes & (GDK_AXIS_FLAG_XTILT | GDK_AXIS_FLAG_YTILT))
{ {
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_XTILT, -90, 90, 0); GDK_AXIS_XTILT, -90, 90, 0);
tablet->axis_indices[GDK_AXIS_XTILT] = axis_pos; tablet->axis_indices[GDK_AXIS_XTILT] = axis_pos;
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_YTILT, -90, 90, 0); GDK_AXIS_YTILT, -90, 90, 0);
tablet->axis_indices[GDK_AXIS_YTILT] = axis_pos; tablet->axis_indices[GDK_AXIS_YTILT] = axis_pos;
} }
if (tool->tool_axes & GDK_AXIS_FLAG_DISTANCE) if (tool->tool_axes & GDK_AXIS_FLAG_DISTANCE)
{ {
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_DISTANCE, 0, 65535, 0); GDK_AXIS_DISTANCE, 0, 65535, 0);
tablet->axis_indices[GDK_AXIS_DISTANCE] = axis_pos; tablet->axis_indices[GDK_AXIS_DISTANCE] = axis_pos;
} }
if (tool->tool_axes & GDK_AXIS_FLAG_PRESSURE) if (tool->tool_axes & GDK_AXIS_FLAG_PRESSURE)
{ {
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_PRESSURE, 0, 65535, 0); GDK_AXIS_PRESSURE, 0, 65535, 0);
tablet->axis_indices[GDK_AXIS_PRESSURE] = axis_pos; tablet->axis_indices[GDK_AXIS_PRESSURE] = axis_pos;
} }
if (tool->tool_axes & GDK_AXIS_FLAG_ROTATION) if (tool->tool_axes & GDK_AXIS_FLAG_ROTATION)
{ {
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_ROTATION, 0, 360, 0); GDK_AXIS_ROTATION, 0, 360, 0);
tablet->axis_indices[GDK_AXIS_ROTATION] = axis_pos; tablet->axis_indices[GDK_AXIS_ROTATION] = axis_pos;
} }
if (tool->tool_axes & GDK_AXIS_FLAG_SLIDER) if (tool->tool_axes & GDK_AXIS_FLAG_SLIDER)
{ {
axis_pos = _gdk_device_add_axis (tablet->current_device, NULL, axis_pos = _gdk_device_add_axis (tablet->current_device,
GDK_AXIS_SLIDER, -65535, 65535, 0); GDK_AXIS_SLIDER, -65535, 65535, 0);
tablet->axis_indices[GDK_AXIS_SLIDER] = axis_pos; tablet->axis_indices[GDK_AXIS_SLIDER] = axis_pos;
} }
@ -3440,7 +3440,6 @@ gdk_wayland_mimic_device_axes (GdkDevice *master,
GdkDevice *slave) GdkDevice *slave)
{ {
gdouble axis_min, axis_max, axis_resolution; gdouble axis_min, axis_max, axis_resolution;
const char *axis_label;
GdkAxisUse axis_use; GdkAxisUse axis_use;
gint axis_count; gint axis_count;
gint i; gint i;
@ -3451,9 +3450,9 @@ gdk_wayland_mimic_device_axes (GdkDevice *master,
for (i = 0; i < axis_count; i++) for (i = 0; i < axis_count; i++)
{ {
_gdk_device_get_axis_info (slave, i, &axis_label, &axis_use, &axis_min, _gdk_device_get_axis_info (slave, i, &axis_use, &axis_min,
&axis_max, &axis_resolution); &axis_max, &axis_resolution);
_gdk_device_add_axis (master, axis_label, axis_use, axis_min, _gdk_device_add_axis (master, axis_use, axis_min,
axis_max, axis_resolution); axis_max, axis_resolution);
} }

View File

@ -32,11 +32,10 @@ G_DEFINE_TYPE (GdkDeviceVirtual, gdk_device_virtual, GDK_TYPE_DEVICE)
void void
_gdk_device_virtual_set_active (GdkDevice *device, _gdk_device_virtual_set_active (GdkDevice *device,
GdkDevice *new_active) GdkDevice *new_active)
{ {
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device); GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
int n_axes, i; int n_axes, i;
const char *label_atom;
GdkAxisUse use; GdkAxisUse use;
gdouble min_value, max_value, resolution; gdouble min_value, max_value, resolution;
@ -50,14 +49,11 @@ _gdk_device_virtual_set_active (GdkDevice *device,
_gdk_device_reset_axes (device); _gdk_device_reset_axes (device);
n_axes = gdk_device_get_n_axes (new_active); n_axes = gdk_device_get_n_axes (new_active);
for (i = 0; i < n_axes; i++) for (i = 0; i < n_axes; i++)
{ {
_gdk_device_get_axis_info (new_active, i, _gdk_device_get_axis_info (new_active, i, &use,
&label_atom, &use, &min_value, &max_value, &resolution);
&min_value, &max_value, &resolution); _gdk_device_add_axis (device, use, min_value, max_value, resolution);
_gdk_device_add_axis (device, }
label_atom, use,
min_value, max_value, resolution);
}
} }
g_signal_emit_by_name (G_OBJECT (device), "changed"); g_signal_emit_by_name (G_OBJECT (device), "changed");

View File

@ -239,6 +239,6 @@ gdk_device_win32_init (GdkDeviceWin32 *device_win32)
device = GDK_DEVICE (device_win32); device = GDK_DEVICE (device_win32);
_gdk_device_add_axis (device, NULL, GDK_AXIS_X, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_X, 0, 0, 1);
_gdk_device_add_axis (device, NULL, GDK_AXIS_Y, 0, 0, 1); _gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
} }

View File

@ -577,7 +577,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
if (device->pktdata & PK_X) if (device->pktdata & PK_X)
{ {
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
NULL,
GDK_AXIS_X, GDK_AXIS_X,
axis_x.axMin, axis_x.axMin,
axis_x.axMax, axis_x.axMax,
@ -588,7 +587,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
if (device->pktdata & PK_Y) if (device->pktdata & PK_Y)
{ {
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
NULL,
GDK_AXIS_Y, GDK_AXIS_Y,
axis_y.axMin, axis_y.axMin,
axis_y.axMax, axis_y.axMax,
@ -600,7 +598,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
if (device->pktdata & PK_NORMAL_PRESSURE) if (device->pktdata & PK_NORMAL_PRESSURE)
{ {
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
NULL,
GDK_AXIS_PRESSURE, GDK_AXIS_PRESSURE,
axis_npressure.axMin, axis_npressure.axMin,
axis_npressure.axMax, axis_npressure.axMax,
@ -617,14 +614,12 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
* we convert to x and y tilt in the -1000..1000 range * we convert to x and y tilt in the -1000..1000 range
*/ */
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
NULL,
GDK_AXIS_XTILT, GDK_AXIS_XTILT,
-1000, -1000,
1000, 1000,
1000); 1000);
_gdk_device_add_axis (GDK_DEVICE (device), _gdk_device_add_axis (GDK_DEVICE (device),
NULL,
GDK_AXIS_YTILT, GDK_AXIS_YTILT,
-1000, -1000,
1000, 1000,

View File

@ -211,7 +211,6 @@ translate_valuator_class (GdkDisplay *display,
static gboolean initialized = FALSE; static gboolean initialized = FALSE;
static Atom label_atoms [GDK_AXIS_LAST] = { 0 }; static Atom label_atoms [GDK_AXIS_LAST] = { 0 };
GdkAxisUse use = GDK_AXIS_IGNORE; GdkAxisUse use = GDK_AXIS_IGNORE;
const char *label;
gint i; gint i;
if (!initialized) if (!initialized)
@ -234,13 +233,18 @@ translate_valuator_class (GdkDisplay *display,
} }
} }
if (valuator_label != None) _gdk_device_add_axis (device, use, min, max, resolution);
label = gdk_x11_get_xatom_name_for_display (display, valuator_label); GDK_DISPLAY_NOTE (display, INPUT,
else {
label = NULL; const char *label;
_gdk_device_add_axis (device, label, use, min, max, resolution); if (valuator_label != None)
GDK_DISPLAY_NOTE (display, INPUT, g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)")); label = gdk_x11_get_xatom_name_for_display (display, valuator_label);
else
label = NULL;
g_message ("\n\taxis: %s %s", label, use == GDK_AXIS_IGNORE ? "(ignored)" : "(used)");
});
} }
static void static void
@ -261,13 +265,7 @@ translate_device_classes (GdkDisplay *display,
{ {
case XIKeyClass: case XIKeyClass:
{ {
XIKeyClassInfo *key_info = (XIKeyClassInfo *) class_info; /* Not used */
gint j;
_gdk_device_set_keys (device, key_info->num_keycodes);
for (j = 0; j < key_info->num_keycodes; j++)
gdk_device_set_key (device, j, key_info->keycodes[j], 0);
} }
break; break;
case XIValuatorClass: case XIValuatorClass: