aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/colormap.c40
-rw-r--r--xorg-server/dix/devices.c154
-rw-r--r--xorg-server/dix/dispatch.c316
-rw-r--r--xorg-server/dix/dixfonts.c26
-rw-r--r--xorg-server/dix/enterleave.c23
-rw-r--r--xorg-server/dix/events.c175
-rw-r--r--xorg-server/dix/extension.c22
-rw-r--r--xorg-server/dix/grabs.c5
-rw-r--r--xorg-server/dix/inpututils.c13
-rw-r--r--xorg-server/dix/pixmap.c135
-rw-r--r--xorg-server/dix/privates.c5
-rw-r--r--xorg-server/dix/property.c76
-rw-r--r--xorg-server/dix/registry.c4
-rw-r--r--xorg-server/dix/selection.c19
-rw-r--r--xorg-server/dix/swaprep.c88
-rw-r--r--xorg-server/dix/swapreq.c2
-rw-r--r--xorg-server/dix/window.c190
17 files changed, 776 insertions, 517 deletions
diff --git a/xorg-server/dix/colormap.c b/xorg-server/dix/colormap.c
index 10306285e..a43e2791b 100644
--- a/xorg-server/dix/colormap.c
+++ b/xorg-server/dix/colormap.c
@@ -450,15 +450,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 */
+ xEvent xE = {
+ .u.colormap.window = pwin->drawable.id,
+ .u.colormap.colormap = None,
+ .u.colormap.new = TRUE,
+ .u.colormap.state = ColormapUninstalled
+ };
xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = None;
- xE.u.colormap.new = TRUE;
- xE.u.colormap.state = ColormapUninstalled;
#ifdef PANORAMIX
if (noPanoramiXExtension || !pwin->drawable.pScreen->myNum)
#endif
@@ -477,7 +477,6 @@ int
TellLostMap(WindowPtr pwin, pointer value)
{
Colormap *pmid = (Colormap *) value;
- xEvent xE;
#ifdef PANORAMIX
if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
@@ -485,11 +484,13 @@ TellLostMap(WindowPtr pwin, pointer value)
#endif
if (wColormap(pwin) == *pmid) {
/* This should be call to DeliverEvent */
+ xEvent xE = {
+ .u.colormap.window = pwin->drawable.id,
+ .u.colormap.colormap = *pmid,
+ .u.colormap.new = FALSE,
+ .u.colormap.state = ColormapUninstalled
+ };
xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = *pmid;
- xE.u.colormap.new = FALSE;
- xE.u.colormap.state = ColormapUninstalled;
DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
}
@@ -501,7 +502,6 @@ int
TellGainedMap(WindowPtr pwin, pointer value)
{
Colormap *pmid = (Colormap *) value;
- xEvent xE;
#ifdef PANORAMIX
if (!noPanoramiXExtension && pwin->drawable.pScreen->myNum)
@@ -509,11 +509,13 @@ TellGainedMap(WindowPtr pwin, pointer value)
#endif
if (wColormap(pwin) == *pmid) {
/* This should be call to DeliverEvent */
+ xEvent xE = {
+ .u.colormap.window = pwin->drawable.id,
+ .u.colormap.colormap = *pmid,
+ .u.colormap.new = FALSE,
+ .u.colormap.state = ColormapInstalled
+ };
xE.u.u.type = ColormapNotify;
- xE.u.colormap.window = pwin->drawable.id;
- xE.u.colormap.colormap = *pmid;
- xE.u.colormap.new = FALSE;
- xE.u.colormap.state = ColormapInstalled;
DeliverEvents(pwin, &xE, 1, (WindowPtr) NULL);
}
@@ -576,7 +578,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];
@@ -653,7 +655,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];
@@ -2146,7 +2148,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 70fb273c9..839de35aa 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -321,15 +321,14 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
void
SendDevicePresenceEvent(int deviceid, int type)
{
- DeviceIntRec dummyDev;
- devicePresenceNotify ev;
-
- memset(&dummyDev, 0, sizeof(DeviceIntRec));
- ev.type = DevicePresenceNotify;
- ev.time = currentTime.milliseconds;
- ev.devchange = type;
- ev.deviceid = deviceid;
- dummyDev.id = XIAllDevices;
+ DeviceIntRec dummyDev = { .id = XIAllDevices };
+ devicePresenceNotify ev = {
+ .type = DevicePresenceNotify,
+ .time = currentTime.milliseconds,
+ .devchange = type,
+ .deviceid = deviceid
+ };
+
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
}
@@ -1666,9 +1665,11 @@ ProcSetModifierMapping(ClientPtr client)
bytes_to_int32(sizeof(xSetModifierMappingReq))))
return BadLength;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSetModifierMappingReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
stuff->numKeyPerModifier);
@@ -1696,15 +1697,16 @@ ProcGetModifierMapping(ClientPtr client)
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
&max_keys_per_mod);
- memset(&rep, 0, sizeof(xGetModifierMappingReply));
- rep.type = X_Reply;
- rep.numKeyPerModifier = max_keys_per_mod;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetModifierMappingReply) {
+ .type = X_Reply,
+ .numKeyPerModifier = max_keys_per_mod,
+ .sequenceNumber = client->sequence,
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
- rep.length = max_keys_per_mod << 1;
+ .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);
@@ -1785,10 +1787,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 = (xSetPointerMappingReply) {
+ .type = X_Reply,
+ .success = MappingSuccess,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
map = (BYTE *) &stuff[1];
/* So we're bounded here by the number of core buttons. This check
@@ -1857,12 +1862,13 @@ ProcGetKeyboardMapping(ClientPtr client)
if (!syms)
return BadAlloc;
- memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.keySymsPerKeyCode = syms->mapWidth;
- /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
- rep.length = syms->mapWidth * stuff->count;
+ rep = (xGetKeyboardMappingReply) {
+ .type = X_Reply,
+ .keySymsPerKeyCode = syms->mapWidth,
+ .sequenceNumber = client->sequence,
+ /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
+ .length = syms->mapWidth * stuff->count
+ };
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client,
@@ -1892,13 +1898,15 @@ ProcGetPointerMapping(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.nElts = (butc) ? butc->numButtons : 0;
- rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4;
+ rep = (xGetPointerMappingReply) {
+ .type = X_Reply,
+ .nElts = (butc) ? butc->numButtons : 0,
+ .sequenceNumber = client->sequence,
+ .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;
}
@@ -2144,15 +2152,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.keyClickPercent = ctrl->click;
- rep.bellPercent = ctrl->bell;
- rep.bellPitch = ctrl->bell_pitch;
- rep.bellDuration = ctrl->bell_duration;
- rep.ledMask = ctrl->leds;
+ rep = (xGetKeyboardControlReply) {
+ .type = X_Reply,
+ .globalAutoRepeat = ctrl->autoRepeat,
+ .sequenceNumber = client->sequence,
+ .length = 5,
+ .ledMask = ctrl->leds,
+ .keyClickPercent = ctrl->click,
+ .bellPercent = ctrl->bell,
+ .bellPitch = ctrl->bell_pitch,
+ .bellDuration = ctrl->bell_duration
+ };
for (i = 0; i < 32; i++)
rep.map[i] = ctrl->autoRepeats[i];
WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
@@ -2287,12 +2297,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.accelNumerator = ctrl->num;
- rep.accelDenominator = ctrl->den;
+ rep = (xGetPointerControlReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .accelNumerator = ctrl->num,
+ .accelDenominator = ctrl->den,
+ .threshold = ctrl->threshold
+ };
WriteReplyToClient(client, sizeof(xGenericReply), &rep);
return Success;
}
@@ -2336,8 +2348,10 @@ ProcGetMotionEvents(ClientPtr client)
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetMotionEventsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence
+ };
nEvents = 0;
start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop);
@@ -2385,20 +2399,23 @@ ProcQueryKeymap(ClientPtr client)
CARD8 *down = keybd->key->down;
REQUEST_SIZE_MATCH(xReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 2;
+ rep = (xQueryKeymapReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .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;
@@ -2432,18 +2449,17 @@ RecalculateMasterButtons(DeviceIntPtr slave)
if (master->button && master->button->numButtons != maxbuttons) {
int i;
- DeviceChangedEvent event;
-
- memset(&event, 0, sizeof(event));
+ DeviceChangedEvent event = {
+ .header = ET_Internal,
+ .type = ET_DeviceChanged,
+ .time = GetTimeInMillis(),
+ .deviceid = master->id,
+ .flags = DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE,
+ .buttons.num_buttons = maxbuttons
+ };
master->button->numButtons = maxbuttons;
- 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;
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 fa397285c..3c6a591db 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -466,8 +466,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)
{
@@ -528,7 +526,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;
@@ -926,10 +924,9 @@ GetGeometry(ClientPtr client, xGetGeometryReply * rep)
int
ProcGetGeometry(ClientPtr client)
{
- xGetGeometryReply rep;
+ xGetGeometryReply rep = { .type = X_Reply };
int status;
- memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success)
return status;
@@ -951,14 +948,13 @@ ProcQueryTree(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
if (rc != Success)
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 = (xQueryTreeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .root = pWin->drawable.pScreen->root->drawable.id,
+ .parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None
+ };
pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
numChildren++;
@@ -1003,13 +999,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));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.atom = atom;
+ xInternAtomReply reply = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .atom = atom
+ };
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
return Success;
}
@@ -1021,21 +1016,21 @@ 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);
- memset(&reply, 0, sizeof(xGetAtomNameReply));
- reply.type = X_Reply;
- reply.length = bytes_to_int32(len);
- reply.sequenceNumber = client->sequence;
- reply.nameLength = len;
+ int len = strlen(str);
+ xGetAtomNameReply reply = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(len),
+ .nameLength = len
+ };
+
WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
- (void) WriteToClient(client, len, str);
+ WriteToClient(client, len, str);
return Success;
}
else {
@@ -1123,10 +1118,12 @@ ProcTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- memset(&rep, 0, sizeof(xTranslateCoordsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+
+ rep = (xTranslateCoordsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
rep.sameScreen = xFalse;
rep.child = None;
@@ -1288,17 +1285,19 @@ 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.fontAscent = info.fontAscent;
- reply.fontDescent = info.fontDescent;
- reply.overallAscent = info.overallAscent;
- reply.overallDescent = info.overallDescent;
- reply.overallWidth = info.overallWidth;
- reply.overallLeft = info.overallLeft;
- reply.overallRight = info.overallRight;
+ reply = (xQueryTextExtentsReply) {
+ .type = X_Reply,
+ .drawDirection = info.drawDirection,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .fontAscent = info.fontAscent,
+ .fontDescent = info.fontDescent,
+ .overallAscent = info.overallAscent,
+ .overallDescent = info.overallDescent,
+ .overallWidth = info.overallWidth,
+ .overallLeft = info.overallLeft,
+ .overallRight = info.overallRight
+ };
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
return Success;
}
@@ -2143,8 +2142,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;
}
@@ -2179,9 +2177,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;
}
@@ -2468,7 +2465,6 @@ ProcAllocColor(ClientPtr client)
{
ColormapPtr pmap;
int rc;
- xAllocColorReply acr;
REQUEST(xAllocColorReq);
@@ -2476,13 +2472,15 @@ ProcAllocColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- acr.type = X_Reply;
- acr.length = 0;
- acr.sequenceNumber = client->sequence;
- acr.red = stuff->red;
- acr.green = stuff->green;
- acr.blue = stuff->blue;
- acr.pixel = 0;
+ xAllocColorReply acr = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .red = stuff->red,
+ .green = stuff->green,
+ .blue = stuff->blue,
+ .pixel = 0
+ };
if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
&acr.pixel, client->index)))
return rc;
@@ -2511,12 +2509,11 @@ ProcAllocNamedColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess);
if (rc == Success) {
- xAllocNamedColorReply ancr;
-
- ancr.type = X_Reply;
- ancr.length = 0;
- ancr.sequenceNumber = client->sequence;
-
+ xAllocNamedColorReply ancr = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
@@ -2557,7 +2554,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;
@@ -2587,11 +2583,13 @@ ProcAllocColorCells(ClientPtr client)
if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif
{
- accr.type = X_Reply;
- accr.length = bytes_to_int32(length);
- accr.sequenceNumber = client->sequence;
- accr.nPixels = npixels;
- accr.nMasks = nmasks;
+ xAllocColorCellsReply accr = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(length),
+ .nPixels = npixels,
+ .nMasks = nmasks
+ };
WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels);
@@ -2631,9 +2629,11 @@ ProcAllocColorPlanes(ClientPtr client)
client->errorValue = stuff->contiguous;
return BadValue;
}
- acpr.type = X_Reply;
- acpr.sequenceNumber = client->sequence;
- acpr.nPixels = npixels;
+ acpr = (xAllocColorPlanesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .nPixels = npixels
+ };
length = (long) npixels *sizeof(Pixel);
ppixels = malloc(length);
@@ -2771,11 +2771,12 @@ ProcQueryColors(ClientPtr client)
free(prgbs);
return rc;
}
- memset(&qcr, 0, sizeof(xQueryColorsReply));
- qcr.type = X_Reply;
- qcr.length = bytes_to_int32(count * sizeof(xrgb));
- qcr.sequenceNumber = client->sequence;
- qcr.nColors = count;
+ qcr = (xQueryColorsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(count * sizeof(xrgb)),
+ .nColors = count
+ };
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
@@ -2803,17 +2804,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)) {
- lcr.type = X_Reply;
- lcr.length = 0;
- lcr.sequenceNumber = client->sequence;
- lcr.screenRed = lcr.exactRed;
- lcr.screenGreen = lcr.exactGreen;
- lcr.screenBlue = lcr.exactBlue;
+ &exactRed, &exactGreen, &exactBlue)) {
+ xLookupColorReply lcr = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .exactRed = exactRed,
+ .exactGreen = exactGreen,
+ .exactBlue = exactBlue,
+ .screenRed = exactRed,
+ .screenGreen = exactGreen,
+ .screenBlue = exactBlue
+ };
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
&lcr.screenGreen,
&lcr.screenBlue, pcmp->pVisual);
@@ -2993,12 +2999,13 @@ ProcQueryBestSize(ClientPtr client)
return rc;
(*pScreen->QueryBestSize) (stuff->class, &stuff->width,
&stuff->height, pScreen);
- memset(&reply, 0, sizeof(xQueryBestSizeReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.width = stuff->width;
- reply.height = stuff->height;
+ reply = (xQueryBestSizeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .width = stuff->width,
+ .height = stuff->height
+ };
WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
return Success;
}
@@ -3078,13 +3085,15 @@ ProcGetScreenSaver(ClientPtr client)
return rc;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.timeout = ScreenSaverTime / MILLI_PER_SECOND;
- rep.interval = ScreenSaverInterval / MILLI_PER_SECOND;
- rep.preferBlanking = ScreenSaverBlanking;
- rep.allowExposures = ScreenSaverAllowExposures;
+ rep = (xGetScreenSaverReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .timeout = ScreenSaverTime / MILLI_PER_SECOND,
+ .interval = ScreenSaverInterval / MILLI_PER_SECOND,
+ .preferBlanking = ScreenSaverBlanking,
+ .allowExposures = ScreenSaverAllowExposures
+ };
WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
return Success;
}
@@ -3111,6 +3120,7 @@ ProcListHosts(ClientPtr client)
{
xListHostsReply reply;
int len, nHosts, result;
+ BOOL enabled;
pointer pdata;
/* REQUEST(xListHostsReq); */
@@ -3122,13 +3132,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.sequenceNumber = client->sequence;
- reply.nHosts = nHosts;
- reply.length = bytes_to_int32(len);
+
+ reply = (xListHostsReply) {
+ .type = X_Reply,
+ .enabled = enabled,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(len),
+ .nHosts = nHosts
+ };
WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts) {
client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
@@ -3243,15 +3257,16 @@ ProcGetFontPath(ClientPtr client)
if (rc != Success)
return rc;
- reply.type = X_Reply;
- reply.sequenceNumber = client->sequence;
- reply.length = bytes_to_int32(stringLens + numpaths);
- reply.nPaths = numpaths;
+ reply = (xGetFontPathReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(stringLens + numpaths),
+ .nPaths = numpaths
+ };
WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
if (stringLens || numpaths)
- (void) WriteToClient(client, stringLens + numpaths,
- (char *) bufferStart);
+ WriteToClient(client, stringLens + numpaths, bufferStart);
return Success;
}
@@ -3523,8 +3538,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;
}
@@ -3577,10 +3592,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) {
@@ -3623,14 +3637,13 @@ void
SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode,
XID resId, int errorCode)
{
- xError rep;
-
- memset(&rep, 0, sizeof(xError));
- rep.type = X_Error;
- rep.errorCode = errorCode;
- rep.majorCode = majorCode;
- rep.minorCode = minorCode;
- rep.resourceID = resId;
+ xError rep = {
+ .type = X_Error,
+ .errorCode = errorCode,
+ .resourceID = resId,
+ .minorCode = minorCode,
+ .majorCode = majorCode
+ };
WriteEventsToClient(client, 1, (xEvent *) &rep);
}
@@ -3742,6 +3755,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
@@ -3889,3 +3907,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 dd9331195..ad218604d 100644
--- a/xorg-server/dix/dixfonts.c
+++ b/xorg-server/dix/dixfonts.c
@@ -753,11 +753,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
- memset(&reply, 0, sizeof(xListFontsReply));
- reply.type = X_Reply;
- reply.length = bytes_to_int32(stringLens + nnames);
- reply.nFonts = nnames;
- reply.sequenceNumber = client->sequence;
+ reply = (xListFontsReply) {
+ .type = X_Reply,
+ .length = bytes_to_int32(stringLens + nnames),
+ .nFonts = nnames,
+ .sequenceNumber = client->sequence
+ };
bufptr = bufferStart = malloc(reply.length << 2);
@@ -782,7 +783,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:
@@ -1020,7 +1021,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);
@@ -1030,11 +1031,12 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
}
finish:
length = sizeof(xListFontsWithInfoReply);
- memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply));
- finalReply.type = X_Reply;
- finalReply.sequenceNumber = client->sequence;
- finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
- - sizeof(xGenericReply));
+ finalReply = (xListFontsWithInfoReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
+ - sizeof(xGenericReply))
+ };
WriteSwappedDataToClient(client, length, &finalReply);
bail:
ClientWakeup(client);
diff --git a/xorg-server/dix/enterleave.c b/xorg-server/dix/enterleave.c
index 761ab3b9f..431566ffe 100644
--- a/xorg-server/dix/enterleave.c
+++ b/xorg-server/dix/enterleave.c
@@ -827,12 +827,14 @@ 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;
- event.detail = detail;
- event.window = pWin->drawable.id;
- event.time = currentTime.milliseconds;
+ event = (deviceFocus) {
+ .deviceid = dev->id,
+ .mode = mode,
+ .type = (type == XI_FocusIn) ? DeviceFocusIn : DeviceFocusOut,
+ .detail = detail,
+ .window = pWin->drawable.id,
+ .time = currentTime.milliseconds
+ };
DeliverEventsToWindow(dev, pWin, (xEvent *) &event, 1,
DeviceFocusChangeMask, NullGrab);
@@ -1246,7 +1248,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 +1293,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 +1340,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 89877a144..3b40446bc 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;
@@ -2833,14 +2834,15 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
if (win == NoneWin || win == PointerRootWin)
return FALSE;
- memset(&event, 0, sizeof(DeviceEvent));
- event.header = ET_Internal;
- event.type = ET_FocusIn;
- event.length = sizeof(DeviceEvent);
- event.time = GetTimeInMillis();
- event.deviceid = dev->id;
- event.sourceid = dev->id;
- event.detail.button = 0;
+ event = (DeviceEvent) {
+ .header = ET_Internal,
+ .type = ET_FocusIn,
+ .length = sizeof(DeviceEvent),
+ .time = GetTimeInMillis(),
+ .deviceid = dev->id,
+ .sourceid = dev->id,
+ .detail.button = 0
+ };
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
@@ -2870,14 +2872,15 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
(*dev->deviceGrab.DeactivateGrab) (dev);
}
- memset(&event, 0, sizeof(DeviceEvent));
- event.header = ET_Internal;
- event.type = ET_Enter;
- event.length = sizeof(DeviceEvent);
- event.time = GetTimeInMillis();
- event.deviceid = dev->id;
- event.sourceid = dev->id;
- event.detail.button = 0;
+ event = (DeviceEvent) {
+ .header = ET_Internal,
+ .type = ET_Enter,
+ .length = sizeof(DeviceEvent),
+ .time = GetTimeInMillis(),
+ .deviceid = dev->id,
+ .sourceid = dev->id,
+ .detail.button = 0
+ };
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
@@ -4456,7 +4459,10 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
int type,
int mode, int detail, WindowPtr pWin, Window child)
{
- xEvent event;
+ xEvent event = {
+ .u.u.type = type,
+ .u.u.detail = detail
+ };
WindowPtr focus;
DeviceIntPtr keybd;
GrabPtr grab = mouse->deviceGrab.grab;
@@ -4476,9 +4482,6 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
mask = pWin->eventMask | wOtherEventMasks(pWin);
}
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = type;
- event.u.u.detail = detail;
event.u.enterLeave.time = currentTime.milliseconds;
event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x;
event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y;
@@ -4509,15 +4512,16 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
}
if ((type == EnterNotify) && (mask & KeymapStateMask)) {
- xKeymapEvent ke;
+ xKeymapEvent ke = {
+ .type = KeymapNotify
+ };
ClientPtr client = grab ? rClient(grab) : wClient(pWin);
+ int rc;
- if (XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess))
- memset((char *) &ke.map[0], 0, 31);
- else
- memmove((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
+ if (rc == Success)
+ memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
- ke.type = KeymapNotify;
if (grab)
TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
mask, KeymapStateMask, grab);
@@ -4602,27 +4606,27 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
void
CoreFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
{
- xEvent event;
-
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.u.type = type,
+ .u.u.detail = detail
+ };
event.u.focus.mode = mode;
- event.u.u.type = type;
- event.u.u.detail = detail;
event.u.focus.window = pWin->drawable.id;
DeliverEventsToWindow(dev, pWin, &event, 1,
GetEventFilter(dev, &event), NullGrab);
if ((type == FocusIn) &&
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask)) {
- xKeymapEvent ke;
+ xKeymapEvent ke = {
+ .type = KeymapNotify
+ };
ClientPtr client = wClient(pWin);
+ int rc;
- if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess))
- memset((char *) &ke.map[0], 0, 31);
- else
- memmove((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
+ rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
+ if (rc == Success)
+ memcpy((char *) &ke.map[0], (char *) &dev->key->down[1], 31);
- ke.type = KeymapNotify;
DeliverEventsToWindow(dev, pWin, (xEvent *) &ke, 1,
KeymapStateMask, NullGrab);
}
@@ -4764,17 +4768,20 @@ ProcGetInputFocus(ClientPtr client)
if (rc != Success)
return rc;
- memset(&rep, 0, sizeof(xGetInputFocusReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xGetInputFocusReply) {
+ .type = X_Reply,
+ .length = 0,
+ .sequenceNumber = client->sequence,
+ .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;
}
@@ -4794,6 +4801,7 @@ ProcGrabPointer(ClientPtr client)
GrabMask mask;
WindowPtr confineTo;
CursorPtr oldCursor;
+ BYTE status;
REQUEST(xGrabPointerReq);
int rc;
@@ -4815,7 +4823,6 @@ ProcGrabPointer(ClientPtr client)
return rc;
}
- memset(&rep, 0, sizeof(xGrabPointerReply));
oldCursor = NullCursor;
grab = device->deviceGrab.grab;
@@ -4830,16 +4837,19 @@ 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);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+ rep = (xGrabPointerReply) {
+ .type = X_Reply,
+ .status = status,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
return Success;
}
@@ -5056,6 +5066,7 @@ int
ProcGrabKeyboard(ClientPtr client)
{
xGrabKeyboardReply rep;
+ BYTE status;
REQUEST(xGrabKeyboardReq);
int result;
@@ -5064,19 +5075,22 @@ 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;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
+
+ rep = (xGrabKeyboardReply) {
+ .type = X_Reply,
+ .status = status,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
return Success;
}
@@ -5139,15 +5153,16 @@ ProcQueryPointer(ClientPtr client)
pSprite = mouse->spriteInfo->sprite;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, 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.root = (GetCurrentRootWindow(mouse))->drawable.id;
- rep.rootX = pSprite->hot.x;
- rep.rootY = pSprite->hot.y;
- rep.child = None;
+ rep = (xQueryPointerReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .mask = event_get_corestate(mouse, keyboard),
+ .root = (GetCurrentRootWindow(mouse))->drawable.id,
+ .rootX = pSprite->hot.x,
+ .rootY = pSprite->hot.y,
+ .child = None
+ };
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
rep.sameScreen = xTrue;
rep.winX = pSprite->hot.x - pWin->drawable.x;
@@ -5415,12 +5430,13 @@ ProcGrabKey(ClientPtr client)
REQUEST_SIZE_MATCH(xGrabKeyReq);
- memset(&param, 0, sizeof(param));
- param.grabtype = CORE;
- param.ownerEvents = stuff->ownerEvents;
- param.this_device_mode = stuff->keyboardMode;
- param.other_devices_mode = stuff->pointerMode;
- param.modifiers = stuff->modifiers;
+ param = (GrabParameters) {
+ .grabtype = CORE,
+ .ownerEvents = stuff->ownerEvents,
+ .this_device_mode = stuff->keyboardMode,
+ .other_devices_mode = stuff->pointerMode,
+ .modifiers = stuff->modifiers
+ };
rc = CheckGrabValues(client, &param);
if (rc != Success)
@@ -5521,12 +5537,13 @@ ProcGrabButton(ClientPtr client)
if (rc != Success)
return rc;
- memset(&param, 0, sizeof(param));
- param.grabtype = CORE;
- param.ownerEvents = stuff->ownerEvents;
- param.this_device_mode = stuff->keyboardMode;
- param.other_devices_mode = stuff->pointerMode;
- param.modifiers = stuff->modifiers;
+ param = (GrabParameters) {
+ .grabtype = CORE,
+ .ownerEvents = stuff->ownerEvents,
+ .this_device_mode = stuff->keyboardMode,
+ .other_devices_mode = stuff->pointerMode,
+ .modifiers = stuff->modifiers
+ };
mask.core = stuff->eventMask;
@@ -5898,14 +5915,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..6380db364 100644
--- a/xorg-server/dix/extension.c
+++ b/xorg-server/dix/extension.c
@@ -252,11 +252,12 @@ ProcQueryExtension(ClientPtr client)
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
- memset(&reply, 0, sizeof(xQueryExtensionReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.major_opcode = 0;
- reply.sequenceNumber = client->sequence;
+ reply = (xQueryExtensionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .major_opcode = 0
+ };
if (!NumExtensions)
reply.present = xFalse;
@@ -284,11 +285,12 @@ ProcListExtensions(ClientPtr client)
REQUEST_SIZE_MATCH(xReq);
- memset(&reply, 0, sizeof(xListExtensionsReply));
- reply.type = X_Reply;
- reply.nExtensions = 0;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
+ reply = (xListExtensionsReply) {
+ .type = X_Reply,
+ .nExtensions = 0,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
buffer = NULL;
if (NumExtensions) {
diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c
index 2f05f5733..55bf64f2c 100644
--- a/xorg-server/dix/grabs.c
+++ b/xorg-server/dix/grabs.c
@@ -205,7 +205,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..f01e9a7cd 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -71,14 +71,13 @@ static void
do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
{
int i;
- xEvent core_mn;
+ xEvent core_mn = { .u.u.type = MappingNotify };
deviceMappingNotify xi_mn;
/* The map in ButtonClassRec refers to button numbers, whereas the
* protocol is zero-indexed. Sigh. */
memcpy(&(dev->button->map[1]), map, len);
- core_mn.u.u.type = MappingNotify;
core_mn.u.mappingNotify.request = MappingPointer;
/* 0 is the server client. */
@@ -93,10 +92,12 @@ 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;
- xi_mn.time = GetTimeInMillis();
+ xi_mn = (deviceMappingNotify) {
+ .type = DeviceMappingNotify,
+ .request = MappingPointer,
+ .deviceid = dev->id,
+ .time = GetTimeInMillis()
+ };
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) &xi_mn, 1);
}
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 740ead739..55b9345a7 100644
--- a/xorg-server/dix/privates.c
+++ b/xorg-server/dix/privates.c
@@ -317,6 +317,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..dec409024 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));
+ xEvent event = {
+ .u.property.window = pWin->drawable.id,
+ .u.property.state = state,
+ .u.property.atom = atom,
+ .u.property.time = currentTime.milliseconds
+ };
event.u.u.type = PropertyNotify;
- event.u.property.window = pWin->drawable.id;
- event.u.property.state = state;
- event.u.property.atom = atom;
- event.u.property.time = currentTime.milliseconds;
DeliverEvents(pWin, &event, 1, (WindowPtr) NULL);
}
@@ -413,15 +412,18 @@ 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 = {
+ .type = X_Reply,
+ .format = format,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .propertyType = propertyType,
+ .bytesAfter = 0,
+ .nItems = 0
+ };
+ WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return Success;
}
@@ -470,13 +472,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,11 +483,15 @@ ProcGetProperty(ClientPtr client)
if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
) {
- reply.bytesAfter = pProp->size;
- reply.format = pProp->format;
- reply.length = 0;
- reply.nItems = 0;
- reply.propertyType = pProp->type;
+ reply = (xGetPropertyReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .bytesAfter = pProp->size,
+ .format = pProp->format,
+ .length = 0,
+ .nItems = 0,
+ .propertyType = pProp->type
+ };
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return Success;
}
@@ -510,11 +512,15 @@ ProcGetProperty(ClientPtr client)
len = min(n - ind, 4 * stuff->longLength);
- reply.bytesAfter = n - (ind + len);
- reply.format = pProp->format;
- reply.length = bytes_to_int32(len);
- reply.nItems = len / (pProp->format / 8);
- reply.propertyType = pProp->type;
+ reply = (xGetPropertyReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .bytesAfter = n - (ind + len),
+ .format = pProp->format,
+ .length = bytes_to_int32(len),
+ .nItems = len / (pProp->format / 8),
+ .propertyType = pProp->type
+ };
if (stuff->delete && (reply.bytesAfter == 0))
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
@@ -589,10 +595,12 @@ ProcListProperties(ClientPtr client)
}
}
- xlpr.type = X_Reply;
- xlpr.nProperties = numProps;
- xlpr.length = bytes_to_int32(numProps * sizeof(Atom));
- xlpr.sequenceNumber = client->sequence;
+ xlpr = (xListPropertiesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(numProps * sizeof(Atom)),
+ .nProperties = numProps
+ };
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
diff --git a/xorg-server/dix/registry.c b/xorg-server/dix/registry.c
index e9c19b092..5bad0fdd4 100644
--- a/xorg-server/dix/registry.c
+++ b/xorg-server/dix/registry.c
@@ -286,7 +286,7 @@ LookupResourceName(RESTYPE resource)
void
dixResetRegistry(void)
{
- ExtensionEntry extEntry;
+ ExtensionEntry extEntry = { .name = CORE };
/* Free all memory */
while (nmajor--) {
@@ -336,8 +336,6 @@ dixResetRegistry(void)
RegisterResourceName(RT_PASSIVEGRAB, "PASSIVE GRAB");
/* Add the core protocol */
- memset(&extEntry, 0, sizeof(extEntry));
- extEntry.name = CORE;
RegisterExtensionNames(&extEntry);
}
diff --git a/xorg-server/dix/selection.c b/xorg-server/dix/selection.c
index dfdcfdc64..e905b1ec2 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))) {
+ xEvent event = {
+ .u.selectionClear.time = time.milliseconds,
+ .u.selectionClear.window = pSel->window,
+ .u.selectionClear.atom = pSel->selection
+ };
event.u.u.type = SelectionClear;
- event.u.selectionClear.time = time.milliseconds;
- event.u.selectionClear.window = pSel->window;
- event.u.selectionClear.atom = pSel->selection;
WriteEventsToClient(pSel->client, 1, &event);
}
}
@@ -238,10 +238,11 @@ ProcGetSelectionOwner(ClientPtr client)
return BadAtom;
}
- memset(&reply, 0, sizeof(xGetSelectionOwnerReply));
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
+ reply = (xGetSelectionOwnerReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .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..0f6d49ef0 100644
--- a/xorg-server/dix/swapreq.c
+++ b/xorg-server/dix/swapreq.c
@@ -283,7 +283,7 @@ SProcConvertSelection(ClientPtr client)
int
SProcSendEvent(ClientPtr client)
{
- xEvent eventT;
+ xEvent eventT = { .u.u.type = 0 };
EventSwapPtr proc;
REQUEST(xSendEventReq);
diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c
index b66080830..cdd12dca6 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,16 +827,17 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
}
if (SubSend(pParent)) {
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.createNotify.window = wid,
+ .u.createNotify.parent = pParent->drawable.id,
+ .u.createNotify.x = x,
+ .u.createNotify.y = y,
+ .u.createNotify.width = w,
+ .u.createNotify.height = h,
+ .u.createNotify.borderWidth = bw,
+ .u.createNotify.override = pWin->overrideRedirect
+ };
event.u.u.type = CreateNotify;
- event.u.createNotify.window = wid;
- event.u.createNotify.parent = pParent->drawable.id;
- event.u.createNotify.x = x;
- event.u.createNotify.y = y;
- event.u.createNotify.width = w;
- event.u.createNotify.height = h;
- event.u.createNotify.borderWidth = bw;
- event.u.createNotify.override = pWin->overrideRedirect;
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,8 +924,7 @@ CrushTree(WindowPtr pWin)
while (1) {
pParent = pChild->parent;
if (SubStrSend(pChild, pParent)) {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
+ xEvent event = { .u.u.type = DestroyNotify };
event.u.destroyNotify.window = pChild->drawable.id;
DeliverEvents(pChild, &event, 1, NullWindow);
}
@@ -961,7 +959,6 @@ DeleteWindow(pointer value, XID wid)
{
WindowPtr pParent;
WindowPtr pWin = (WindowPtr) value;
- xEvent event;
UnmapWindow(pWin, FALSE);
@@ -969,8 +966,7 @@ DeleteWindow(pointer value, XID wid)
pParent = pWin->parent;
if (wid && pParent && SubStrSend(pWin, pParent)) {
- memset(&event, 0, sizeof(xEvent));
- event.u.u.type = DestroyNotify;
+ xEvent event = { .u.u.type = DestroyNotify };
event.u.destroyNotify.window = pWin->drawable.id;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -1355,11 +1351,13 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
CheckWindowOptionalNeed(pChild);
}
+ xE = (xEvent) {
+ .u.colormap.window = pWin->drawable.id,
+ .u.colormap.colormap = cmap,
+ .u.colormap.new = xTrue,
+ .u.colormap.state = IsMapInstalled(cmap, pWin)
+ };
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);
DeliverEvents(pWin, &xE, 1, NullWindow);
}
break;
@@ -1746,12 +1744,12 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
GravityTranslate(cwsx, cwsy, cwsx - dx, cwsy - dy, dw, dh,
pSib->winGravity, &cwsx, &cwsy);
if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) {
- xEvent event;
-
+ xEvent event = {
+ .u.gravity.window = pSib->drawable.id,
+ .u.gravity.x = cwsx - wBorderWidth(pSib),
+ .u.gravity.y = cwsy - wBorderWidth(pSib)
+ };
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);
DeliverEvents(pSib, &event, 1, NullWindow);
pSib->origin.x = cwsx;
pSib->origin.y = cwsy;
@@ -2090,7 +2088,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 +2176,25 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
if ((!pWin->overrideRedirect) && (RedirectSend(pParent)
)) {
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.configureRequest.window = pWin->drawable.id,
+ .u.configureRequest.sibling = (mask & CWSibling) ? sibwid : None,
+ .u.configureRequest.x = x,
+ .u.configureRequest.y = y,
+ .u.configureRequest.width = w,
+ .u.configureRequest.height = h,
+ .u.configureRequest.borderWidth = bw,
+ .u.configureRequest.valueMask = mask,
+ .u.configureRequest.parent = pParent->drawable.id
+ };
event.u.u.type = ConfigureRequest;
- 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.x = x;
- event.u.configureRequest.y = y;
+ 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 +2205,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));
+ xEvent eventT = {
+ .u.resizeRequest.window = pWin->drawable.id,
+ .u.resizeRequest.width = w,
+ .u.resizeRequest.height = h
+ };
eventT.u.u.type = ResizeRequest;
- eventT.u.resizeRequest.window = pWin->drawable.id;
- eventT.u.resizeRequest.width = w;
- eventT.u.resizeRequest.height = h;
if (MaybeDeliverEventsToClient(pWin, &eventT, 1,
ResizeRedirectMask, client) == 1) {
/* if event is delivered, leave the actual size alone. */
@@ -2270,25 +2261,23 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
}
if (SubStrSend(pWin, pParent)) {
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.configureNotify.window = pWin->drawable.id,
+ .u.configureNotify.aboveSibling = pSib ? pSib->drawable.id : None,
+ .u.configureNotify.x = x,
+ .u.configureNotify.y = y,
+ .u.configureNotify.width = w,
+ .u.configureNotify.height = h,
+ .u.configureNotify.borderWidth = bw,
+ .u.configureNotify.override = pWin->overrideRedirect
+ };
event.u.u.type = ConfigureNotify;
- 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.x = x;
- event.u.configureNotify.y = y;
#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 +2350,13 @@ 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 = (xEvent) {
+ .u.circulate.window = pWin->drawable.id,
+ .u.circulate.parent = pParent->drawable.id,
+ .u.circulate.event = pParent->drawable.id,
+ .u.circulate.place = (direction == RaiseLowest) ?
+ PlaceOnTop : PlaceOnBottom,
+ };
if (RedirectSend(pParent)) {
event.u.u.type = CirculateRequest;
@@ -2420,19 +2409,20 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
if (WasMapped)
UnmapWindow(pWin, FALSE);
- memset(&event, 0, sizeof(xEvent));
+ event = (xEvent) {
+ .u.reparent.window = pWin->drawable.id,
+ .u.reparent.parent = pParent->drawable.id,
+ .u.reparent.x = x,
+ .u.reparent.y = y,
+ .u.reparent.override = pWin->overrideRedirect
+ };
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;
#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 +2558,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));
+ xEvent event = {
+ .u.mapRequest.window = pWin->drawable.id,
+ .u.mapRequest.parent = pParent->drawable.id
+ };
event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
SubstructureRedirectMask,
@@ -2586,10 +2576,11 @@ MapWindow(WindowPtr pWin, ClientPtr client)
pWin->mapped = TRUE;
if (SubStrSend(pWin, pParent) && MapUnmapEventsEnabled(pWin)) {
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.mapNotify.window = pWin->drawable.id,
+ .u.mapNotify.override = pWin->overrideRedirect,
+ };
event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -2644,7 +2635,6 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
ScreenPtr pScreen;
Mask parentRedirect;
Mask parentNotify;
- xEvent event;
Bool anyMarked;
WindowPtr pLayerWin;
@@ -2655,10 +2645,11 @@ 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));
+ xEvent event = {
+ .u.mapRequest.window = pWin->drawable.id,
+ .u.mapRequest.parent = pParent->drawable.id
+ };
event.u.u.type = MapRequest;
- event.u.mapRequest.window = pWin->drawable.id;
- event.u.mapRequest.parent = pParent->drawable.id;
if (MaybeDeliverEventsToClient(pParent, &event, 1,
SubstructureRedirectMask,
@@ -2668,10 +2659,11 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
pWin->mapped = TRUE;
if (parentNotify || StrSend(pWin)) {
- memset(&event, 0, sizeof(xEvent));
+ xEvent event = {
+ .u.mapNotify.window = pWin->drawable.id,
+ .u.mapNotify.override = pWin->overrideRedirect
+ };
event.u.u.type = MapNotify;
- event.u.mapNotify.window = pWin->drawable.id;
- event.u.mapNotify.override = pWin->overrideRedirect;
DeliverEvents(pWin, &event, 1, NullWindow);
}
@@ -2765,7 +2757,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 +2765,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));
+ xEvent event = {
+ .u.unmapNotify.window = pWin->drawable.id,
+ .u.unmapNotify.fromConfigure = fromConfigure
+ };
event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pWin->drawable.id;
- event.u.unmapNotify.fromConfigure = fromConfigure;
DeliverEvents(pWin, &event, 1, NullWindow);
}
if (wasViewable && !fromConfigure) {
@@ -2813,7 +2805,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 +2823,11 @@ UnmapSubwindows(WindowPtr pWin)
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
if (pChild->mapped) {
if (parentNotify || StrSend(pChild)) {
+ xEvent event = {
+ .u.unmapNotify.window = pChild->drawable.id,
+ .u.unmapNotify.fromConfigure = xFalse
+ };
event.u.u.type = UnmapNotify;
- event.u.unmapNotify.window = pChild->drawable.id;
- event.u.unmapNotify.fromConfigure = xFalse;
DeliverEvents(pChild, &event, 1, NullWindow);
}
if (pChild->viewable) {
@@ -3028,10 +3021,11 @@ SendVisibilityNotify(WindowPtr pWin)
}
#endif
- memset(&event, 0, sizeof(xEvent));
+ event = (xEvent) {
+ .u.visibility.window = pWin->drawable.id,
+ .u.visibility.state = visibility
+ };
event.u.u.type = VisibilityNotify;
- event.u.visibility.window = pWin->drawable.id;
- event.u.visibility.state = visibility;
DeliverEvents(pWin, &event, 1, NullWindow);
}