diff options
author | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
commit | 81f91c615982e50bb62708201569c33a3cd3d973 (patch) | |
tree | 4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/Xext/shape.c | |
parent | b571a562410f565af2bdde52d9f7f9a23ffae04f (diff) | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2 vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip |
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/Xext/shape.c')
-rw-r--r-- | xorg-server/Xext/shape.c | 211 |
1 files changed, 92 insertions, 119 deletions
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c index 565dfdd16..0264d1c41 100644 --- a/xorg-server/Xext/shape.c +++ b/xorg-server/Xext/shape.c @@ -24,8 +24,6 @@ in this Software without prior written authorization from The Open Group. ********************************************************/ -#define NEED_REPLIES -#define NEED_EVENTS #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #else @@ -45,8 +43,7 @@ in this Software without prior written authorization from The Open Group. #include "dixstruct.h" #include "resource.h" #include "opaque.h" -#define _SHAPE_SERVER_ /* don't want Xlib structures */ -#include <X11/extensions/shapestr.h> +#include <X11/extensions/shapeproto.h> #include "regionstr.h" #include "gcstruct.h" #include "modinit.h" @@ -67,18 +64,6 @@ static void SShapeNotifyEvent( xShapeNotifyEvent * /* from */, xShapeNotifyEvent * /* to */ ); -static int -RegionOperate ( - ClientPtr /* client */, - WindowPtr /* pWin */, - int /* kind */, - RegionPtr * /* destRgnp */, - RegionPtr /* srcRgn */, - int /* op */, - int /* xoff */, - int /* yoff */, - CreateDftPtr /* create */ - ); /* SendShapeNotify, CreateBoundingShape and CreateClipShape are used * externally by the Xfixes extension and are now defined in window.h @@ -111,7 +96,7 @@ static DISPATCH_PROC(SProcShapeSelectInput); #endif static int ShapeEventBase = 0; -static RESTYPE ClientType, EventType; /* resource types for event masks */ +static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */ /* * each window has a list of clients requesting @@ -144,8 +129,8 @@ ShapeExtensionInit(void) ExtensionEntry *extEntry; ClientType = CreateNewResourceType(ShapeFreeClient); - EventType = CreateNewResourceType(ShapeFreeEvents); - if (ClientType && EventType && + ShapeEventType = CreateNewResourceType(ShapeFreeEvents); + if (ClientType && ShapeEventType && (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, ProcShapeDispatch, SProcShapeDispatch, NULL, StandardMinorOpcode))) @@ -156,14 +141,15 @@ ShapeExtensionInit(void) } static int -RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) - ClientPtr client; - WindowPtr pWin; - int kind; - RegionPtr *destRgnp, srcRgn; - int op; - int xoff, yoff; - CreateDftPtr create; /* creates a reasonable *destRgnp */ +RegionOperate ( + ClientPtr client, + WindowPtr pWin, + int kind, + RegionPtr *destRgnp, + RegionPtr srcRgn, + int op, + int xoff, int yoff, + CreateDftPtr create) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -241,8 +227,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) } RegionPtr -CreateBoundingShape (pWin) - WindowPtr pWin; +CreateBoundingShape (WindowPtr pWin) { BoxRec extents; @@ -254,8 +239,7 @@ CreateBoundingShape (pWin) } RegionPtr -CreateClipShape (pWin) - WindowPtr pWin; +CreateClipShape (WindowPtr pWin) { BoxRec extents; @@ -267,13 +251,13 @@ CreateClipShape (pWin) } static int -ProcShapeQueryVersion (client) - ClientPtr client; +ProcShapeQueryVersion (ClientPtr client) { xShapeQueryVersionReply rep; int n; REQUEST_SIZE_MATCH (xShapeQueryVersionReq); + memset(&rep, 0, sizeof(xShapeQueryVersionReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -295,8 +279,7 @@ ProcShapeQueryVersion (client) *****************/ static int -ProcShapeRectangles (client) - ClientPtr client; +ProcShapeRectangles (ClientPtr client) { WindowPtr pWin; ScreenPtr pScreen; @@ -371,13 +354,14 @@ ProcPanoramiXShapeRectangles( { REQUEST(xShapeRectanglesReq); PanoramiXRes *win; - int j, result = 0; + int j, result; REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) - return BadWindow; + result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, + client, DixWriteAccess); + if (result != Success) + return (result == BadValue) ? BadWindow : result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -395,8 +379,7 @@ ProcPanoramiXShapeRectangles( static int -ProcShapeMask (client) - ClientPtr client; +ProcShapeMask (ClientPtr client) { WindowPtr pWin; ScreenPtr pScreen; @@ -470,18 +453,20 @@ ProcPanoramiXShapeMask( { REQUEST(xShapeMaskReq); PanoramiXRes *win, *pmap; - int j, result = 0; + int j, result; REQUEST_SIZE_MATCH (xShapeMaskReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) - return BadWindow; + result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, + client, DixWriteAccess); + if (result != Success) + return (result == BadValue) ? BadWindow : result; if(stuff->src != None) { - if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_PIXMAP, DixReadAccess))) - return BadPixmap; + result = dixLookupResourceByType((pointer *)&pmap, stuff->src, + XRT_PIXMAP, client, DixReadAccess); + if (result != Success) + return (result == BadValue) ? BadPixmap : result; } else pmap = NULL; @@ -502,8 +487,7 @@ ProcPanoramiXShapeMask( ************/ static int -ProcShapeCombine (client) - ClientPtr client; +ProcShapeCombine (ClientPtr client) { WindowPtr pSrcWin, pDestWin; ScreenPtr pScreen; @@ -599,17 +583,19 @@ ProcPanoramiXShapeCombine( { REQUEST(xShapeCombineReq); PanoramiXRes *win, *win2; - int j, result = 0; + int j, result; REQUEST_AT_LEAST_SIZE (xShapeCombineReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) - return BadWindow; + result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, + client, DixWriteAccess); + if (result != Success) + return (result == BadValue) ? BadWindow : result; - if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_WINDOW, DixReadAccess))) - return BadWindow; + result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW, + client, DixReadAccess); + if (result != Success) + return (result == BadValue) ? BadWindow : result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -626,8 +612,7 @@ ProcPanoramiXShapeCombine( *************/ static int -ProcShapeOffset (client) - ClientPtr client; +ProcShapeOffset (ClientPtr client) { WindowPtr pWin; ScreenPtr pScreen; @@ -672,13 +657,14 @@ ProcPanoramiXShapeOffset( { REQUEST(xShapeOffsetReq); PanoramiXRes *win; - int j, result = 0; + int j, result; REQUEST_AT_LEAST_SIZE (xShapeOffsetReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) - return BadWindow; + result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, + client, DixWriteAccess); + if (result != Success) + return (result == BadValue) ? BadWindow : result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -691,8 +677,7 @@ ProcPanoramiXShapeOffset( static int -ProcShapeQueryExtents (client) - ClientPtr client; +ProcShapeQueryExtents (ClientPtr client) { REQUEST(xShapeQueryExtentsReq); WindowPtr pWin; @@ -705,6 +690,7 @@ ProcShapeQueryExtents (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; @@ -756,18 +742,18 @@ ProcShapeQueryExtents (client) /*ARGSUSED*/ static int -ShapeFreeClient (data, id) - pointer data; - XID id; +ShapeFreeClient (pointer data, XID id) { ShapeEventPtr pShapeEvent; WindowPtr pWin; ShapeEventPtr *pHead, pCur, pPrev; + int rc; pShapeEvent = (ShapeEventPtr) data; pWin = pShapeEvent->window; - pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); - if (pHead) { + rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, + ShapeEventType, serverClient, DixReadAccess); + if (rc == Success) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next) pPrev = pCur; @@ -785,9 +771,7 @@ ShapeFreeClient (data, id) /*ARGSUSED*/ static int -ShapeFreeEvents (data, id) - pointer data; - XID id; +ShapeFreeEvents (pointer data, XID id) { ShapeEventPtr *pHead, pCur, pNext; @@ -802,8 +786,7 @@ ShapeFreeEvents (data, id) } static int -ProcShapeSelectInput (client) - ClientPtr client; +ProcShapeSelectInput (ClientPtr client) { REQUEST(xShapeSelectInputReq); WindowPtr pWin; @@ -815,8 +798,11 @@ ProcShapeSelectInput (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (rc != Success) return rc; - pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, EventType, DixWriteAccess); + rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, + ShapeEventType, client, DixWriteAccess); + if (rc != Success && rc != BadValue) + return rc; + switch (stuff->enable) { case xTrue: if (pHead) { @@ -832,8 +818,7 @@ ProcShapeSelectInput (client) } /* build the entry */ - pNewShapeEvent = (ShapeEventPtr) - xalloc (sizeof (ShapeEventRec)); + pNewShapeEvent = xalloc (sizeof (ShapeEventRec)); if (!pNewShapeEvent) return BadAlloc; pNewShapeEvent->next = 0; @@ -855,9 +840,9 @@ ProcShapeSelectInput (client) */ if (!pHead) { - pHead = (ShapeEventPtr *) xalloc (sizeof (ShapeEventPtr)); + pHead = xalloc (sizeof (ShapeEventPtr)); if (!pHead || - !AddResource (pWin->drawable.id, EventType, (pointer)pHead)) + !AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead)) { FreeResource (clientResource, RT_NONE); return BadAlloc; @@ -898,9 +883,7 @@ ProcShapeSelectInput (client) */ void -SendShapeNotify (pWin, which) - WindowPtr pWin; - int which; +SendShapeNotify (WindowPtr pWin, int which) { ShapeEventPtr *pHead, pShapeEvent; ClientPtr client; @@ -908,9 +891,11 @@ SendShapeNotify (pWin, which) BoxRec extents; RegionPtr region; BYTE shaped; + int rc; - pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); - if (!pHead) + rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, + ShapeEventType, serverClient, DixReadAccess); + if (rc != Success) return; switch (which) { case ShapeBounding: @@ -974,8 +959,7 @@ SendShapeNotify (pWin, which) } static int -ProcShapeInputSelected (client) - ClientPtr client; +ProcShapeInputSelected (ClientPtr client) { REQUEST(xShapeInputSelectedReq); WindowPtr pWin; @@ -988,8 +972,10 @@ ProcShapeInputSelected (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; - pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, - pWin->drawable.id, EventType, DixReadAccess); + rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, + ShapeEventType, client, DixReadAccess); + if (rc != Success && rc != BadValue) + return rc; enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; @@ -1015,8 +1001,7 @@ ProcShapeInputSelected (client) } static int -ProcShapeGetRectangles (client) - ClientPtr client; +ProcShapeGetRectangles (ClientPtr client) { REQUEST(xShapeGetRectanglesReq); WindowPtr pWin; @@ -1046,7 +1031,7 @@ ProcShapeGetRectangles (client) } if (!region) { nrects = 1; - rects = (xRectangle *) xalloc (sizeof (xRectangle)); + rects = xalloc (sizeof (xRectangle)); if (!rects) return BadAlloc; switch (stuff->kind) { @@ -1073,7 +1058,7 @@ ProcShapeGetRectangles (client) BoxPtr box; nrects = REGION_NUM_RECTS(region); box = REGION_RECTS(region); - rects = (xRectangle *) xalloc (nrects * sizeof (xRectangle)); + rects = xalloc (nrects * sizeof (xRectangle)); if (!rects && nrects) return BadAlloc; for (i = 0; i < nrects; i++, box++) { @@ -1085,7 +1070,7 @@ ProcShapeGetRectangles (client) } rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.length = (nrects * sizeof (xRectangle)) >> 2; + rep.length = bytes_to_int32(nrects * sizeof (xRectangle)); rep.ordering = YXBanded; rep.nrects = nrects; if (client->swapped) { @@ -1101,8 +1086,7 @@ ProcShapeGetRectangles (client) } static int -ProcShapeDispatch (client) - ClientPtr client; +ProcShapeDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { @@ -1150,8 +1134,7 @@ ProcShapeDispatch (client) } static void -SShapeNotifyEvent(from, to) - xShapeNotifyEvent *from, *to; +SShapeNotifyEvent(xShapeNotifyEvent *from, xShapeNotifyEvent *to) { to->type = from->type; to->kind = from->kind; @@ -1166,8 +1149,7 @@ SShapeNotifyEvent(from, to) } static int -SProcShapeQueryVersion (client) - ClientPtr client; +SProcShapeQueryVersion (ClientPtr client) { int n; REQUEST (xShapeQueryVersionReq); @@ -1177,8 +1159,7 @@ SProcShapeQueryVersion (client) } static int -SProcShapeRectangles (client) - ClientPtr client; +SProcShapeRectangles (ClientPtr client) { char n; REQUEST (xShapeRectanglesReq); @@ -1193,8 +1174,7 @@ SProcShapeRectangles (client) } static int -SProcShapeMask (client) - ClientPtr client; +SProcShapeMask (ClientPtr client) { char n; REQUEST (xShapeMaskReq); @@ -1209,8 +1189,7 @@ SProcShapeMask (client) } static int -SProcShapeCombine (client) - ClientPtr client; +SProcShapeCombine (ClientPtr client) { char n; REQUEST (xShapeCombineReq); @@ -1225,8 +1204,7 @@ SProcShapeCombine (client) } static int -SProcShapeOffset (client) - ClientPtr client; +SProcShapeOffset (ClientPtr client) { char n; REQUEST (xShapeOffsetReq); @@ -1240,8 +1218,7 @@ SProcShapeOffset (client) } static int -SProcShapeQueryExtents (client) - ClientPtr client; +SProcShapeQueryExtents (ClientPtr client) { char n; REQUEST (xShapeQueryExtentsReq); @@ -1253,8 +1230,7 @@ SProcShapeQueryExtents (client) } static int -SProcShapeSelectInput (client) - ClientPtr client; +SProcShapeSelectInput (ClientPtr client) { char n; REQUEST (xShapeSelectInputReq); @@ -1266,8 +1242,7 @@ SProcShapeSelectInput (client) } static int -SProcShapeInputSelected (client) - ClientPtr client; +SProcShapeInputSelected (ClientPtr client) { int n; REQUEST (xShapeInputSelectedReq); @@ -1279,8 +1254,7 @@ SProcShapeInputSelected (client) } static int -SProcShapeGetRectangles (client) - ClientPtr client; +SProcShapeGetRectangles (ClientPtr client) { REQUEST(xShapeGetRectanglesReq); char n; @@ -1292,8 +1266,7 @@ SProcShapeGetRectangles (client) } static int -SProcShapeDispatch (client) - ClientPtr client; +SProcShapeDispatch (ClientPtr client) { REQUEST(xReq); switch (stuff->data) { |