diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2016-05-23 14:12:14 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2016-05-23 14:15:22 +1000 |
commit | d8aef838347bc64fa635eeac436c2d1154d846ce (patch) | |
tree | c8de1a8e6300ae0a56e2abf1aa0a9cc1cab910b0 | |
parent | 34b6ed980f8fd01e2246a94b87d32458a131974b (diff) |
Fix proximity events
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.hutterer@who-t.net>
-rw-r--r-- | src/xf86libinput.c | 18 |
1 files 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 |