summaryrefslogtreecommitdiff
path: root/gdk/x11/gdkdevicemanager-xi2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdk/x11/gdkdevicemanager-xi2.c')
-rw-r--r--gdk/x11/gdkdevicemanager-xi2.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 50c1a00711..a57ecaf885 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -837,6 +837,7 @@ handle_device_changed (GdkX11DeviceManagerXI2 *device_manager,
{
_gdk_device_reset_axes (device);
_gdk_device_xi2_unset_scroll_valuators ((GdkX11DeviceXI2 *) device);
+ gdk_x11_device_xi2_store_axes (GDK_X11_DEVICE_XI2 (device), NULL, 0);
translate_device_classes (display, device, ev->classes, ev->num_classes);
g_signal_emit_by_name (G_OBJECT (device), "changed");
@@ -939,13 +940,16 @@ translate_axes (GdkDevice *device,
axes = g_new0 (gdouble, n_axes);
vals = valuators->values;
- for (i = 0; i < valuators->mask_len * 8; i++)
+ for (i = 0; i < MIN (valuators->mask_len * 8, n_axes); i++)
{
GdkAxisUse use;
gdouble val;
if (!XIMaskIsSet (valuators->mask, i))
- continue;
+ {
+ axes[i] = gdk_x11_device_xi2_get_last_axis_value (GDK_X11_DEVICE_XI2 (device), i);
+ continue;
+ }
use = gdk_device_get_axis_use (device, i);
val = *vals++;
@@ -970,6 +974,8 @@ translate_axes (GdkDevice *device,
}
}
+ gdk_x11_device_xi2_store_axes (GDK_X11_DEVICE_XI2 (device), axes, n_axes);
+
return axes;
}