[mutter] clutter/evdev: Emit ClutterDeviceManager::tool-changed



commit 75c3f0ffbad1b9606b31ac073c10c9c0e75e7c91
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Oct 31 17:36:50 2016 +0100

    clutter/evdev: Emit ClutterDeviceManager::tool-changed
    
    We do so whenever a tool enters or leaves proximity. We now also
    ensure that last_tool is NULL after it leaves proximity, although
    the CLUTTER_PROXIMITY_OUT event itself should still contain tool
    information.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773779

 .../clutter/evdev/clutter-device-manager-evdev.c   |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/evdev/clutter-device-manager-evdev.c 
b/clutter/clutter/evdev/clutter-device-manager-evdev.c
index b8679a3..eeddc22 100644
--- a/clutter/clutter/evdev/clutter-device-manager-evdev.c
+++ b/clutter/clutter/evdev/clutter-device-manager-evdev.c
@@ -1210,7 +1210,12 @@ input_device_update_tool (ClutterInputDevice          *input_device,
         }
     }
 
-  evdev_device->last_tool = tool;
+  if (evdev_device->last_tool != tool)
+    {
+      evdev_device->last_tool = tool;
+      g_signal_emit_by_name (clutter_device_manager_get_default (),
+                             "tool-changed", input_device, tool);
+    }
 }
 
 static gdouble *
@@ -1753,8 +1758,11 @@ process_device_event (ClutterDeviceManagerEvdev *manager_evdev,
 
         libinput_tool = libinput_event_tablet_tool_get_tool (tablet_event);
 
-        input_device_update_tool (device, libinput_tool);
+        if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN)
+          input_device_update_tool (device, libinput_tool);
         notify_proximity (device, time, state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
+        if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT)
+          input_device_update_tool (device, NULL);
         break;
       }
     case LIBINPUT_EVENT_TABLET_TOOL_BUTTON:


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