diff options
author | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
commit | 6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab (patch) | |
tree | 21e1af7ee94600e349ae21353dc11963a06e988d /xorg-server/dix | |
parent | 75f57cf199b6c042b0f7515e3a1ab80f7ccecfab (diff) | |
parent | d137057fd13e83ec15ab416c7fe774741da06047 (diff) | |
download | vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.gz vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.bz2 vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/shm.c
xorg-server/Xext/sync.c
xorg-server/Xext/xf86bigfont.c
xorg-server/Xi/opendev.c
xorg-server/dix/dispatch.c
xorg-server/include/globals.h
xorg-server/mi/miinitext.c
Diffstat (limited to 'xorg-server/dix')
-rw-r--r-- | xorg-server/dix/colormap.c | 22 | ||||
-rw-r--r-- | xorg-server/dix/devices.c | 63 | ||||
-rw-r--r-- | xorg-server/dix/dispatch.c | 175 | ||||
-rw-r--r-- | xorg-server/dix/dixfonts.c | 4 | ||||
-rw-r--r-- | xorg-server/dix/enterleave.c | 10 | ||||
-rw-r--r-- | xorg-server/dix/events.c | 57 | ||||
-rw-r--r-- | xorg-server/dix/extension.c | 5 | ||||
-rw-r--r-- | xorg-server/dix/grabs.c | 5 | ||||
-rw-r--r-- | xorg-server/dix/inpututils.c | 1 | ||||
-rw-r--r-- | xorg-server/dix/pixmap.c | 135 | ||||
-rw-r--r-- | xorg-server/dix/privates.c | 5 | ||||
-rw-r--r-- | xorg-server/dix/property.c | 43 | ||||
-rw-r--r-- | xorg-server/dix/selection.c | 8 | ||||
-rw-r--r-- | xorg-server/dix/swaprep.c | 88 | ||||
-rw-r--r-- | xorg-server/dix/swapreq.c | 1 | ||||
-rw-r--r-- | xorg-server/dix/window.c | 117 |
16 files changed, 492 insertions, 247 deletions
diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c index 02937fb72..c3078503a 100644 --- a/xorg-server/dix/colormap.c +++ b/xorg-server/dix/colormap.c @@ -454,15 +454,15 @@ FreeColormap(pointer value, XID mid) static int TellNoMap(WindowPtr pwin, Colormap * pmid) { - xEvent xE; - if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ - xE.u.u.type = ColormapNotify; + xEvent xE; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = None; xE.u.colormap.new = TRUE; xE.u.colormap.state = ColormapUninstalled; + + xE.u.u.type = ColormapNotify; #ifdef PANORAMIX if (noPanoramiXExtension || !pwin->drawable.pScreen->myNum) #endif @@ -481,7 +481,6 @@ int TellLostMap(WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *) value; - xEvent xE; #ifdef PANORAMIX if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum) @@ -489,11 +488,13 @@ TellLostMap(WindowPtr pwin, pointer value) #endif if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ - xE.u.u.type = ColormapNotify; + xEvent xE; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapUninstalled; + + xE.u.u.type = ColormapNotify; DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL); } @@ -505,7 +506,6 @@ int TellGainedMap(WindowPtr pwin, pointer value) { Colormap *pmid = (Colormap *) value; - xEvent xE; #ifdef PANORAMIX if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum) @@ -513,11 +513,13 @@ TellGainedMap(WindowPtr pwin, pointer value) #endif if (wColormap(pwin) == *pmid) { /* This should be call to DeliverEvent */ - xE.u.u.type = ColormapNotify; + xEvent xE; xE.u.colormap.window = pwin->drawable.id; xE.u.colormap.colormap = *pmid; xE.u.colormap.new = FALSE; xE.u.colormap.state = ColormapInstalled; + + xE.u.u.type = ColormapNotify; DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL); } @@ -580,7 +582,7 @@ CopyFree(int channel, int client, ColormapPtr pmapSrc, ColormapPtr pmapDst) int nalloc; switch (channel) { - default: /* so compiler can see that everything gets initialized */ + default: /* so compiler can see that everything gets initialized */ case REDMAP: ppix = (pmapSrc->clientPixelsRed)[client]; npix = (pmapSrc->numPixelsRed)[client]; @@ -657,7 +659,7 @@ FreeCell(ColormapPtr pmap, Pixel i, int channel) int *pCount; switch (channel) { - default: /* so compiler can see that everything gets initialized */ + default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: case REDMAP: pent = (EntryPtr) & pmap->red[i]; @@ -2150,7 +2152,7 @@ FreeCo(ColormapPtr pmap, int client, int color, int npixIn, Pixel * ppixIn, ppixClient = pmap->clientPixelsBlue[client]; npixClient = pmap->numPixelsBlue[client]; break; - default: /* so compiler can see that everything gets initialized */ + default: /* so compiler can see that everything gets initialized */ case PSEUDOMAP: cmask = ~((Pixel) 0); rgbbad = 0; diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 49b33041b..b9225a195 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -1674,9 +1674,10 @@ ProcSetModifierMapping(ClientPtr client) bytes_to_int32(sizeof(xSetModifierMappingReq)))) return BadLength; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1], stuff->numKeyPerModifier); @@ -1712,7 +1713,7 @@ ProcGetModifierMapping(ClientPtr client) rep.length = max_keys_per_mod << 1; WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); - (void) WriteToClient(client, max_keys_per_mod * 8, (char *) modkeymap); + WriteToClient(client, max_keys_per_mod * 8, modkeymap); free(modkeymap); @@ -1793,10 +1794,13 @@ ProcSetPointerMapping(ClientPtr client) if (client->req_len != bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts)) return BadLength; + + rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; rep.success = MappingSuccess; + rep.sequenceNumber = client->sequence; + rep.length = 0; + map = (BYTE *) &stuff[1]; /* So we're bounded here by the number of core buttons. This check @@ -1867,10 +1871,11 @@ ProcGetKeyboardMapping(ClientPtr client) memset(&rep, 0, sizeof(xGetKeyboardMappingReply)); rep.type = X_Reply; - rep.sequenceNumber = client->sequence; rep.keySymsPerKeyCode = syms->mapWidth; + rep.sequenceNumber = client->sequence; /* length is a count of 4 byte quantities and KeySyms are 4 bytes */ rep.length = syms->mapWidth * stuff->count; + WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; WriteSwappedDataToClient(client, @@ -1900,13 +1905,15 @@ ProcGetPointerMapping(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.sequenceNumber = client->sequence; rep.nElts = (butc) ? butc->numButtons : 0; + rep.sequenceNumber = client->sequence; rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4; + WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); if (butc) - WriteToClient(client, (int) rep.nElts, (char *) &butc->map[1]); + WriteToClient(client, (int) rep.nElts, &butc->map[1]); return Success; } @@ -2152,15 +2159,17 @@ ProcGetKeyboardControl(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 5; - rep.sequenceNumber = client->sequence; rep.globalAutoRepeat = ctrl->autoRepeat; + rep.sequenceNumber = client->sequence; + rep.length = 5; + rep.ledMask = ctrl->leds; rep.keyClickPercent = ctrl->click; rep.bellPercent = ctrl->bell; rep.bellPitch = ctrl->bell_pitch; rep.bellDuration = ctrl->bell_duration; - rep.ledMask = ctrl->leds; + for (i = 0; i < 32; i++) rep.map[i] = ctrl->autoRepeats[i]; WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep); @@ -2295,12 +2304,14 @@ ProcGetPointerControl(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; - rep.threshold = ctrl->threshold; + rep.length = 0; rep.accelNumerator = ctrl->num; rep.accelDenominator = ctrl->den; + rep.threshold = ctrl->threshold; + WriteReplyToClient(client, sizeof(xGenericReply), &rep); return Success; } @@ -2344,8 +2355,10 @@ ProcGetMotionEvents(ClientPtr client) if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); + rep.type = X_Reply; rep.sequenceNumber = client->sequence; + nEvents = 0; start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); @@ -2393,20 +2406,22 @@ ProcQueryKeymap(ClientPtr client) CARD8 *down = keybd->key->down; REQUEST_SIZE_MATCH(xReq); + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 2; rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess); - if (rc != Success && rc != BadAccess) + /* If rc is Success, we're allowed to copy out the keymap. + * If it's BadAccess, we leave it empty & lie to the client. + */ + if (rc == Success) { + for (i = 0; i < 32; i++) + rep.map[i] = down[i]; + } + else if (rc != BadAccess) return rc; - for (i = 0; i < 32; i++) - rep.map[i] = down[i]; - - if (rc == BadAccess) - memset(rep.map, 0, 32); - WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep); return Success; @@ -2440,18 +2455,16 @@ RecalculateMasterButtons(DeviceIntPtr slave) if (master->button && master->button->numButtons != maxbuttons) { int i; - DeviceChangedEvent event; - - memset(&event, 0, sizeof(event)); - - master->button->numButtons = maxbuttons; - + DeviceChangedEvent event; memset(&event, 0, sizeof(event)); event.header = ET_Internal; event.type = ET_DeviceChanged; event.time = GetTimeInMillis(); event.deviceid = master->id; event.flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE; event.buttons.num_buttons = maxbuttons; + + master->button->numButtons = maxbuttons; + memcpy(&event.buttons.names, master->button->labels, maxbuttons * sizeof(Atom)); diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index c1ffcb07c..9b9aa3552 100644 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -500,8 +500,6 @@ Dispatch(void) static int VendorRelease = VENDOR_RELEASE;
static char *VendorString = VENDOR_NAME;
-static const int padlength[4] = { 0, 3, 2, 1 };
-
void
SetVendorRelease(int release)
{
@@ -562,7 +560,7 @@ CreateConnectionBlock(void) memmove(pBuf, VendorString, (int) setup.nbytesVendor);
sizesofar += setup.nbytesVendor;
pBuf += setup.nbytesVendor;
- i = padlength[setup.nbytesVendor & 3];
+ i = padding_for_int32(setup.nbytesVendor);
sizesofar += i;
while (--i >= 0)
*pBuf++ = 0;
@@ -964,6 +962,7 @@ ProcGetGeometry(ClientPtr client) int status;
memset(&rep, 0, sizeof(xGetGeometryReply));
+ rep.type = X_Reply ;
if ((status = GetGeometry(client, &rep)) != Success)
return status;
@@ -994,12 +993,10 @@ ProcQueryTree(ClientPtr client) return rc;
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply;
- reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
- if (pWin->parent)
- reply.parent = pWin->parent->drawable.id;
- else
- reply.parent = (Window) None;
+ reply.root = pWin->drawable.pScreen->root->drawable.id;
+ reply.parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None;
+
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
#ifdef WIN32
@@ -1050,13 +1047,12 @@ ProcInternAtom(ClientPtr client) tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
if (atom != BAD_RESOURCE) {
- xInternAtomReply reply;
-
- memset(&reply, 0, sizeof(xInternAtomReply));
+ xInternAtomReply reply; memset(&reply, 0, sizeof(xInternAtomReply));
reply.type = X_Reply;
- reply.length = 0;
reply.sequenceNumber = client->sequence;
+ reply.length = 0;
reply.atom = atom;
+
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
return Success;
}
@@ -1068,21 +1064,20 @@ int ProcGetAtomName(ClientPtr client)
{
const char *str;
- xGetAtomNameReply reply;
- int len;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
if ((str = NameForAtom(stuff->id))) {
- len = strlen(str);
+ xGetAtomNameReply reply;
+ int len = strlen(str);
memset(&reply, 0, sizeof(xGetAtomNameReply));
reply.type = X_Reply;
- reply.length = bytes_to_int32(len);
reply.sequenceNumber = client->sequence;
+ reply.length = bytes_to_int32(len);
reply.nameLength = len;
WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
- (void) WriteToClient(client, len, str);
+ WriteToClient(client, len, str);
return Success;
}
else {
@@ -1172,8 +1167,9 @@ ProcTranslateCoords(ClientPtr client) return rc;
memset(&rep, 0, sizeof(xTranslateCoordsReply));
rep.type = X_Reply;
- rep.length = 0;
rep.sequenceNumber = client->sequence;
+ rep.length = 0;
+
if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
rep.sameScreen = xFalse;
rep.child = None;
@@ -1335,10 +1331,11 @@ ProcQueryTextExtents(ClientPtr client) }
if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
return BadAlloc;
+
reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
reply.drawDirection = info.drawDirection;
+ reply.sequenceNumber = client->sequence;
+ reply.length = 0;
reply.fontAscent = info.fontAscent;
reply.fontDescent = info.fontDescent;
reply.overallAscent = info.overallAscent;
@@ -1346,6 +1343,7 @@ ProcQueryTextExtents(ClientPtr client) reply.overallWidth = info.overallWidth;
reply.overallLeft = info.overallLeft;
reply.overallRight = info.overallRight;
+
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
return Success;
}
@@ -2190,8 +2188,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, BitsPerPixel(pDraw->depth), ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void) WriteToClient(client,
- (int) (nlines * widthBytesLine), pBuf);
+ WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
}
linesDone += nlines;
}
@@ -2226,9 +2223,8 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, 1, ClientOrder(client));
/* Don't split me, gcc pukes when you do */
- (void) WriteToClient(client,
- (int) (nlines * widthBytesLine),
- pBuf);
+ WriteToClient(client, (int) (nlines * widthBytesLine),
+ pBuf);
}
linesDone += nlines;
}
@@ -2515,7 +2511,6 @@ ProcAllocColor(ClientPtr client) {
ColormapPtr pmap;
int rc;
- xAllocColorReply acr;
REQUEST(xAllocColorReq);
@@ -2523,9 +2518,10 @@ ProcAllocColor(ClientPtr client) rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
+ xAllocColorReply acr;
acr.type = X_Reply;
- acr.length = 0;
acr.sequenceNumber = client->sequence;
+ acr.length = 0;
acr.red = stuff->red;
acr.green = stuff->green;
acr.blue = stuff->blue;
@@ -2559,10 +2555,9 @@ ProcAllocNamedColor(ClientPtr client) client, DixAddAccess);
if (rc == Success) {
xAllocNamedColorReply ancr;
-
ancr.type = X_Reply;
- ancr.length = 0;
ancr.sequenceNumber = client->sequence;
+ ancr.length = 0;
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
@@ -2604,7 +2599,6 @@ ProcAllocColorCells(ClientPtr client) rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- xAllocColorCellsReply accr;
int npixels, nmasks;
long length;
Pixel *ppixels, *pmasks;
@@ -2634,9 +2628,10 @@ ProcAllocColorCells(ClientPtr client) if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
{
+ xAllocColorCellsReply accr;
accr.type = X_Reply;
- accr.length = bytes_to_int32(length);
accr.sequenceNumber = client->sequence;
+ accr.length = bytes_to_int32(length);
accr.nPixels = npixels;
accr.nMasks = nmasks;
WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
@@ -2678,9 +2673,11 @@ ProcAllocColorPlanes(ClientPtr client) client->errorValue = stuff->contiguous;
return BadValue;
}
+
acpr.type = X_Reply;
acpr.sequenceNumber = client->sequence;
acpr.nPixels = npixels;
+
length = (long) npixels *sizeof(Pixel);
ppixels = malloc(length);
@@ -2820,9 +2817,10 @@ ProcQueryColors(ClientPtr client) }
memset(&qcr, 0, sizeof(xQueryColorsReply));
qcr.type = X_Reply;
- qcr.length = bytes_to_int32(count * sizeof(xrgb));
qcr.sequenceNumber = client->sequence;
+ qcr.length = bytes_to_int32(count * sizeof(xrgb));
qcr.nColors = count;
+
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
@@ -2850,17 +2848,22 @@ ProcLookupColor(ClientPtr client) rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixReadAccess);
if (rc == Success) {
- xLookupColorReply lcr;
+ CARD16 exactRed, exactGreen, exactBlue;
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
- &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) {
+ &exactRed, &exactGreen, &exactBlue)) {
+ xLookupColorReply lcr;
lcr.type = X_Reply;
- lcr.length = 0;
lcr.sequenceNumber = client->sequence;
- lcr.screenRed = lcr.exactRed;
- lcr.screenGreen = lcr.exactGreen;
- lcr.screenBlue = lcr.exactBlue;
+ lcr.length = 0;
+ lcr.exactRed = exactRed;
+ lcr.exactGreen = exactGreen;
+ lcr.exactBlue = exactBlue;
+ lcr.screenRed = exactRed;
+ lcr.screenGreen = exactGreen;
+ lcr.screenBlue = exactBlue;
+
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
&lcr.screenGreen,
&lcr.screenBlue, pcmp->pVisual);
@@ -3042,10 +3045,11 @@ ProcQueryBestSize(ClientPtr client) &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply));
reply.type = X_Reply;
- reply.length = 0;
reply.sequenceNumber = client->sequence;
+ reply.length = 0;
reply.width = stuff->width;
reply.height = stuff->height;
+
WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
return Success;
}
@@ -3125,13 +3129,15 @@ ProcGetScreenSaver(ClientPtr client) return rc;
}
+
rep.type = X_Reply;
- rep.length = 0;
rep.sequenceNumber = client->sequence;
+ rep.length = 0;
rep.timeout = ScreenSaverTime / MILLI_PER_SECOND;
rep.interval = ScreenSaverInterval / MILLI_PER_SECOND;
rep.preferBlanking = ScreenSaverBlanking;
rep.allowExposures = ScreenSaverAllowExposures;
+
WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
return Success;
}
@@ -3158,6 +3164,7 @@ ProcListHosts(ClientPtr client) {
xListHostsReply reply;
int len, nHosts, result;
+ BOOL enabled;
pointer pdata;
/* REQUEST(xListHostsReq); */
@@ -3169,13 +3176,17 @@ ProcListHosts(ClientPtr client) if (result != Success)
return result;
- result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
+ result = GetHosts(&pdata, &nHosts, &len, &enabled);
if (result != Success)
return result;
+
+
reply.type = X_Reply;
+ reply.enabled = enabled;
reply.sequenceNumber = client->sequence;
- reply.nHosts = nHosts;
reply.length = bytes_to_int32(len);
+ reply.nHosts = nHosts;
+
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts) {
client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
@@ -3290,6 +3301,7 @@ ProcGetFontPath(ClientPtr client) if (rc != Success)
return rc;
+
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = bytes_to_int32(stringLens + numpaths);
@@ -3297,8 +3309,7 @@ ProcGetFontPath(ClientPtr client) WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
if (stringLens || numpaths)
- (void) WriteToClient(client, stringLens + numpaths,
- (char *) bufferStart);
+ WriteToClient(client, stringLens + numpaths, bufferStart);
return Success;
}
@@ -3570,8 +3581,8 @@ SendConnSetup(ClientPtr client, const char *reason) if (client->swapped)
WriteSConnSetupPrefix(client, &csp);
else
- (void) WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
- (void) WriteToClient(client, (int) csp.lengthReason, reason);
+ WriteToClient(client, sz_xConnSetupPrefix, &csp);
+ WriteToClient(client, (int) csp.lengthReason, reason);
return client->noClientException = -1;
}
@@ -3624,10 +3635,9 @@ SendConnSetup(ClientPtr client, const char *reason) lConnectionInfo);
}
else {
- (void) WriteToClient(client, sizeof(xConnSetupPrefix),
- (char *) lconnSetupPrefix);
- (void) WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
- lConnectionInfo);
+ WriteToClient(client, sizeof(xConnSetupPrefix), lconnSetupPrefix);
+ WriteToClient(client, (int) (lconnSetupPrefix->length << 2),
+ lConnectionInfo);
}
client->clientState = ClientStateRunning;
if (ClientStateCallback) {
@@ -3670,14 +3680,12 @@ void SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
XID resId, int errorCode)
{
- xError rep;
-
- memset(&rep, 0, sizeof(xError));
+ xError rep; memset(&rep, 0, sizeof(xError));
rep.type = X_Error;
rep.errorCode = errorCode;
- rep.majorCode = majorCode;
- rep.minorCode = minorCode;
rep.resourceID = resId;
+ rep.minorCode = minorCode;
+ rep.majorCode = majorCode;
WriteEventsToClient(client, 1, (xEvent *) &rep);
}
@@ -3789,6 +3797,11 @@ static int init_screen(ScreenPtr pScreen, int i, Bool gpu) pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
+ xorg_list_init(&pScreen->pixmap_dirty_list);
+ xorg_list_init(&pScreen->unattached_list);
+ xorg_list_init(&pScreen->output_slave_list);
+ xorg_list_init(&pScreen->offload_slave_list);
+
/*
* This loop gets run once for every Screen that gets added,
* but thats ok. If the ddx layer initializes the formats
@@ -3936,3 +3949,55 @@ RemoveGPUScreen(ScreenPtr pScreen) free(pScreen);
}
+
+void
+AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+ assert(new->isGPU);
+ assert(!new->current_master);
+ xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
+ new->current_master = pScreen;
+}
+
+void
+DetachUnboundGPU(ScreenPtr slave)
+{
+ assert(slave->isGPU);
+ xorg_list_del(&slave->unattached_head);
+ slave->current_master = NULL;
+}
+
+void
+AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+ assert(new->isGPU);
+ assert(!new->current_master);
+ xorg_list_add(&new->output_head, &pScreen->output_slave_list);
+ new->current_master = pScreen;
+}
+
+void
+DetachOutputGPU(ScreenPtr slave)
+{
+ assert(slave->isGPU);
+ xorg_list_del(&slave->output_head);
+ slave->current_master = NULL;
+}
+
+void
+AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+ assert(new->isGPU);
+ assert(!new->current_master);
+ xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
+ new->current_master = pScreen;
+}
+
+void
+DetachOffloadGPU(ScreenPtr slave)
+{
+ assert(slave->isGPU);
+ xorg_list_del(&slave->offload_head);
+ slave->current_master = NULL;
+}
+
diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c index aefd612fc..4feca742f 100644 --- a/xorg-server/dix/dixfonts.c +++ b/xorg-server/dix/dixfonts.c @@ -795,7 +795,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c) reply.length = bytes_to_int32(stringLens + nnames); client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); - (void) WriteToClient(client, stringLens + nnames, bufferStart); + WriteToClient(client, stringLens + nnames, bufferStart); free(bufferStart); bail: @@ -1041,7 +1041,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) pFP++; } WriteSwappedDataToClient(client, length, reply); - (void) WriteToClient(client, namelen, name); + WriteToClient(client, namelen, name); if (pFontInfo == &fontInfo) { free(fontInfo.props); free(fontInfo.isStringProp); diff --git a/xorg-server/dix/enterleave.c b/xorg-server/dix/enterleave.c index 761ab3b9f..765cfb0ea 100644 --- a/xorg-server/dix/enterleave.c +++ b/xorg-server/dix/enterleave.c @@ -827,6 +827,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, free(xi2event); /* XI 1.x event */ + event.deviceid = dev->id; event.mode = mode; event.type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut; @@ -1246,7 +1247,8 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr exclude) * Assumption: Neither A nor B are valid windows. */ static void -CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */ +CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, + WindowPtr A, /* PointerRootWin or NoneWin */ WindowPtr B, /* NoneWin or PointerRootWin */ int mode) { @@ -1290,7 +1292,8 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A, /* PointerRootWi * Assumption: A is a valid window and not PointerRoot or None. */ static void -CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B, /* PointerRootWin or NoneWin */ +CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, + WindowPtr B, /* PointerRootWin or NoneWin */ int mode) { WindowPtr root; @@ -1336,7 +1339,8 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B, * Assumption: B is a valid window and not PointerRoot or None. */ static void -CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */ +CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, + WindowPtr A, /* PointerRootWin or NoneWin */ WindowPtr B, int mode) { WindowPtr root; diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 3361e8316..005db808f 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -698,9 +698,10 @@ ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py) } static void -CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, Bool confineToScreen, /* unused if PanoramiX on */ - ScreenPtr pScreen) -{ /* unused if PanoramiX on */ +CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents, + Bool confineToScreen, /* unused if PanoramiX on */ + ScreenPtr pScreen) /* unused if PanoramiX on */ +{ HotSpot new; SpritePtr pSprite = pDev->spriteInfo->sprite; @@ -4331,6 +4332,7 @@ OtherClientGone(pointer value, XID id) prev = other; } FatalError("client not on event list"); + return BadValue; // to avoid warning } int @@ -4517,11 +4519,13 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse, if ((type == EnterNotify) && (mask & KeymapStateMask)) { xKeymapEvent ke; ClientPtr client = grab ? rClient(grab) : wClient(pWin); + int rc; - if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess)) - memset((char *) &ke.map[0], 0, 31); + rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess); + if (rc == Success) + memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31); else - memmove((char *) &ke.map[0], (char *) &keybd->key->down[1], 31); + memset((char *) &ke.map[0], 0, 31); ke.type = KeymapNotify; if (grab) @@ -4608,12 +4612,11 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse, void CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) { - xEvent event; - - memset(&event, 0, sizeof(xEvent)); - event.u.focus.mode = mode; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = type; event.u.u.detail = detail; + + event.u.focus.mode = mode; event.u.focus.window = pWin->drawable.id; DeliverEventsToWindow(dev, pWin, &event, 1, @@ -4622,11 +4625,13 @@ CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin) ((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) { xKeymapEvent ke; ClientPtr client = wClient(pWin); + int rc; - if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess)) - memset((char *) &ke.map[0], 0, 31); + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); + if (rc == Success) + memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31); else - memmove((char *) &ke.map[0], (char *) &dev->key->down[1], 31); + memset((char *) &ke.map[0], 0, 31); ke.type = KeymapNotify; DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1, @@ -4774,13 +4779,15 @@ ProcGetInputFocus(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; + rep.revertTo = focus->revert; + if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; - rep.revertTo = focus->revert; + WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; } @@ -4800,6 +4807,7 @@ ProcGrabPointer(ClientPtr client) GrabMask mask; WindowPtr confineTo; CursorPtr oldCursor; + BYTE status; REQUEST(xGrabPointerReq); int rc; @@ -4821,7 +4829,6 @@ ProcGrabPointer(ClientPtr client) return rc; } - memset(&rep, 0, sizeof(xGrabPointerReply)); oldCursor = NullCursor; grab = device->deviceGrab.grab; @@ -4836,14 +4843,16 @@ ProcGrabPointer(ClientPtr client) rc = GrabDevice(client, device, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, - &mask, CORE, stuff->cursor, stuff->confineTo, &rep.status); + &mask, CORE, stuff->cursor, stuff->confineTo, &status); if (rc != Success) return rc; - if (oldCursor && rep.status == GrabSuccess) + if (oldCursor && status == GrabSuccess) FreeCursor(oldCursor, (Cursor) 0); + memset(&rep, 0, sizeof(xGrabPointerReply)); rep.type = X_Reply; + rep.status = status; rep.sequenceNumber = client->sequence; rep.length = 0; WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); @@ -5062,6 +5071,7 @@ int ProcGrabKeyboard(ClientPtr client) { xGrabKeyboardReply rep; + BYTE status; REQUEST(xGrabKeyboardReq); int result; @@ -5070,17 +5080,19 @@ ProcGrabKeyboard(ClientPtr client) REQUEST_SIZE_MATCH(xGrabKeyboardReq); - memset(&rep, 0, sizeof(xGrabKeyboardReply)); mask.core = KeyPressMask | KeyReleaseMask; result = GrabDevice(client, keyboard, stuff->pointerMode, stuff->keyboardMode, stuff->grabWindow, stuff->ownerEvents, stuff->time, &mask, CORE, None, - None, &rep.status); + None, &status); if (result != Success) return result; + + memset(&rep, 0, sizeof(xGrabKeyboardReply)); rep.type = X_Reply; + rep.status = status, rep.sequenceNumber = client->sequence; rep.length = 0; WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); @@ -5148,12 +5160,13 @@ ProcQueryPointer(ClientPtr client) memset(&rep, 0, sizeof(xQueryPointerReply)); rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.mask = event_get_corestate(mouse, keyboard); rep.length = 0; + rep.mask = event_get_corestate(mouse, keyboard); rep.root = (GetCurrentRootWindow(mouse))->drawable.id; rep.rootX = pSprite->hot.x; rep.rootY = pSprite->hot.y; rep.child = None; + if (pSprite->hot.pScreen == pWin->drawable.pScreen) { rep.sameScreen = xTrue; rep.winX = pSprite->hot.x - pWin->drawable.x; @@ -5905,14 +5918,14 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) (*EventSwapVector[eventFrom->u.u.type & 0177]) (eventFrom, eventTo); - WriteToClient(pClient, eventlength, (char *) eventTo); + WriteToClient(pClient, eventlength, eventTo); } } else { /* only one GenericEvent, remember? that means either count is 1 and * eventlength is arbitrary or eventlength is 32 and count doesn't * matter. And we're all set. Woohoo. */ - WriteToClient(pClient, count * eventlength, (char *) events); + WriteToClient(pClient, count * eventlength, events); } } diff --git a/xorg-server/dix/extension.c b/xorg-server/dix/extension.c index 3cdfb5152..bdbbf014c 100644 --- a/xorg-server/dix/extension.c +++ b/xorg-server/dix/extension.c @@ -254,9 +254,9 @@ ProcQueryExtension(ClientPtr client) memset(&reply, 0, sizeof(xQueryExtensionReply)); reply.type = X_Reply; + reply.sequenceNumber = client->sequence; reply.length = 0; reply.major_opcode = 0; - reply.sequenceNumber = client->sequence; if (!NumExtensions) reply.present = xFalse; @@ -287,8 +287,9 @@ ProcListExtensions(ClientPtr client) memset(&reply, 0, sizeof(xListExtensionsReply)); reply.type = X_Reply; reply.nExtensions = 0; - reply.length = 0; reply.sequenceNumber = client->sequence; + reply.length = 0; + buffer = NULL; if (NumExtensions) { diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c index b775f117d..83e18e263 100644 --- a/xorg-server/dix/grabs.c +++ b/xorg-server/dix/grabs.c @@ -204,7 +204,10 @@ AllocGrab(void) } GrabPtr -CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice, WindowPtr window, enum InputLevel grabtype, GrabMask *mask, GrabParameters *param, int type, KeyCode keybut, /* key or button */ +CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice, + WindowPtr window, enum InputLevel grabtype, GrabMask *mask, + GrabParameters *param, int type, + KeyCode keybut, /* key or button */ WindowPtr confineTo, CursorPtr cursor) { GrabPtr grab; diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c index 223d547c5..3136a6dd3 100644 --- a/xorg-server/dix/inpututils.c +++ b/xorg-server/dix/inpututils.c @@ -93,6 +93,7 @@ do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) WriteEventsToClient(clients[i], 1, &core_mn); } + xi_mn.type = DeviceMappingNotify; xi_mn.request = MappingPointer; xi_mn.deviceid = dev->id; diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c index 0c85c3fb1..9163e99eb 100644 --- a/xorg-server/dix/pixmap.c +++ b/xorg-server/dix/pixmap.c @@ -129,3 +129,138 @@ FreePixmap(PixmapPtr pPixmap) dixFiniPrivates(pPixmap, PRIVATE_PIXMAP); free(pPixmap); } + +PixmapPtr PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave) +{ + PixmapPtr spix; + int ret; + void *handle; + ScreenPtr master = pixmap->drawable.pScreen; + int depth = pixmap->drawable.depth; + + ret = master->SharePixmapBacking(pixmap, slave, &handle); + if (ret == FALSE) + return NULL; + + spix = slave->CreatePixmap(slave, 0, 0, depth, + CREATE_PIXMAP_USAGE_SHARED); + slave->ModifyPixmapHeader(spix, pixmap->drawable.width, + pixmap->drawable.height, depth, 0, + pixmap->devKind, NULL); + + spix->master_pixmap = pixmap; + + ret = slave->SetSharedPixmapBacking(spix, handle); + if (ret == FALSE) { + slave->DestroyPixmap(spix); + return NULL; + } + + return spix; +} + +Bool +PixmapStartDirtyTracking(PixmapPtr src, + PixmapPtr slave_dst, + int x, int y) +{ + ScreenPtr screen = src->drawable.pScreen; + PixmapDirtyUpdatePtr dirty_update; + + dirty_update = calloc(1, sizeof(PixmapDirtyUpdateRec)); + if (!dirty_update) + return FALSE; + + dirty_update->src = src; + dirty_update->slave_dst = slave_dst; + dirty_update->x = x; + dirty_update->y = y; + + dirty_update->damage = DamageCreate(NULL, NULL, + DamageReportNone, + TRUE, src->drawable.pScreen, + src->drawable.pScreen); + if (!dirty_update->damage) { + free(dirty_update); + return FALSE; + } + + DamageRegister(&src->drawable, dirty_update->damage); + xorg_list_add(&dirty_update->ent, &screen->pixmap_dirty_list); + return TRUE; +} + +Bool +PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst) +{ + ScreenPtr screen = src->drawable.pScreen; + PixmapDirtyUpdatePtr ent, safe; + + xorg_list_for_each_entry_safe(ent, safe, &screen->pixmap_dirty_list, ent) { + if (ent->src == src && ent->slave_dst == slave_dst) { + DamageUnregister(&src->drawable, ent->damage); + DamageDestroy(ent->damage); + xorg_list_del(&ent->ent); + free(ent); + } + } + return TRUE; +} + +/* + * this function can possibly be improved and optimised, by clipping + * instead of iterating + */ +Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region) +{ + ScreenPtr pScreen = dirty->src->drawable.pScreen; + int n; + BoxPtr b; + RegionPtr region = DamageRegion(dirty->damage); + GCPtr pGC; + PixmapPtr dst; + SourceValidateProcPtr SourceValidate; + + /* + * SourceValidate is used by the software cursor code + * to pull the cursor off of the screen when reading + * bits from the frame buffer. Bypassing this function + * leaves the software cursor in place + */ + SourceValidate = pScreen->SourceValidate; + pScreen->SourceValidate = NULL; + + RegionTranslate(dirty_region, dirty->x, dirty->y); + RegionIntersect(dirty_region, dirty_region, region); + + if (RegionNil(dirty_region)) { + RegionUninit(dirty_region); + return FALSE; + } + + dst = dirty->slave_dst->master_pixmap; + + RegionTranslate(dirty_region, -dirty->x, -dirty->y); + n = RegionNumRects(dirty_region); + b = RegionRects(dirty_region); + + pGC = GetScratchGC(dirty->src->drawable.depth, pScreen); + ValidateGC(&dst->drawable, pGC); + + while (n--) { + BoxRec dst_box; + int w, h; + + dst_box = *b; + w = dst_box.x2 - dst_box.x1; + h = dst_box.y2 - dst_box.y1; + + pGC->ops->CopyArea(&dirty->src->drawable, &dst->drawable, pGC, + dirty->x + dst_box.x1, dirty->y + dst_box.y1, w, h, dst_box.x1, dst_box.y1); + b++; + } + FreeScratchGC(pGC); + + pScreen->SourceValidate = SourceValidate; + return TRUE; +} diff --git a/xorg-server/dix/privates.c b/xorg-server/dix/privates.c index 497a2396e..6f03bbcdb 100644 --- a/xorg-server/dix/privates.c +++ b/xorg-server/dix/privates.c @@ -342,6 +342,11 @@ grow_screen_specific_set(DevPrivateType type, unsigned bytes) grow_private_set(&pScreen->screenSpecificPrivates[type], bytes); } + for (s = 0; s < screenInfo.numGPUScreens; s++) { + ScreenPtr pScreen = screenInfo.gpuscreens[s]; + + grow_private_set(&pScreen->screenSpecificPrivates[type], bytes); + } } /* diff --git a/xorg-server/dix/property.c b/xorg-server/dix/property.c index b1b83124f..833c3ca59 100644 --- a/xorg-server/dix/property.c +++ b/xorg-server/dix/property.c @@ -108,14 +108,13 @@ dixLookupProperty(PropertyPtr *result, WindowPtr pWin, Atom propertyName, static void deliverPropertyNotifyEvent(WindowPtr pWin, int state, Atom atom) { - xEvent event; - - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = PropertyNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.property.window = pWin->drawable.id; event.u.property.state = state; event.u.property.atom = atom; event.u.property.time = currentTime.milliseconds; + + event.u.u.type = PropertyNotify; DeliverEvents(pWin, &event, 1, (WindowPtr) NULL); } @@ -413,15 +412,17 @@ DeleteAllWindowProperties(WindowPtr pWin) } static int -NullPropertyReply(ClientPtr client, - ATOM propertyType, int format, xGetPropertyReply * reply) +NullPropertyReply(ClientPtr client, ATOM propertyType, int format) { - reply->nItems = 0; - reply->length = 0; - reply->bytesAfter = 0; - reply->propertyType = propertyType; - reply->format = format; - WriteReplyToClient(client, sizeof(xGenericReply), reply); + xGetPropertyReply reply; + reply.type = X_Reply; + reply.format = format; + reply.sequenceNumber = client->sequence; + reply.length = 0; + reply.propertyType = propertyType; + reply.bytesAfter = 0; + reply.nItems = 0; + WriteReplyToClient(client, sizeof(xGenericReply), &reply); return Success; } @@ -470,13 +471,9 @@ ProcGetProperty(ClientPtr client) return BadAtom; } - memset(&reply, 0, sizeof(xGetPropertyReply)); - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - rc = dixLookupProperty(&pProp, pWin, stuff->property, client, prop_mode); if (rc == BadMatch) - return NullPropertyReply(client, None, 0, &reply); + return NullPropertyReply(client, None, 0); else if (rc != Success) return rc; @@ -485,6 +482,9 @@ ProcGetProperty(ClientPtr client) if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType)) ) { + memset(&reply, 0, sizeof(xGetPropertyReply)); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; reply.bytesAfter = pProp->size; reply.format = pProp->format; reply.length = 0; @@ -510,6 +510,9 @@ ProcGetProperty(ClientPtr client) len = min(n - ind, 4 * stuff->longLength); + memset(&reply, 0, sizeof(xGetPropertyReply)); + reply.type = X_Reply; + reply.sequenceNumber = client->sequence, reply.bytesAfter = n - (ind + len); reply.format = pProp->format; reply.length = bytes_to_int32(len); @@ -589,10 +592,12 @@ ProcListProperties(ClientPtr client) } } + xlpr.type = X_Reply; - xlpr.nProperties = numProps; - xlpr.length = bytes_to_int32(numProps * sizeof(Atom)); xlpr.sequenceNumber = client->sequence; + xlpr.length = bytes_to_int32(numProps * sizeof(Atom)); + xlpr.nProperties = numProps; + WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); if (numProps) { client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; diff --git a/xorg-server/dix/selection.c b/xorg-server/dix/selection.c index dfdcfdc64..060afb808 100644 --- a/xorg-server/dix/selection.c +++ b/xorg-server/dix/selection.c @@ -174,8 +174,6 @@ ProcSetSelectionOwner(ClientPtr client) rc = dixLookupSelection(&pSel, stuff->selection, client, DixSetAttrAccess); if (rc == Success) { - xEvent event; - /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return @@ -183,10 +181,12 @@ ProcSetSelectionOwner(ClientPtr client) if (CompareTimeStamps(time, pSel->lastTimeChanged) == EARLIER) return Success; if (pSel->client && (!pWin || (pSel->client != client))) { - event.u.u.type = SelectionClear; + xEvent event; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = pSel->window; event.u.selectionClear.atom = pSel->selection; + + event.u.u.type = SelectionClear; WriteEventsToClient(pSel->client, 1, &event); } } @@ -240,8 +240,8 @@ ProcGetSelectionOwner(ClientPtr client) memset(&reply, 0, sizeof(xGetSelectionOwnerReply)); reply.type = X_Reply; - reply.length = 0; reply.sequenceNumber = client->sequence; + reply.length = 0; rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); if (rc == Success) diff --git a/xorg-server/dix/swaprep.c b/xorg-server/dix/swaprep.c index 9440c4ee3..559fe271e 100644 --- a/xorg-server/dix/swaprep.c +++ b/xorg-server/dix/swaprep.c @@ -80,7 +80,7 @@ Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf) { swapl(&pbuf[i]); } - (void) WriteToClient(pClient, size << 2, (char *) pbuf); + WriteToClient(pClient, size << 2, pbuf); } /** @@ -123,7 +123,7 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) from++; to++; } - (void) WriteToClient(pClient, nbytes, (char *) pbufT); + WriteToClient(pClient, nbytes, pbufT); } if (pbufT != tmpbuf) @@ -170,7 +170,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) from++; to++; } - (void) WriteToClient(pClient, nbytes, (char *) pbufT); + WriteToClient(pClient, nbytes, pbufT); } if (pbufT != tmpbuf) @@ -182,7 +182,7 @@ void SGenericReply(ClientPtr pClient, int size, xGenericReply * pRep) { swaps(&pRep->sequenceNumber); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } /* Extra-large reply */ @@ -200,7 +200,7 @@ SGetWindowAttributesReply(ClientPtr pClient, int size, swapl(&pRep->allEventMasks); swapl(&pRep->yourEventMask); swaps(&pRep->doNotPropagateMask); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -213,7 +213,7 @@ SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply * pRep) swaps(&pRep->width); swaps(&pRep->height); swaps(&pRep->borderWidth); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -224,7 +224,7 @@ SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep) swapl(&pRep->root); swapl(&pRep->parent); swaps(&pRep->nChildren); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -232,7 +232,7 @@ SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->atom); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -241,7 +241,7 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nameLength); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -252,7 +252,7 @@ SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply * pRep) swapl(&pRep->propertyType); swapl(&pRep->bytesAfter); swapl(&pRep->nItems); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -261,7 +261,7 @@ SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nProperties); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -270,7 +270,7 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->owner); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -284,7 +284,7 @@ SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep) swaps(&pRep->winX); swaps(&pRep->winY); swaps(&pRep->mask); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } static void @@ -307,7 +307,7 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep) SwapTimecoord(pRepT); pRepT++; } - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } @@ -317,7 +317,7 @@ SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->nEvents); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -327,7 +327,7 @@ STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep) swapl(&pRep->child); swaps(&pRep->dstX); swaps(&pRep->dstY); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -335,7 +335,7 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->focus); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } /* extra long reply */ @@ -344,7 +344,7 @@ SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply * pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } static void @@ -405,7 +405,7 @@ void SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply * pRep) { SwapFont(pRep, TRUE); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -420,7 +420,7 @@ SQueryTextExtentsReply(ClientPtr pClient, int size, swapl(&pRep->overallWidth); swapl(&pRep->overallLeft); swapl(&pRep->overallRight); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -429,7 +429,7 @@ SListFontsReply(ClientPtr pClient, int size, xListFontsReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nFonts); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -437,7 +437,7 @@ SListFontsWithInfoReply(ClientPtr pClient, int size, xListFontsWithInfoReply * pRep) { SwapFont((xQueryFontReply *) pRep, FALSE); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -446,7 +446,7 @@ SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nPaths); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -455,7 +455,7 @@ SGetImageReply(ClientPtr pClient, int size, xGetImageReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swapl(&pRep->visual); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); /* Fortunately, image doesn't need swapping */ } @@ -466,7 +466,7 @@ SListInstalledColormapsReply(ClientPtr pClient, int size, swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColormaps); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -477,7 +477,7 @@ SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep) swaps(&pRep->green); swaps(&pRep->blue); swapl(&pRep->pixel); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -491,7 +491,7 @@ SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep) swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -501,7 +501,7 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep) swapl(&pRep->length); swaps(&pRep->nPixels); swaps(&pRep->nMasks); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -514,7 +514,7 @@ SAllocColorPlanesReply(ClientPtr pClient, int size, swapl(&pRep->redMask); swapl(&pRep->greenMask); swapl(&pRep->blueMask); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } static void @@ -537,7 +537,7 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb * prgb) SwapRGB(prgbT); prgbT++; } - (void) WriteToClient(pClient, size, (char *) prgb); + WriteToClient(pClient, size, prgb); } void @@ -546,7 +546,7 @@ SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nColors); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -559,7 +559,7 @@ SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep) swaps(&pRep->screenRed); swaps(&pRep->screenGreen); swaps(&pRep->screenBlue); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -568,7 +568,7 @@ SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep) swaps(&pRep->sequenceNumber); swaps(&pRep->width); swaps(&pRep->height); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -576,7 +576,7 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep) { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -585,7 +585,7 @@ SGetKeyboardMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -594,7 +594,7 @@ SGetPointerMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -603,7 +603,7 @@ SGetModifierMappingReply(ClientPtr pClient, int size, { swaps(&pRep->sequenceNumber); swapl(&pRep->length); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -615,7 +615,7 @@ SGetKeyboardControlReply(ClientPtr pClient, int size, swapl(&pRep->ledMask); swaps(&pRep->bellPitch); swaps(&pRep->bellDuration); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -626,7 +626,7 @@ SGetPointerControlReply(ClientPtr pClient, int size, swaps(&pRep->accelNumerator); swaps(&pRep->accelDenominator); swaps(&pRep->threshold); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -635,7 +635,7 @@ SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep) swaps(&pRep->sequenceNumber); swaps(&pRep->timeout); swaps(&pRep->interval); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -651,7 +651,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf) swaps(&host->length); bufT += sizeof(xHostEntry) + pad_to_int32(len); } - (void) WriteToClient(pClient, size, buf); + WriteToClient(pClient, size, buf); } void @@ -660,7 +660,7 @@ SListHostsReply(ClientPtr pClient, int size, xListHostsReply * pRep) swaps(&pRep->sequenceNumber); swapl(&pRep->length); swaps(&pRep->nHosts); - (void) WriteToClient(pClient, size, (char *) pRep); + WriteToClient(pClient, size, pRep); } void @@ -1140,7 +1140,7 @@ WriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) return; } SwapConnSetupInfo(pInfo, pInfoTBase); - (void) WriteToClient(pClient, (int) size, (char *) pInfoTBase); + WriteToClient(pClient, (int) size, pInfoTBase); free(pInfoTBase); } @@ -1160,7 +1160,7 @@ WriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix * pcsp) xConnSetupPrefix cspT; SwapConnSetupPrefix(pcsp, &cspT); - (void) WriteToClient(pClient, sizeof(cspT), (char *) &cspT); + WriteToClient(pClient, sizeof(cspT), &cspT); } /* diff --git a/xorg-server/dix/swapreq.c b/xorg-server/dix/swapreq.c index a896b4b29..6f9d4d891 100644 --- a/xorg-server/dix/swapreq.c +++ b/xorg-server/dix/swapreq.c @@ -296,6 +296,7 @@ SProcSendEvent(ClientPtr client) proc = EventSwapVector[stuff->event.u.u.type & 0177]; if (!proc || proc == NotImplemented) /* no swapping proc; invalid event type? */ return BadValue; + eventT.u.u.type = 0; (*proc) (&stuff->event, &eventT); stuff->event = eventT; diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c index b66080830..efa53aafe 100644 --- a/xorg-server/dix/window.c +++ b/xorg-server/dix/window.c @@ -641,7 +641,6 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, WindowPtr pWin; WindowPtr pHead; ScreenPtr pScreen; - xEvent event; int idepth, ivisual; Bool fOK; DepthPtr pDepth; @@ -828,8 +827,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, } if (SubSend(pParent)) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = CreateNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.createNotify.window = wid; event.u.createNotify.parent = pParent->drawable.id; event.u.createNotify.x = x; @@ -838,6 +836,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w, event.u.createNotify.height = h; event.u.createNotify.borderWidth = bw; event.u.createNotify.override = pWin->overrideRedirect; + + event.u.u.type = CreateNotify; DeliverEvents(pParent, &event, 1, NullWindow); } return pWin; @@ -912,7 +912,6 @@ CrushTree(WindowPtr pWin) { WindowPtr pChild, pSib, pParent; UnrealizeWindowProcPtr UnrealizeWindow; - xEvent event; if (!(pChild = pWin->firstChild)) return; @@ -925,6 +924,7 @@ CrushTree(WindowPtr pWin) while (1) { pParent = pChild->parent; if (SubStrSend(pChild, pParent)) { + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pChild->drawable.id; @@ -961,7 +961,6 @@ DeleteWindow(pointer value, XID wid) { WindowPtr pParent; WindowPtr pWin = (WindowPtr) value; - xEvent event; UnmapWindow(pWin, FALSE); @@ -969,6 +968,7 @@ DeleteWindow(pointer value, XID wid) pParent = pWin->parent; if (wid && pParent && SubStrSend(pWin, pParent)) { + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pWin->drawable.id; @@ -1355,11 +1355,13 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) CheckWindowOptionalNeed(pChild); } - xE.u.u.type = ColormapNotify; + xE.u.colormap.window = pWin->drawable.id; xE.u.colormap.colormap = cmap; xE.u.colormap.new = xTrue; xE.u.colormap.state = IsMapInstalled(cmap, pWin); + + xE.u.u.type = ColormapNotify; DeliverEvents(pWin, &xE, 1, NullWindow); } break; @@ -1747,11 +1749,11 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh) pSib->winGravity, &cwsx, &cwsy); if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) { xEvent event; - - event.u.u.type = GravityNotify; event.u.gravity.window = pSib->drawable.id; event.u.gravity.x = cwsx - wBorderWidth(pSib); event.u.gravity.y = cwsy - wBorderWidth(pSib); + + event.u.u.type = GravityNotify; DeliverEvents(pSib, &event, 1, NullWindow); pSib->origin.x = cwsx; pSib->origin.y = cwsy; @@ -2090,7 +2092,6 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) unsigned short w = pWin->drawable.width, h = pWin->drawable.height, bw = pWin->borderWidth; int rc, action, smode = Above; - xEvent event; if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask)) @@ -2179,30 +2180,25 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = ConfigureRequest; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.configureRequest.window = pWin->drawable.id; - if (mask & CWSibling) - event.u.configureRequest.sibling = sibwid; - else - event.u.configureRequest.sibling = None; - if (mask & CWStackMode) - event.u.u.detail = smode; - else - event.u.u.detail = Above; + event.u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None; event.u.configureRequest.x = x; event.u.configureRequest.y = y; + event.u.configureRequest.width = w; + event.u.configureRequest.height = h; + event.u.configureRequest.borderWidth = bw; + event.u.configureRequest.valueMask = mask; + event.u.configureRequest.parent = pParent->drawable.id; + + event.u.u.type = ConfigureRequest; + event.u.u.detail = (mask & CWStackMode) ? smode : Above; #ifdef PANORAMIX if (!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureRequest.x += screenInfo.screens[0]->x; event.u.configureRequest.y += screenInfo.screens[0]->y; } #endif - event.u.configureRequest.width = w; - event.u.configureRequest.height = h; - event.u.configureRequest.borderWidth = bw; - event.u.configureRequest.valueMask = mask; - event.u.configureRequest.parent = pParent->drawable.id; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) return Success; @@ -2213,13 +2209,12 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) if (size_change && ((pWin->eventMask | wOtherEventMasks(pWin)) & ResizeRedirectMask)) { - xEvent eventT; - - memset(&eventT, 0, sizeof(xEvent)); - eventT.u.u.type = ResizeRequest; + xEvent eventT; memset(&eventT, 0, sizeof(xEvent)); eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.width = w; eventT.u.resizeRequest.height = h; + + eventT.u.u.type = ResizeRequest; if (MaybeDeliverEventsToClient(pWin, &eventT, 1, ResizeRedirectMask, client) == 1) { /* if event is delivered, leave the actual size alone. */ @@ -2270,25 +2265,23 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client) } if (SubStrSend(pWin, pParent)) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = ConfigureNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.configureNotify.window = pWin->drawable.id; - if (pSib) - event.u.configureNotify.aboveSibling = pSib->drawable.id; - else - event.u.configureNotify.aboveSibling = None; + event.u.configureNotify.aboveSibling = pSib ? pSib->drawable.id : None; event.u.configureNotify.x = x; event.u.configureNotify.y = y; + event.u.configureNotify.width = w; + event.u.configureNotify.height = h; + event.u.configureNotify.borderWidth = bw; + event.u.configureNotify.override = pWin->overrideRedirect; + + event.u.u.type = ConfigureNotify; #ifdef PANORAMIX if (!noPanoramiXExtension && (!pParent || !pParent->parent)) { event.u.configureNotify.x += screenInfo.screens[0]->x; event.u.configureNotify.y += screenInfo.screens[0]->y; } #endif - event.u.configureNotify.width = w; - event.u.configureNotify.height = h; - event.u.configureNotify.borderWidth = bw; - event.u.configureNotify.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, NullWindow); } if (mask & CWBorderWidth) { @@ -2361,13 +2354,12 @@ CirculateWindow(WindowPtr pParent, int direction, ClientPtr client) return Success; } + event.u.circulate.window = pWin->drawable.id; event.u.circulate.parent = pParent->drawable.id; event.u.circulate.event = pParent->drawable.id; - if (direction == RaiseLowest) - event.u.circulate.place = PlaceOnTop; - else - event.u.circulate.place = PlaceOnBottom; + event.u.circulate.place = (direction == RaiseLowest) ? + PlaceOnTop : PlaceOnBottom; if (RedirectSend(pParent)) { event.u.u.type = CirculateRequest; @@ -2421,18 +2413,19 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent, UnmapWindow(pWin, FALSE); memset(&event, 0, sizeof(xEvent)); - event.u.u.type = ReparentNotify; event.u.reparent.window = pWin->drawable.id; event.u.reparent.parent = pParent->drawable.id; event.u.reparent.x = x; event.u.reparent.y = y; + event.u.reparent.override = pWin->overrideRedirect; + + event.u.u.type = ReparentNotify; #ifdef PANORAMIX if (!noPanoramiXExtension && !pParent->parent) { event.u.reparent.x += screenInfo.screens[0]->x; event.u.reparent.y += screenInfo.screens[0]->y; } #endif - event.u.reparent.override = pWin->overrideRedirect; DeliverEvents(pWin, &event, 1, pParent); /* take out of sibling chain */ @@ -2568,15 +2561,15 @@ MapWindow(WindowPtr pWin, ClientPtr client) pScreen = pWin->drawable.pScreen; if ((pParent = pWin->parent)) { - xEvent event; Bool anyMarked; if ((!pWin->overrideRedirect) && (RedirectSend(pParent) )) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = MapRequest; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; + + event.u.u.type = MapRequest; if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, @@ -2586,10 +2579,11 @@ MapWindow(WindowPtr pWin, ClientPtr client) pWin->mapped = TRUE; if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = MapNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; + + event.u.u.type = MapNotify; DeliverEvents(pWin, &event, 1, NullWindow); } @@ -2644,7 +2638,6 @@ MapSubwindows(WindowPtr pParent, ClientPtr client) ScreenPtr pScreen; Mask parentRedirect; Mask parentNotify; - xEvent event; Bool anyMarked; WindowPtr pLayerWin; @@ -2655,11 +2648,12 @@ MapSubwindows(WindowPtr pParent, ClientPtr client) for (pWin = pParent->firstChild; pWin; pWin = pWin->nextSib) { if (!pWin->mapped) { if (parentRedirect && !pWin->overrideRedirect) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = MapRequest; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.mapRequest.window = pWin->drawable.id; event.u.mapRequest.parent = pParent->drawable.id; + event.u.u.type = MapRequest; + if (MaybeDeliverEventsToClient(pParent, &event, 1, SubstructureRedirectMask, client) == 1) @@ -2668,10 +2662,11 @@ MapSubwindows(WindowPtr pParent, ClientPtr client) pWin->mapped = TRUE; if (parentNotify || StrSend(pWin)) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = MapNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.mapNotify.window = pWin->drawable.id; event.u.mapNotify.override = pWin->overrideRedirect; + + event.u.u.type = MapNotify; DeliverEvents(pWin, &event, 1, NullWindow); } @@ -2765,7 +2760,6 @@ int UnmapWindow(WindowPtr pWin, Bool fromConfigure) { WindowPtr pParent; - xEvent event; Bool wasRealized = (Bool) pWin->realized; Bool wasViewable = (Bool) pWin->viewable; ScreenPtr pScreen = pWin->drawable.pScreen; @@ -2774,10 +2768,11 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure) if ((!pWin->mapped) || (!(pParent = pWin->parent))) return Success; if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) { - memset(&event, 0, sizeof(xEvent)); - event.u.u.type = UnmapNotify; + xEvent event; memset(&event, 0, sizeof(xEvent)); event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.fromConfigure = fromConfigure; + + event.u.u.type = UnmapNotify; DeliverEvents(pWin, &event, 1, NullWindow); } if (wasViewable && !fromConfigure) { @@ -2813,7 +2808,6 @@ void UnmapSubwindows(WindowPtr pWin) { WindowPtr pChild, pHead; - xEvent event; Bool wasRealized = (Bool) pWin->realized; Bool wasViewable = (Bool) pWin->viewable; Bool anyMarked = FALSE; @@ -2832,9 +2826,11 @@ UnmapSubwindows(WindowPtr pWin) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) { if (pChild->mapped) { if (parentNotify || StrSend(pChild)) { - event.u.u.type = UnmapNotify; + xEvent event; event.u.unmapNotify.window = pChild->drawable.id; event.u.unmapNotify.fromConfigure = xFalse; + + event.u.u.type = UnmapNotify; DeliverEvents(pChild, &event, 1, NullWindow); } if (pChild->viewable) { @@ -3029,9 +3025,10 @@ SendVisibilityNotify(WindowPtr pWin) #endif memset(&event, 0, sizeof(xEvent)); - event.u.u.type = VisibilityNotify; event.u.visibility.window = pWin->drawable.id; event.u.visibility.state = visibility; + + event.u.u.type = VisibilityNotify; DeliverEvents(pWin, &event, 1, NullWindow); } |