[PATCH libinput] tablet: skip tablet_flush() if our current tool type is none

Peter Hutterer peter.hutterer at who-t.net
Fri Feb 2 02:12:13 UTC 2018


If a tablet never sends a BTN_TOOL_foo, we never update the tool and we remain
on the 'none' tool.

https://bugzilla.redhat.com/show_bug.cgi?id=1535755

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-tablet.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 8188686c..748c1345 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1558,11 +1558,15 @@ tablet_flush(struct tablet_dispatch *tablet,
 	     struct evdev_device *device,
 	     uint64_t time)
 {
-	struct libinput_tablet_tool *tool =
-		tablet_get_tool(tablet,
-				tablet->current_tool_type,
-				tablet->current_tool_id,
-				tablet->current_tool_serial);
+	struct libinput_tablet_tool *tool;
+
+	if (tablet->current_tool_type == LIBINPUT_TOOL_NONE)
+		return;
+
+	tool = tablet_get_tool(tablet,
+			       tablet->current_tool_type,
+			       tablet->current_tool_id,
+			       tablet->current_tool_serial);
 
 	if (!tool)
 		return; /* OOM */
-- 
2.14.3



More information about the wayland-devel mailing list