2004-07-29 16:33:43 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2003 Keith Packard
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
#include "xfixesint.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include <picturestr.h>
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
#include <regionstr.h>
|
|
|
|
#include <gcstruct.h>
|
|
|
|
#include <window.h>
|
|
|
|
|
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
|
|
|
RESTYPE RegionResType;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
static int
|
2013-12-15 10:05:51 +01:00
|
|
|
RegionResFree(void *data, XID id)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion = (RegionPtr) data;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pRegion);
|
2004-07-29 16:33:43 +02:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
RegionPtr
|
2012-03-21 20:55:09 +01:00
|
|
|
XFixesRegionCopy(RegionPtr pRegion)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
|
|
|
|
RegionNumRects(pRegion));
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
if (!pNew)
|
2012-03-21 20:55:09 +01:00
|
|
|
return 0;
|
|
|
|
if (!RegionCopy(pNew, pRegion)) {
|
|
|
|
RegionDestroy(pNew);
|
|
|
|
return 0;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
return pNew;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bool
|
2012-03-21 20:55:09 +01:00
|
|
|
XFixesRegionInit(void)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2009-12-03 02:43:01 +01:00
|
|
|
RegionResType = CreateNewResourceType(RegionResFree, "XFixesRegion");
|
2009-12-11 09:58:25 +01:00
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return RegionResType != 0;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCreateRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int things;
|
|
|
|
RegionPtr pRegion;
|
|
|
|
|
|
|
|
REQUEST(xXFixesCreateRegionReq);
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
|
|
|
|
|
|
|
things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (things & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2004-07-29 16:33:43 +02:00
|
|
|
things >>= 3;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (!pRegion)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCreateRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesCreateRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
2004-07-29 16:33:43 +02:00
|
|
|
SwapRestS(stuff);
|
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCreateRegionFromBitmap(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion;
|
|
|
|
PixmapPtr pPixmap;
|
2007-08-30 17:48:45 +02:00
|
|
|
int rc;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromBitmapReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, RT_PIXMAP,
|
2012-03-21 20:55:09 +01:00
|
|
|
client, DixReadAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->bitmap;
|
|
|
|
return rc;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
if (pPixmap->drawable.depth != 1)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
if (!pRegion)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCreateRegionFromBitmap(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromBitmapReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swapl(&stuff->bitmap);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCreateRegionFromWindow(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion;
|
|
|
|
Bool copy = TRUE;
|
|
|
|
WindowPtr pWin;
|
2007-08-30 17:48:45 +02:00
|
|
|
int rc;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST(xXFixesCreateRegionFromWindowReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
|
2012-03-21 20:55:09 +01:00
|
|
|
client, DixGetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
switch (stuff->kind) {
|
|
|
|
case WindowRegionBounding:
|
2012-03-21 20:55:09 +01:00
|
|
|
pRegion = wBoundingShape(pWin);
|
|
|
|
if (!pRegion) {
|
|
|
|
pRegion = CreateBoundingShape(pWin);
|
|
|
|
copy = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
case WindowRegionClip:
|
2012-03-21 20:55:09 +01:00
|
|
|
pRegion = wClipShape(pWin);
|
|
|
|
if (!pRegion) {
|
|
|
|
pRegion = CreateClipShape(pWin);
|
|
|
|
copy = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->kind;
|
|
|
|
return BadValue;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
if (copy && pRegion)
|
2012-03-21 20:55:09 +01:00
|
|
|
pRegion = XFixesRegionCopy(pRegion);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (!pRegion)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCreateRegionFromWindow(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromWindowReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swapl(&stuff->window);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCreateRegionFromGC(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion, pClip;
|
|
|
|
GCPtr pGC;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
REQUEST(xXFixesCreateRegionFromGCReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2007-08-30 17:48:45 +02:00
|
|
|
rc = dixLookupGC(&pGC, stuff->gc, client, DixGetAttrAccess);
|
2006-12-15 01:15:21 +01:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
|
|
|
|
2014-06-20 19:31:20 +02:00
|
|
|
if (pGC->clientClip) {
|
2012-03-21 20:55:09 +01:00
|
|
|
pClip = (RegionPtr) pGC->clientClip;
|
|
|
|
pRegion = XFixesRegionCopy(pClip);
|
|
|
|
if (!pRegion)
|
|
|
|
return BadAlloc;
|
2014-06-20 19:31:20 +02:00
|
|
|
} else {
|
|
|
|
return BadMatch;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCreateRegionFromGC(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromGCReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swapl(&stuff->gc);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCreateRegionFromPicture(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion;
|
|
|
|
PicturePtr pPicture;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromPictureReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
|
|
|
|
LEGAL_NEW_RESOURCE(stuff->region, client);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2014-04-10 17:34:28 +02:00
|
|
|
if (!pPicture->pDrawable)
|
|
|
|
return RenderErrBase + BadPicture;
|
|
|
|
|
2014-10-08 17:20:33 +02:00
|
|
|
if (pPicture->clientClip) {
|
2012-03-21 20:55:09 +01:00
|
|
|
pRegion = XFixesRegionCopy((RegionPtr) pPicture->clientClip);
|
|
|
|
if (!pRegion)
|
|
|
|
return BadAlloc;
|
2014-10-08 17:20:33 +02:00
|
|
|
} else {
|
|
|
|
return BadMatch;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2013-12-15 10:05:51 +01:00
|
|
|
if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCreateRegionFromPicture(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCreateRegionFromPictureReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swapl(&stuff->picture);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesDestroyRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesDestroyRegionReq);
|
|
|
|
RegionPtr pRegion;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
FreeResource(stuff->region, RT_NONE);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesDestroyRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesDestroyRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesSetRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int things;
|
|
|
|
RegionPtr pRegion, pNew;
|
|
|
|
|
|
|
|
REQUEST(xXFixesSetRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (things & 4)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadLength;
|
2004-07-29 16:33:43 +02:00
|
|
|
things >>= 3;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (!pNew)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
|
|
|
if (!RegionCopy(pRegion, pNew)) {
|
|
|
|
RegionDestroy(pNew);
|
|
|
|
return BadAlloc;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pNew);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesSetRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesSetRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
2004-07-29 16:33:43 +02:00
|
|
|
SwapRestS(stuff);
|
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCopyRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pSource, pDestination;
|
|
|
|
|
|
|
|
REQUEST(xXFixesCopyRegionReq);
|
|
|
|
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if (!RegionCopy(pDestination, pSource))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCopyRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCopyRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->source);
|
|
|
|
swapl(&stuff->destination);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesCombineRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pSource1, pSource2, pDestination;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCombineRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
switch (stuff->xfixesReqType) {
|
|
|
|
case X_XFixesUnionRegion:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!RegionUnion(pDestination, pSource1, pSource2))
|
|
|
|
return BadAlloc;
|
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
case X_XFixesIntersectRegion:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!RegionIntersect(pDestination, pSource1, pSource2))
|
|
|
|
return BadAlloc;
|
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
case X_XFixesSubtractRegion:
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!RegionSubtract(pDestination, pSource1, pSource2))
|
|
|
|
return BadAlloc;
|
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesCombineRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesCombineRegionReq);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->source1);
|
|
|
|
swapl(&stuff->source2);
|
|
|
|
swapl(&stuff->destination);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesInvertRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pSource, pDestination;
|
|
|
|
BoxRec bounds;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesInvertRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
/* Compute bounds, limit to 16 bits */
|
|
|
|
bounds.x1 = stuff->x;
|
|
|
|
bounds.y1 = stuff->y;
|
|
|
|
if ((int) stuff->x + (int) stuff->width > MAXSHORT)
|
2012-03-21 20:55:09 +01:00
|
|
|
bounds.x2 = MAXSHORT;
|
2004-07-29 16:33:43 +02:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
bounds.x2 = stuff->x + stuff->width;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
if ((int) stuff->y + (int) stuff->height > MAXSHORT)
|
2012-03-21 20:55:09 +01:00
|
|
|
bounds.y2 = MAXSHORT;
|
2004-07-29 16:33:43 +02:00
|
|
|
else
|
2012-03-21 20:55:09 +01:00
|
|
|
bounds.y2 = stuff->y + stuff->height;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if (!RegionInverse(pDestination, pSource, &bounds))
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesInvertRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesInvertRegionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->source);
|
|
|
|
swaps(&stuff->x);
|
|
|
|
swaps(&stuff->y);
|
|
|
|
swaps(&stuff->width);
|
|
|
|
swaps(&stuff->height);
|
|
|
|
swapl(&stuff->destination);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesTranslateRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesTranslateRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionTranslate(pRegion, stuff->dx, stuff->dy);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesTranslateRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesTranslateRegionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
|
|
|
swaps(&stuff->dx);
|
|
|
|
swaps(&stuff->dy);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesRegionExtents(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pSource, pDestination;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesRegionExtentsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionReset(pDestination, RegionExtents(pSource));
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesRegionExtents(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesRegionExtentsReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->source);
|
|
|
|
swapl(&stuff->destination);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesFetchRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pRegion;
|
2004-07-29 16:33:43 +02:00
|
|
|
xXFixesFetchRegionReply *reply;
|
2012-03-21 20:55:09 +01:00
|
|
|
xRectangle *pRect;
|
|
|
|
BoxPtr pExtent;
|
|
|
|
BoxPtr pBox;
|
|
|
|
int i, nBox;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesFetchRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pExtent = RegionExtents(pRegion);
|
2012-03-21 20:55:09 +01:00
|
|
|
pBox = RegionRects(pRegion);
|
|
|
|
nBox = RegionNumRects(pRegion);
|
|
|
|
|
2012-07-10 04:12:42 +02:00
|
|
|
reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle),
|
|
|
|
1);
|
2004-07-29 16:33:43 +02:00
|
|
|
if (!reply)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadAlloc;
|
2004-07-29 16:33:43 +02:00
|
|
|
reply->type = X_Reply;
|
|
|
|
reply->sequenceNumber = client->sequence;
|
|
|
|
reply->length = nBox << 1;
|
|
|
|
reply->x = pExtent->x1;
|
|
|
|
reply->y = pExtent->y1;
|
|
|
|
reply->width = pExtent->x2 - pExtent->x1;
|
|
|
|
reply->height = pExtent->y2 - pExtent->y1;
|
|
|
|
|
|
|
|
pRect = (xRectangle *) (reply + 1);
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < nBox; i++) {
|
|
|
|
pRect[i].x = pBox[i].x1;
|
|
|
|
pRect[i].y = pBox[i].y1;
|
|
|
|
pRect[i].width = pBox[i].x2 - pBox[i].x1;
|
|
|
|
pRect[i].height = pBox[i].y2 - pBox[i].y1;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&reply->sequenceNumber);
|
|
|
|
swapl(&reply->length);
|
|
|
|
swaps(&reply->x);
|
|
|
|
swaps(&reply->y);
|
|
|
|
swaps(&reply->width);
|
|
|
|
swaps(&reply->height);
|
|
|
|
SwapShorts((INT16 *) pRect, nBox * 4);
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-05-13 09:03:35 +02:00
|
|
|
WriteToClient(client, sizeof(xXFixesFetchRegionReply) +
|
2012-03-21 20:55:09 +01:00
|
|
|
nBox * sizeof(xRectangle), (char *) reply);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(reply);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesFetchRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesFetchRegionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->region);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesSetGCClipRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
GCPtr pGC;
|
|
|
|
RegionPtr pRegion;
|
|
|
|
ChangeGCVal vals[2];
|
|
|
|
int rc;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesSetGCClipRegionReq);
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
2006-12-15 01:15:21 +01:00
|
|
|
|
2007-08-30 17:48:45 +02:00
|
|
|
rc = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
|
2006-12-15 01:15:21 +01:00
|
|
|
if (rc != Success)
|
2012-03-21 20:55:09 +01:00
|
|
|
return rc;
|
2006-12-15 01:15:21 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pRegion) {
|
|
|
|
pRegion = XFixesRegionCopy(pRegion);
|
|
|
|
if (!pRegion)
|
|
|
|
return BadAlloc;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-08 23:10:51 +02:00
|
|
|
vals[0].val = stuff->xOrigin;
|
|
|
|
vals[1].val = stuff->yOrigin;
|
2012-03-21 20:55:09 +01:00
|
|
|
ChangeGC(NullClient, pGC, GCClipXOrigin | GCClipYOrigin, vals);
|
|
|
|
(*pGC->funcs->ChangeClip) (pGC, pRegion ? CT_REGION : CT_NONE,
|
2013-12-15 10:05:51 +01:00
|
|
|
(void *) pRegion, 0);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesSetGCClipRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetGCClipRegionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->gc);
|
|
|
|
swapl(&stuff->region);
|
|
|
|
swaps(&stuff->xOrigin);
|
|
|
|
swaps(&stuff->yOrigin);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
typedef RegionPtr (*CreateDftPtr) (WindowPtr pWin);
|
2004-07-29 16:33:43 +02:00
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesSetWindowShapeRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
WindowPtr pWin;
|
|
|
|
RegionPtr pRegion;
|
|
|
|
RegionPtr *pDestRegion;
|
2007-08-30 17:48:45 +02:00
|
|
|
int rc;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesSetWindowShapeRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
2013-12-15 10:05:51 +01:00
|
|
|
rc = dixLookupResourceByType((void **) &pWin, stuff->dest, RT_WINDOW,
|
2012-03-21 20:55:09 +01:00
|
|
|
client, DixSetAttrAccess);
|
|
|
|
if (rc != Success) {
|
|
|
|
client->errorValue = stuff->dest;
|
|
|
|
return rc;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
|
2004-07-29 16:33:43 +02:00
|
|
|
switch (stuff->destKind) {
|
|
|
|
case ShapeBounding:
|
|
|
|
case ShapeClip:
|
2005-06-10 06:01:14 +02:00
|
|
|
case ShapeInput:
|
2012-03-21 20:55:09 +01:00
|
|
|
break;
|
2004-07-29 16:33:43 +02:00
|
|
|
default:
|
2012-03-21 20:55:09 +01:00
|
|
|
client->errorValue = stuff->destKind;
|
|
|
|
return BadValue;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (pRegion) {
|
|
|
|
pRegion = XFixesRegionCopy(pRegion);
|
|
|
|
if (!pRegion)
|
|
|
|
return BadAlloc;
|
|
|
|
if (!pWin->optional)
|
|
|
|
MakeWindowOptional(pWin);
|
|
|
|
switch (stuff->destKind) {
|
|
|
|
default:
|
|
|
|
case ShapeBounding:
|
|
|
|
pDestRegion = &pWin->optional->boundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
pDestRegion = &pWin->optional->clipShape;
|
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
pDestRegion = &pWin->optional->inputShape;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (stuff->xOff || stuff->yOff)
|
|
|
|
RegionTranslate(pRegion, stuff->xOff, stuff->yOff);
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
else {
|
|
|
|
if (pWin->optional) {
|
|
|
|
switch (stuff->destKind) {
|
|
|
|
default:
|
|
|
|
case ShapeBounding:
|
|
|
|
pDestRegion = &pWin->optional->boundingShape;
|
|
|
|
break;
|
|
|
|
case ShapeClip:
|
|
|
|
pDestRegion = &pWin->optional->clipShape;
|
|
|
|
break;
|
|
|
|
case ShapeInput:
|
|
|
|
pDestRegion = &pWin->optional->inputShape;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pDestRegion = &pRegion; /* a NULL region pointer */
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
if (*pDestRegion)
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionDestroy(*pDestRegion);
|
2004-07-29 16:33:43 +02:00
|
|
|
*pDestRegion = pRegion;
|
2010-06-06 05:55:29 +02:00
|
|
|
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
2012-03-21 20:55:09 +01:00
|
|
|
SendShapeNotify(pWin, stuff->destKind);
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesSetWindowShapeRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetWindowShapeRegionReq);
|
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->dest);
|
|
|
|
swaps(&stuff->xOff);
|
|
|
|
swaps(&stuff->yOff);
|
|
|
|
swapl(&stuff->region);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesSetPictureClipRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
PicturePtr pPicture;
|
|
|
|
RegionPtr pRegion;
|
|
|
|
|
2004-07-29 16:33:43 +02:00
|
|
|
REQUEST(xXFixesSetPictureClipRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
2010-05-06 20:00:38 +02:00
|
|
|
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2014-04-10 17:34:28 +02:00
|
|
|
if (!pPicture->pDrawable)
|
|
|
|
return RenderErrBase + BadPicture;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
|
|
|
|
pRegion);
|
2004-07-29 16:33:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesSetPictureClipRegion(ClientPtr client)
|
2004-07-29 16:33:43 +02:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetPictureClipRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->picture);
|
|
|
|
swapl(&stuff->region);
|
|
|
|
swaps(&stuff->xOrigin);
|
|
|
|
swaps(&stuff->yOrigin);
|
2004-07-29 16:33:43 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
2004-07-31 09:26:50 +02:00
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
ProcXFixesExpandRegion(ClientPtr client)
|
2004-07-31 09:26:50 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
RegionPtr pSource, pDestination;
|
|
|
|
|
|
|
|
REQUEST(xXFixesExpandRegionReq);
|
|
|
|
BoxPtr pTmp;
|
|
|
|
BoxPtr pSrc;
|
|
|
|
int nBoxes;
|
|
|
|
int i;
|
2004-07-31 09:26:50 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
|
2006-12-14 20:45:42 +01:00
|
|
|
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
|
|
|
|
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
nBoxes = RegionNumRects(pSource);
|
|
|
|
pSrc = RegionRects(pSource);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (nBoxes) {
|
|
|
|
pTmp = malloc(nBoxes * sizeof(BoxRec));
|
|
|
|
if (!pTmp)
|
|
|
|
return BadAlloc;
|
|
|
|
for (i = 0; i < nBoxes; i++) {
|
|
|
|
pTmp[i].x1 = pSrc[i].x1 - stuff->left;
|
|
|
|
pTmp[i].x2 = pSrc[i].x2 + stuff->right;
|
|
|
|
pTmp[i].y1 = pSrc[i].y1 - stuff->top;
|
|
|
|
pTmp[i].y2 = pSrc[i].y2 + stuff->bottom;
|
|
|
|
}
|
|
|
|
RegionEmpty(pDestination);
|
|
|
|
for (i = 0; i < nBoxes; i++) {
|
|
|
|
RegionRec r;
|
|
|
|
|
|
|
|
RegionInit(&r, &pTmp[i], 0);
|
|
|
|
RegionUnion(pDestination, pDestination, &r);
|
|
|
|
}
|
|
|
|
free(pTmp);
|
2004-07-31 09:26:50 +02:00
|
|
|
}
|
2010-05-11 05:22:05 +02:00
|
|
|
return Success;
|
2004-07-31 09:26:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
SProcXFixesExpandRegion(ClientPtr client)
|
2004-07-31 09:26:50 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST(xXFixesExpandRegionReq);
|
2004-07-31 09:26:50 +02:00
|
|
|
|
2011-08-04 21:35:41 +02:00
|
|
|
swaps(&stuff->length);
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
|
2011-08-04 21:35:41 +02:00
|
|
|
swapl(&stuff->source);
|
|
|
|
swapl(&stuff->destination);
|
|
|
|
swaps(&stuff->left);
|
|
|
|
swaps(&stuff->right);
|
|
|
|
swaps(&stuff->top);
|
|
|
|
swaps(&stuff->bottom);
|
2004-07-31 09:26:50 +02:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2010-01-05 21:35:10 +01:00
|
|
|
#ifdef PANORAMIX
|
|
|
|
#include "panoramiX.h"
|
|
|
|
#include "panoramiXsrv.h"
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXFixesSetGCClipRegion(ClientPtr client)
|
2010-01-05 21:35:10 +01:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetGCClipRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *gc;
|
|
|
|
|
2010-01-05 21:35:10 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((result = dixLookupResourceByType((void **) &gc, stuff->gc, XRT_GC,
|
|
|
|
client, DixWriteAccess))) {
|
|
|
|
client->errorValue = stuff->gc;
|
|
|
|
return result;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
|
|
|
stuff->gc = gc->info[j].id;
|
|
|
|
result = (*PanoramiXSaveXFixesVector[X_XFixesSetGCClipRegion]) (client);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXFixesSetWindowShapeRegion(ClientPtr client)
|
2010-01-05 21:35:10 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *win;
|
2013-11-04 23:49:34 +01:00
|
|
|
RegionPtr reg = NULL;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2010-01-05 21:35:10 +01:00
|
|
|
REQUEST(xXFixesSetWindowShapeRegionReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((result = dixLookupResourceByType((void **) &win, stuff->dest,
|
|
|
|
XRT_WINDOW, client,
|
|
|
|
DixWriteAccess))) {
|
|
|
|
client->errorValue = stuff->dest;
|
|
|
|
return result;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
2013-11-04 23:49:34 +01:00
|
|
|
if (win->u.win.root)
|
|
|
|
VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
|
|
|
|
|
2010-01-05 21:35:10 +01:00
|
|
|
FOR_NSCREENS_FORWARD(j) {
|
2013-11-04 23:49:34 +01:00
|
|
|
ScreenPtr screen = screenInfo.screens[j];
|
2012-03-21 20:55:09 +01:00
|
|
|
stuff->dest = win->info[j].id;
|
2013-11-04 23:49:34 +01:00
|
|
|
|
|
|
|
if (reg)
|
|
|
|
RegionTranslate(reg, -screen->x, -screen->y);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
result =
|
|
|
|
(*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client);
|
2013-11-04 23:49:34 +01:00
|
|
|
|
|
|
|
if (reg)
|
|
|
|
RegionTranslate(reg, screen->x, screen->y);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-03-21 20:55:09 +01:00
|
|
|
PanoramiXFixesSetPictureClipRegion(ClientPtr client)
|
2010-01-05 21:35:10 +01:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetPictureClipRegionReq);
|
2012-03-21 20:55:09 +01:00
|
|
|
int result = Success, j;
|
|
|
|
PanoramiXRes *pict;
|
2013-11-04 23:49:33 +01:00
|
|
|
RegionPtr reg = NULL;
|
2010-01-05 21:35:10 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
|
2010-01-05 21:35:10 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((result = dixLookupResourceByType((void **) &pict, stuff->picture,
|
|
|
|
XRT_PICTURE, client,
|
|
|
|
DixWriteAccess))) {
|
|
|
|
client->errorValue = stuff->picture;
|
|
|
|
return result;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
2013-11-04 23:49:33 +01:00
|
|
|
if (pict->u.pict.root)
|
|
|
|
VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess);
|
|
|
|
|
2010-01-05 21:35:10 +01:00
|
|
|
FOR_NSCREENS_BACKWARD(j) {
|
2013-11-04 23:49:33 +01:00
|
|
|
ScreenPtr screen = screenInfo.screens[j];
|
2010-01-05 21:35:10 +01:00
|
|
|
stuff->picture = pict->info[j].id;
|
2013-11-04 23:49:33 +01:00
|
|
|
|
|
|
|
if (reg)
|
|
|
|
RegionTranslate(reg, -screen->x, -screen->y);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
result =
|
|
|
|
(*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client);
|
2013-11-04 23:49:33 +01:00
|
|
|
|
|
|
|
if (reg)
|
|
|
|
RegionTranslate(reg, screen->x, screen->y);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (result != Success)
|
|
|
|
break;
|
2010-01-05 21:35:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|