aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/shape.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext/shape.c')
-rw-r--r--xorg-server/Xext/shape.c83
1 files changed, 45 insertions, 38 deletions
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index cc5214a1b..d36867cc8 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -44,7 +44,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
#include "gcstruct.h"
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
@@ -204,22 +204,23 @@ CreateClipShape(WindowPtr pWin)
static int
ProcShapeQueryVersion(ClientPtr client)
{
- xShapeQueryVersionReply rep;
+ xShapeQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SHAPE_MAJOR_VERSION,
+ .minorVersion = SERVER_SHAPE_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
- memset(&rep, 0, sizeof(xShapeQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
- rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
return Success;
}
@@ -631,12 +632,13 @@ ProcShapeQueryExtents(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.boundingShaped = (wBoundingShape(pWin) != 0);
- rep.clipShaped = (wClipShape(pWin) != 0);
+ rep = (xShapeQueryExtentsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .boundingShaped = (wBoundingShape(pWin) != 0),
+ .clipShaped = (wClipShape(pWin) != 0)
+ };
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = RegionExtents(region);
@@ -679,7 +681,7 @@ ProcShapeQueryExtents(ClientPtr client)
swaps(&rep.widthClipShape);
swaps(&rep.heightClipShape);
}
- WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
return Success;
}
@@ -824,7 +826,6 @@ void
SendShapeNotify(WindowPtr pWin, int which)
{
ShapeEventPtr *pHead, pShapeEvent;
- xShapeNotifyEvent se;
BoxRec extents;
RegionPtr region;
BYTE shaped;
@@ -881,15 +882,17 @@ SendShapeNotify(WindowPtr pWin, int which)
return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- se.type = ShapeNotify + ShapeEventBase;
- se.kind = which;
- se.window = pWin->drawable.id;
- se.x = extents.x1;
- se.y = extents.y1;
- se.width = extents.x2 - extents.x1;
- se.height = extents.y2 - extents.y1;
- se.time = currentTime.milliseconds;
- se.shaped = shaped;
+ xShapeNotifyEvent se = {
+ .type = ShapeNotify + ShapeEventBase,
+ .kind = which,
+ .window = pWin->drawable.id,
+ .x = extents.x1,
+ .y = extents.y1,
+ .width = extents.x2 - extents.x1,
+ .height = extents.y2 - extents.y1,
+ .time = currentTime.milliseconds,
+ .shaped = shaped
+ };
WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
}
}
@@ -920,15 +923,17 @@ ProcShapeInputSelected(ClientPtr client)
}
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.enabled = enabled;
+ rep = (xShapeInputSelectedReply) {
+ .type = X_Reply,
+ .enabled = enabled,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
- WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
return Success;
}
@@ -1001,19 +1006,21 @@ ProcShapeGetRectangles(ClientPtr client)
rects[i].height = box->y2 - box->y1;
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
- rep.ordering = YXBanded;
- rep.nrects = nrects;
+ rep = (xShapeGetRectanglesReply) {
+ .type = X_Reply,
+ .ordering = YXBanded,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(nrects * sizeof(xRectangle)),
+ .nrects = nrects
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nrects);
SwapShorts((short *) rects, (unsigned long) nrects * 4);
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
- WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
+ WriteToClient(client, sizeof(rep), &rep);
+ WriteToClient(client, nrects * sizeof(xRectangle), rects);
free(rects);
return Success;
}