aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/shape.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/Xext/shape.c
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/Xext/shape.c')
-rw-r--r--xorg-server/Xext/shape.c1311
1 files changed, 650 insertions, 661 deletions
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index 3263c0224..d3859a51d 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -49,35 +49,30 @@ in this Software without prior written authorization from The Open Group.
#include "modinit.h"
#include "protocol-versions.h"
-typedef RegionPtr (*CreateDftPtr)(
- WindowPtr /* pWin */
- );
-
-static int ShapeFreeClient(
- pointer /* data */,
- XID /* id */
- );
-static int ShapeFreeEvents(
- pointer /* data */,
- XID /* id */
- );
-static void SShapeNotifyEvent(
- xShapeNotifyEvent * /* from */,
- xShapeNotifyEvent * /* to */
- );
+typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
+ );
+
+static int ShapeFreeClient(pointer /* data */ ,
+ XID /* id */
+ );
+static int ShapeFreeEvents(pointer /* data */ ,
+ XID /* id */
+ );
+static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
+ xShapeNotifyEvent * /* to */
+ );
/* SendShapeNotify, CreateBoundingShape and CreateClipShape are used
* externally by the Xfixes extension and are now defined in window.h
*/
-
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
static int ShapeEventBase = 0;
-static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
+static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
/*
* each window has a list of clients requesting
@@ -90,10 +85,10 @@ static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
typedef struct _ShapeEvent *ShapeEventPtr;
typedef struct _ShapeEvent {
- ShapeEventPtr next;
- ClientPtr client;
- WindowPtr window;
- XID clientResource;
+ ShapeEventPtr next;
+ ClientPtr client;
+ WindowPtr window;
+ XID clientResource;
} ShapeEventRec;
/****************
@@ -105,23 +100,18 @@ typedef struct _ShapeEvent {
****************/
static int
-RegionOperate (
- ClientPtr client,
- WindowPtr pWin,
- int kind,
- RegionPtr *destRgnp,
- RegionPtr srcRgn,
- int op,
- int xoff, int yoff,
- CreateDftPtr create)
+RegionOperate(ClientPtr client,
+ WindowPtr pWin,
+ int kind,
+ RegionPtr *destRgnp,
+ RegionPtr srcRgn, int op, int xoff, int yoff, CreateDftPtr create)
{
if (srcRgn && (xoff || yoff))
- RegionTranslate(srcRgn, xoff, yoff);
- if (!pWin->parent)
- {
- if (srcRgn)
- RegionDestroy(srcRgn);
- return Success;
+ RegionTranslate(srcRgn, xoff, yoff);
+ if (!pWin->parent) {
+ if (srcRgn)
+ RegionDestroy(srcRgn);
+ return Success;
}
/* May/30/2001:
@@ -130,80 +120,81 @@ RegionOperate (
* see shape.PS, page 3, ShapeMask.
*/
if (srcRgn == NULL) {
- if (*destRgnp != NULL) {
- RegionDestroy(*destRgnp);
- *destRgnp = 0;
- /* go on to remove shape and generate ShapeNotify */
- }
- else {
- /* May/30/2001:
- * The target currently has no shape in effect, so nothing to
- * do here. The specs say that ShapeNotify is generated whenever
- * the client region is "modified"; since no modification is done
- * here, we do not generate that event. The specs does not say
- * "it is an error to request removal when there is no shape in
- * effect", so we return good status.
- */
- return Success;
- }
- }
- else switch (op) {
- case ShapeSet:
- if (*destRgnp)
- RegionDestroy(*destRgnp);
- *destRgnp = srcRgn;
- srcRgn = 0;
- break;
- case ShapeUnion:
- if (*destRgnp)
- RegionUnion(*destRgnp, *destRgnp, srcRgn);
- break;
- case ShapeIntersect:
- if (*destRgnp)
- RegionIntersect(*destRgnp, *destRgnp, srcRgn);
- else {
- *destRgnp = srcRgn;
- srcRgn = 0;
- }
- break;
- case ShapeSubtract:
- if (!*destRgnp)
- *destRgnp = (*create)(pWin);
- RegionSubtract(*destRgnp, *destRgnp, srcRgn);
- break;
- case ShapeInvert:
- if (!*destRgnp)
- *destRgnp = RegionCreate((BoxPtr) 0, 0);
- else
- RegionSubtract(*destRgnp, srcRgn, *destRgnp);
- break;
- default:
- client->errorValue = op;
- return BadValue;
+ if (*destRgnp != NULL) {
+ RegionDestroy(*destRgnp);
+ *destRgnp = 0;
+ /* go on to remove shape and generate ShapeNotify */
+ }
+ else {
+ /* May/30/2001:
+ * The target currently has no shape in effect, so nothing to
+ * do here. The specs say that ShapeNotify is generated whenever
+ * the client region is "modified"; since no modification is done
+ * here, we do not generate that event. The specs does not say
+ * "it is an error to request removal when there is no shape in
+ * effect", so we return good status.
+ */
+ return Success;
+ }
}
+ else
+ switch (op) {
+ case ShapeSet:
+ if (*destRgnp)
+ RegionDestroy(*destRgnp);
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ break;
+ case ShapeUnion:
+ if (*destRgnp)
+ RegionUnion(*destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeIntersect:
+ if (*destRgnp)
+ RegionIntersect(*destRgnp, *destRgnp, srcRgn);
+ else {
+ *destRgnp = srcRgn;
+ srcRgn = 0;
+ }
+ break;
+ case ShapeSubtract:
+ if (!*destRgnp)
+ *destRgnp = (*create) (pWin);
+ RegionSubtract(*destRgnp, *destRgnp, srcRgn);
+ break;
+ case ShapeInvert:
+ if (!*destRgnp)
+ *destRgnp = RegionCreate((BoxPtr) 0, 0);
+ else
+ RegionSubtract(*destRgnp, srcRgn, *destRgnp);
+ break;
+ default:
+ client->errorValue = op;
+ return BadValue;
+ }
if (srcRgn)
- RegionDestroy(srcRgn);
+ RegionDestroy(srcRgn);
(*pWin->drawable.pScreen->SetShape) (pWin, kind);
- SendShapeNotify (pWin, kind);
+ SendShapeNotify(pWin, kind);
return Success;
}
RegionPtr
-CreateBoundingShape (WindowPtr pWin)
+CreateBoundingShape(WindowPtr pWin)
{
- BoxRec extents;
+ BoxRec extents;
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
return RegionCreate(&extents, 1);
}
RegionPtr
-CreateClipShape (WindowPtr pWin)
+CreateClipShape(WindowPtr pWin)
{
- BoxRec extents;
+ BoxRec extents;
extents.x1 = 0;
extents.y1 = 0;
@@ -213,10 +204,11 @@ CreateClipShape (WindowPtr pWin)
}
static int
-ProcShapeQueryVersion (ClientPtr client)
+ProcShapeQueryVersion(ClientPtr client)
{
- xShapeQueryVersionReply rep;
- REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
+ xShapeQueryVersionReply rep;
+
+ REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply;
rep.length = 0;
@@ -224,12 +216,12 @@ ProcShapeQueryVersion (ClientPtr client)
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);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.majorVersion);
+ swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
return Success;
}
@@ -239,325 +231,324 @@ ProcShapeQueryVersion (ClientPtr client)
*****************/
static int
-ProcShapeRectangles (ClientPtr client)
+ProcShapeRectangles(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xShapeRectanglesReq);
- xRectangle *prects;
- int nrects, ctype, rc;
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- CreateDftPtr createDefault;
+ xRectangle *prects;
+ int nrects, ctype, rc;
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
- (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
- {
- client->errorValue = stuff->ordering;
+ (stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
+ client->errorValue = stuff->ordering;
return BadValue;
}
- nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
+ nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
if (nrects & 4)
- return BadLength;
+ return BadLength;
nrects >>= 3;
prects = (xRectangle *) &stuff[1];
- ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
+ ctype = VerifyRectOrder(nrects, prects, (int) stuff->ordering);
if (ctype < 0)
- return BadMatch;
+ return BadMatch;
srcRgn = RegionFromRects(nrects, prects, ctype);
if (!pWin->optional)
- MakeWindowOptional (pWin);
+ MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pWin->optional->boundingShape;
- break;
+ destRgn = &pWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pWin->optional->clipShape;
- break;
+ destRgn = &pWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pWin->optional->inputShape;
- break;
+ destRgn = &pWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeRectangles(
- ClientPtr client)
+ProcPanoramiXShapeRectangles(ClientPtr client)
{
REQUEST(xShapeRectanglesReq);
- PanoramiXRes *win;
- int j, result;
+ PanoramiXRes *win;
+ int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- result = ProcShapeRectangles (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ result = ProcShapeRectangles(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
/**************
* ProcShapeMask
**************/
-
static int
-ProcShapeMask (ClientPtr client)
+ProcShapeMask(ClientPtr client)
{
- WindowPtr pWin;
- ScreenPtr pScreen;
+ WindowPtr pWin;
+ ScreenPtr pScreen;
+
REQUEST(xShapeMaskReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- PixmapPtr pPixmap;
- CreateDftPtr createDefault;
- int rc;
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ PixmapPtr pPixmap;
+ CreateDftPtr createDefault;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
pScreen = pWin->drawable.pScreen;
if (stuff->src == None)
- srcRgn = 0;
+ srcRgn = 0;
else {
- rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
- client, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
+ RT_PIXMAP, client, DixReadAccess);
if (rc != Success)
- return rc;
- if (pPixmap->drawable.pScreen != pScreen ||
- pPixmap->drawable.depth != 1)
- return BadMatch;
- srcRgn = BitmapToRegion(pScreen, pPixmap);
- if (!srcRgn)
- return BadAlloc;
+ return rc;
+ if (pPixmap->drawable.pScreen != pScreen ||
+ pPixmap->drawable.depth != 1)
+ return BadMatch;
+ srcRgn = BitmapToRegion(pScreen, pPixmap);
+ if (!srcRgn)
+ return BadAlloc;
}
if (!pWin->optional)
- MakeWindowOptional (pWin);
+ MakeWindowOptional(pWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pWin->optional->boundingShape;
- break;
+ destRgn = &pWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pWin->optional->clipShape;
- break;
+ destRgn = &pWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pWin->optional->inputShape;
- break;
+ destRgn = &pWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeMask(
- ClientPtr client)
+ProcPanoramiXShapeMask(ClientPtr client)
{
REQUEST(xShapeMaskReq);
- PanoramiXRes *win, *pmap;
- int j, result;
+ PanoramiXRes *win, *pmap;
+ int j, result;
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- if(stuff->src != None) {
- result = dixLookupResourceByType((pointer *)&pmap, stuff->src,
- XRT_PIXMAP, client, DixReadAccess);
- if (result != Success)
- return result;
- } else
- pmap = NULL;
+ if (stuff->src != None) {
+ result = dixLookupResourceByType((pointer *) &pmap, stuff->src,
+ XRT_PIXMAP, client, DixReadAccess);
+ if (result != Success)
+ return result;
+ }
+ else
+ pmap = NULL;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- if(pmap)
- stuff->src = pmap->info[j].id;
- result = ProcShapeMask (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ if (pmap)
+ stuff->src = pmap->info[j].id;
+ result = ProcShapeMask(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
/************
* ProcShapeCombine
************/
static int
-ProcShapeCombine (ClientPtr client)
+ProcShapeCombine(ClientPtr client)
{
- WindowPtr pSrcWin, pDestWin;
+ WindowPtr pSrcWin, pDestWin;
+
REQUEST(xShapeCombineReq);
- RegionPtr srcRgn;
- RegionPtr *destRgn;
- CreateDftPtr createDefault;
- CreateDftPtr createSrc;
- RegionPtr tmp;
- int rc;
-
- REQUEST_SIZE_MATCH (xShapeCombineReq);
+ RegionPtr srcRgn;
+ RegionPtr *destRgn;
+ CreateDftPtr createDefault;
+ CreateDftPtr createSrc;
+ RegionPtr tmp;
+ int rc;
+
+ REQUEST_SIZE_MATCH(xShapeCombineReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
if (!pDestWin->optional)
- MakeWindowOptional (pDestWin);
+ MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
case ShapeClip:
- createDefault = CreateClipShape;
- break;
+ createDefault = CreateClipShape;
+ break;
case ShapeInput:
- createDefault = CreateBoundingShape;
- break;
+ createDefault = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->srcKind) {
case ShapeBounding:
- srcRgn = wBoundingShape (pSrcWin);
- createSrc = CreateBoundingShape;
- break;
+ srcRgn = wBoundingShape(pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
case ShapeClip:
- srcRgn = wClipShape (pSrcWin);
- createSrc = CreateClipShape;
- break;
+ srcRgn = wClipShape(pSrcWin);
+ createSrc = CreateClipShape;
+ break;
case ShapeInput:
- srcRgn = wInputShape (pSrcWin);
- createSrc = CreateBoundingShape;
- break;
+ srcRgn = wInputShape(pSrcWin);
+ createSrc = CreateBoundingShape;
+ break;
default:
- client->errorValue = stuff->srcKind;
- return BadValue;
+ client->errorValue = stuff->srcKind;
+ return BadValue;
}
- if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
- {
- return BadMatch;
+ if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen) {
+ return BadMatch;
}
if (srcRgn) {
tmp = RegionCreate((BoxPtr) 0, 0);
RegionCopy(tmp, srcRgn);
srcRgn = tmp;
- } else
- srcRgn = (*createSrc) (pSrcWin);
+ }
+ else
+ srcRgn = (*createSrc) (pSrcWin);
if (!pDestWin->optional)
- MakeWindowOptional (pDestWin);
+ MakeWindowOptional(pDestWin);
switch (stuff->destKind) {
case ShapeBounding:
- destRgn = &pDestWin->optional->boundingShape;
- break;
+ destRgn = &pDestWin->optional->boundingShape;
+ break;
case ShapeClip:
- destRgn = &pDestWin->optional->clipShape;
- break;
+ destRgn = &pDestWin->optional->clipShape;
+ break;
case ShapeInput:
- destRgn = &pDestWin->optional->inputShape;
- break;
+ destRgn = &pDestWin->optional->inputShape;
+ break;
default:
- return BadValue;
+ return BadValue;
}
- return RegionOperate (client, pDestWin, (int)stuff->destKind,
- destRgn, srcRgn, (int)stuff->op,
- stuff->xOff, stuff->yOff, createDefault);
+ return RegionOperate(client, pDestWin, (int) stuff->destKind,
+ destRgn, srcRgn, (int) stuff->op,
+ stuff->xOff, stuff->yOff, createDefault);
}
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeCombine(
- ClientPtr client)
+ProcPanoramiXShapeCombine(ClientPtr client)
{
REQUEST(xShapeCombineReq);
- PanoramiXRes *win, *win2;
- int j, result;
+ PanoramiXRes *win, *win2;
+ int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
+ REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
- result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW,
- client, DixReadAccess);
+ result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW,
+ client, DixReadAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- stuff->src = win2->info[j].id;
- result = ProcShapeCombine (client);
- if (result != Success) break;
+ stuff->dest = win->info[j].id;
+ stuff->src = win2->info[j].id;
+ result = ProcShapeCombine(client);
+ if (result != Success)
+ break;
}
return result;
}
@@ -568,82 +559,80 @@ ProcPanoramiXShapeCombine(
*************/
static int
-ProcShapeOffset (ClientPtr client)
+ProcShapeOffset(ClientPtr client)
{
- WindowPtr pWin;
+ WindowPtr pWin;
+
REQUEST(xShapeOffsetReq);
- RegionPtr srcRgn;
- int rc;
+ RegionPtr srcRgn;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ REQUEST_SIZE_MATCH(xShapeOffsetReq);
UpdateCurrentTime();
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->destKind) {
case ShapeBounding:
- srcRgn = wBoundingShape (pWin);
- break;
+ srcRgn = wBoundingShape(pWin);
+ break;
case ShapeClip:
- srcRgn = wClipShape(pWin);
- break;
+ srcRgn = wClipShape(pWin);
+ break;
case ShapeInput:
- srcRgn = wInputShape (pWin);
- break;
+ srcRgn = wInputShape(pWin);
+ break;
default:
- client->errorValue = stuff->destKind;
- return BadValue;
+ client->errorValue = stuff->destKind;
+ return BadValue;
}
- if (srcRgn)
- {
+ if (srcRgn) {
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
}
- SendShapeNotify (pWin, (int)stuff->destKind);
+ SendShapeNotify(pWin, (int) stuff->destKind);
return Success;
}
-
#ifdef PANORAMIX
static int
-ProcPanoramiXShapeOffset(
- ClientPtr client)
+ProcPanoramiXShapeOffset(ClientPtr client)
{
REQUEST(xShapeOffsetReq);
PanoramiXRes *win;
int j, result;
- REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
-
- result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
- client, DixWriteAccess);
+ REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
+
+ result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
+ client, DixWriteAccess);
if (result != Success)
- return result;
+ return result;
FOR_NSCREENS(j) {
- stuff->dest = win->info[j].id;
- result = ProcShapeOffset (client);
- if(result != Success) break;
+ stuff->dest = win->info[j].id;
+ result = ProcShapeOffset(client);
+ if (result != Success)
+ break;
}
return result;
}
#endif
-
static int
-ProcShapeQueryExtents (ClientPtr client)
+ProcShapeQueryExtents(ClientPtr client)
{
REQUEST(xShapeQueryExtentsReq);
- WindowPtr pWin;
- xShapeQueryExtentsReply rep;
- BoxRec extents, *pExtents;
- int rc;
- RegionPtr region;
+ WindowPtr pWin;
+ xShapeQueryExtentsReply rep;
+ BoxRec extents, *pExtents;
+ int rc;
+ RegionPtr region;
- REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
rep.type = X_Reply;
rep.length = 0;
@@ -651,183 +640,180 @@ ProcShapeQueryExtents (ClientPtr client)
rep.boundingShaped = (wBoundingShape(pWin) != 0);
rep.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);
- extents = *pExtents;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = RegionExtents(region);
+ extents = *pExtents;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
}
rep.xBoundingShape = extents.x1;
rep.yBoundingShape = extents.y1;
rep.widthBoundingShape = extents.x2 - extents.x1;
rep.heightBoundingShape = extents.y2 - extents.y1;
if ((region = wClipShape(pWin))) {
- /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
- pExtents = RegionExtents(region);
- extents = *pExtents;
- } else {
- extents.x1 = 0;
- extents.y1 = 0;
- extents.x2 = pWin->drawable.width;
- extents.y2 = pWin->drawable.height;
+ /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
+ pExtents = RegionExtents(region);
+ extents = *pExtents;
+ }
+ else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
}
rep.xClipShape = extents.x1;
rep.yClipShape = extents.y1;
rep.widthClipShape = extents.x2 - extents.x1;
rep.heightClipShape = extents.y2 - extents.y1;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.xBoundingShape);
- swaps(&rep.yBoundingShape);
- swaps(&rep.widthBoundingShape);
- swaps(&rep.heightBoundingShape);
- swaps(&rep.xClipShape);
- swaps(&rep.yClipShape);
- swaps(&rep.widthClipShape);
- swaps(&rep.heightClipShape);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.xBoundingShape);
+ swaps(&rep.yBoundingShape);
+ swaps(&rep.widthBoundingShape);
+ swaps(&rep.heightBoundingShape);
+ swaps(&rep.xClipShape);
+ swaps(&rep.yClipShape);
+ swaps(&rep.widthClipShape);
+ swaps(&rep.heightClipShape);
}
- WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
+ WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
return Success;
}
-/*ARGSUSED*/
-static int
-ShapeFreeClient (pointer data, XID id)
+ /*ARGSUSED*/ static int
+ShapeFreeClient(pointer data, XID id)
{
- ShapeEventPtr pShapeEvent;
- WindowPtr pWin;
- ShapeEventPtr *pHead, pCur, pPrev;
+ ShapeEventPtr pShapeEvent;
+ WindowPtr pWin;
+ ShapeEventPtr *pHead, pCur, pPrev;
int rc;
pShapeEvent = (ShapeEventPtr) data;
pWin = pShapeEvent->window;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, serverClient, DixReadAccess);
+ 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;
- if (pCur)
- {
- if (pPrev)
- pPrev->next = pShapeEvent->next;
- else
- *pHead = pShapeEvent->next;
- }
+ pPrev = 0;
+ for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
+ pPrev = pCur;
+ if (pCur) {
+ if (pPrev)
+ pPrev->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ }
}
free((pointer) pShapeEvent);
return 1;
}
-/*ARGSUSED*/
-static int
-ShapeFreeEvents (pointer data, XID id)
+ /*ARGSUSED*/ static int
+ShapeFreeEvents(pointer data, XID id)
{
- ShapeEventPtr *pHead, pCur, pNext;
+ ShapeEventPtr *pHead, pCur, pNext;
pHead = (ShapeEventPtr *) data;
for (pCur = *pHead; pCur; pCur = pNext) {
- pNext = pCur->next;
- FreeResource (pCur->clientResource, ClientType);
- free((pointer) pCur);
+ pNext = pCur->next;
+ FreeResource(pCur->clientResource, ClientType);
+ free((pointer) pCur);
}
free((pointer) pHead);
return 1;
}
static int
-ProcShapeSelectInput (ClientPtr client)
+ProcShapeSelectInput(ClientPtr client)
{
REQUEST(xShapeSelectInputReq);
- WindowPtr pWin;
- ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
- XID clientResource;
- int rc;
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
+ XID clientResource;
+ int rc;
- REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ REQUEST_SIZE_MATCH(xShapeSelectInputReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, client, DixWriteAccess);
+ return rc;
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, client, DixWriteAccess);
if (rc != Success && rc != BadValue)
- return rc;
+ return rc;
switch (stuff->enable) {
case xTrue:
- if (pHead) {
-
- /* check for existing entry. */
- for (pShapeEvent = *pHead;
- pShapeEvent;
- pShapeEvent = pShapeEvent->next)
- {
- if (pShapeEvent->client == client)
- return Success;
- }
- }
-
- /* build the entry */
- pNewShapeEvent = malloc(sizeof (ShapeEventRec));
- if (!pNewShapeEvent)
- return BadAlloc;
- pNewShapeEvent->next = 0;
- pNewShapeEvent->client = client;
- pNewShapeEvent->window = pWin;
- /*
- * add a resource that will be deleted when
- * the client goes away
- */
- clientResource = FakeClientID (client->index);
- pNewShapeEvent->clientResource = clientResource;
- if (!AddResource (clientResource, ClientType, (pointer)pNewShapeEvent))
- return BadAlloc;
- /*
- * create a resource to contain a pointer to the list
- * of clients selecting input. This must be indirect as
- * the list may be arbitrarily rearranged which cannot be
- * done through the resource database.
- */
- if (!pHead)
- {
- pHead = malloc(sizeof (ShapeEventPtr));
- if (!pHead ||
- !AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
- {
- FreeResource (clientResource, RT_NONE);
- return BadAlloc;
- }
- *pHead = 0;
- }
- pNewShapeEvent->next = *pHead;
- *pHead = pNewShapeEvent;
- break;
+ if (pHead) {
+
+ /* check for existing entry. */
+ for (pShapeEvent = *pHead;
+ pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client)
+ return Success;
+ }
+ }
+
+ /* build the entry */
+ pNewShapeEvent = malloc(sizeof(ShapeEventRec));
+ if (!pNewShapeEvent)
+ return BadAlloc;
+ pNewShapeEvent->next = 0;
+ pNewShapeEvent->client = client;
+ pNewShapeEvent->window = pWin;
+ /*
+ * add a resource that will be deleted when
+ * the client goes away
+ */
+ clientResource = FakeClientID(client->index);
+ pNewShapeEvent->clientResource = clientResource;
+ if (!AddResource(clientResource, ClientType, (pointer) pNewShapeEvent))
+ return BadAlloc;
+ /*
+ * create a resource to contain a pointer to the list
+ * of clients selecting input. This must be indirect as
+ * the list may be arbitrarily rearranged which cannot be
+ * done through the resource database.
+ */
+ if (!pHead) {
+ pHead = malloc(sizeof(ShapeEventPtr));
+ if (!pHead ||
+ !AddResource(pWin->drawable.id, ShapeEventType,
+ (pointer) pHead)) {
+ FreeResource(clientResource, RT_NONE);
+ return BadAlloc;
+ }
+ *pHead = 0;
+ }
+ pNewShapeEvent->next = *pHead;
+ *pHead = pNewShapeEvent;
+ break;
case xFalse:
- /* delete the interest */
- if (pHead) {
- pNewShapeEvent = 0;
- for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- if (pShapeEvent->client == client)
- break;
- pNewShapeEvent = pShapeEvent;
- }
- if (pShapeEvent) {
- FreeResource (pShapeEvent->clientResource, ClientType);
- if (pNewShapeEvent)
- pNewShapeEvent->next = pShapeEvent->next;
- else
- *pHead = pShapeEvent->next;
- free(pShapeEvent);
- }
- }
- break;
+ /* delete the interest */
+ if (pHead) {
+ pNewShapeEvent = 0;
+ for (pShapeEvent = *pHead; pShapeEvent;
+ pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client)
+ break;
+ pNewShapeEvent = pShapeEvent;
+ }
+ if (pShapeEvent) {
+ FreeResource(pShapeEvent->clientResource, ClientType);
+ if (pNewShapeEvent)
+ pNewShapeEvent->next = pShapeEvent->next;
+ else
+ *pHead = pShapeEvent->next;
+ free(pShapeEvent);
+ }
+ }
+ break;
default:
- client->errorValue = stuff->enable;
- return BadValue;
+ client->errorValue = stuff->enable;
+ return BadValue;
}
return Success;
}
@@ -837,394 +823,398 @@ ProcShapeSelectInput (ClientPtr client)
*/
void
-SendShapeNotify (WindowPtr pWin, int which)
+SendShapeNotify(WindowPtr pWin, int which)
{
- ShapeEventPtr *pHead, pShapeEvent;
- xShapeNotifyEvent se;
- BoxRec extents;
- RegionPtr region;
- BYTE shaped;
+ ShapeEventPtr *pHead, pShapeEvent;
+ xShapeNotifyEvent se;
+ BoxRec extents;
+ RegionPtr region;
+ BYTE shaped;
int rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, serverClient, DixReadAccess);
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, serverClient, DixReadAccess);
if (rc != Success)
- return;
+ return;
switch (which) {
case ShapeBounding:
- region = wBoundingShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- shaped = xFalse;
- }
- break;
+ region = wBoundingShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
+ shaped = xFalse;
+ }
+ break;
case ShapeClip:
- region = wClipShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = 0;
- extents.y1 = 0;
- extents.x2 = pWin->drawable.width;
- extents.y2 = pWin->drawable.height;
- shaped = xFalse;
- }
- break;
+ region = wClipShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = 0;
+ extents.y1 = 0;
+ extents.x2 = pWin->drawable.width;
+ extents.y2 = pWin->drawable.height;
+ shaped = xFalse;
+ }
+ break;
case ShapeInput:
- region = wInputShape(pWin);
- if (region) {
- extents = *RegionExtents(region);
- shaped = xTrue;
- } else {
- extents.x1 = -wBorderWidth (pWin);
- extents.y1 = -wBorderWidth (pWin);
- extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
- extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
- shaped = xFalse;
- }
- break;
+ region = wInputShape(pWin);
+ if (region) {
+ extents = *RegionExtents(region);
+ shaped = xTrue;
+ }
+ else {
+ extents.x1 = -wBorderWidth(pWin);
+ extents.y1 = -wBorderWidth(pWin);
+ extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
+ extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
+ shaped = xFalse;
+ }
+ break;
default:
- return;
+ 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;
- WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se);
+ 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;
+ WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
}
}
static int
-ProcShapeInputSelected (ClientPtr client)
+ProcShapeInputSelected(ClientPtr client)
{
REQUEST(xShapeInputSelectedReq);
- WindowPtr pWin;
- ShapeEventPtr pShapeEvent, *pHead;
- int enabled, rc;
- xShapeInputSelectedReply rep;
- REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ WindowPtr pWin;
+ ShapeEventPtr pShapeEvent, *pHead;
+ int enabled, rc;
+ xShapeInputSelectedReply rep;
+
+ REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
- rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
- ShapeEventType, client, DixReadAccess);
+ return rc;
+ rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
+ ShapeEventType, client, DixReadAccess);
if (rc != Success && rc != BadValue)
- return rc;
+ return rc;
enabled = xFalse;
if (pHead) {
- for (pShapeEvent = *pHead;
- pShapeEvent;
- pShapeEvent = pShapeEvent->next)
- {
- if (pShapeEvent->client == client) {
- enabled = xTrue;
- break;
- }
- }
+ for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
+ if (pShapeEvent->client == client) {
+ enabled = xTrue;
+ break;
+ }
+ }
}
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.enabled = enabled;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
}
- WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
return Success;
}
static int
-ProcShapeGetRectangles (ClientPtr client)
+ProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
- WindowPtr pWin;
- xShapeGetRectanglesReply rep;
- xRectangle *rects;
- int nrects, i, rc;
- RegionPtr region;
+ WindowPtr pWin;
+ xShapeGetRectanglesReply rep;
+ xRectangle *rects;
+ int nrects, i, rc;
+ RegionPtr region;
+
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
switch (stuff->kind) {
case ShapeBounding:
- region = wBoundingShape(pWin);
- break;
+ region = wBoundingShape(pWin);
+ break;
case ShapeClip:
- region = wClipShape(pWin);
- break;
+ region = wClipShape(pWin);
+ break;
case ShapeInput:
- region = wInputShape (pWin);
- break;
+ region = wInputShape(pWin);
+ break;
default:
- client->errorValue = stuff->kind;
- return BadValue;
+ client->errorValue = stuff->kind;
+ return BadValue;
}
if (!region) {
- nrects = 1;
- rects = malloc(sizeof (xRectangle));
- if (!rects)
- return BadAlloc;
- switch (stuff->kind) {
- case ShapeBounding:
- rects->x = - (int) wBorderWidth (pWin);
- rects->y = - (int) wBorderWidth (pWin);
- rects->width = pWin->drawable.width + wBorderWidth (pWin);
- rects->height = pWin->drawable.height + wBorderWidth (pWin);
- break;
- case ShapeClip:
- rects->x = 0;
- rects->y = 0;
- rects->width = pWin->drawable.width;
- rects->height = pWin->drawable.height;
- break;
- case ShapeInput:
- rects->x = - (int) wBorderWidth (pWin);
- rects->y = - (int) wBorderWidth (pWin);
- rects->width = pWin->drawable.width + wBorderWidth (pWin);
- rects->height = pWin->drawable.height + wBorderWidth (pWin);
- break;
- }
- } else {
- BoxPtr box;
- nrects = RegionNumRects(region);
- box = RegionRects(region);
- rects = malloc(nrects * sizeof (xRectangle));
- if (!rects && nrects)
- return BadAlloc;
- for (i = 0; i < nrects; i++, box++) {
- rects[i].x = box->x1;
- rects[i].y = box->y1;
- rects[i].width = box->x2 - box->x1;
- rects[i].height = box->y2 - box->y1;
- }
+ nrects = 1;
+ rects = malloc(sizeof(xRectangle));
+ if (!rects)
+ return BadAlloc;
+ switch (stuff->kind) {
+ case ShapeBounding:
+ rects->x = -(int) wBorderWidth(pWin);
+ rects->y = -(int) wBorderWidth(pWin);
+ rects->width = pWin->drawable.width + wBorderWidth(pWin);
+ rects->height = pWin->drawable.height + wBorderWidth(pWin);
+ break;
+ case ShapeClip:
+ rects->x = 0;
+ rects->y = 0;
+ rects->width = pWin->drawable.width;
+ rects->height = pWin->drawable.height;
+ break;
+ case ShapeInput:
+ rects->x = -(int) wBorderWidth(pWin);
+ rects->y = -(int) wBorderWidth(pWin);
+ rects->width = pWin->drawable.width + wBorderWidth(pWin);
+ rects->height = pWin->drawable.height + wBorderWidth(pWin);
+ break;
+ }
+ }
+ else {
+ BoxPtr box;
+
+ nrects = RegionNumRects(region);
+ box = RegionRects(region);
+ rects = malloc(nrects * sizeof(xRectangle));
+ if (!rects && nrects)
+ return BadAlloc;
+ for (i = 0; i < nrects; i++, box++) {
+ rects[i].x = box->x1;
+ rects[i].y = box->y1;
+ rects[i].width = box->x2 - box->x1;
+ rects[i].height = box->y2 - box->y1;
+ }
}
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(nrects * sizeof (xRectangle));
+ rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
rep.ordering = YXBanded;
rep.nrects = nrects;
if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swapl(&rep.nrects);
- SwapShorts ((short *)rects, (unsigned long)nrects * 4);
+ 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), (char *) &rep);
+ WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
free(rects);
return Success;
}
static int
-ProcShapeDispatch (ClientPtr client)
+ProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
- return ProcShapeQueryVersion (client);
+ return ProcShapeQueryVersion(client);
case X_ShapeRectangles:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeRectangles (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeRectangles(client);
+ else
#endif
- return ProcShapeRectangles (client);
+ return ProcShapeRectangles(client);
case X_ShapeMask:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeMask (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeMask(client);
+ else
#endif
- return ProcShapeMask (client);
+ return ProcShapeMask(client);
case X_ShapeCombine:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeCombine (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeCombine(client);
+ else
#endif
- return ProcShapeCombine (client);
+ return ProcShapeCombine(client);
case X_ShapeOffset:
#ifdef PANORAMIX
- if ( !noPanoramiXExtension )
- return ProcPanoramiXShapeOffset (client);
- else
+ if (!noPanoramiXExtension)
+ return ProcPanoramiXShapeOffset(client);
+ else
#endif
- return ProcShapeOffset (client);
+ return ProcShapeOffset(client);
case X_ShapeQueryExtents:
- return ProcShapeQueryExtents (client);
+ return ProcShapeQueryExtents(client);
case X_ShapeSelectInput:
- return ProcShapeSelectInput (client);
+ return ProcShapeSelectInput(client);
case X_ShapeInputSelected:
- return ProcShapeInputSelected (client);
+ return ProcShapeInputSelected(client);
case X_ShapeGetRectangles:
- return ProcShapeGetRectangles (client);
+ return ProcShapeGetRectangles(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
static void
-SShapeNotifyEvent(xShapeNotifyEvent *from, xShapeNotifyEvent *to)
+SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
{
to->type = from->type;
to->kind = from->kind;
- cpswapl (from->window, to->window);
- cpswaps (from->sequenceNumber, to->sequenceNumber);
- cpswaps (from->x, to->x);
- cpswaps (from->y, to->y);
- cpswaps (from->width, to->width);
- cpswaps (from->height, to->height);
- cpswapl (from->time, to->time);
+ cpswapl(from->window, to->window);
+ cpswaps(from->sequenceNumber, to->sequenceNumber);
+ cpswaps(from->x, to->x);
+ cpswaps(from->y, to->y);
+ cpswaps(from->width, to->width);
+ cpswaps(from->height, to->height);
+ cpswapl(from->time, to->time);
to->shaped = from->shaped;
}
static int
-SProcShapeQueryVersion (ClientPtr client)
+SProcShapeQueryVersion(ClientPtr client)
{
- REQUEST (xShapeQueryVersionReq);
+ REQUEST(xShapeQueryVersionReq);
swaps(&stuff->length);
- return ProcShapeQueryVersion (client);
+ return ProcShapeQueryVersion(client);
}
static int
-SProcShapeRectangles (ClientPtr client)
+SProcShapeRectangles(ClientPtr client)
{
- REQUEST (xShapeRectanglesReq);
+ REQUEST(xShapeRectanglesReq);
swaps(&stuff->length);
- REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
+ REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
SwapRestS(stuff);
- return ProcShapeRectangles (client);
+ return ProcShapeRectangles(client);
}
static int
-SProcShapeMask (ClientPtr client)
+SProcShapeMask(ClientPtr client)
{
- REQUEST (xShapeMaskReq);
+ REQUEST(xShapeMaskReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeMaskReq);
+ REQUEST_SIZE_MATCH(xShapeMaskReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
- return ProcShapeMask (client);
+ return ProcShapeMask(client);
}
static int
-SProcShapeCombine (ClientPtr client)
+SProcShapeCombine(ClientPtr client)
{
- REQUEST (xShapeCombineReq);
+ REQUEST(xShapeCombineReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeCombineReq);
+ REQUEST_SIZE_MATCH(xShapeCombineReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->src);
- return ProcShapeCombine (client);
+ return ProcShapeCombine(client);
}
static int
-SProcShapeOffset (ClientPtr client)
+SProcShapeOffset(ClientPtr client)
{
- REQUEST (xShapeOffsetReq);
+ REQUEST(xShapeOffsetReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeOffsetReq);
+ REQUEST_SIZE_MATCH(xShapeOffsetReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
- return ProcShapeOffset (client);
+ return ProcShapeOffset(client);
}
static int
-SProcShapeQueryExtents (ClientPtr client)
+SProcShapeQueryExtents(ClientPtr client)
{
- REQUEST (xShapeQueryExtentsReq);
+ REQUEST(xShapeQueryExtentsReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
+ REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
swapl(&stuff->window);
- return ProcShapeQueryExtents (client);
+ return ProcShapeQueryExtents(client);
}
static int
-SProcShapeSelectInput (ClientPtr client)
+SProcShapeSelectInput(ClientPtr client)
{
- REQUEST (xShapeSelectInputReq);
+ REQUEST(xShapeSelectInputReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeSelectInputReq);
+ REQUEST_SIZE_MATCH(xShapeSelectInputReq);
swapl(&stuff->window);
- return ProcShapeSelectInput (client);
+ return ProcShapeSelectInput(client);
}
static int
-SProcShapeInputSelected (ClientPtr client)
+SProcShapeInputSelected(ClientPtr client)
{
- REQUEST (xShapeInputSelectedReq);
+ REQUEST(xShapeInputSelectedReq);
swaps(&stuff->length);
- REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
+ REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
swapl(&stuff->window);
- return ProcShapeInputSelected (client);
+ return ProcShapeInputSelected(client);
}
static int
-SProcShapeGetRectangles (ClientPtr client)
+SProcShapeGetRectangles(ClientPtr client)
{
REQUEST(xShapeGetRectanglesReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
swapl(&stuff->window);
- return ProcShapeGetRectangles (client);
+ return ProcShapeGetRectangles(client);
}
static int
-SProcShapeDispatch (ClientPtr client)
+SProcShapeDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data) {
case X_ShapeQueryVersion:
- return SProcShapeQueryVersion (client);
+ return SProcShapeQueryVersion(client);
case X_ShapeRectangles:
- return SProcShapeRectangles (client);
+ return SProcShapeRectangles(client);
case X_ShapeMask:
- return SProcShapeMask (client);
+ return SProcShapeMask(client);
case X_ShapeCombine:
- return SProcShapeCombine (client);
+ return SProcShapeCombine(client);
case X_ShapeOffset:
- return SProcShapeOffset (client);
+ return SProcShapeOffset(client);
case X_ShapeQueryExtents:
- return SProcShapeQueryExtents (client);
+ return SProcShapeQueryExtents(client);
case X_ShapeSelectInput:
- return SProcShapeSelectInput (client);
+ return SProcShapeSelectInput(client);
case X_ShapeInputSelected:
- return SProcShapeInputSelected (client);
+ return SProcShapeInputSelected(client);
case X_ShapeGetRectangles:
- return SProcShapeGetRectangles (client);
+ return SProcShapeGetRectangles(client);
default:
- return BadRequest;
+ return BadRequest;
}
}
@@ -1236,11 +1226,10 @@ ShapeExtensionInit(void)
ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient");
ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent");
if (ClientType && ShapeEventType &&
- (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
- ProcShapeDispatch, SProcShapeDispatch,
- NULL, StandardMinorOpcode)))
- {
- ShapeEventBase = extEntry->eventBase;
- EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
+ (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
+ ProcShapeDispatch, SProcShapeDispatch,
+ NULL, StandardMinorOpcode))) {
+ ShapeEventBase = extEntry->eventBase;
+ EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
}
}