Commit 23a8b62d authored by Povilas Kanapickas's avatar Povilas Kanapickas Committed by Peter Hutterer
Browse files

dix: Store replayed event into GrabInfoRec struct as InternalEvent*

parent 8bd8b3af
......@@ -1451,7 +1451,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
g = AllocGrab(devgrab);
BUG_WARN(!g);
*dev->deviceGrab.sync.event = ev->device_event;
*dev->deviceGrab.sync.event = *ev;
/* The listener array has a sequence of grabs and then one event
* selection. Implicit grab activation occurs through delivering an
......
......@@ -281,7 +281,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
dev->deviceGrab.grabTime = currentTime;
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent));
dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
XkbSetExtension(dev, ProcessKeyboardEvent);
......
......@@ -1304,7 +1304,6 @@ static void
ComputeFreezes(void)
{
DeviceIntPtr replayDev = syncEvents.replayDev;
WindowPtr w;
GrabPtr grab;
DeviceIntPtr dev;
......@@ -1316,26 +1315,29 @@ ComputeFreezes(void)
return;
syncEvents.playingEvents = TRUE;
if (replayDev) {
DeviceEvent *event = replayDev->deviceGrab.sync.event;
InternalEvent *event = replayDev->deviceGrab.sync.event;
syncEvents.replayDev = (DeviceIntPtr) NULL;
w = XYToWindow(replayDev->spriteInfo->sprite,
event->root_x, event->root_y);
if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) {
if (IsTouchEvent((InternalEvent *) event)) {
if (!CheckDeviceGrabs(replayDev, &event->device_event,
syncEvents.replayWin)) {
if (IsTouchEvent(event)) {
TouchPointInfoPtr ti =
TouchFindByClientID(replayDev, event->touchid);
TouchFindByClientID(replayDev, event->device_event.touchid);
BUG_WARN(!ti);
TouchListenerAcceptReject(replayDev, ti, 0, XIRejectTouch);
}
else if (replayDev->focus &&
!IsPointerEvent((InternalEvent *) event))
DeliverFocusedEvent(replayDev, (InternalEvent *) event, w);
else
DeliverDeviceEvents(w, (InternalEvent *) event, NullGrab,
NullWindow, replayDev);
else {
WindowPtr w = XYToWindow(replayDev->spriteInfo->sprite,
event->device_event.root_x,
event->device_event.root_y);
if (replayDev->focus && !IsPointerEvent(event))
DeliverFocusedEvent(replayDev, event, w);
else
DeliverDeviceEvents(w, event, NullGrab,
NullWindow, replayDev);
}
}
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
......@@ -1813,8 +1815,8 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
* anything else is accept.
*/
if (newState != NOT_GRABBED /* Replay */ &&
IsTouchEvent((InternalEvent*)grabinfo->sync.event)) {
TouchAcceptAndEnd(thisDev, grabinfo->sync.event->touchid);
IsTouchEvent(grabinfo->sync.event)) {
TouchAcceptAndEnd(thisDev, grabinfo->sync.event->device_event.touchid);
}
}
......@@ -3731,7 +3733,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
if (grabinfo->sync.state == FROZEN_NO_EVENT)
grabinfo->sync.state = FROZEN_WITH_EVENT;
*grabinfo->sync.event = real_event->device_event;
*grabinfo->sync.event = *real_event;
free(xE);
return TRUE;
......@@ -4303,7 +4305,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
case FREEZE_NEXT_EVENT:
grabinfo->sync.state = FROZEN_WITH_EVENT;
FreezeThaw(thisDev, TRUE);
*grabinfo->sync.event = event->device_event;
*grabinfo->sync.event = *event;
break;
}
}
......
......@@ -877,7 +877,7 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
{
TouchPointInfoPtr ti;
GrabPtr grab;
DeviceEvent *ev;
InternalEvent *ev;
if (!dev->touch)
return;
......@@ -887,10 +887,10 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
return;
ev = dev->deviceGrab.sync.event;
if (!IsTouchEvent((InternalEvent *) ev))
if (!IsTouchEvent(ev))
return;
ti = TouchFindByClientID(dev, ev->touchid);
ti = TouchFindByClientID(dev, ev->device_event.touchid);
if (!ti)
return;
......
......@@ -501,7 +501,7 @@ typedef struct _GrabInfoRec {
Bool frozen;
int state;
GrabPtr other; /* if other grab has this frozen */
DeviceEvent *event; /* saved to be replayed */
InternalEvent *event; /* saved to be replayed */
} sync;
} GrabInfoRec, *GrabInfoPtr;
......
Supports Markdown
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