[PATCH] Re-enable the RECORD extension. (#20500)
Daniel Stone
daniel at fooishbar.org
Fri Jan 8 08:45:08 PST 2010
Hi,
On Fri, Jan 08, 2010 at 03:27:27PM +1000, Peter Hutterer wrote:
> I'd like to get more testing and review for this since it might become a
> candidate for 1.7.5. First tests look like it works fine again.
> This patch requires the EventToCore patch
> http://lists.freedesktop.org/archives/xorg-devel/2010-January/004752.html
Comments inline.
> + eventinfo.events = (xEventPtr)xi_events;
> + eventinfo.count = count;
> + ErrorF("POE xi root is %lx\n", xi_events->u.keyButtonPointer.root);
> + CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo);
> + xfree(xi_events);
> +
> + if (IsMaster(device))
> + {
> + xEvent core;
> + EventToCore(ev, &core);
> + eventinfo.events = (xEventPtr)&core;
> + eventinfo.count = 1;
> + ErrorF("POE core root is %lx\n", core.u.keyButtonPointer.root);
> + CallCallbacks(&DeviceEventCallback, (pointer) & eventinfo);
> + }
So it looks like we will record one Xi and one core event for every
event that ends up getting sent through the MD, regardless of which
deliveries were made.
Previously we'd only record an input event if any deliveries of that
type occurred, right? It looks like something like the attached
(note: wholly untested, had to peg my CPU at 12% to prevent thermal
shutdowns ... MacBook Air + Australian summer is a poor combination)
would match the old semantics.
Cheers,
Daniel
-------------- next part --------------
diff --git a/dix/events.c b/dix/events.c
index 85c8f9a..cf6b253 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2454,10 +2454,14 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
int deliveries = 0;
xEvent core;
xEvent *xE = NULL;
+ xEvent *xi2 = NULL;
+ xEventInfo event_info;
int rc, mask, count = 0;
CHECKEVENT(event);
+ event_info.count = 0;
+
while (pWin)
{
if ((mask = EventIsDeliverable(dev, event, pWin)))
@@ -2465,7 +2469,6 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
/* XI2 events first */
if (mask & XI2_MASK)
{
- xEvent *xi2 = NULL;
rc = EventToXI2(event, &xi2);
if (rc == Success)
{
@@ -2474,9 +2477,14 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
FixUpEventFromWindow(dev, xi2, pWin, child, FALSE);
deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1,
filter, grab);
- xfree(xi2);
if (deliveries > 0)
+ {
+ event_info.events = xi2;
+ event_info.count = 1;
goto unwind;
+ }
+ xfree(xi2);
+ xi2 = NULL;
} else if (rc != BadMatch)
ErrorF("[dix] %s: XI2 conversion failed in DDE (%d).\n",
dev->name, rc);
@@ -2494,7 +2502,16 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
deliveries = DeliverEventsToWindow(dev, pWin, xE, count,
filter, grab);
if (deliveries > 0)
+ {
+ event_info.events = xE;
+ event_info.count = count;
goto unwind;
+ }
+ }
+
+ if (rc == Success) {
+ xfree(xE);
+ xE = NULL;
}
}
@@ -2510,7 +2527,11 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
deliveries = DeliverEventsToWindow(dev, pWin, &core, 1,
filter, grab);
if (deliveries > 0)
+ {
+ event_info.events = &core;
+ event_info.events = 1;
goto unwind;
+ }
}
}
@@ -2527,7 +2548,12 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
}
unwind:
+ if (event_info.count)
+ CallCallbacks(&DeviceEventCallback, (pointer) &event_info);
+
+ xfree(xi2);
xfree(xE);
+
return deliveries;
}
@@ -3734,9 +3760,12 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
BOOL sendCore = (IsMaster(keybd) && keybd->coreEvents);
xEvent core;
xEvent *xE = NULL, *xi2 = NULL;
+ xEventInfo event_info;
int count, rc;
int deliveries = 0;
+ event_info.count = 0;
+
if (focus == FollowKeyboardWin)
focus = inputInfo.keyboard->focus->win;
if (!focus)
@@ -3765,22 +3794,39 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1,
filter, NullGrab);
if (deliveries > 0)
+ {
+ event_info.events = xi2;
+ event_info.count = 1;
goto unwind;
+ }
+
+ xfree(xi2);
+ xi2 = NULL;
} else if (rc != BadMatch)
ErrorF("[dix] %s: XI2 conversion failed in DFE (%d, %d). Skipping delivery.\n",
keybd->name, event->any.type, rc);
rc = EventToXI(event, &xE, &count);
- if (rc == Success &&
- XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success)
+ if (rc == Success)
{
- FixUpEventFromWindow(ptr, xE, focus, None, FALSE);
- deliveries = DeliverEventsToWindow(keybd, focus, xE, count,
- GetEventFilter(keybd, xE),
- NullGrab);
+ if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE,
+ count) == Success)
+ {
+ FixUpEventFromWindow(ptr, xE, focus, None, FALSE);
+ deliveries = DeliverEventsToWindow(keybd, focus, xE, count,
+ GetEventFilter(keybd, xE),
+ NullGrab);
- if (deliveries > 0)
- goto unwind;
+ if (deliveries > 0)
+ {
+ event_info.events = xE;
+ event_info.count = count;
+ goto unwind;
+ }
+ }
+
+ xfree(xE);
+ xE = NULL;
} else if (rc != BadMatch)
ErrorF("[dix] %s: XI conversion failed in DFE (%d, %d). Skipping delivery.\n",
keybd->name, event->any.type, rc);
@@ -3796,13 +3842,20 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window)
GetEventFilter(keybd, &core),
NullGrab);
}
+
+ if (deliveries > 0)
+ {
+ event_info.events = &core;
+ event_info.count = 1;
+ goto unwind;
+ }
}
unwind:
- if (xE)
- xfree(xE);
- if (xi2)
- xfree(xi2);
+ if (event_info.count)
+ CallCallbacks(&DeviceEventCallback, (pointer) &event_info);
+ xfree(xi2);
+ xfree(xE);
return;
}
@@ -3824,6 +3877,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
SpritePtr pSprite = thisDev->spriteInfo->sprite;
BOOL sendCore = FALSE;
int rc, count = 0;
+ xEvent core;
xEvent *xi = NULL;
xEvent *xi2 = NULL;
@@ -3875,8 +3929,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
/* try core event */
if (sendCore && grab->grabtype == GRABTYPE_CORE)
{
- xEvent core;
-
rc = EventToCore(event, &core);
if (rc == Success)
{
@@ -3893,6 +3945,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
&core, 1, mask,
GetEventFilter(thisDev, &core),
grab);
+ if (deliveries)
+ {
+ event_info.events = &core;
+ event_info.count = 1;
+ }
}
} else if (rc != BadMatch)
ErrorF("[dix] DeliverGrabbedEvent. Core conversion failed.\n");
@@ -3912,6 +3969,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
/* XXX: XACE */
deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask,
GetEventFilter(thisDev, xi2), grab);
+ if (deliveries)
+ {
+ event_info.events = xi2;
+ event_info.count = 1;
+ }
} else if (rc != BadMatch)
ErrorF("[dix] %s: XI2 conversion failed in DGE (%d, %d). Skipping delivery.\n",
thisDev->name, event->any.type, rc);
@@ -3945,6 +4007,11 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
mask,
GetEventFilter(thisDev, xi),
grab);
+ if (deliveries)
+ {
+ event_info.events = xi;
+ event_info.count = count;
+ }
}
} else if (rc != BadMatch)
ErrorF("[dix] %s: XI conversion failed in DGE (%d, %d). Skipping delivery.\n",
@@ -3982,6 +4049,9 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
}
}
+ if (event_info.count)
+ CallCallbacks(&DeviceEventCallback, (pointer) &event_info);
+
if (xi)
xfree(xi);
if (xi2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20100109/13822dbe/attachment.pgp
More information about the xorg-devel
mailing list