dix: always allocate and set the grab's sync.event
Allocate the memory at device creation time and always store the event, even if we're not frozen. This way we know which event triggered the grab. Since the event was never freed anyway except on device shutdown, this doesn't really change things much. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
parent
218752bdc5
commit
a15abf82dd
|
@ -275,6 +275,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
|||
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
|
||||
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
|
||||
dev->deviceGrab.activeGrab = AllocGrab();
|
||||
dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent));
|
||||
|
||||
XkbSetExtension(dev, ProcessKeyboardEvent);
|
||||
|
||||
|
|
|
@ -3717,12 +3717,8 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event)
|
|||
}
|
||||
|
||||
if (grabinfo->sync.state == FROZEN_NO_EVENT)
|
||||
{
|
||||
if (!grabinfo->sync.event)
|
||||
grabinfo->sync.event = calloc(1, sizeof(DeviceEvent));
|
||||
*grabinfo->sync.event = event->device_event;
|
||||
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
||||
}
|
||||
*grabinfo->sync.event = event->device_event;
|
||||
|
||||
free(xE);
|
||||
return TRUE;
|
||||
|
@ -4310,8 +4306,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
|
|||
case FREEZE_NEXT_EVENT:
|
||||
grabinfo->sync.state = FROZEN_WITH_EVENT;
|
||||
FreezeThaw(thisDev, TRUE);
|
||||
if (!grabinfo->sync.event)
|
||||
grabinfo->sync.event = calloc(1, sizeof(InternalEvent));
|
||||
*grabinfo->sync.event = event->device_event;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue