[clutter] xi2: Reset the correct scroll axes on DeviceChanged



commit 9614dff158f4871bf40b335e3542b7bc57802021
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Nov 28 21:17:11 2012 -0500

    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 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index 4250644..8ecc8ad 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]