diff options
author | marha <marha@users.sourceforge.net> | 2011-09-22 15:20:09 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-22 15:20:09 +0200 |
commit | c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (patch) | |
tree | 8874978d314129a4f47ee575b076c2d8eb1a8738 /xorg-server/xfixes | |
parent | 37466741e35c5eb3b204863a5023bf8d192efc06 (diff) | |
download | vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.gz vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.bz2 vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.zip |
libxtrans libX11 libX11 libXext mesa xserver git update 22 sep 2011
Diffstat (limited to 'xorg-server/xfixes')
-rw-r--r-- | xorg-server/xfixes/cursor.c | 122 | ||||
-rw-r--r-- | xorg-server/xfixes/region.c | 156 | ||||
-rw-r--r-- | xorg-server/xfixes/saveset.c | 143 | ||||
-rw-r--r-- | xorg-server/xfixes/select.c | 579 | ||||
-rw-r--r-- | xorg-server/xfixes/xfixes.c | 16 |
5 files changed, 490 insertions, 526 deletions
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c index ecbed4016..2950e4579 100644 --- a/xorg-server/xfixes/cursor.c +++ b/xorg-server/xfixes/cursor.c @@ -309,12 +309,11 @@ GetBit (unsigned char *line, int x) int SProcXFixesSelectCursorInput (ClientPtr client) { - register int n; REQUEST(xXFixesSelectCursorInputReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swapl(&stuff->eventMask, n); + swaps(&stuff->length); + swapl(&stuff->window); + swapl(&stuff->eventMask); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -418,16 +417,15 @@ ProcXFixesGetCursorImage (ClientPtr client) CopyCursorToImage (pCursor, image); if (client->swapped) { - int n; - swaps (&rep->sequenceNumber, n); - swapl (&rep->length, n); - swaps (&rep->x, n); - swaps (&rep->y, n); - swaps (&rep->width, n); - swaps (&rep->height, n); - swaps (&rep->xhot, n); - swaps (&rep->yhot, n); - swapl (&rep->cursorSerial, n); + swaps(&rep->sequenceNumber); + swapl(&rep->length); + swaps(&rep->x); + swaps(&rep->y); + swaps(&rep->width); + swaps(&rep->height); + swaps(&rep->xhot); + swaps(&rep->yhot); + swapl(&rep->cursorSerial); SwapLongs (image, npixels); } WriteToClient(client, sizeof (xXFixesGetCursorImageReply) + @@ -439,9 +437,8 @@ ProcXFixesGetCursorImage (ClientPtr client) int SProcXFixesGetCursorImage (ClientPtr client) { - int n; REQUEST(xXFixesGetCursorImageReq); - swaps (&stuff->length, n); + swaps(&stuff->length); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -467,13 +464,12 @@ ProcXFixesSetCursorName (ClientPtr client) int SProcXFixesSetCursorName (ClientPtr client) { - int n; REQUEST(xXFixesSetCursorNameReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq); - swapl (&stuff->cursor, n); - swaps (&stuff->nbytes, n); + swapl(&stuff->cursor); + swaps(&stuff->nbytes); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -501,11 +497,10 @@ ProcXFixesGetCursorName (ClientPtr client) reply.nbytes = len; if (client->swapped) { - int n; - swaps (&reply.sequenceNumber, n); - swapl (&reply.length, n); - swapl (&reply.atom, n); - swaps (&reply.nbytes, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.atom); + swaps(&reply.nbytes); } WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply); WriteToClient(client, len, str); @@ -516,12 +511,11 @@ ProcXFixesGetCursorName (ClientPtr client) int SProcXFixesGetCursorName (ClientPtr client) { - int n; REQUEST(xXFixesGetCursorNameReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq); - swapl (&stuff->cursor, n); + swapl(&stuff->cursor); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -576,18 +570,17 @@ ProcXFixesGetCursorImageAndName (ClientPtr client) memcpy ((image + npixels), name, nbytes); if (client->swapped) { - int n; - swaps (&rep->sequenceNumber, n); - swapl (&rep->length, n); - swaps (&rep->x, n); - swaps (&rep->y, n); - swaps (&rep->width, n); - swaps (&rep->height, n); - swaps (&rep->xhot, n); - swaps (&rep->yhot, n); - swapl (&rep->cursorSerial, n); - swapl (&rep->cursorName, n); - swaps (&rep->nbytes, n); + swaps(&rep->sequenceNumber); + swapl(&rep->length); + swaps(&rep->x); + swaps(&rep->y); + swaps(&rep->width); + swaps(&rep->height); + swaps(&rep->xhot); + swaps(&rep->yhot); + swapl(&rep->cursorSerial); + swapl(&rep->cursorName); + swaps(&rep->nbytes); SwapLongs (image, npixels); } WriteToClient(client, sizeof (xXFixesGetCursorImageAndNameReply) + @@ -599,9 +592,8 @@ ProcXFixesGetCursorImageAndName (ClientPtr client) int SProcXFixesGetCursorImageAndName (ClientPtr client) { - int n; REQUEST(xXFixesGetCursorImageAndNameReq); - swaps (&stuff->length, n); + swaps(&stuff->length); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -734,13 +726,12 @@ ProcXFixesChangeCursor (ClientPtr client) int SProcXFixesChangeCursor (ClientPtr client) { - int n; REQUEST(xXFixesChangeCursorReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesChangeCursorReq); - swapl (&stuff->source, n); - swapl (&stuff->destination, n); + swapl(&stuff->source); + swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -772,13 +763,12 @@ ProcXFixesChangeCursorByName (ClientPtr client) int SProcXFixesChangeCursorByName (ClientPtr client) { - int n; REQUEST(xXFixesChangeCursorByNameReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_AT_LEAST_SIZE (xXFixesChangeCursorByNameReq); - swapl (&stuff->source, n); - swaps (&stuff->nbytes, n); + swapl(&stuff->source); + swaps(&stuff->nbytes); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -933,12 +923,11 @@ ProcXFixesHideCursor (ClientPtr client) int SProcXFixesHideCursor (ClientPtr client) { - int n; REQUEST(xXFixesHideCursorReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesHideCursorReq); - swapl (&stuff->window, n); + swapl(&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -984,12 +973,11 @@ ProcXFixesShowCursor (ClientPtr client) int SProcXFixesShowCursor (ClientPtr client) { - int n; REQUEST(xXFixesShowCursorReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesShowCursorReq); - swapl (&stuff->window, n); + swapl(&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -1350,18 +1338,17 @@ ProcXFixesCreatePointerBarrier (ClientPtr client) int SProcXFixesCreatePointerBarrier (ClientPtr client) { - int n; REQUEST(xXFixesCreatePointerBarrierReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesCreatePointerBarrierReq); - swapl(&stuff->barrier, n); - swapl(&stuff->window, n); - swaps(&stuff->x1, n); - swaps(&stuff->y1, n); - swaps(&stuff->x2, n); - swaps(&stuff->y2, n); - swapl(&stuff->directions, n); + swapl(&stuff->barrier); + swapl(&stuff->window); + swaps(&stuff->x1); + swaps(&stuff->y1); + swaps(&stuff->x2); + swaps(&stuff->y2); + swapl(&stuff->directions); return ProcXFixesVector[stuff->xfixesReqType](client); } @@ -1412,12 +1399,11 @@ ProcXFixesDestroyPointerBarrier (ClientPtr client) int SProcXFixesDestroyPointerBarrier (ClientPtr client) { - int n; REQUEST(xXFixesDestroyPointerBarrierReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq); - swapl(&stuff->barrier, n); + swapl(&stuff->barrier); return ProcXFixesVector[stuff->xfixesReqType](client); } diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c index be2d391dd..4c2263702 100644 --- a/xorg-server/xfixes/region.c +++ b/xorg-server/xfixes/region.c @@ -93,12 +93,11 @@ ProcXFixesCreateRegion (ClientPtr client) int SProcXFixesCreateRegion (ClientPtr client) { - register int n; REQUEST(xXFixesCreateRegionReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq); - swapl(&stuff->region, n); + swapl(&stuff->region); SwapRestS(stuff); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -138,13 +137,12 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) int SProcXFixesCreateRegionFromBitmap (ClientPtr client) { - int n; REQUEST (xXFixesCreateRegionFromBitmapReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq); - swapl(&stuff->region, n); - swapl(&stuff->bitmap, n); + swapl(&stuff->region); + swapl(&stuff->bitmap); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -200,13 +198,12 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client) int SProcXFixesCreateRegionFromWindow (ClientPtr client) { - int n; REQUEST (xXFixesCreateRegionFromWindowReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq); - swapl(&stuff->region, n); - swapl(&stuff->window, n); + swapl(&stuff->region); + swapl(&stuff->window); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -250,13 +247,12 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) int SProcXFixesCreateRegionFromGC (ClientPtr client) { - int n; REQUEST (xXFixesCreateRegionFromGCReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq); - swapl(&stuff->region, n); - swapl(&stuff->gc, n); + swapl(&stuff->region); + swapl(&stuff->gc); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -297,13 +293,12 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client) int SProcXFixesCreateRegionFromPicture (ClientPtr client) { - int n; REQUEST (xXFixesCreateRegionFromPictureReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq); - swapl(&stuff->region, n); - swapl(&stuff->picture, n); + swapl(&stuff->region); + swapl(&stuff->picture); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -322,12 +317,11 @@ ProcXFixesDestroyRegion (ClientPtr client) int SProcXFixesDestroyRegion (ClientPtr client) { - int n; REQUEST (xXFixesDestroyRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq); - swapl (&stuff->region, n); + swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -361,12 +355,11 @@ ProcXFixesSetRegion (ClientPtr client) int SProcXFixesSetRegion (ClientPtr client) { - int n; REQUEST (xXFixesSetRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq); - swapl (&stuff->region, n); + swapl(&stuff->region); SwapRestS(stuff); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -389,13 +382,12 @@ ProcXFixesCopyRegion (ClientPtr client) int SProcXFixesCopyRegion (ClientPtr client) { - int n; REQUEST (xXFixesCopyRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq); - swapl (&stuff->source, n); - swapl (&stuff->destination, n); + swapl(&stuff->source); + swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -431,14 +423,13 @@ ProcXFixesCombineRegion (ClientPtr client) int SProcXFixesCombineRegion (ClientPtr client) { - int n; REQUEST (xXFixesCombineRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesCombineRegionReq); - swapl (&stuff->source1, n); - swapl (&stuff->source2, n); - swapl (&stuff->destination, n); + swapl(&stuff->source1); + swapl(&stuff->source2); + swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -475,17 +466,16 @@ ProcXFixesInvertRegion (ClientPtr client) int SProcXFixesInvertRegion (ClientPtr client) { - int n; REQUEST(xXFixesInvertRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesInvertRegionReq); - swapl (&stuff->source, n); - swaps (&stuff->x, n); - swaps (&stuff->y, n); - swaps (&stuff->width, n); - swaps (&stuff->height, n); - swapl (&stuff->destination, n); + swapl(&stuff->source); + swaps(&stuff->x); + swaps(&stuff->y); + swaps(&stuff->width); + swaps(&stuff->height); + swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -505,14 +495,13 @@ ProcXFixesTranslateRegion (ClientPtr client) int SProcXFixesTranslateRegion (ClientPtr client) { - int n; REQUEST(xXFixesTranslateRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); - swapl (&stuff->region, n); - swaps (&stuff->dx, n); - swaps (&stuff->dy, n); + swapl(&stuff->region); + swaps(&stuff->dx); + swaps(&stuff->dy); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -534,13 +523,12 @@ ProcXFixesRegionExtents (ClientPtr client) int SProcXFixesRegionExtents (ClientPtr client) { - int n; REQUEST(xXFixesRegionExtentsReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq); - swapl (&stuff->source, n); - swapl (&stuff->destination, n); + swapl(&stuff->source); + swapl(&stuff->destination); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -584,13 +572,12 @@ ProcXFixesFetchRegion (ClientPtr client) } if (client->swapped) { - int n; - swaps (&reply->sequenceNumber, n); - swapl (&reply->length, n); - swaps (&reply->x, n); - swaps (&reply->y, n); - swaps (&reply->width, n); - swaps (&reply->height, n); + swaps(&reply->sequenceNumber); + swapl(&reply->length); + swaps(&reply->x); + swaps(&reply->y); + swaps(&reply->width); + swaps(&reply->height); SwapShorts ((INT16 *) pRect, nBox * 4); } (void) WriteToClient(client, sizeof (xXFixesFetchRegionReply) + @@ -602,12 +589,11 @@ ProcXFixesFetchRegion (ClientPtr client) int SProcXFixesFetchRegion (ClientPtr client) { - int n; REQUEST(xXFixesFetchRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); - swapl (&stuff->region, n); + swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -645,15 +631,14 @@ ProcXFixesSetGCClipRegion (ClientPtr client) int SProcXFixesSetGCClipRegion (ClientPtr client) { - int n; REQUEST(xXFixesSetGCClipRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq); - swapl (&stuff->gc, n); - swapl (&stuff->region, n); - swaps (&stuff->xOrigin, n); - swaps (&stuff->yOrigin, n); + swapl(&stuff->gc); + swapl(&stuff->region); + swaps(&stuff->xOrigin); + swaps(&stuff->yOrigin); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -739,15 +724,14 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) int SProcXFixesSetWindowShapeRegion (ClientPtr client) { - int n; REQUEST(xXFixesSetWindowShapeRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq); - swapl (&stuff->dest, n); - swaps (&stuff->xOff, n); - swaps (&stuff->yOff, n); - swapl (&stuff->region, n); + swapl(&stuff->dest); + swaps(&stuff->xOff); + swaps(&stuff->yOff); + swapl(&stuff->region); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -769,15 +753,14 @@ ProcXFixesSetPictureClipRegion (ClientPtr client) int SProcXFixesSetPictureClipRegion (ClientPtr client) { - int n; REQUEST(xXFixesSetPictureClipRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq); - swapl (&stuff->picture, n); - swapl (&stuff->region, n); - swaps (&stuff->xOrigin, n); - swaps (&stuff->yOrigin, n); + swapl(&stuff->picture); + swapl(&stuff->region); + swaps(&stuff->xOrigin); + swaps(&stuff->yOrigin); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } @@ -824,17 +807,16 @@ ProcXFixesExpandRegion (ClientPtr client) int SProcXFixesExpandRegion (ClientPtr client) { - int n; REQUEST (xXFixesExpandRegionReq); - swaps (&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH (xXFixesExpandRegionReq); - swapl (&stuff->source, n); - swapl (&stuff->destination, n); - swaps (&stuff->left, n); - swaps (&stuff->right, n); - swaps (&stuff->top, n); - swaps (&stuff->bottom, n); + swapl(&stuff->source); + swapl(&stuff->destination); + swaps(&stuff->left); + swaps(&stuff->right); + swaps(&stuff->top); + swaps(&stuff->bottom); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } diff --git a/xorg-server/xfixes/saveset.c b/xorg-server/xfixes/saveset.c index dcd66792a..ba959c22b 100644 --- a/xorg-server/xfixes/saveset.c +++ b/xorg-server/xfixes/saveset.c @@ -1,72 +1,71 @@ -/*
- * Copyright © 2002 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xfixesint.h"
-
-int
-ProcXFixesChangeSaveSet(ClientPtr client)
-{
- Bool toRoot, map;
- int result;
- WindowPtr pWin;
- REQUEST(xXFixesChangeSaveSetReq);
-
- REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
- result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
- if (result != Success)
- return result;
- if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
- return BadMatch;
- if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))
- {
- client->errorValue = stuff->mode;
- return BadValue;
- }
- if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot))
- {
- client->errorValue = stuff->target;
- return BadValue;
- }
- if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap))
- {
- client->errorValue = stuff->map;
- return BadValue;
- }
- toRoot = (stuff->target == SaveSetRoot);
- map = (stuff->map == SaveSetMap);
- return AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, map);
-}
-
-int
-SProcXFixesChangeSaveSet(ClientPtr client)
-{
- register int n;
- REQUEST(xXFixesChangeSaveSetReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
-}
+/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" + +int +ProcXFixesChangeSaveSet(ClientPtr client) +{ + Bool toRoot, map; + int result; + WindowPtr pWin; + REQUEST(xXFixesChangeSaveSetReq); + + REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); + result = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess); + if (result != Success) + return result; + if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) + return BadMatch; + if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) + { + client->errorValue = stuff->mode; + return BadValue; + } + if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot)) + { + client->errorValue = stuff->target; + return BadValue; + } + if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap)) + { + client->errorValue = stuff->map; + return BadValue; + } + toRoot = (stuff->target == SaveSetRoot); + map = (stuff->map == SaveSetMap); + return AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, map); +} + +int +SProcXFixesChangeSaveSet(ClientPtr client) +{ + REQUEST(xXFixesChangeSaveSetReq); + + swaps(&stuff->length); + swapl(&stuff->window); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); +} diff --git a/xorg-server/xfixes/select.c b/xorg-server/xfixes/select.c index 1343ea737..2bf13f3fd 100644 --- a/xorg-server/xfixes/select.c +++ b/xorg-server/xfixes/select.c @@ -1,290 +1,289 @@ -/*
- * Copyright © 2002 Keith Packard
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xfixesint.h"
-#include "xace.h"
-
-static RESTYPE SelectionClientType, SelectionWindowType;
-static Bool SelectionCallbackRegistered = FALSE;
-
-/*
- * There is a global list of windows selecting for selection events
- * on every selection. This should be plenty efficient for the
- * expected usage, if it does become a problem, it should be easily
- * replaced with a hash table of some kind keyed off the selection atom
- */
-
-typedef struct _SelectionEvent *SelectionEventPtr;
-
-typedef struct _SelectionEvent {
- SelectionEventPtr next;
- Atom selection;
- CARD32 eventMask;
- ClientPtr pClient;
- WindowPtr pWindow;
- XID clientResource;
-} SelectionEventRec;
-
-static SelectionEventPtr selectionEvents;
-
-static void
-XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args)
-{
- SelectionEventPtr e;
- SelectionInfoRec *info = (SelectionInfoRec *) args;
- Selection *selection = info->selection;
- int subtype;
- CARD32 eventMask;
-
- switch (info->kind) {
- case SelectionSetOwner:
- subtype = XFixesSetSelectionOwnerNotify;
- eventMask = XFixesSetSelectionOwnerNotifyMask;
- break;
- case SelectionWindowDestroy:
- subtype = XFixesSelectionWindowDestroyNotify;
- eventMask = XFixesSelectionWindowDestroyNotifyMask;
- break;
- case SelectionClientClose:
- subtype = XFixesSelectionClientCloseNotify;
- eventMask = XFixesSelectionClientCloseNotifyMask;
- break;
- default:
- return;
- }
- 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;
- WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
- }
- }
-}
-
-static Bool
-CheckSelectionCallback (void)
-{
- if (selectionEvents)
- {
- if (!SelectionCallbackRegistered)
- {
- if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL))
- return FALSE;
- SelectionCallbackRegistered = TRUE;
- }
- }
- else
- {
- if (SelectionCallbackRegistered)
- {
- DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL);
- SelectionCallbackRegistered = FALSE;
- }
- }
- return TRUE;
-}
-
-#define SelectionAllEvents (XFixesSetSelectionOwnerNotifyMask |\
- XFixesSelectionWindowDestroyNotifyMask |\
- XFixesSelectionClientCloseNotifyMask)
-
-static int
-XFixesSelectSelectionInput (ClientPtr pClient,
- Atom selection,
- WindowPtr pWindow,
- CARD32 eventMask)
-{
- pointer val;
- int rc;
- SelectionEventPtr *prev, e;
-
- rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess);
- if (rc != Success)
- return rc;
-
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e->selection == selection &&
- e->pClient == pClient &&
- e->pWindow == pWindow)
- {
- break;
- }
- }
- if (!eventMask)
- {
- if (e)
- {
- FreeResource (e->clientResource, 0);
- }
- return Success;
- }
- if (!e)
- {
- e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec));
- if (!e)
- return BadAlloc;
-
- e->next = 0;
- e->selection = selection;
- e->pClient = pClient;
- e->pWindow = pWindow;
- e->clientResource = FakeClientID(pClient->index);
-
- /*
- * Add a resource hanging from the window to
- * catch window destroy
- */
- rc = dixLookupResourceByType (&val, pWindow->drawable.id,
- SelectionWindowType, serverClient,
- DixGetAttrAccess);
- if (rc != Success)
- if (!AddResource (pWindow->drawable.id, SelectionWindowType,
- (pointer) pWindow))
- {
- free(e);
- return BadAlloc;
- }
-
- if (!AddResource (e->clientResource, SelectionClientType, (pointer) e))
- return BadAlloc;
-
- *prev = e;
- if (!CheckSelectionCallback ())
- {
- FreeResource (e->clientResource, 0);
- return BadAlloc;
- }
- }
- e->eventMask = eventMask;
- return Success;
-}
-
-int
-ProcXFixesSelectSelectionInput (ClientPtr client)
-{
- REQUEST (xXFixesSelectSelectionInputReq);
- WindowPtr pWin;
- int rc;
-
- REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
- if (rc != Success)
- return rc;
- if (stuff->eventMask & ~SelectionAllEvents)
- {
- client->errorValue = stuff->eventMask;
- return BadValue;
- }
- return XFixesSelectSelectionInput (client, stuff->selection,
- pWin, stuff->eventMask);
-}
-
-int
-SProcXFixesSelectSelectionInput (ClientPtr client)
-{
- register int n;
- REQUEST(xXFixesSelectSelectionInputReq);
-
- swaps(&stuff->length, n);
- swapl(&stuff->window, n);
- swapl(&stuff->selection, n);
- swapl(&stuff->eventMask, n);
- return (*ProcXFixesVector[stuff->xfixesReqType])(client);
-}
-
-void
-SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from,
- xXFixesSelectionNotifyEvent *to)
-{
- to->type = from->type;
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswapl (from->window, to->window);
- cpswapl (from->owner, to->owner);
- cpswapl (from->selection, to->selection);
- cpswapl (from->timestamp, to->timestamp);
- cpswapl (from->selectionTimestamp, to->selectionTimestamp);
-}
-
-static int
-SelectionFreeClient (pointer data, XID id)
-{
- SelectionEventPtr old = (SelectionEventPtr) data;
- SelectionEventPtr *prev, e;
-
- for (prev = &selectionEvents; (e = *prev); prev = &e->next)
- {
- if (e == old)
- {
- *prev = e->next;
- free(e);
- CheckSelectionCallback ();
- break;
- }
- }
- return 1;
-}
-
-static int
-SelectionFreeWindow (pointer data, XID id)
-{
- WindowPtr pWindow = (WindowPtr) data;
- SelectionEventPtr e, next;
-
- for (e = selectionEvents; e; e = next)
- {
- next = e->next;
- if (e->pWindow == pWindow)
- {
- FreeResource (e->clientResource, 0);
- }
- }
- return 1;
-}
-
-Bool
-XFixesSelectionInit (void)
-{
- SelectionClientType = CreateNewResourceType(SelectionFreeClient,
- "XFixesSelectionClient");
- SelectionWindowType = CreateNewResourceType(SelectionFreeWindow,
- "XFixesSelectionWindow");
- return SelectionClientType && SelectionWindowType;
-}
+/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xfixesint.h" +#include "xace.h" + +static RESTYPE SelectionClientType, SelectionWindowType; +static Bool SelectionCallbackRegistered = FALSE; + +/* + * There is a global list of windows selecting for selection events + * on every selection. This should be plenty efficient for the + * expected usage, if it does become a problem, it should be easily + * replaced with a hash table of some kind keyed off the selection atom + */ + +typedef struct _SelectionEvent *SelectionEventPtr; + +typedef struct _SelectionEvent { + SelectionEventPtr next; + Atom selection; + CARD32 eventMask; + ClientPtr pClient; + WindowPtr pWindow; + XID clientResource; +} SelectionEventRec; + +static SelectionEventPtr selectionEvents; + +static void +XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args) +{ + SelectionEventPtr e; + SelectionInfoRec *info = (SelectionInfoRec *) args; + Selection *selection = info->selection; + int subtype; + CARD32 eventMask; + + switch (info->kind) { + case SelectionSetOwner: + subtype = XFixesSetSelectionOwnerNotify; + eventMask = XFixesSetSelectionOwnerNotifyMask; + break; + case SelectionWindowDestroy: + subtype = XFixesSelectionWindowDestroyNotify; + eventMask = XFixesSelectionWindowDestroyNotifyMask; + break; + case SelectionClientClose: + subtype = XFixesSelectionClientCloseNotify; + eventMask = XFixesSelectionClientCloseNotifyMask; + break; + default: + return; + } + 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; + WriteEventsToClient (e->pClient, 1, (xEvent *) &ev); + } + } +} + +static Bool +CheckSelectionCallback (void) +{ + if (selectionEvents) + { + if (!SelectionCallbackRegistered) + { + if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL)) + return FALSE; + SelectionCallbackRegistered = TRUE; + } + } + else + { + if (SelectionCallbackRegistered) + { + DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL); + SelectionCallbackRegistered = FALSE; + } + } + return TRUE; +} + +#define SelectionAllEvents (XFixesSetSelectionOwnerNotifyMask |\ + XFixesSelectionWindowDestroyNotifyMask |\ + XFixesSelectionClientCloseNotifyMask) + +static int +XFixesSelectSelectionInput (ClientPtr pClient, + Atom selection, + WindowPtr pWindow, + CARD32 eventMask) +{ + pointer val; + int rc; + SelectionEventPtr *prev, e; + + rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess); + if (rc != Success) + return rc; + + for (prev = &selectionEvents; (e = *prev); prev = &e->next) + { + if (e->selection == selection && + e->pClient == pClient && + e->pWindow == pWindow) + { + break; + } + } + if (!eventMask) + { + if (e) + { + FreeResource (e->clientResource, 0); + } + return Success; + } + if (!e) + { + e = (SelectionEventPtr) malloc(sizeof (SelectionEventRec)); + if (!e) + return BadAlloc; + + e->next = 0; + e->selection = selection; + e->pClient = pClient; + e->pWindow = pWindow; + e->clientResource = FakeClientID(pClient->index); + + /* + * Add a resource hanging from the window to + * catch window destroy + */ + rc = dixLookupResourceByType (&val, pWindow->drawable.id, + SelectionWindowType, serverClient, + DixGetAttrAccess); + if (rc != Success) + if (!AddResource (pWindow->drawable.id, SelectionWindowType, + (pointer) pWindow)) + { + free(e); + return BadAlloc; + } + + if (!AddResource (e->clientResource, SelectionClientType, (pointer) e)) + return BadAlloc; + + *prev = e; + if (!CheckSelectionCallback ()) + { + FreeResource (e->clientResource, 0); + return BadAlloc; + } + } + e->eventMask = eventMask; + return Success; +} + +int +ProcXFixesSelectSelectionInput (ClientPtr client) +{ + REQUEST (xXFixesSelectSelectionInputReq); + WindowPtr pWin; + int rc; + + REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); + if (rc != Success) + return rc; + if (stuff->eventMask & ~SelectionAllEvents) + { + client->errorValue = stuff->eventMask; + return BadValue; + } + return XFixesSelectSelectionInput (client, stuff->selection, + pWin, stuff->eventMask); +} + +int +SProcXFixesSelectSelectionInput (ClientPtr client) +{ + REQUEST(xXFixesSelectSelectionInputReq); + + swaps(&stuff->length); + swapl(&stuff->window); + swapl(&stuff->selection); + swapl(&stuff->eventMask); + return (*ProcXFixesVector[stuff->xfixesReqType])(client); +} + +void +SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from, + xXFixesSelectionNotifyEvent *to) +{ + to->type = from->type; + cpswaps (from->sequenceNumber, to->sequenceNumber); + cpswapl (from->window, to->window); + cpswapl (from->owner, to->owner); + cpswapl (from->selection, to->selection); + cpswapl (from->timestamp, to->timestamp); + cpswapl (from->selectionTimestamp, to->selectionTimestamp); +} + +static int +SelectionFreeClient (pointer data, XID id) +{ + SelectionEventPtr old = (SelectionEventPtr) data; + SelectionEventPtr *prev, e; + + for (prev = &selectionEvents; (e = *prev); prev = &e->next) + { + if (e == old) + { + *prev = e->next; + free(e); + CheckSelectionCallback (); + break; + } + } + return 1; +} + +static int +SelectionFreeWindow (pointer data, XID id) +{ + WindowPtr pWindow = (WindowPtr) data; + SelectionEventPtr e, next; + + for (e = selectionEvents; e; e = next) + { + next = e->next; + if (e->pWindow == pWindow) + { + FreeResource (e->clientResource, 0); + } + } + return 1; +} + +Bool +XFixesSelectionInit (void) +{ + SelectionClientType = CreateNewResourceType(SelectionFreeClient, + "XFixesSelectionClient"); + SelectionWindowType = CreateNewResourceType(SelectionFreeWindow, + "XFixesSelectionWindow"); + return SelectionClientType && SelectionWindowType; +} diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c index e0ebedd80..96d33c00b 100644 --- a/xorg-server/xfixes/xfixes.c +++ b/xorg-server/xfixes/xfixes.c @@ -61,7 +61,6 @@ ProcXFixesQueryVersion(ClientPtr client) { XFixesClientPtr pXFixesClient = GetXFixesClient (client); xXFixesQueryVersionReply rep; - register int n; REQUEST(xXFixesQueryVersionReq); REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); @@ -83,10 +82,10 @@ ProcXFixesQueryVersion(ClientPtr client) pXFixesClient->major_version = rep.majorVersion; pXFixesClient->minor_version = rep.minorVersion; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.majorVersion, n); - swapl(&rep.minorVersion, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.majorVersion); + swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *)&rep); return Success; @@ -161,12 +160,11 @@ ProcXFixesDispatch (ClientPtr client) static int SProcXFixesQueryVersion(ClientPtr client) { - register int n; REQUEST(xXFixesQueryVersionReq); - swaps(&stuff->length, n); - swapl(&stuff->majorVersion, n); - swapl(&stuff->minorVersion, n); + swaps(&stuff->length); + swapl(&stuff->majorVersion); + swapl(&stuff->minorVersion); return (*ProcXFixesVector[stuff->xfixesReqType]) (client); } |