[PATCH 3/3] Set event sequence number in WriteEventsToClient instead of at callers.
Jamey Sharp
jamey at minilop.net
Sat May 15 13:52:15 PDT 2010
TryClientEvents already did this; this commit just moves the assignment
one level down so that no event source has to worry about sequence
numbers.
...No event source, that is, except XKB, which inexplicably calls
WriteToClient directly for several events.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
Xext/saver.c | 5 +----
Xext/security.c | 4 +---
Xext/shape.c | 5 +----
Xext/shm.c | 1 -
Xext/sync.c | 5 -----
Xext/xcalibrate.c | 1 -
Xext/xvdisp.c | 1 -
damageext/damageext.c | 1 -
dix/dispatch.c | 1 -
dix/events.c | 15 ++++-----------
dix/inpututils.c | 1 -
glx/glxdri2.c | 1 -
hw/xfree86/dixmods/extmod/xf86vmode.c | 5 +----
hw/xfree86/dri2/dri2ext.c | 2 --
hw/xquartz/applewm.c | 5 +----
hw/xquartz/xpr/appledri.c | 8 +-------
hw/xwin/winwindowswm.c | 1 -
randr/rrcrtc.c | 1 -
randr/rroutput.c | 1 -
randr/rrproperty.c | 1 -
randr/rrscreen.c | 2 --
xfixes/cursor.c | 1 -
xfixes/select.c | 1 -
xkb/xkbEvents.c | 1 -
24 files changed, 10 insertions(+), 60 deletions(-)
diff --git a/Xext/saver.c b/Xext/saver.c
index 42fc632..30c4a8c 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -480,7 +480,6 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
ScreenSaverEventPtr pEv;
unsigned long mask;
xScreenSaverNotifyEvent ev;
- ClientPtr client;
int kind;
UpdateCurrentTimeIf ();
@@ -499,18 +498,16 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
kind = ScreenSaverInternal;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
{
- client = pEv->client;
if (!(pEv->mask & mask))
continue;
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
ev.state = state;
- ev.sequenceNumber = client->sequence;
ev.timestamp = currentTime.milliseconds;
ev.root = WindowTable[pScreen->myNum]->drawable.id;
ev.window = savedScreenInfo[pScreen->myNum].wid;
ev.kind = kind;
ev.forced = forced;
- WriteEventsToClient (client, 1, (xEvent *) &ev);
+ WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
}
}
diff --git a/Xext/security.c b/Xext/security.c
index 16aac05..32730e2 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -198,12 +198,10 @@ SecurityDeleteAuthorization(
while ((pEventClient = pAuth->eventClients))
{
/* send revocation event event */
- ClientPtr client = rClient(pEventClient);
xSecurityAuthorizationRevokedEvent are;
are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.sequenceNumber = client->sequence;
are.authId = pAuth->id;
- WriteEventsToClient(client, 1, (xEvent *)&are);
+ WriteEventsToClient(rClient(pEventClient), 1, (xEvent *)&are);
FreeResource(pEventClient->resource, RT_NONE);
}
diff --git a/Xext/shape.c b/Xext/shape.c
index 10437f4..10ac283 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -885,7 +885,6 @@ void
SendShapeNotify (WindowPtr pWin, int which)
{
ShapeEventPtr *pHead, pShapeEvent;
- ClientPtr client;
xShapeNotifyEvent se;
BoxRec extents;
RegionPtr region;
@@ -940,18 +939,16 @@ SendShapeNotify (WindowPtr pWin, int which)
return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- client = pShapeEvent->client;
se.type = ShapeNotify + ShapeEventBase;
se.kind = which;
se.window = pWin->drawable.id;
- se.sequenceNumber = client->sequence;
se.x = extents.x1;
se.y = extents.y1;
se.width = extents.x2 - extents.x1;
se.height = extents.y2 - extents.y1;
se.time = currentTime.milliseconds;
se.shaped = shaped;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se);
}
}
diff --git a/Xext/shm.c b/Xext/shm.c
index 25043fa..b2c4208 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -943,7 +943,6 @@ ProcShmPutImage(ClientPtr client)
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
- ev.sequenceNumber = client->sequence;
ev.minorEvent = X_ShmPutImage;
ev.majorEvent = ShmReqCode;
ev.shmseg = stuff->shmseg;
diff --git a/Xext/sync.c b/Xext/sync.c
index 3729f1b..f7ac405 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -372,7 +372,6 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm)
ane.type = SyncEventBase + XSyncAlarmNotify;
ane.kind = XSyncAlarmNotify;
- ane.sequenceNumber = pAlarm->client->sequence;
ane.alarm = pAlarm->alarm_id;
if (pTrigger->pCounter)
{
@@ -395,10 +394,7 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm)
/* send to other interested clients */
for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next)
- {
- ane.sequenceNumber = pcl->client->sequence;
WriteEventsToClient(pcl->client, 1, (xEvent *) &ane);
- }
}
@@ -423,7 +419,6 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait,
SyncTrigger *pTrigger = &(*ppAwait)->trigger;
pev->type = SyncEventBase + XSyncCounterNotify;
pev->kind = XSyncCounterNotify;
- pev->sequenceNumber = client->sequence;
pev->counter = pTrigger->pCounter->id;
pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value);
pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c
index 8659384..bff1c31 100644
--- a/Xext/xcalibrate.c
+++ b/Xext/xcalibrate.c
@@ -54,7 +54,6 @@ xcalibrate_event_hook (int x, int y, int pressure, void *closure)
xXCalibrateRawTouchscreenEvent ev;
ev.type = XCalibrateEventBase + X_XCalibrateRawTouchscreen;
- ev.sequenceNumber = pClient->sequence;
ev.x = x;
ev.y = y;
ev.pressure = pressure;
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index fd633f1..250a994 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1100,7 +1100,6 @@ ProcXvShmPutImage(ClientPtr client)
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
- ev.sequenceNumber = client->sequence;
ev.minorEvent = xv_ShmPutImage;
ev.majorEvent = XvReqCode;
ev.shmseg = stuff->shmseg;
diff --git a/damageext/damageext.c b/damageext/damageext.c
index c80554e..d923434 100644
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -50,7 +50,6 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
UpdateCurrentTimeIf ();
ev.type = DamageEventBase + XDamageNotify;
ev.level = pDamageExt->level;
- ev.sequenceNumber = pClient->sequence;
ev.drawable = pDamageExt->drawable;
ev.damage = pDamageExt->id;
ev.timestamp = currentTime.milliseconds;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index fe9ddb2..c9e3188 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3741,7 +3741,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
memset(&rep, 0, sizeof(xError));
rep.type = X_Error;
- rep.sequenceNumber = client->sequence;
rep.errorCode = errorCode;
rep.majorCode = majorCode;
rep.minorCode = minorCode;
diff --git a/dix/events.c b/dix/events.c
index a00ecd9..39ad400 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1841,7 +1841,6 @@ int
TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
int count, Mask mask, Mask filter, GrabPtr grab)
{
- int i;
int type;
#ifdef DEBUG_EVENTS
@@ -1908,7 +1907,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
{
xEvent release = *pEvents;
release.u.u.type = KeyRelease;
- release.u.u.sequenceNumber = client->sequence;
WriteEventsToClient(client, 1, &release);
#ifdef DEBUG_EVENTS
ErrorF(" (plus fake core release for repeat)");
@@ -1929,7 +1927,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
{
deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents;
release.type = DeviceKeyRelease;
- release.sequenceNumber = client->sequence;
#ifdef DEBUG_EVENTS
ErrorF(" (plus fake xi1 release for repeat)");
#endif
@@ -1943,14 +1940,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
}
}
- type &= 0177;
- if (type != KeymapNotify)
- {
- /* all extension events must have a sequence number */
- for (i = 0; i < count; i++)
- pEvents[i].u.u.sequenceNumber = client->sequence;
- }
-
if (BitIsOn(criticalEvents, type))
{
if (client->smart_priority < SMART_MAX_PRIORITY)
@@ -5672,6 +5661,10 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
if (!pClient || pClient == serverClient || pClient->clientGone)
return;
+ for (i = 0; i < count; i++)
+ if ((events[i].u.u.type & 0x7f) != KeymapNotify)
+ events[i].u.u.sequenceNumber = pClient->sequence;
+
/* Let XKB rewrite the state, as it depends on client preferences. */
XkbFilterEvents(pClient, count, events);
diff --git a/dix/inpututils.c b/dix/inpututils.c
index e3b44fc..8e75372 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -88,7 +88,6 @@ do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
if (!XIShouldNotify(clients[i], dev))
continue;
- core_mn.u.u.sequenceNumber = clients[i]->sequence;
WriteEventsToClient(clients[i], 1, &core_mn);
}
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 9df682e..b971102 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -187,7 +187,6 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
/* unknown swap completion type */
break;
}
- wire.sequenceNumber = client->sequence;
wire.drawable = drawable->drawId;
wire.ust_hi = ust >> 32;
wire.ust_lo = ust & 0xffffffff;
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 0b7f75e..754fe37 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -331,7 +331,6 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
XF86VidModeEventPtr pEv;
unsigned long mask;
xXF86VidModeNotifyEvent ev;
- ClientPtr client;
int kind;
UpdateCurrentTimeIf ();
@@ -343,17 +342,15 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced)
kind = XF86VidModeModeChange;
for (pEv = pPriv->events; pEv; pEv = pEv->next)
{
- client = pEv->client;
if (!(pEv->mask & mask))
continue;
ev.type = XF86VidModeNotify + XF86VidModeEventBase;
ev.state = state;
- ev.sequenceNumber = client->sequence;
ev.timestamp = currentTime.milliseconds;
ev.root = WindowTable[pScreen->myNum]->drawable.id;
ev.kind = kind;
ev.forced = forced;
- WriteEventsToClient (client, 1, (xEvent *) &ev);
+ WriteEventsToClient (pEv->client, 1, (xEvent *) &ev);
}
}
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 444751d..e6d98f5 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -161,7 +161,6 @@ DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv)
ClientPtr client = priv;
event.type = DRI2EventBase + DRI2_InvalidateBuffers;
- event.sequenceNumber = client->sequence;
event.drawable = pDraw->id;
WriteEventsToClient(client, 1, (xEvent *)&event);
@@ -363,7 +362,6 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc,
DrawablePtr pDrawable = data;
event.type = DRI2EventBase + DRI2_BufferSwapComplete;
- event.sequenceNumber = client->sequence;
event.event_type = type;
event.drawable = pDrawable->id;
event.ust_hi = (CARD64)ust >> 32;
diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index 8c248ed..0845f67 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -341,7 +341,6 @@ ProcAppleWMSelectInput (register ClientPtr client)
void
AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
WMEventPtr *pHead, pEvent;
- ClientPtr client;
xAppleWMNotifyEvent se;
int i;
@@ -349,15 +348,13 @@ AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
if (i != Success || !pHead)
return;
for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
- client = pEvent->client;
if ((pEvent->mask & mask) == 0)
continue;
se.type = type + WMEventBase;
se.kind = which;
se.arg = arg;
- se.sequenceNumber = client->sequence;
se.time = currentTime.milliseconds;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ WriteEventsToClient (pEvent->client, 1, (xEvent *) &se);
}
}
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index 0fbe850..3afe244 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -192,22 +192,16 @@ static void surface_notify(
{
DRISurfaceNotifyArg *arg = _arg;
int client_index = (int) x_cvt_vptr_to_uint(data);
- ClientPtr client;
xAppleDRINotifyEvent se;
if (client_index < 0 || client_index >= currentMaxClients)
return;
- client = clients[client_index];
- if (client == NULL)
- return;
-
se.type = DRIEventBase + AppleDRISurfaceNotify;
se.kind = arg->kind;
se.arg = arg->id;
- se.sequenceNumber = client->sequence;
se.time = currentTime.milliseconds;
- WriteEventsToClient (client, 1, (xEvent *) &se);
+ WriteEventsToClient (clients[client_index], 1, (xEvent *) &se);
}
static int
diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c
index b534bd5..99329c3 100755
--- a/hw/xwin/winwindowswm.c
+++ b/hw/xwin/winwindowswm.c
@@ -319,7 +319,6 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg,
se.y = y;
se.w = w;
se.h = h;
- se.sequenceNumber = client->sequence;
se.time = currentTime.milliseconds;
WriteEventsToClient (client, 1, (xEvent *) &se);
}
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 8543535..95e74c5 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -254,7 +254,6 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc)
ce.type = RRNotify + RREventBase;
ce.subCode = RRNotify_CrtcChange;
- ce.sequenceNumber = client->sequence;
ce.timestamp = pScrPriv->lastSetTime.milliseconds;
ce.window = pWin->drawable.id;
ce.crtc = crtc->id;
diff --git a/randr/rroutput.c b/randr/rroutput.c
index e9ab2b9..445c318 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -337,7 +337,6 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output)
oe.type = RRNotify + RREventBase;
oe.subCode = RRNotify_OutputChange;
- oe.sequenceNumber = client->sequence;
oe.timestamp = pScrPriv->lastSetTime.milliseconds;
oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
oe.window = pWin->drawable.id;
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 3aab37a..5e37577 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -40,7 +40,6 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
if (!(pRREvent->mask & RROutputPropertyNotifyMask))
continue;
- event->sequenceNumber = pRREvent->client->sequence;
event->window = pRREvent->window->drawable.id;
WriteEventsToClient(pRREvent->client, 1, (xEvent *)event);
}
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 051d514..a940f8a 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -102,13 +102,11 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen)
se.type = RRScreenChangeNotify + RREventBase;
se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0);
se.timestamp = pScrPriv->lastSetTime.milliseconds;
- se.sequenceNumber = client->sequence;
se.configTimestamp = pScrPriv->lastConfigTime.milliseconds;
se.root = pRoot->drawable.id;
se.window = pWin->drawable.id;
se.subpixelOrder = PictureGetSubpixelOrder (pScreen);
- se.sequenceNumber = client->sequence;
se.sizeID = RR10CurrentSizeID (pScreen);
if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) {
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index e963069..e963e37 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -169,7 +169,6 @@ CursorDisplayCursor (DeviceIntPtr pDev,
xXFixesCursorNotifyEvent ev;
ev.type = XFixesEventBase + XFixesCursorNotify;
ev.subtype = XFixesDisplayCursorNotify;
- ev.sequenceNumber = e->pClient->sequence;
ev.window = e->pWindow->drawable.id;
ev.cursorSerial = pCursor->serialNumber;
ev.timestamp = currentTime.milliseconds;
diff --git a/xfixes/select.c b/xfixes/select.c
index ffd1c69..3aa26d3 100644
--- a/xfixes/select.c
+++ b/xfixes/select.c
@@ -85,7 +85,6 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
ev.type = XFixesEventBase + XFixesSelectionNotify;
ev.subtype = subtype;
- ev.sequenceNumber = e->pClient->sequence;
ev.window = e->pWindow->drawable.id;
if (subtype == XFixesSetSelectionOwnerNotify)
ev.owner = selection->window;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 0a6a76c..8028502 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -102,7 +102,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed,
if (!XIShouldNotify(clients[i], kbd))
continue;
- core_mn.u.u.sequenceNumber = clients[i]->sequence;
if (keymap_changed) {
core_mn.u.mappingNotify.request = MappingKeyboard;
--
1.7.0
More information about the xorg-devel
mailing list