summaryrefslogtreecommitdiff
path: root/xserver/dix/touch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/dix/touch.c')
-rw-r--r--xserver/dix/touch.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/xserver/dix/touch.c b/xserver/dix/touch.c
index 5f77be575..2b30b7df0 100644
--- a/xserver/dix/touch.c
+++ b/xserver/dix/touch.c
@@ -682,15 +682,20 @@ 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;
ti->listeners[ti->num_listeners].window = window;
+ ti->listeners[ti->num_listeners].grab = grab;
+ if (grab)
+ ti->num_grabs++;
ti->num_listeners++;
}
@@ -709,6 +714,11 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
if (ti->listeners[i].listener == resource) {
int j;
+ if (ti->listeners[i].grab) {
+ ti->listeners[i].grab = NULL;
+ ti->num_grabs--;
+ }
+
for (j = i; j < ti->num_listeners - 1; j++)
ti->listeners[j] = ti->listeners[j + 1];
ti->num_listeners--;
@@ -739,9 +749,9 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
type = LISTENER_POINTER_GRAB;
}
- TouchAddListener(ti, grab->resource, grab->grabtype,
- type, LISTENER_AWAITING_BEGIN, grab->window);
- ti->num_grabs++;
+ /* 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);
}
/**
@@ -796,8 +806,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (!xi2mask_isset(iclients->xi2mask, dev, XI_TouchOwnership))
TouchEventHistoryAllocate(ti);
- TouchAddListener(ti, iclients->resource, XI2,
- type, LISTENER_AWAITING_BEGIN, win);
+ TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2,
+ type, LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
}
@@ -811,9 +821,9 @@ 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);
+ win, NULL);
return TRUE;
}
}
@@ -826,9 +836,9 @@ 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);
+ win, NULL);
return TRUE;
}
@@ -838,8 +848,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
continue;
TouchEventHistoryAllocate(ti);
- TouchAddListener(ti, oclients->resource, CORE,
- type, LISTENER_AWAITING_BEGIN, win);
+ TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE,
+ type, LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
}
@@ -994,8 +1004,6 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
for (i = 0; i < nev; i++)
mieqProcessDeviceEvent(dev, events + i, NULL);
- ProcessInputEvents();
-
FreeEventList(events, GetMaximumEventsNum());
return nev ? Success : BadMatch;