2003-11-14 16:54:54 +01: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.
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2006-02-10 23:00:30 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
|
|
|
#include "os.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "windowstr.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "extnsionst.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "opaque.h"
|
2009-07-15 08:51:05 +02:00
|
|
|
#include <X11/extensions/shapeproto.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "regionstr.h"
|
|
|
|
#include "gcstruct.h"
|
2003-11-25 20:29:01 +01:00
|
|
|
#include "modinit.h"
|
2009-09-18 08:27:54 +02:00
|
|
|
#include "protocol-versions.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
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 */
|
|
|
|
);
|
|
|
|
|
2004-07-30 01:43:40 +02:00
|
|
|
/* SendShapeNotify, CreateBoundingShape and CreateClipShape are used
|
|
|
|
* externally by the Xfixes extension and are now defined in window.h
|
|
|
|
*/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
#include "panoramiX.h"
|
2003-11-14 17:49:22 +01:00
|
|
|
#include "panoramiXsrv.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static int ShapeEventBase = 0;
|
2009-01-27 06:40:31 +01:00
|
|
|
static RESTYPE ClientType, ShapeEventType; /* resource types for event masks */
|
2003-11-14 16:54:54 +01: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 {
|
|
|
|
ShapeEventPtr next;
|
|
|
|
ClientPtr client;
|
|
|
|
WindowPtr window;
|
|
|
|
XID clientResource;
|
|
|
|
} ShapeEventRec;
|
|
|
|
|
|
|
|
/****************
|
|
|
|
* ShapeExtensionInit
|
|
|
|
*
|
|
|
|
* Called from InitExtensions in main() or from QueryExtension() if the
|
|
|
|
* extension is dynamically loaded.
|
|
|
|
*
|
|
|
|
****************/
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
RegionOperate (
|
|
|
|
ClientPtr client,
|
|
|
|
WindowPtr pWin,
|
|
|
|
int kind,
|
|
|
|
RegionPtr *destRgnp,
|
|
|
|
RegionPtr srcRgn,
|
|
|
|
int op,
|
|
|
|
int xoff, int yoff,
|
|
|
|
CreateDftPtr create)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
if (srcRgn && (xoff || yoff))
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionTranslate(srcRgn, xoff, yoff);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pWin->parent)
|
|
|
|
{
|
|
|
|
if (srcRgn)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(srcRgn);
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
}
|
2003-11-14 17:49:22 +01: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) {
|
|
|
|
if (*destRgnp != NULL) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(*destRgnp);
|
2003-11-14 17:49:22 +01:00
|
|
|
*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) {
|
2003-11-14 16:54:54 +01:00
|
|
|
case ShapeSet:
|
|
|
|
if (*destRgnp)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(*destRgnp);
|
2003-11-14 16:54:54 +01:00
|
|
|
*destRgnp = srcRgn;
|
|
|
|
srcRgn = 0;
|
|
|
|
break;
|
|
|
|
case ShapeUnion:
|
|
|
|
if (*destRgnp)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUnion(*destRgnp, *destRgnp, srcRgn);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
case ShapeIntersect:
|
|
|
|
if (*destRgnp)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionIntersect(*destRgnp, *destRgnp, srcRgn);
|
2003-11-14 16:54:54 +01:00
|
|
|
else {
|
|
|
|
*destRgnp = srcRgn;
|
|
|
|
srcRgn = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ShapeSubtract:
|
|
|
|
if (!*destRgnp)
|
|
|
|
*destRgnp = (*create)(pWin);
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(*destRgnp, *destRgnp, srcRgn);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
case ShapeInvert:
|
|
|
|
if (!*destRgnp)
|
2010-05-22 00:05:48 +02:00
|
|
|
*destRgnp = RegionCreate((BoxPtr) 0, 0);
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(*destRgnp, srcRgn, *destRgnp);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
client->errorValue = op;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (srcRgn)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(srcRgn);
|
2010-06-06 05:55:29 +02:00
|
|
|
(*pWin->drawable.pScreen->SetShape) (pWin, kind);
|
2003-11-14 16:54:54 +01:00
|
|
|
SendShapeNotify (pWin, kind);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
RegionPtr
|
2009-01-11 08:16:12 +01:00
|
|
|
CreateBoundingShape (WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
BoxRec extents;
|
|
|
|
|
|
|
|
extents.x1 = -wBorderWidth (pWin);
|
|
|
|
extents.y1 = -wBorderWidth (pWin);
|
|
|
|
extents.x2 = pWin->drawable.width + wBorderWidth (pWin);
|
|
|
|
extents.y2 = pWin->drawable.height + wBorderWidth (pWin);
|
2010-05-22 00:05:48 +02:00
|
|
|
return RegionCreate(&extents, 1);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
RegionPtr
|
2009-01-11 08:16:12 +01:00
|
|
|
CreateClipShape (WindowPtr pWin)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
BoxRec extents;
|
|
|
|
|
|
|
|
extents.x1 = 0;
|
|
|
|
extents.y1 = 0;
|
|
|
|
extents.x2 = pWin->drawable.width;
|
|
|
|
extents.y2 = pWin->drawable.height;
|
2010-05-22 00:05:48 +02:00
|
|
|
return RegionCreate(&extents, 1);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeQueryVersion (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
xShapeQueryVersionReply rep;
|
2007-11-21 06:29:31 +01:00
|
|
|
int n;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeQueryVersionReq);
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2009-09-18 08:27:54 +02:00
|
|
|
rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
|
|
|
|
rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep.sequenceNumber, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swaps(&rep.majorVersion, n);
|
|
|
|
swaps(&rep.minorVersion, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof (xShapeQueryVersionReply), (char *)&rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************
|
|
|
|
* ProcShapeRectangles
|
|
|
|
*
|
|
|
|
*****************/
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeRectangles (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
REQUEST(xShapeRectanglesReq);
|
|
|
|
xRectangle *prects;
|
2006-12-15 20:11:40 +01:00
|
|
|
int nrects, ctype, rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
2003-11-14 17:49:22 +01:00
|
|
|
CreateDftPtr createDefault;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
|
|
|
|
UpdateCurrentTime();
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
|
|
|
|
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
|
|
|
|
{
|
|
|
|
client->errorValue = stuff->ordering;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
nrects = ((stuff->length << 2) - sizeof(xShapeRectanglesReq));
|
|
|
|
if (nrects & 4)
|
|
|
|
return BadLength;
|
|
|
|
nrects >>= 3;
|
|
|
|
prects = (xRectangle *) &stuff[1];
|
|
|
|
ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering);
|
|
|
|
if (ctype < 0)
|
|
|
|
return BadMatch;
|
2010-05-22 00:05:48 +02:00
|
|
|
srcRgn = RegionFromRects(nrects, prects, ctype);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (!pWin->optional)
|
|
|
|
MakeWindowOptional (pWin);
|
2005-06-10 06:01:14 +02:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pWin->optional->boundingShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeClip:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pWin->optional->clipShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
destRgn = &pWin->optional->inputShape;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return BadValue;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
return RegionOperate (client, pWin, (int)stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int)stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2003-11-25 20:29:01 +01:00
|
|
|
ProcPanoramiXShapeRectangles(
|
2007-11-21 06:29:31 +01:00
|
|
|
ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
REQUEST(xShapeRectanglesReq);
|
|
|
|
PanoramiXRes *win;
|
2009-04-29 07:04:37 +02:00
|
|
|
int j, result;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
result = ProcShapeRectangles (client);
|
2010-04-27 00:05:06 +02:00
|
|
|
if (result != Success) break;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
/**************
|
|
|
|
* ProcShapeMask
|
|
|
|
**************/
|
|
|
|
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeMask (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
REQUEST(xShapeMaskReq);
|
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
|
|
|
PixmapPtr pPixmap;
|
2003-11-14 17:49:22 +01:00
|
|
|
CreateDftPtr createDefault;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeMaskReq);
|
|
|
|
UpdateCurrentTime();
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
if (stuff->src == None)
|
|
|
|
srcRgn = 0;
|
|
|
|
else {
|
2008-08-07 00:26:24 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
|
2007-08-30 19:20:04 +02:00
|
|
|
client, DixReadAccess);
|
|
|
|
if (rc != Success)
|
2010-04-25 08:26:40 +02:00
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (pPixmap->drawable.pScreen != pScreen ||
|
|
|
|
pPixmap->drawable.depth != 1)
|
|
|
|
return BadMatch;
|
2010-05-22 00:05:48 +02:00
|
|
|
srcRgn = BitmapToRegion(pScreen, pPixmap);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!srcRgn)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pWin->optional)
|
|
|
|
MakeWindowOptional (pWin);
|
2005-06-10 06:01:14 +02:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pWin->optional->boundingShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeClip:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pWin->optional->clipShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
destRgn = &pWin->optional->inputShape;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return BadValue;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
return RegionOperate (client, pWin, (int)stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int)stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2003-11-25 20:29:01 +01:00
|
|
|
ProcPanoramiXShapeMask(
|
2007-11-21 06:29:31 +01:00
|
|
|
ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
REQUEST(xShapeMaskReq);
|
|
|
|
PanoramiXRes *win, *pmap;
|
2009-04-29 07:04:37 +02:00
|
|
|
int j, result;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
REQUEST_SIZE_MATCH (xShapeMaskReq);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
if(stuff->src != None) {
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&pmap, stuff->src,
|
|
|
|
XRT_PIXMAP, client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
} else
|
|
|
|
pmap = NULL;
|
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
if(pmap)
|
|
|
|
stuff->src = pmap->info[j].id;
|
|
|
|
result = ProcShapeMask (client);
|
2010-04-27 00:05:06 +02:00
|
|
|
if (result != Success) break;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
/************
|
|
|
|
* ProcShapeCombine
|
|
|
|
************/
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeCombine (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pSrcWin, pDestWin;
|
|
|
|
REQUEST(xShapeCombineReq);
|
|
|
|
RegionPtr srcRgn;
|
|
|
|
RegionPtr *destRgn;
|
2003-11-14 17:49:22 +01:00
|
|
|
CreateDftPtr createDefault;
|
|
|
|
CreateDftPtr createSrc;
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr tmp;
|
2006-12-15 20:11:40 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeCombineReq);
|
|
|
|
UpdateCurrentTime();
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pDestWin->optional)
|
|
|
|
MakeWindowOptional (pDestWin);
|
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
createDefault = CreateClipShape;
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
createDefault = CreateBoundingShape;
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->srcKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
srcRgn = wBoundingShape (pSrcWin);
|
|
|
|
createSrc = CreateBoundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
srcRgn = wClipShape (pSrcWin);
|
|
|
|
createSrc = CreateClipShape;
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
srcRgn = wInputShape (pSrcWin);
|
|
|
|
createSrc = CreateBoundingShape;
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->srcKind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
2010-06-06 05:55:29 +02:00
|
|
|
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
return BadMatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (srcRgn) {
|
2010-05-22 00:05:48 +02:00
|
|
|
tmp = RegionCreate((BoxPtr) 0, 0);
|
|
|
|
RegionCopy(tmp, srcRgn);
|
2003-11-14 16:54:54 +01:00
|
|
|
srcRgn = tmp;
|
|
|
|
} else
|
|
|
|
srcRgn = (*createSrc) (pSrcWin);
|
|
|
|
|
|
|
|
if (!pDestWin->optional)
|
|
|
|
MakeWindowOptional (pDestWin);
|
2005-06-10 06:01:14 +02:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pDestWin->optional->boundingShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeClip:
|
2003-11-14 16:54:54 +01:00
|
|
|
destRgn = &pDestWin->optional->clipShape;
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
destRgn = &pDestWin->optional->inputShape;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return BadValue;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
return RegionOperate (client, pDestWin, (int)stuff->destKind,
|
|
|
|
destRgn, srcRgn, (int)stuff->op,
|
|
|
|
stuff->xOff, stuff->yOff, createDefault);
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2003-11-25 20:29:01 +01:00
|
|
|
ProcPanoramiXShapeCombine(
|
2007-11-21 06:29:31 +01:00
|
|
|
ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
REQUEST(xShapeCombineReq);
|
|
|
|
PanoramiXRes *win, *win2;
|
2009-04-29 07:04:37 +02:00
|
|
|
int j, result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW,
|
|
|
|
client, DixReadAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
stuff->src = win2->info[j].id;
|
|
|
|
result = ProcShapeCombine (client);
|
2010-04-27 00:05:06 +02:00
|
|
|
if (result != Success) break;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
/*************
|
|
|
|
* ProcShapeOffset
|
|
|
|
*************/
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeOffset (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
REQUEST(xShapeOffsetReq);
|
|
|
|
RegionPtr srcRgn;
|
2006-12-15 20:11:40 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeOffsetReq);
|
|
|
|
UpdateCurrentTime();
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
srcRgn = wBoundingShape (pWin);
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
srcRgn = wClipShape(pWin);
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
srcRgn = wInputShape (pWin);
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (srcRgn)
|
|
|
|
{
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
|
2010-06-06 05:55:29 +02:00
|
|
|
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
SendShapeNotify (pWin, (int)stuff->destKind);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
static int
|
2003-11-25 20:29:01 +01:00
|
|
|
ProcPanoramiXShapeOffset(
|
2007-11-21 06:29:31 +01:00
|
|
|
ClientPtr client)
|
2003-11-14 17:49:22 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeOffsetReq);
|
|
|
|
PanoramiXRes *win;
|
2009-04-29 07:04:37 +02:00
|
|
|
int j, result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
|
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
|
|
|
client, DixWriteAccess);
|
|
|
|
if (result != Success)
|
2010-04-25 08:56:36 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
|
|
|
|
FOR_NSCREENS(j) {
|
|
|
|
stuff->dest = win->info[j].id;
|
|
|
|
result = ProcShapeOffset (client);
|
|
|
|
if(result != Success) break;
|
|
|
|
}
|
2010-06-06 16:18:40 +02:00
|
|
|
return result;
|
2003-11-14 17:49:22 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeQueryExtents (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeQueryExtentsReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
xShapeQueryExtentsReply rep;
|
|
|
|
BoxRec extents, *pExtents;
|
2007-11-21 06:29:31 +01:00
|
|
|
int n, rc;
|
2003-11-14 17:49:22 +01:00
|
|
|
RegionPtr region;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2009-02-13 10:23:28 +01:00
|
|
|
memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.length = 0;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
|
|
|
rep.boundingShaped = (wBoundingShape(pWin) != 0);
|
|
|
|
rep.clipShaped = (wClipShape(pWin) != 0);
|
2003-11-14 17:49:22 +01:00
|
|
|
if ((region = wBoundingShape(pWin))) {
|
2003-11-14 16:54:54 +01:00
|
|
|
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
2010-05-22 00:05:48 +02:00
|
|
|
pExtents = RegionExtents(region);
|
2003-11-14 16:54:54 +01:00
|
|
|
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;
|
2003-11-14 17:49:22 +01:00
|
|
|
if ((region = wClipShape(pWin))) {
|
2003-11-14 16:54:54 +01:00
|
|
|
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
2010-05-22 00:05:48 +02:00
|
|
|
pExtents = RegionExtents(region);
|
2003-11-14 16:54:54 +01:00
|
|
|
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, n);
|
|
|
|
swapl(&rep.length, n);
|
|
|
|
swaps(&rep.xBoundingShape, n);
|
|
|
|
swaps(&rep.yBoundingShape, n);
|
|
|
|
swaps(&rep.widthBoundingShape, n);
|
|
|
|
swaps(&rep.heightBoundingShape, n);
|
|
|
|
swaps(&rep.xClipShape, n);
|
|
|
|
swaps(&rep.yClipShape, n);
|
|
|
|
swaps(&rep.widthClipShape, n);
|
|
|
|
swaps(&rep.heightClipShape, n);
|
|
|
|
}
|
|
|
|
WriteToClient(client, sizeof (xShapeQueryExtentsReply), (char *)&rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ShapeFreeClient (pointer data, XID id)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
ShapeEventPtr pShapeEvent;
|
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr *pHead, pCur, pPrev;
|
2009-04-29 07:04:37 +02:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
pShapeEvent = (ShapeEventPtr) data;
|
|
|
|
pWin = pShapeEvent->window;
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
|
|
|
ShapeEventType, serverClient, DixReadAccess);
|
|
|
|
if (rc == Success) {
|
2003-11-14 16:54:54 +01: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;
|
|
|
|
}
|
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free((pointer) pShapeEvent);
|
2003-11-14 16:54:54 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ShapeFreeEvents (pointer data, XID id)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
ShapeEventPtr *pHead, pCur, pNext;
|
|
|
|
|
|
|
|
pHead = (ShapeEventPtr *) data;
|
|
|
|
for (pCur = *pHead; pCur; pCur = pNext) {
|
|
|
|
pNext = pCur->next;
|
|
|
|
FreeResource (pCur->clientResource, ClientType);
|
2010-05-05 20:44:06 +02:00
|
|
|
free((pointer) pCur);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free((pointer) pHead);
|
2003-11-14 16:54:54 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeSelectInput (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeSelectInputReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
|
|
|
|
XID clientResource;
|
2006-12-15 21:50:46 +01:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
2006-12-15 21:50:46 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
|
|
|
ShapeEventType, client, DixWriteAccess);
|
|
|
|
if (rc != Success && rc != BadValue)
|
|
|
|
return rc;
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
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 */
|
2010-05-05 20:44:06 +02:00
|
|
|
pNewShapeEvent = malloc(sizeof (ShapeEventRec));
|
2003-11-14 16:54:54 +01:00
|
|
|
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)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
pHead = malloc(sizeof (ShapeEventPtr));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pHead ||
|
2009-01-27 06:40:31 +01:00
|
|
|
!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
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;
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pShapeEvent);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
client->errorValue = stuff->enable;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* deliver the event
|
|
|
|
*/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2009-01-11 08:16:12 +01:00
|
|
|
SendShapeNotify (WindowPtr pWin, int which)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
ShapeEventPtr *pHead, pShapeEvent;
|
|
|
|
xShapeNotifyEvent se;
|
|
|
|
BoxRec extents;
|
|
|
|
RegionPtr region;
|
|
|
|
BYTE shaped;
|
2009-04-29 07:04:37 +02:00
|
|
|
int rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
|
|
|
ShapeEventType, serverClient, DixReadAccess);
|
|
|
|
if (rc != Success)
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
2005-06-10 06:01:14 +02:00
|
|
|
switch (which) {
|
|
|
|
case ShapeBounding:
|
2003-11-14 16:54:54 +01:00
|
|
|
region = wBoundingShape(pWin);
|
|
|
|
if (region) {
|
2010-05-22 00:05:48 +02:00
|
|
|
extents = *RegionExtents(region);
|
2003-11-14 16:54:54 +01:00
|
|
|
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;
|
|
|
|
}
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeClip:
|
2003-11-14 16:54:54 +01:00
|
|
|
region = wClipShape(pWin);
|
|
|
|
if (region) {
|
2010-05-22 00:05:48 +02:00
|
|
|
extents = *RegionExtents(region);
|
2003-11-14 16:54:54 +01:00
|
|
|
shaped = xTrue;
|
|
|
|
} else {
|
|
|
|
extents.x1 = 0;
|
|
|
|
extents.y1 = 0;
|
|
|
|
extents.x2 = pWin->drawable.width;
|
|
|
|
extents.y2 = pWin->drawable.height;
|
|
|
|
shaped = xFalse;
|
|
|
|
}
|
2005-06-10 06:01:14 +02:00
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
region = wInputShape(pWin);
|
|
|
|
if (region) {
|
2010-05-22 00:05:48 +02:00
|
|
|
extents = *RegionExtents(region);
|
2005-06-10 06:01:14 +02:00
|
|
|
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;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
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;
|
2010-05-15 22:12:44 +02:00
|
|
|
WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeInputSelected (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeInputSelectedReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
ShapeEventPtr pShapeEvent, *pHead;
|
2006-12-15 20:11:40 +01:00
|
|
|
int enabled, rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
xShapeInputSelectedReply rep;
|
2007-11-21 06:29:31 +01:00
|
|
|
int n;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2009-04-29 07:04:37 +02:00
|
|
|
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
|
|
|
ShapeEventType, client, DixReadAccess);
|
|
|
|
if (rc != Success && rc != BadValue)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
enabled = xFalse;
|
|
|
|
if (pHead) {
|
|
|
|
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, n);
|
|
|
|
swapl (&rep.length, n);
|
|
|
|
}
|
|
|
|
WriteToClient (client, sizeof (xShapeInputSelectedReply), (char *) &rep);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeGetRectangles (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeGetRectanglesReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
xShapeGetRectanglesReply rep;
|
|
|
|
xRectangle *rects;
|
2006-12-15 20:11:40 +01:00
|
|
|
int nrects, i, rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr region;
|
2007-11-21 06:29:31 +01:00
|
|
|
int n;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
2007-08-30 19:20:04 +02:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2006-12-15 20:11:40 +01:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2003-11-14 16:54:54 +01:00
|
|
|
switch (stuff->kind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
region = wBoundingShape(pWin);
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
region = wClipShape(pWin);
|
|
|
|
break;
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
|
|
|
region = wInputShape (pWin);
|
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
default:
|
|
|
|
client->errorValue = stuff->kind;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if (!region) {
|
|
|
|
nrects = 1;
|
2010-05-05 20:44:06 +02:00
|
|
|
rects = malloc(sizeof (xRectangle));
|
2003-11-14 16:54:54 +01:00
|
|
|
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;
|
2005-06-10 06:01:14 +02:00
|
|
|
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;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
BoxPtr box;
|
2010-05-22 00:05:48 +02:00
|
|
|
nrects = RegionNumRects(region);
|
|
|
|
box = RegionRects(region);
|
2010-05-05 20:44:06 +02:00
|
|
|
rects = malloc(nrects * sizeof (xRectangle));
|
2003-11-14 16:54:54 +01: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rep.type = X_Reply;
|
|
|
|
rep.sequenceNumber = client->sequence;
|
2009-07-06 04:20:21 +02:00
|
|
|
rep.length = bytes_to_int32(nrects * sizeof (xRectangle));
|
2003-11-14 16:54:54 +01:00
|
|
|
rep.ordering = YXBanded;
|
|
|
|
rep.nrects = nrects;
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps (&rep.sequenceNumber, n);
|
|
|
|
swapl (&rep.length, n);
|
|
|
|
swapl (&rep.nrects, n);
|
|
|
|
SwapShorts ((short *)rects, (unsigned long)nrects * 4);
|
|
|
|
}
|
|
|
|
WriteToClient (client, sizeof (rep), (char *) &rep);
|
|
|
|
WriteToClient (client, nrects * sizeof (xRectangle), (char *) rects);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(rects);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
ProcShapeDispatch (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
switch (stuff->data) {
|
|
|
|
case X_ShapeQueryVersion:
|
|
|
|
return ProcShapeQueryVersion (client);
|
|
|
|
case X_ShapeRectangles:
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if ( !noPanoramiXExtension )
|
|
|
|
return ProcPanoramiXShapeRectangles (client);
|
|
|
|
else
|
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
return ProcShapeRectangles (client);
|
2003-11-14 16:54:54 +01:00
|
|
|
case X_ShapeMask:
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if ( !noPanoramiXExtension )
|
|
|
|
return ProcPanoramiXShapeMask (client);
|
|
|
|
else
|
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
return ProcShapeMask (client);
|
2003-11-14 16:54:54 +01:00
|
|
|
case X_ShapeCombine:
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if ( !noPanoramiXExtension )
|
|
|
|
return ProcPanoramiXShapeCombine (client);
|
|
|
|
else
|
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
return ProcShapeCombine (client);
|
2003-11-14 16:54:54 +01:00
|
|
|
case X_ShapeOffset:
|
|
|
|
#ifdef PANORAMIX
|
|
|
|
if ( !noPanoramiXExtension )
|
|
|
|
return ProcPanoramiXShapeOffset (client);
|
|
|
|
else
|
|
|
|
#endif
|
2003-11-14 17:49:22 +01:00
|
|
|
return ProcShapeOffset (client);
|
2003-11-14 16:54:54 +01:00
|
|
|
case X_ShapeQueryExtents:
|
|
|
|
return ProcShapeQueryExtents (client);
|
|
|
|
case X_ShapeSelectInput:
|
|
|
|
return ProcShapeSelectInput (client);
|
|
|
|
case X_ShapeInputSelected:
|
|
|
|
return ProcShapeInputSelected (client);
|
|
|
|
case X_ShapeGetRectangles:
|
|
|
|
return ProcShapeGetRectangles (client);
|
|
|
|
default:
|
|
|
|
return BadRequest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-01-11 08:16:12 +01:00
|
|
|
SShapeNotifyEvent(xShapeNotifyEvent *from, xShapeNotifyEvent *to)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
to->shaped = from->shaped;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeQueryVersion (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
int n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeQueryVersionReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
return ProcShapeQueryVersion (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeRectangles (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeRectanglesReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
|
|
|
|
swapl (&stuff->dest, n);
|
|
|
|
swaps (&stuff->xOff, n);
|
|
|
|
swaps (&stuff->yOff, n);
|
|
|
|
SwapRestS(stuff);
|
|
|
|
return ProcShapeRectangles (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeMask (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeMaskReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeMaskReq);
|
|
|
|
swapl (&stuff->dest, n);
|
|
|
|
swaps (&stuff->xOff, n);
|
|
|
|
swaps (&stuff->yOff, n);
|
|
|
|
swapl (&stuff->src, n);
|
|
|
|
return ProcShapeMask (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeCombine (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeCombineReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeCombineReq);
|
|
|
|
swapl (&stuff->dest, n);
|
|
|
|
swaps (&stuff->xOff, n);
|
|
|
|
swaps (&stuff->yOff, n);
|
|
|
|
swapl (&stuff->src, n);
|
|
|
|
return ProcShapeCombine (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeOffset (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeOffsetReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeOffsetReq);
|
|
|
|
swapl (&stuff->dest, n);
|
|
|
|
swaps (&stuff->xOff, n);
|
|
|
|
swaps (&stuff->yOff, n);
|
|
|
|
return ProcShapeOffset (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeQueryExtents (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeQueryExtentsReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
|
|
|
|
swapl (&stuff->window, n);
|
|
|
|
return ProcShapeQueryExtents (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeSelectInput (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeSelectInputReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
|
|
|
|
swapl (&stuff->window, n);
|
|
|
|
return ProcShapeSelectInput (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeInputSelected (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-11-21 06:29:31 +01:00
|
|
|
int n;
|
2003-11-14 16:54:54 +01:00
|
|
|
REQUEST (xShapeInputSelectedReq);
|
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
|
|
|
|
swapl (&stuff->window, n);
|
|
|
|
return ProcShapeInputSelected (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeGetRectangles (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xShapeGetRectanglesReq);
|
2007-11-21 06:29:31 +01:00
|
|
|
char n;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
swaps (&stuff->length, n);
|
|
|
|
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
|
|
|
swapl (&stuff->window, n);
|
|
|
|
return ProcShapeGetRectangles (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-01-11 08:16:12 +01:00
|
|
|
SProcShapeDispatch (ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
switch (stuff->data) {
|
|
|
|
case X_ShapeQueryVersion:
|
|
|
|
return SProcShapeQueryVersion (client);
|
|
|
|
case X_ShapeRectangles:
|
|
|
|
return SProcShapeRectangles (client);
|
|
|
|
case X_ShapeMask:
|
|
|
|
return SProcShapeMask (client);
|
|
|
|
case X_ShapeCombine:
|
|
|
|
return SProcShapeCombine (client);
|
|
|
|
case X_ShapeOffset:
|
|
|
|
return SProcShapeOffset (client);
|
|
|
|
case X_ShapeQueryExtents:
|
|
|
|
return SProcShapeQueryExtents (client);
|
|
|
|
case X_ShapeSelectInput:
|
|
|
|
return SProcShapeSelectInput (client);
|
|
|
|
case X_ShapeInputSelected:
|
|
|
|
return SProcShapeInputSelected (client);
|
|
|
|
case X_ShapeGetRectangles:
|
|
|
|
return SProcShapeGetRectangles (client);
|
|
|
|
default:
|
|
|
|
return BadRequest;
|
|
|
|
}
|
|
|
|
}
|
2010-07-16 19:19:50 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
ShapeExtensionInit(void)
|
|
|
|
{
|
|
|
|
ExtensionEntry *extEntry;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|