2006-11-26 11:13:41 -07:00
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
Copyright 1989, 1998 The Open Group
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall not be
|
|
|
|
used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
in this Software without prior written authorization from The Open Group.
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include "misc.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "extnsionst.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "opaque.h"
|
2010-04-13 13:54:46 -06:00
|
|
|
#include <X11/extensions/shapeproto.h>
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "regionstr.h"
|
|
|
|
#include "gcstruct.h"
|
2013-06-07 11:28:45 -06:00
|
|
|
#include "extinit.h"
|
2010-07-27 13:02:24 -06:00
|
|
|
#include "protocol-versions.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
|
|
|
|
);
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
static int ShapeFreeClient(void * /* data */ ,
|
|
|
|
XID /* id */
|
2012-06-10 07:21:05 -06:00
|
|
|
);
|
2014-09-27 11:52:59 -06:00
|
|
|
static int ShapeFreeEvents(void * /* data */ ,
|
|
|
|
XID /* id */
|
2012-06-10 07:21:05 -06:00
|
|
|
);
|
|
|
|
static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
|
|
|
|
xShapeNotifyEvent * /* to */
|
|
|
|
);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/* 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;
|
2012-06-10 07:21:05 -06:00
|
|
|
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* each window has a list of clients requesting
|
|
|
|
* ShapeNotify events. Each client has a resource
|
|
|
|
* for each window it selects ShapeNotify input for,
|
|
|
|
* this resource is used to delete the ShapeNotifyRec
|
|
|
|
* entry from the per-window queue.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _ShapeEvent *ShapeEventPtr;
|
|
|
|
|
|
|
|
typedef struct _ShapeEvent {
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventPtr next;
|
|
|
|
ClientPtr client;
|
|
|
|
WindowPtr window;
|
|
|
|
XID clientResource;
|
2006-11-26 11:13:41 -07:00
|
|
|
} ShapeEventRec;
|
|
|
|
|
|
|
|
/****************
|
|
|
|
* ShapeExtensionInit
|
|
|
|
*
|
|
|
|
* Called from InitExtensions in main() or from QueryExtension() if the
|
|
|
|
* extension is dynamically loaded.
|
|
|
|
*
|
|
|
|
****************/
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionOperate(ClientPtr client,
|
|
|
|
WindowPtr pWin,
|
|
|
|
int kind,
|
|
|
|
RegionPtr *destRgnp,
|
|
|
|
RegionPtr srcRgn, int op, int xoff, int yoff, CreateDftPtr create)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
if (srcRgn && (xoff || yoff))
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionTranslate(srcRgn, xoff, yoff);
|
|
|
|
if (!pWin->parent) {
|
|
|
|
if (srcRgn)
|
|
|
|
RegionDestroy(srcRgn);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* May/30/2001:
|
|
|
|
* The shape.PS specs say if src is None, existing shape is to be
|
|
|
|
* removed (and so the op-code has no meaning in such removal);
|
|
|
|
* see shape.PS, page 3, ShapeMask.
|
|
|
|
*/
|
|
|
|
if (srcRgn == NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
if (srcRgn)
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionDestroy(srcRgn);
|
2010-12-05 08:36:02 -07:00
|
|
|
(*pWin->drawable.pScreen->SetShape) (pWin, kind);
|
2012-06-10 07:21:05 -06:00
|
|
|
SendShapeNotify(pWin, kind);
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
RegionPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
CreateBoundingShape(WindowPtr pWin)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
BoxRec extents;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
extents.x1 = -wBorderWidth(pWin);
|
|
|
|
extents.y1 = -wBorderWidth(pWin);
|
|
|
|
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
|
|
|
extents.y2 = pWin->drawable.height + wBorderWidth(pWin);
|
2010-12-05 08:36:02 -07:00
|
|
|
return RegionCreate(&extents, 1);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
RegionPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
CreateClipShape(WindowPtr pWin)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
BoxRec extents;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
extents.x1 = 0;
|
|
|
|
extents.y1 = 0;
|
|
|
|
extents.x2 = pWin->drawable.width;
|
|
|
|
extents.y2 = pWin->drawable.height;
|
2010-12-05 08:36:02 -07:00
|
|
|
return RegionCreate(&extents, 1);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2013-06-07 11:28:45 -06:00
|
|
|
xShapeQueryVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.majorVersion = SERVER_SHAPE_MAJOR_VERSION,
|
|
|
|
.minorVersion = SERVER_SHAPE_MINOR_VERSION
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swaps(&rep.majorVersion);
|
|
|
|
swaps(&rep.minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************
|
|
|
|
* ProcShapeRectangles
|
|
|
|
*
|
|
|
|
*****************/
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeRectangles(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xShapeRectanglesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
xRectangle *prects;
|
|
|
|
int nrects, ctype, rc;
|
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
|
|
|
CreateDftPtr createDefault;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
UpdateCurrentTime();
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
|
2012-06-10 07:21:05 -06:00
|
|
|
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
|
|
|
|
client->errorValue = stuff->ordering;
|
2006-11-26 11:13:41 -07:00
|
|
|
return BadValue;
|
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (nrects & 4)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadLength;
|
2006-11-26 11:13:41 -07:00
|
|
|
nrects >>= 3;
|
|
|
|
prects = (xRectangle *) &stuff[1];
|
2012-06-10 07:21:05 -06:00
|
|
|
ctype = VerifyRectOrder(nrects, prects, (int) stuff->ordering);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (ctype < 0)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2010-12-05 08:36:02 -07:00
|
|
|
srcRgn = RegionFromRects(nrects, prects, ctype);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!pWin->optional)
|
2012-06-10 07:21:05 -06:00
|
|
|
MakeWindowOptional(pWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->boundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->clipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->inputShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return RegionOperate(client, pWin, (int) stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int) stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcPanoramiXShapeRectangles(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeRectanglesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXRes *win;
|
|
|
|
int j, result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixWriteAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (result != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
result = ProcShapeRectangles(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**************
|
|
|
|
* ProcShapeMask
|
|
|
|
**************/
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeMask(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xShapeMaskReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
CreateDftPtr createDefault;
|
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeMaskReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
UpdateCurrentTime();
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
if (stuff->src == None)
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
else {
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pPixmap, stuff->src,
|
2012-06-10 07:21:05 -06:00
|
|
|
RT_PIXMAP, client, DixReadAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
|
|
|
if (pPixmap->drawable.pScreen != pScreen ||
|
|
|
|
pPixmap->drawable.depth != 1)
|
|
|
|
return BadMatch;
|
|
|
|
srcRgn = BitmapToRegion(pScreen, pPixmap);
|
|
|
|
if (!srcRgn)
|
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!pWin->optional)
|
2012-06-10 07:21:05 -06:00
|
|
|
MakeWindowOptional(pWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->boundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->clipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pWin->optional->inputShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return RegionOperate(client, pWin, (int) stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int) stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcPanoramiXShapeMask(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeMaskReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXRes *win, *pmap;
|
|
|
|
int j, result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeMaskReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixWriteAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (result != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->src != None) {
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &pmap, stuff->src,
|
2012-06-10 07:21:05 -06:00
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pmap = NULL;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
if (pmap)
|
|
|
|
stuff->src = pmap->info[j].id;
|
|
|
|
result = ProcShapeMask(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/************
|
|
|
|
* ProcShapeCombine
|
|
|
|
************/
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeCombine(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pSrcWin, pDestWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xShapeCombineReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
|
|
|
CreateDftPtr createDefault;
|
|
|
|
CreateDftPtr createSrc;
|
|
|
|
RegionPtr tmp;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xShapeCombineReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
UpdateCurrentTime();
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pDestWin->optional)
|
2012-06-10 07:21:05 -06:00
|
|
|
MakeWindowOptional(pDestWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->srcKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wBoundingShape(pSrcWin);
|
|
|
|
createSrc = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wClipShape(pSrcWin);
|
|
|
|
createSrc = CreateClipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wInputShape(pSrcWin);
|
|
|
|
createSrc = CreateBoundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->srcKind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen) {
|
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (srcRgn) {
|
2010-12-05 08:36:02 -07:00
|
|
|
tmp = RegionCreate((BoxPtr) 0, 0);
|
|
|
|
RegionCopy(tmp, srcRgn);
|
2006-11-26 11:13:41 -07:00
|
|
|
srcRgn = tmp;
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
|
|
|
else
|
|
|
|
srcRgn = (*createSrc) (pSrcWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (!pDestWin->optional)
|
2012-06-10 07:21:05 -06:00
|
|
|
MakeWindowOptional(pDestWin);
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pDestWin->optional->boundingShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pDestWin->optional->clipShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
destRgn = &pDestWin->optional->inputShape;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return RegionOperate(client, pDestWin, (int) stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int) stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcPanoramiXShapeCombine(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeCombineReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
PanoramiXRes *win, *win2;
|
|
|
|
int j, result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xShapeCombineReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixWriteAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (result != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &win2, stuff->src, XRT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixReadAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (result != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
stuff->src = win2->info[j].id;
|
|
|
|
result = ProcShapeCombine(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*************
|
|
|
|
* ProcShapeOffset
|
|
|
|
*************/
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeOffset(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xShapeOffsetReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
RegionPtr srcRgn;
|
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeOffsetReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
UpdateCurrentTime();
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wBoundingShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wClipShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
srcRgn = wInputShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (srcRgn) {
|
2010-12-05 08:36:02 -07:00
|
|
|
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
|
|
|
|
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
SendShapeNotify(pWin, (int) stuff->destKind);
|
2006-11-26 11:13:41 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcPanoramiXShapeOffset(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeOffsetReq);
|
|
|
|
PanoramiXRes *win;
|
2010-07-27 13:02:24 -06:00
|
|
|
int j, result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xShapeOffsetReq);
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
result = dixLookupResourceByType((void **) &win, stuff->dest, XRT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixWriteAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (result != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
result = ProcShapeOffset(client);
|
|
|
|
if (result != Success)
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return result;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeQueryExtents(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeQueryExtentsReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
xShapeQueryExtentsReply rep;
|
|
|
|
BoxRec extents, *pExtents;
|
|
|
|
int rc;
|
|
|
|
RegionPtr region;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xShapeQueryExtentsReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.boundingShaped = (wBoundingShape(pWin) != 0),
|
|
|
|
.clipShaped = (wClipShape(pWin) != 0)
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if ((region = wBoundingShape(pWin))) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* 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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
rep.xBoundingShape = extents.x1;
|
|
|
|
rep.yBoundingShape = extents.y1;
|
|
|
|
rep.widthBoundingShape = extents.x2 - extents.x1;
|
|
|
|
rep.heightBoundingShape = extents.y2 - extents.y1;
|
|
|
|
if ((region = wClipShape(pWin))) {
|
2012-06-10 07:21:05 -06:00
|
|
|
/* 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;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
rep.xClipShape = extents.x1;
|
|
|
|
rep.yClipShape = extents.y1;
|
|
|
|
rep.widthClipShape = extents.x2 - extents.x1;
|
|
|
|
rep.heightClipShape = extents.y2 - extents.y1;
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*ARGSUSED*/ static int
|
2014-09-27 11:52:59 -06:00
|
|
|
ShapeFreeClient(void *data, XID id)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventPtr pShapeEvent;
|
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr *pHead, pCur, pPrev;
|
2010-07-27 13:02:24 -06:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
pShapeEvent = (ShapeEventPtr) data;
|
|
|
|
pWin = pShapeEvent->window;
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventType, serverClient, DixReadAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (rc == Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2014-09-27 11:52:59 -06:00
|
|
|
free((void *) pShapeEvent);
|
2006-11-26 11:13:41 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
/*ARGSUSED*/ static int
|
2014-09-27 11:52:59 -06:00
|
|
|
ShapeFreeEvents(void *data, XID id)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventPtr *pHead, pCur, pNext;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
pHead = (ShapeEventPtr *) data;
|
|
|
|
for (pCur = *pHead; pCur; pCur = pNext) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pNext = pCur->next;
|
|
|
|
FreeResource(pCur->clientResource, ClientType);
|
2014-09-27 11:52:59 -06:00
|
|
|
free((void *) pCur);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2014-09-27 11:52:59 -06:00
|
|
|
free((void *) pHead);
|
2006-11-26 11:13:41 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeSelectInput(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeSelectInputReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
|
|
|
|
XID clientResource;
|
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventType, client, DixWriteAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (rc != Success && rc != BadValue)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->enable) {
|
|
|
|
case xTrue:
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(clientResource, ClientType, (void *) pNewShapeEvent))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
|
|
|
/*
|
2014-09-27 11:52:59 -06:00
|
|
|
* create a resource to contain a void *to the list
|
2012-06-10 07:21:05 -06:00
|
|
|
* 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,
|
2014-09-27 11:52:59 -06:00
|
|
|
(void *) pHead)) {
|
2012-06-10 07:21:05 -06:00
|
|
|
FreeResource(clientResource, RT_NONE);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
*pHead = 0;
|
|
|
|
}
|
|
|
|
pNewShapeEvent->next = *pHead;
|
|
|
|
*pHead = pNewShapeEvent;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case xFalse:
|
2012-06-10 07:21:05 -06:00
|
|
|
/* 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;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->enable;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* deliver the event
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
SendShapeNotify(WindowPtr pWin, int which)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventPtr *pHead, pShapeEvent;
|
|
|
|
BoxRec extents;
|
|
|
|
RegionPtr region;
|
|
|
|
BYTE shaped;
|
2010-07-27 13:02:24 -06:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventType, serverClient, DixReadAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (which) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2017-12-08 08:01:59 -07:00
|
|
|
UpdateCurrentTimeIf();
|
2006-11-26 11:13:41 -07:00
|
|
|
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
2013-06-07 11:28:45 -06:00
|
|
|
xShapeNotifyEvent se = {
|
|
|
|
.type = ShapeNotify + ShapeEventBase,
|
|
|
|
.kind = which,
|
|
|
|
.window = pWin->drawable.id,
|
|
|
|
.x = extents.x1,
|
|
|
|
.y = extents.y1,
|
|
|
|
.width = extents.x2 - extents.x1,
|
|
|
|
.height = extents.y2 - extents.y1,
|
|
|
|
.time = currentTime.milliseconds,
|
|
|
|
.shaped = shaped
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeInputSelected(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeInputSelectedReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr pShapeEvent, *pHead;
|
|
|
|
int enabled, rc;
|
|
|
|
xShapeInputSelectedReply rep;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pHead, pWin->drawable.id,
|
2012-06-10 07:21:05 -06:00
|
|
|
ShapeEventType, client, DixReadAccess);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (rc != Success && rc != BadValue)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
enabled = xFalse;
|
|
|
|
if (pHead) {
|
2012-06-10 07:21:05 -06:00
|
|
|
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
|
|
|
if (pShapeEvent->client == client) {
|
|
|
|
enabled = xTrue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xShapeInputSelectedReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.enabled = enabled,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeGetRectangles(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeGetRectanglesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWin;
|
|
|
|
xShapeGetRectanglesReply rep;
|
|
|
|
xRectangle *rects;
|
|
|
|
int nrects, i, rc;
|
|
|
|
RegionPtr region;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
switch (stuff->kind) {
|
|
|
|
case ShapeBounding:
|
2012-06-10 07:21:05 -06:00
|
|
|
region = wBoundingShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeClip:
|
2012-06-10 07:21:05 -06:00
|
|
|
region = wClipShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case ShapeInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
region = wInputShape(pWin);
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->kind;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
if (!region) {
|
2012-06-10 07:21:05 -06:00
|
|
|
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);
|
2016-05-29 06:02:34 -06:00
|
|
|
rects = xallocarray(nrects, sizeof(xRectangle));
|
2012-06-10 07:21:05 -06:00
|
|
|
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;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xShapeGetRectanglesReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.ordering = YXBanded,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(nrects * sizeof(xRectangle)),
|
|
|
|
.nrects = nrects
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swapl(&rep.length);
|
|
|
|
swapl(&rep.nrects);
|
|
|
|
SwapShorts((short *) rects, (unsigned long) nrects * 4);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(rep), &rep);
|
|
|
|
WriteToClient(client, nrects * sizeof(xRectangle), rects);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(rects);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcShapeDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
switch (stuff->data) {
|
|
|
|
case X_ShapeQueryVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeRectangles:
|
|
|
|
#ifdef PANORAMIX
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
return ProcPanoramiXShapeRectangles(client);
|
|
|
|
else
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeMask:
|
|
|
|
#ifdef PANORAMIX
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
return ProcPanoramiXShapeMask(client);
|
|
|
|
else
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeMask(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeCombine:
|
|
|
|
#ifdef PANORAMIX
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
return ProcPanoramiXShapeCombine(client);
|
|
|
|
else
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeCombine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeOffset:
|
|
|
|
#ifdef PANORAMIX
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!noPanoramiXExtension)
|
|
|
|
return ProcPanoramiXShapeOffset(client);
|
|
|
|
else
|
2006-11-26 11:13:41 -07:00
|
|
|
#endif
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeOffset(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeQueryExtents:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeQueryExtents(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeSelectInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeSelectInput(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeInputSelected:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeInputSelected(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeGetRectangles:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeGetRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static void _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SShapeNotifyEvent(xShapeNotifyEvent * from, xShapeNotifyEvent * to)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
to->type = from->type;
|
|
|
|
to->kind = from->kind;
|
2012-06-10 07:21:05 -06:00
|
|
|
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);
|
2006-11-26 11:13:41 -07:00
|
|
|
to->shaped = from->shaped;
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeQueryVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeQueryVersionReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
return ProcShapeQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeRectangles(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeRectanglesReq);
|
|
|
|
|
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xShapeRectanglesReq);
|
|
|
|
swapl(&stuff->dest);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
2006-11-26 11:13:41 -07:00
|
|
|
SwapRestS(stuff);
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcShapeRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeMask(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeMaskReq);
|
|
|
|
|
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeMaskReq);
|
|
|
|
swapl(&stuff->dest);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
return ProcShapeMask(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeCombine(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeCombineReq);
|
|
|
|
|
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeCombineReq);
|
|
|
|
swapl(&stuff->dest);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
|
|
|
swapl(&stuff->src);
|
|
|
|
return ProcShapeCombine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeOffset(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeOffsetReq);
|
|
|
|
|
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeOffsetReq);
|
|
|
|
swapl(&stuff->dest);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
|
|
|
return ProcShapeOffset(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeQueryExtents(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeQueryExtentsReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeQueryExtentsReq);
|
|
|
|
swapl(&stuff->window);
|
|
|
|
return ProcShapeQueryExtents(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeSelectInput(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeSelectInputReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeSelectInputReq);
|
|
|
|
swapl(&stuff->window);
|
|
|
|
return ProcShapeSelectInput(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeInputSelected(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xShapeInputSelectedReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
|
|
|
swapl(&stuff->window);
|
|
|
|
return ProcShapeInputSelected(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeGetRectangles(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xShapeGetRectanglesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->window);
|
|
|
|
return ProcShapeGetRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcShapeDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
switch (stuff->data) {
|
|
|
|
case X_ShapeQueryVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeQueryVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeRectangles:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeMask:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeMask(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeCombine:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeCombine(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeOffset:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeOffset(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeQueryExtents:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeQueryExtents(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeSelectInput:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeSelectInput(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeInputSelected:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeInputSelected(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_ShapeGetRectangles:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcShapeGetRectangles(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
void
|
|
|
|
ShapeExtensionInit(void)
|
|
|
|
{
|
|
|
|
ExtensionEntry *extEntry;
|
|
|
|
|
|
|
|
ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient");
|
|
|
|
ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent");
|
|
|
|
if (ClientType && ShapeEventType &&
|
2012-06-10 07:21:05 -06:00
|
|
|
(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
|
|
|
|
ProcShapeDispatch, SProcShapeDispatch,
|
|
|
|
NULL, StandardMinorOpcode))) {
|
|
|
|
ShapeEventBase = extEntry->eventBase;
|
|
|
|
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
}
|