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
This commit is contained in:
Jasper St. Pierre 2012-11-28 21:17:11 -05:00
parent 7204f51643
commit 9614dff158

View File

@ -733,15 +733,19 @@ clutter_device_manager_xi2_translate_event (ClutterEventTranslator *translator,
device = g_hash_table_lookup (manager_xi2->devices_by_id, device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->deviceid)); GINT_TO_POINTER (xev->deviceid));
source_device = g_hash_table_lookup (manager_xi2->devices_by_id,
GINT_TO_POINTER (xev->sourceid));
if (device) if (device)
{ {
_clutter_input_device_reset_axes (device); _clutter_input_device_reset_axes (device);
_clutter_input_device_reset_scroll_info (device);
translate_device_classes (backend_x11->xdpy, translate_device_classes (backend_x11->xdpy,
device, device,
xev->classes, xev->classes,
xev->num_classes); xev->num_classes);
} }
if (source_device)
_clutter_input_device_reset_scroll_info (device);
} }
retval = CLUTTER_TRANSLATE_REMOVE; retval = CLUTTER_TRANSLATE_REMOVE;
break; break;