summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-15 13:12:44 -0700
committerJamey Sharp <jamey@minilop.net>2010-05-19 12:32:34 -0700
commit8033fb6c9792820a82fbdff6a14ff8a7a141ba74 (patch)
tree8e9d073e08028f46e5b8c725a029bc8f41c216fc
parent4b9600a4167427a8fe88bca9b738c9a99cac9469 (diff)
Set event sequence number in WriteEventsToClient instead of at callers.
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@minilop.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--Xext/saver.c5
-rw-r--r--Xext/security.c4
-rw-r--r--Xext/shape.c5
-rw-r--r--Xext/shm.c1
-rw-r--r--Xext/sync.c5
-rw-r--r--Xext/xcalibrate.c1
-rw-r--r--Xext/xvdisp.c1
-rw-r--r--damageext/damageext.c1
-rw-r--r--dix/dispatch.c1
-rw-r--r--dix/events.c15
-rw-r--r--dix/inpututils.c1
-rw-r--r--glx/glxdri2.c1
-rw-r--r--hw/xfree86/dixmods/extmod/xf86vmode.c5
-rw-r--r--hw/xfree86/dri2/dri2ext.c2
-rw-r--r--hw/xquartz/applewm.c5
-rw-r--r--hw/xquartz/xpr/appledri.c8
-rwxr-xr-xhw/xwin/winwindowswm.c1
-rw-r--r--randr/rrcrtc.c1
-rw-r--r--randr/rroutput.c1
-rw-r--r--randr/rrproperty.c1
-rw-r--r--randr/rrscreen.c2
-rw-r--r--xfixes/cursor.c1
-rw-r--r--xfixes/select.c1
-rw-r--r--xkb/xkbEvents.c1
24 files changed, 10 insertions, 60 deletions
diff --git a/Xext/saver.c b/Xext/saver.c
index 42fc6328b..30c4a8c9b 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 16aac05e4..32730e20d 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 10437f496..10ac2839c 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 25043fadc..b2c42083e 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 3729f1bf2..f7ac405dd 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 865938497..bff1c3168 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 fd633f1f9..250a9949a 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 c80554ec5..d9234345b 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 fe9ddb2a8..c9e3188cc 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 a00ecd9fa..39ad4007c 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 e3b44fc08..8e7537250 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 9df682e71..b971102d8 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 0b7f75e88..754fe372c 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 444751d51..e6d98f53b 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 8c248edf0..0845f67f0 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 0fbe850a6..3afe2443c 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 b534bd515..99329c383 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 854353533..95e74c5d8 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 e9ab2b904..445c31827 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 3aab37afd..5e37577b8 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 051d51410..a940f8aae 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 e963069fc..e963e3740 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 ffd1c6919..3aa26d365 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 0a6a76c10..8028502b9 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;