From 9614dff158f4871bf40b335e3542b7bc57802021 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 28 Nov 2012 21:17:11 -0500 Subject: [PATCH] xi2: Reset the correct scroll axes on DeviceChanged Otherwise, we'll have incorrect scrolling when we switch hardware devices without switching virtual devices. For example, on a ThinkPad, scroll using the touchpad, move the eraser mouse, and then scroll again: the deltas will be wrong. This also matches what GTK+ does. https://bugzilla.gnome.org/show_bug.cgi?id=689258 --- clutter/x11/clutter-device-manager-xi2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c index 4250644fb..8ecc8ad66 100644 --- a/clutter/x11/clutter-device-manager-xi2.c +++ b/clutter/x11/clutter-device-manager-xi2.c @@ -733,15 +733,19 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator, device = g_hash_table_lookup (manager_xi2->devices_by_id, GINT_TO_POINTER (xev->deviceid)); + source_device = g_hash_table_lookup (manager_xi2->devices_by_id, + GINT_TO_POINTER (xev->sourceid)); if (device) { _clutter_input_device_reset_axes (device); - _clutter_input_device_reset_scroll_info (device); translate_device_classes (backend_x11->xdpy, device, xev->classes, xev->num_classes); } + + if (source_device) + _clutter_input_device_reset_scroll_info (device); } retval = CLUTTER_TRANSLATE_REMOVE; break;