Two bugs caused proximity events to be discarded. First, on proximity out
posting through pDev would be discarded because pDev is the parent device that
we use as a base for hotplugging the real devices for each tool from. That
device never sends events though, doing so will see the event discarded in the
server.

Second, if the tool already exists don't just exit, send the proximity event
first. To unify the three paths where we do send the events simply move them
down to the exit phase of the function.

https://bugs.freedesktop.org/show_bug.cgi?id=95484

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/xf86libinput.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 49f0583..9298aed 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1492,18 +1492,13 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
        char name[64];
        ValuatorMask *mask = driver_data->valuators;
        double x, y;
+       BOOL in_prox;
 
        x = libinput_event_tablet_tool_get_x_transformed(event, 
TABLET_AXIS_MAX);
        y = libinput_event_tablet_tool_get_y_transformed(event, 
TABLET_AXIS_MAX);
        valuator_mask_set_double(mask, 0, x);
        valuator_mask_set_double(mask, 1, y);
 
-       if (libinput_event_tablet_tool_get_proximity_state(event) ==
-           LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) {
-               xf86PostProximityEventM(pDev, FALSE, mask);
-               return;
-       }
-
        tool = libinput_event_tablet_tool_get_tool(event);
        serial = libinput_tablet_tool_get_serial(tool);
        tool_id = libinput_tablet_tool_get_tool_id(tool);
@@ -1513,8 +1508,10 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
                                 shared_device_link) {
                if (dev->tablet_tool &&
                    libinput_tablet_tool_get_serial(dev->tablet_tool) == serial 
&&
-                   libinput_tablet_tool_get_tool_id(dev->tablet_tool) == 
tool_id)
-                       return;
+                   libinput_tablet_tool_get_tool_id(dev->tablet_tool) == 
tool_id) {
+                       pDev = dev->pInfo->dev;
+                       goto out;
+               }
        }
 
        t = calloc(1, sizeof *t);
@@ -1537,7 +1534,10 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
 
        pDev = xf86libinput_create_subdevice(pInfo, CAP_TABLET_TOOL, 
HOTPLUG_NOW, options);
 
-       xf86PostProximityEventM(pDev, TRUE, mask);
+out:
+       in_prox = libinput_event_tablet_tool_get_proximity_state(event) ==
+                               LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN;
+       xf86PostProximityEventM(pDev, in_prox, mask);
 }
 
 static void
-- 
2.7.4

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to