summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-02-02 14:54:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-02-23 17:52:40 +1000
commit1c38abd4b136301008ba77d4e68aea34508f4c22 (patch)
tree68131d734bc63eb770c53fed836d6b60ea6136af /dix
parentfb858774b80eb75c2f8e81fe893bbbdd37065fbd (diff)
dix: switch DeliverGrabbedEvent to internal events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/dix/events.c b/dix/events.c
index 396dba9c3..6b59fb3d6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3475,6 +3475,8 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
DeviceIntPtr dev;
SpritePtr pSprite = thisDev->spriteInfo->sprite;
BOOL sendCore = FALSE;
+ int rc, count = 0;
+ xEvent *xi = NULL;
grabinfo = &thisDev->deviceGrab;
grab = grabinfo->grab;
@@ -3510,12 +3512,20 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
}
if (!deliveries)
{
- /* FIXME: temporary solution only. The event masks need a rework,
- * especially for generic events. */
- static int count;
- static xEvent xi[1000]; /* enough bytes for the events we have atm */
+ /* XXX: In theory, we could pass the internal events through to
+ * everything and only convert just before hitting the wire. We can't
+ * do that yet, so DGE is the last stop for internal events. From here
+ * onwards, we deal with core/XI events.
+ */
- count = ConvertBackToXI((InternalEvent*)event, xi);
+ rc = EventToXI(event, &xi, &count);
+ if (rc != Success)
+ {
+ ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n",
+ thisDev->name, event->u.any.type, rc);
+ goto unwind;
+ } else if (count == 0) /* no XI/Core event for you */
+ goto unwind;
if (xi->u.u.type == GenericEvent)
{
@@ -3524,7 +3534,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
GenericMaskPtr gemask = grab->genericMasks;
if (!gemask || !gemask->eventMask[GEEXTIDX(ge)])
- return;
+ goto unwind;
if (GEEventFill(xi))
GEEventFill(xi)(ge, thisDev, grab->window, grab);
@@ -3541,13 +3551,12 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
if (sendCore && grab->coreGrab)
{
xEvent core;
- int rc;
rc = EventToCore(event, &core);
if (rc != Success && rc != BadMatch)
{
ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n");
- return;
+ goto unwind;
}
FixUpEventFromWindow(thisDev, &core, grab->window,
@@ -3622,6 +3631,10 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
break;
}
}
+
+unwind:
+ if (xi)
+ xfree(xi);
}
/* This function is used to set the key pressed or key released state -