Commit f59499b5 authored by Peter Hutterer's avatar Peter Hutterer

dix: add resource type to touch listeners

Instead of guessing what resource type the listener is and what property to
retrieve, store the resource type in the listener directly.

Breaks XIT test cases:
TouchGrabTestMultipleTaps.PassiveGrabPointerEmulationMultipleTouchesFastSuccession

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56557Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
Reviewed-by: default avatarChase Douglas <chase.douglas@ubuntu.com>
parent 9ad0fdb1
......@@ -1305,13 +1305,9 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
*mask = (*grab)->xi2mask;
}
else {
if (listener->level == CORE)
rc = dixLookupWindow(win, listener->listener,
serverClient, DixSendAccess);
else
rc = dixLookupResourceByType((pointer *) win, listener->listener,
RT_INPUTCLIENT,
serverClient, DixSendAccess);
rc = dixLookupResourceByType((pointer *) win, listener->listener,
listener->resource_type,
serverClient, DixSendAccess);
if (rc != Success)
return FALSE;
......@@ -1452,6 +1448,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
l = &ti->listeners[ti->num_listeners - 1];
l->listener = devgrab->resource;
l->grab = devgrab;
//l->resource_type = RT_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
l->type = LISTENER_POINTER_GRAB;
......
......@@ -675,12 +675,13 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource)
* Add the resource to this touch's listeners.
*/
void
TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
enum TouchListenerType type, enum TouchListenerState state,
WindowPtr window,
TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
enum InputLevel level, enum TouchListenerType type,
enum TouchListenerState state, WindowPtr window,
GrabPtr grab)
{
ti->listeners[ti->num_listeners].listener = resource;
ti->listeners[ti->num_listeners].resource_type = resource_type;
ti->listeners[ti->num_listeners].level = level;
ti->listeners[ti->num_listeners].state = state;
ti->listeners[ti->num_listeners].type = type;
......@@ -741,7 +742,8 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
type = LISTENER_POINTER_GRAB;
}
TouchAddListener(ti, grab->resource, grab->grabtype,
/* grab listeners are always RT_NONE since we keep the grab pointer */
TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype,
type, LISTENER_AWAITING_BEGIN, grab->window, grab);
}
......@@ -797,7 +799,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership))
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI2,
TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2,
type, LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
......@@ -812,7 +814,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
continue;
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI,
TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI,
LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
win, NULL);
return TRUE;
......@@ -827,7 +829,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
/* window owner */
if (IsMaster(dev) && (win->eventMask & core_filter)) {
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, win->drawable.id, CORE,
TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE,
LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
win, NULL);
return TRUE;
......@@ -839,7 +841,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
continue;
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, oclients->resource, CORE,
TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE,
type, LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
......
......@@ -565,7 +565,7 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev,
XID resource);
extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
extern void TouchAddListener(TouchPointInfoPtr ti, XID resource,
extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, int resource_type,
enum InputLevel level, enum TouchListenerType type,
enum TouchListenerState state, WindowPtr window, GrabPtr grab);
extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
......
......@@ -301,6 +301,7 @@ typedef struct _ValuatorClassRec {
typedef struct _TouchListener {
XID listener; /* grabs/event selection IDs receiving
* events for this touch */
int resource_type; /* listener's resource type */
enum TouchListenerType type;
enum TouchListenerState state;
enum InputLevel level; /* matters only for emulating touches */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment