diff options
Diffstat (limited to 'xorg-server/xfixes')
-rw-r--r-- | xorg-server/xfixes/cursor.c | 41 | ||||
-rw-r--r-- | xorg-server/xfixes/region.c | 5 | ||||
-rw-r--r-- | xorg-server/xfixes/select.c | 23 | ||||
-rw-r--r-- | xorg-server/xfixes/xfixes.c | 13 | ||||
-rw-r--r-- | xorg-server/xfixes/xfixesint.h | 5 |
5 files changed, 42 insertions, 45 deletions
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c index 467529a4f..4eee59246 100644 --- a/xorg-server/xfixes/cursor.c +++ b/xorg-server/xfixes/cursor.c @@ -172,14 +172,14 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) CursorCurrent[pDev->id] = pCursor; for (e = cursorEvents; e; e = e->next) { if ((e->eventMask & XFixesDisplayCursorNotifyMask)) { - xXFixesCursorNotifyEvent ev; - - ev.type = XFixesEventBase + XFixesCursorNotify; - ev.subtype = XFixesDisplayCursorNotify; - ev.window = e->pWindow->drawable.id; - ev.cursorSerial = pCursor ? pCursor->serialNumber : 0; - ev.timestamp = currentTime.milliseconds; - ev.name = pCursor ? pCursor->name : None; + xXFixesCursorNotifyEvent ev = { + .type = XFixesEventBase + XFixesCursorNotify, + .subtype = XFixesDisplayCursorNotify, + .window = e->pWindow->drawable.id, + .cursorSerial = pCursor ? pCursor->serialNumber : 0, + .timestamp = currentTime.milliseconds, + .name = pCursor ? pCursor->name : None + }; WriteEventsToClient(e->pClient, 1, (xEvent *) &ev); } } @@ -380,7 +380,8 @@ ProcXFixesGetCursorImage(ClientPtr client) width = pCursor->bits->width; height = pCursor->bits->height; npixels = width * height; - rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32)); + rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32), + 1); if (!rep) return BadAlloc; @@ -409,8 +410,8 @@ ProcXFixesGetCursorImage(ClientPtr client) swapl(&rep->cursorSerial); SwapLongs(image, npixels); } - WriteToClient(client, sizeof(xXFixesGetCursorImageReply) + - (npixels << 2), (char *) rep); + WriteToClient(client, + sizeof(xXFixesGetCursorImageReply) + (npixels << 2), rep); free(rep); return Success; } @@ -473,11 +474,13 @@ ProcXFixesGetCursorName(ClientPtr client) str = ""; len = strlen(str); - reply.type = X_Reply; - reply.length = bytes_to_int32(len); - reply.sequenceNumber = client->sequence; - reply.atom = pCursor->name; - reply.nbytes = len; + reply = (xXFixesGetCursorNameReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(len), + .atom = pCursor->name, + .nbytes = len + }; if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); @@ -529,8 +532,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) name = pCursor->name ? NameForAtom(pCursor->name) : ""; nbytes = strlen(name); nbytesRound = pad_to_int32(nbytes); - rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) + - npixels * sizeof(CARD32) + nbytesRound); + rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) + + npixels * sizeof(CARD32) + nbytesRound, 1); if (!rep) return BadAlloc; @@ -565,7 +568,7 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) SwapLongs(image, npixels); } WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) + - (npixels << 2) + nbytesRound, (char *) rep); + (npixels << 2) + nbytesRound, rep); free(rep); return Success; } diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c index 0acbadae2..0e9ca443f 100644 --- a/xorg-server/xfixes/region.c +++ b/xorg-server/xfixes/region.c @@ -557,7 +557,8 @@ ProcXFixesFetchRegion(ClientPtr client) pBox = RegionRects(pRegion); nBox = RegionNumRects(pRegion); - reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle)); + reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle), + 1); if (!reply) return BadAlloc; reply->type = X_Reply; @@ -584,7 +585,7 @@ ProcXFixesFetchRegion(ClientPtr client) swaps(&reply->height); SwapShorts((INT16 *) pRect, nBox * 4); } - (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) + + WriteToClient(client, sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle), (char *) reply); free(reply); return Success; diff --git a/xorg-server/xfixes/select.c b/xorg-server/xfixes/select.c index a896846a7..ee8ed6f68 100644 --- a/xorg-server/xfixes/select.c +++ b/xorg-server/xfixes/select.c @@ -77,19 +77,16 @@ XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args) } for (e = selectionEvents; e; e = e->next) { if (e->selection == selection->selection && (e->eventMask & eventMask)) { - xXFixesSelectionNotifyEvent ev; - - memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent)); - ev.type = XFixesEventBase + XFixesSelectionNotify; - ev.subtype = subtype; - ev.window = e->pWindow->drawable.id; - if (subtype == XFixesSetSelectionOwnerNotify) - ev.owner = selection->window; - else - ev.owner = 0; - ev.selection = e->selection; - ev.timestamp = currentTime.milliseconds; - ev.selectionTimestamp = selection->lastTimeChanged.milliseconds; + xXFixesSelectionNotifyEvent ev = { + .type = XFixesEventBase + XFixesSelectionNotify, + .subtype = subtype, + .window = e->pWindow->drawable.id, + .owner = (subtype == XFixesSetSelectionOwnerNotify) ? + selection->window : 0, + .selection = e->selection, + .timestamp = currentTime.milliseconds, + .selectionTimestamp = selection->lastTimeChanged.milliseconds + }; WriteEventsToClient(e->pClient, 1, (xEvent *) &ev); } } diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c index f80230fd3..52c57dfab 100644 --- a/xorg-server/xfixes/xfixes.c +++ b/xorg-server/xfixes/xfixes.c @@ -48,6 +48,7 @@ #include "xfixesint.h" #include "protocol-versions.h" +#include "extinit.h" static unsigned char XFixesReqCode; int XFixesEventBase; @@ -61,15 +62,15 @@ static int ProcXFixesQueryVersion(ClientPtr client) { XFixesClientPtr pXFixesClient = GetXFixesClient(client); - xXFixesQueryVersionReply rep; + xXFixesQueryVersionReply rep = { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0 + }; REQUEST(xXFixesQueryVersionReq); REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); - memset(&rep, 0, sizeof(xXFixesQueryVersionReply)); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_XFIXES_MAJOR_VERSION, @@ -90,7 +91,7 @@ ProcXFixesQueryVersion(ClientPtr client) swapl(&rep.majorVersion); swapl(&rep.minorVersion); } - WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep); return Success; } diff --git a/xorg-server/xfixes/xfixesint.h b/xorg-server/xfixes/xfixesint.h index 71f88a93d..334c71fbf 100644 --- a/xorg-server/xfixes/xfixesint.h +++ b/xorg-server/xfixes/xfixesint.h @@ -71,11 +71,6 @@ typedef struct _XFixesClient { extern int (*ProcXFixesVector[XFixesNumberRequests]) (ClientPtr); -/* Initialize extension at server startup time */ - -void - XFixesExtensionInit(void); - /* Save set */ int ProcXFixesChangeSaveSet(ClientPtr client); |