summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-08 15:38:44 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-13 13:24:08 +1000
commita15abf82ddb5a209dbc30c4d12e1dc23c4adf3e4 (patch)
tree6dd27281e11f03360f06b18edba222a33f0b631b
parent218752bdc5d9323d1e6202e762573a925cf8a4eb (diff)
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>
-rw-r--r--dix/devices.c1
-rw-r--r--dix/events.c8
2 files changed, 2 insertions, 7 deletions
diff --git a/dix/devices.c b/dix/devices.c
index e448eab62..9ca8fe055 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -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);
diff --git a/dix/events.c b/dix/events.c
index db86f5167..086f438fd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -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;
}