New upstream version 3.5.99.27

This commit is contained in:
geos_one
2025-08-08 20:00:36 +02:00
commit bc8d10cc33
4267 changed files with 1757978 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#include <Server.tmpl>
NULL =
SRCS = cursor.c region.c saveset.c select.c xfixes.c
OBJS = cursor.o region.o saveset.o select.o xfixes.o
INCLUDES = -I. -I../include -I../Xext -I../fixes -I../render \
-I$(EXTINCSRC) -I$(XINCLUDESRC) \
`pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
#if defined(NXAgentServer) && NXAgentServer
NX_DEFINES = -DNXAGENT_SERVER
#endif
DEFINES = \
$(NX_DEFINES) \
$(NULL)
NormalLibraryTarget(xfixes,$(OBJS))
NormalLibraryObjectRule()
LintLibraryTarget(xfixes,$(SRCS))
NormalLintTarget($(SRCS))
DependTarget()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,858 @@
/*
* 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xfixesint.h"
#include "scrnintstr.h"
#ifdef RENDER
#include <picturestr.h>
extern int RenderErrBase;
#endif
#include <regionstr.h>
#include <gcstruct.h>
#include <window.h>
RESTYPE RegionResType;
static int
RegionResFree (void * data, XID id)
{
RegionPtr pRegion = (RegionPtr) data;
RegionDestroy(pRegion);
return Success;
}
RegionPtr
XFixesRegionCopy (RegionPtr pRegion)
{
RegionPtr pNew = RegionCreate(RegionExtents(pRegion),
RegionNumRects(pRegion));
if (!pNew)
return 0;
if (!RegionCopy(pNew, pRegion))
{
RegionDestroy(pNew);
return 0;
}
return pNew;
}
Bool
XFixesRegionInit (void)
{
RegionResType = CreateNewResourceType(RegionResFree);
return TRUE;
}
int
ProcXFixesCreateRegion (ClientPtr client)
{
int things;
RegionPtr pRegion;
REQUEST (xXFixesCreateRegionReq);
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
if (things & 4)
return BadLength;
things >>= 3;
pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pRegion)
return BadAlloc;
if (!AddResource (stuff->region, RegionResType, (void *) pRegion))
return BadAlloc;
return(client->noClientException);
}
int
SProcXFixesCreateRegion (ClientPtr client)
{
REQUEST(xXFixesCreateRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);
swapl(&stuff->region);
SwapRestS(stuff);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCreateRegionFromBitmap (ClientPtr client)
{
RegionPtr pRegion;
PixmapPtr pPixmap;
REQUEST (xXFixesCreateRegionFromBitmapReq);
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromBitmapReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
pPixmap = (PixmapPtr) SecurityLookupIDByType (client, stuff->bitmap,
RT_PIXMAP,
DixReadAccess);
if (!pPixmap)
{
client->errorValue = stuff->bitmap;
return BadPixmap;
}
if (pPixmap->drawable.depth != 1)
return BadMatch;
pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);
if (!pRegion)
return BadAlloc;
if (!AddResource (stuff->region, RegionResType, (void *) pRegion))
return BadAlloc;
return(client->noClientException);
}
int
SProcXFixesCreateRegionFromBitmap (ClientPtr client)
{
REQUEST(xXFixesCreateRegionFromBitmapReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
swapl(&stuff->region);
swapl(&stuff->bitmap);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCreateRegionFromWindow (ClientPtr client)
{
RegionPtr pRegion;
Bool copy = TRUE;
WindowPtr pWin;
REQUEST (xXFixesCreateRegionFromWindowReq);
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
if (!pWin)
{
client->errorValue = stuff->window;
return BadWindow;
}
switch (stuff->kind) {
case WindowRegionBounding:
#ifdef SHAPE
pRegion = wBoundingShape(pWin);
if (!pRegion)
#endif
{
pRegion = CreateBoundingShape (pWin);
copy = FALSE;
}
break;
case WindowRegionClip:
#ifdef SHAPE
pRegion = wClipShape(pWin);
if (!pRegion)
#endif
{
pRegion = CreateClipShape (pWin);
copy = FALSE;
}
break;
default:
client->errorValue = stuff->kind;
return BadValue;
}
if (copy && pRegion)
pRegion = XFixesRegionCopy (pRegion);
if (!pRegion)
return BadAlloc;
if (!AddResource (stuff->region, RegionResType, (void *) pRegion))
return BadAlloc;
return(client->noClientException);
}
int
SProcXFixesCreateRegionFromWindow (ClientPtr client)
{
REQUEST(xXFixesCreateRegionFromWindowReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromWindowReq);
swapl(&stuff->region);
swapl(&stuff->window);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCreateRegionFromGC (ClientPtr client)
{
RegionPtr pRegion, pClip;
GCPtr pGC;
#ifndef NXAGENT_SERVER
int rc;
#endif
REQUEST (xXFixesCreateRegionFromGCReq);
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
#ifndef NXAGENT_SERVER
rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess);
if (rc != Success)
return rc;
#else
SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);
#endif
switch (pGC->clientClipType) {
case CT_PIXMAP:
pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip);
if (!pRegion)
return BadAlloc;
break;
case CT_REGION:
pClip = (RegionPtr) pGC->clientClip;
pRegion = XFixesRegionCopy (pClip);
if (!pRegion)
return BadAlloc;
break;
default:
return BadImplementation; /* assume sane server bits */
}
if (!AddResource (stuff->region, RegionResType, (void *) pRegion))
return BadAlloc;
return(client->noClientException);
}
int
SProcXFixesCreateRegionFromGC (ClientPtr client)
{
REQUEST(xXFixesCreateRegionFromGCReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromGCReq);
swapl(&stuff->region);
swapl(&stuff->gc);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCreateRegionFromPicture (ClientPtr client)
{
#ifdef RENDER
RegionPtr pRegion;
PicturePtr pPicture;
REQUEST (xXFixesCreateRegionFromPictureReq);
REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);
LEGAL_NEW_RESOURCE (stuff->region, client);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixReadAccess,
RenderErrBase + BadPicture);
switch (pPicture->clientClipType) {
case CT_PIXMAP:
pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
(PixmapPtr) pPicture->clientClip);
if (!pRegion)
return BadAlloc;
break;
case CT_REGION:
pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip);
if (!pRegion)
return BadAlloc;
break;
default:
return BadImplementation; /* assume sane server bits */
}
if (!AddResource (stuff->region, RegionResType, (void *) pRegion))
return BadAlloc;
return(client->noClientException);
#else
return BadRequest;
#endif
}
int
SProcXFixesCreateRegionFromPicture (ClientPtr client)
{
REQUEST(xXFixesCreateRegionFromPictureReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesCreateRegionFromPictureReq);
swapl(&stuff->region);
swapl(&stuff->picture);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesDestroyRegion (ClientPtr client)
{
REQUEST (xXFixesDestroyRegionReq);
RegionPtr pRegion;
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
FreeResource (stuff->region, RT_NONE);
return(client->noClientException);
}
int
SProcXFixesDestroyRegion (ClientPtr client)
{
REQUEST(xXFixesDestroyRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesDestroyRegionReq);
swapl(&stuff->region);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesSetRegion (ClientPtr client)
{
int things;
RegionPtr pRegion, pNew;
REQUEST (xXFixesSetRegionReq);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);
if (things & 4)
return BadLength;
things >>= 3;
pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);
if (!pNew)
return BadAlloc;
if (!RegionCopy(pRegion, pNew))
{
RegionDestroy(pNew);
return BadAlloc;
}
RegionDestroy(pNew);
return(client->noClientException);
}
int
SProcXFixesSetRegion (ClientPtr client)
{
REQUEST(xXFixesSetRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesSetRegionReq);
swapl(&stuff->region);
SwapRestS(stuff);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCopyRegion (ClientPtr client)
{
RegionPtr pSource, pDestination;
REQUEST (xXFixesCopyRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
if (!RegionCopy(pDestination, pSource))
return BadAlloc;
return(client->noClientException);
}
int
SProcXFixesCopyRegion (ClientPtr client)
{
REQUEST(xXFixesCopyRegionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXFixesCopyRegionReq);
swapl(&stuff->source);
swapl(&stuff->destination);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesCombineRegion (ClientPtr client)
{
RegionPtr pSource1, pSource2, pDestination;
int ret = Success;
REQUEST (xXFixesCombineRegionReq);
REQUEST_SIZE_MATCH (xXFixesCombineRegionReq);
VERIFY_REGION(pSource1, stuff->source1, client, DixReadAccess);
VERIFY_REGION(pSource2, stuff->source2, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
switch (stuff->xfixesReqType) {
case X_XFixesUnionRegion:
if (!RegionUnion(pDestination, pSource1, pSource2))
ret = BadAlloc;
break;
case X_XFixesIntersectRegion:
if (!RegionIntersect(pDestination, pSource1, pSource2))
ret = BadAlloc;
break;
case X_XFixesSubtractRegion:
if (!RegionSubtract(pDestination, pSource1, pSource2))
ret = BadAlloc;
break;
}
if (ret == Success)
ret = client->noClientException;
return ret;
}
int
SProcXFixesCombineRegion (ClientPtr client)
{
REQUEST(xXFixesCombineRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesCombineRegionReq);
swapl(&stuff->source1);
swapl(&stuff->source2);
swapl(&stuff->destination);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesInvertRegion (ClientPtr client)
{
RegionPtr pSource, pDestination;
BoxRec bounds;
int ret = Success;
REQUEST(xXFixesInvertRegionReq);
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
/* Compute bounds, limit to 16 bits */
bounds.x1 = stuff->x;
bounds.y1 = stuff->y;
if ((int) stuff->x + (int) stuff->width > MAXSHORT)
bounds.x2 = MAXSHORT;
else
bounds.x2 = stuff->x + stuff->width;
if ((int) stuff->y + (int) stuff->height > MAXSHORT)
bounds.y2 = MAXSHORT;
else
bounds.y2 = stuff->y + stuff->height;
if (!RegionInverse(pDestination, pSource, &bounds))
ret = BadAlloc;
if (ret == Success)
ret = client->noClientException;
return ret;
}
int
SProcXFixesInvertRegion (ClientPtr client)
{
REQUEST(xXFixesInvertRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesInvertRegionReq);
swapl(&stuff->source);
swaps(&stuff->x);
swaps(&stuff->y);
swaps(&stuff->width);
swaps(&stuff->height);
swapl(&stuff->destination);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesTranslateRegion (ClientPtr client)
{
RegionPtr pRegion;
REQUEST(xXFixesTranslateRegionReq);
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixWriteAccess);
RegionTranslate(pRegion, stuff->dx, stuff->dy);
return (client->noClientException);
}
int
SProcXFixesTranslateRegion (ClientPtr client)
{
REQUEST(xXFixesTranslateRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq);
swapl(&stuff->region);
swaps(&stuff->dx);
swaps(&stuff->dy);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesRegionExtents (ClientPtr client)
{
RegionPtr pSource, pDestination;
REQUEST(xXFixesRegionExtentsReq);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
RegionReset(pDestination, RegionExtents(pSource));
return (client->noClientException);
}
int
SProcXFixesRegionExtents (ClientPtr client)
{
REQUEST(xXFixesRegionExtentsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesRegionExtentsReq);
swapl(&stuff->source);
swapl(&stuff->destination);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesFetchRegion (ClientPtr client)
{
RegionPtr pRegion;
xXFixesFetchRegionReply *reply;
xRectangle *pRect;
BoxPtr pExtent;
BoxPtr pBox;
int i, nBox;
REQUEST(xXFixesFetchRegionReq);
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);
pExtent = RegionExtents(pRegion);
pBox = RegionRects (pRegion);
nBox = RegionNumRects (pRegion);
reply = calloc (sizeof (xXFixesFetchRegionReply) +
nBox * sizeof (xRectangle), 1);
if (!reply)
return BadAlloc;
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);
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;
}
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);
}
WriteToClient(client, sizeof (xXFixesFetchRegionReply) +
nBox * sizeof (xRectangle), reply);
free (reply);
return (client->noClientException);
}
int
SProcXFixesFetchRegion (ClientPtr client)
{
REQUEST(xXFixesFetchRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesFetchRegionReq);
swapl(&stuff->region);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesSetGCClipRegion (ClientPtr client)
{
GCPtr pGC;
RegionPtr pRegion;
XID vals[2];
#ifndef NXAGENT_SERVER
int rc;
#endif
REQUEST(xXFixesSetGCClipRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
#ifndef NXAGENT_SERVER
rc = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess);
if (rc != Success)
return rc;
#else
SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess);
#endif
VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess);
if (pRegion)
{
pRegion = XFixesRegionCopy (pRegion);
if (!pRegion)
return BadAlloc;
}
vals[0] = stuff->xOrigin;
vals[1] = stuff->yOrigin;
DoChangeGC (pGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
(*pGC->funcs->ChangeClip)(pGC, pRegion ? CT_REGION : CT_NONE, (void *)pRegion, 0);
return (client->noClientException);
}
int
SProcXFixesSetGCClipRegion (ClientPtr client)
{
REQUEST(xXFixesSetGCClipRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
swapl(&stuff->gc);
swapl(&stuff->region);
swaps(&stuff->xOrigin);
swaps(&stuff->yOrigin);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
typedef RegionPtr (*CreateDftPtr)(WindowPtr pWin);
int
ProcXFixesSetWindowShapeRegion (ClientPtr client)
{
#ifdef SHAPE
WindowPtr pWin;
ScreenPtr pScreen;
RegionPtr pRegion;
RegionPtr *pDestRegion;
REQUEST(xXFixesSetWindowShapeRegionReq);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
pWin = (WindowPtr) LookupIDByType (stuff->dest, RT_WINDOW);
if (!pWin)
{
client->errorValue = stuff->dest;
return BadWindow;
}
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess);
pScreen = pWin->drawable.pScreen;
switch (stuff->destKind) {
case ShapeBounding:
case ShapeClip:
case ShapeInput:
break;
default:
client->errorValue = stuff->destKind;
return BadValue;
}
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);
}
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 */
}
if (*pDestRegion)
RegionDestroy(*pDestRegion);
*pDestRegion = pRegion;
(*pScreen->SetShape) (pWin);
SendShapeNotify (pWin, stuff->destKind);
return (client->noClientException);
#else
return BadRequest;
#endif
}
int
SProcXFixesSetWindowShapeRegion (ClientPtr client)
{
REQUEST(xXFixesSetWindowShapeRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesSetWindowShapeRegionReq);
swapl(&stuff->dest);
swaps(&stuff->xOff);
swaps(&stuff->yOff);
swapl(&stuff->region);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesSetPictureClipRegion (ClientPtr client)
{
#ifdef RENDER
PicturePtr pPicture;
RegionPtr pRegion;
REQUEST(xXFixesSetPictureClipRegionReq);
REQUEST_SIZE_MATCH (xXFixesSetPictureClipRegionReq);
VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess,
RenderErrBase + BadPicture);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
return SetPictureClipRegion (pPicture, stuff->xOrigin, stuff->yOrigin,
pRegion);
#else
return BadRequest;
#endif
}
int
SProcXFixesSetPictureClipRegion (ClientPtr client)
{
REQUEST(xXFixesSetPictureClipRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq);
swapl(&stuff->picture);
swapl(&stuff->region);
swaps(&stuff->xOrigin);
swaps(&stuff->yOrigin);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
int
ProcXFixesExpandRegion (ClientPtr client)
{
RegionPtr pSource, pDestination;
int ret = Success;
REQUEST (xXFixesExpandRegionReq);
BoxPtr pTmp;
BoxPtr pSrc;
int nBoxes;
int i;
REQUEST_SIZE_MATCH (xXFixesExpandRegionReq);
VERIFY_REGION(pSource, stuff->source, client, DixReadAccess);
VERIFY_REGION(pDestination, stuff->destination, client, DixWriteAccess);
nBoxes = RegionNumRects(pSource);
pSrc = RegionRects(pSource);
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);
}
if (ret == Success)
ret = client->noClientException;
return ret;
}
int
SProcXFixesExpandRegion (ClientPtr client)
{
REQUEST(xXFixesExpandRegionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXFixesExpandRegionReq);
swapl(&stuff->source);
swapl(&stuff->destination);
swaps(&stuff->left);
swaps(&stuff->right);
swaps(&stuff->top);
swaps(&stuff->bottom);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright © 2002 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xfixesint.h"
int
ProcXFixesChangeSaveSet(ClientPtr client)
{
Bool toRoot, remap;
int result;
WindowPtr pWin;
REQUEST(xXFixesChangeSaveSetReq);
REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
#ifndef NXAGENT_SERVER
result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (result != Success)
return result;
#else
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
DixReadAccess);
if (!pWin)
return(BadWindow);
#endif
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch;
if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))
{
client->errorValue = stuff->mode;
return( BadValue );
}
if ((stuff->target != SaveSetNearest) && (stuff->target != SaveSetRoot))
{
client->errorValue = stuff->target;
return( BadValue );
}
if ((stuff->map != SaveSetMap) && (stuff->map != SaveSetUnmap))
{
client->errorValue = stuff->map;
return( BadValue );
}
toRoot = (stuff->target == SaveSetRoot);
remap = (stuff->map == SaveSetMap);
result = AlterSaveSetForClient(client, pWin, stuff->mode, toRoot, remap);
if (client->noClientException != Success)
return(client->noClientException);
else
return(result);
}
int
SProcXFixesChangeSaveSet(ClientPtr client)
{
REQUEST(xXFixesChangeSaveSetReq);
swaps(&stuff->length);
swapl(&stuff->window);
return ProcXFixesChangeSaveSet(client);
}

View File

@@ -0,0 +1,288 @@
/*
* Copyright © 2002 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xfixesint.h"
static RESTYPE SelectionClientType, SelectionWindowType;
static Bool SelectionCallbackRegistered = FALSE;
/*
* There is a global list of windows selecting for selection events
* on every selection. This should be plenty efficient for the
* expected usage, if it does become a problem, it should be easily
* replaced with a hash table of some kind keyed off the selection atom
*/
typedef struct _SelectionEvent *SelectionEventPtr;
typedef struct _SelectionEvent {
SelectionEventPtr next;
Atom selection;
CARD32 eventMask;
ClientPtr pClient;
WindowPtr pWindow;
XID clientResource;
} SelectionEventRec;
static SelectionEventPtr selectionEvents;
static void
XFixesSelectionCallback (CallbackListPtr *callbacks, void * data, void * args)
{
SelectionEventPtr e;
SelectionInfoRec *info = (SelectionInfoRec *) args;
Selection *selection = info->selection;
int subtype;
CARD32 eventMask;
switch (info->kind) {
case SelectionSetOwner:
subtype = XFixesSetSelectionOwnerNotify;
eventMask = XFixesSetSelectionOwnerNotifyMask;
break;
case SelectionWindowDestroy:
subtype = XFixesSelectionWindowDestroyNotify;
eventMask = XFixesSelectionWindowDestroyNotifyMask;
break;
case SelectionClientClose:
subtype = XFixesSelectionClientCloseNotify;
eventMask = XFixesSelectionClientCloseNotifyMask;
break;
default:
return;
}
for (e = selectionEvents; e; e = e->next)
{
if (e->selection == selection->selection &&
(e->eventMask & eventMask))
{
xXFixesSelectionNotifyEvent ev;
memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent));
ev.type = XFixesEventBase + XFixesSelectionNotify;
ev.subtype = subtype;
ev.window = e->pWindow->drawable.id;
if (subtype == XFixesSetSelectionOwnerNotify)
ev.owner = selection->window;
else
ev.owner = 0;
ev.selection = e->selection;
ev.timestamp = currentTime.milliseconds;
ev.selectionTimestamp = selection->lastTimeChanged.milliseconds;
WriteEventsToClient (e->pClient, 1, (xEvent *) &ev);
}
}
}
static Bool
CheckSelectionCallback (void)
{
if (selectionEvents)
{
if (!SelectionCallbackRegistered)
{
if (!AddCallback (&SelectionCallback, XFixesSelectionCallback, NULL))
return FALSE;
SelectionCallbackRegistered = TRUE;
}
}
else
{
if (SelectionCallbackRegistered)
{
DeleteCallback (&SelectionCallback, XFixesSelectionCallback, NULL);
SelectionCallbackRegistered = FALSE;
}
}
return TRUE;
}
#define SelectionAllEvents (XFixesSetSelectionOwnerNotifyMask |\
XFixesSelectionWindowDestroyNotifyMask |\
XFixesSelectionClientCloseNotifyMask)
static int
XFixesSelectSelectionInput (ClientPtr pClient,
Atom selection,
WindowPtr pWindow,
CARD32 eventMask)
{
SelectionEventPtr *prev, e;
for (prev = &selectionEvents; (e = *prev); prev = &e->next)
{
if (e->selection == selection &&
e->pClient == pClient &&
e->pWindow == pWindow)
{
break;
}
}
if (!eventMask)
{
if (e)
{
FreeResource (e->clientResource, 0);
}
return Success;
}
if (!e)
{
e = (SelectionEventPtr) malloc (sizeof (SelectionEventRec));
if (!e)
return BadAlloc;
e->next = 0;
e->selection = selection;
e->pClient = pClient;
e->pWindow = pWindow;
e->clientResource = FakeClientID(pClient->index);
/*
* Add a resource hanging from the window to
* catch window destroy
*/
if (!LookupIDByType(pWindow->drawable.id, SelectionWindowType))
if (!AddResource (pWindow->drawable.id, SelectionWindowType,
(void *) pWindow))
{
free (e);
return BadAlloc;
}
if (!AddResource (e->clientResource, SelectionClientType, (void *) e))
return BadAlloc;
*prev = e;
if (!CheckSelectionCallback ())
{
FreeResource (e->clientResource, 0);
return BadAlloc;
}
}
e->eventMask = eventMask;
return Success;
}
int
ProcXFixesSelectSelectionInput (ClientPtr client)
{
REQUEST (xXFixesSelectSelectionInputReq);
WindowPtr pWin;
#ifndef NXAGENT_SERVER
int rc;
#endif
REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq);
#ifndef NXAGENT_SERVER
rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
if (rc != Success)
return rc;
#else
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
DixReadAccess);
if (!pWin)
return(BadWindow);
#endif
if (stuff->eventMask & ~SelectionAllEvents)
{
client->errorValue = stuff->eventMask;
return( BadValue );
}
return XFixesSelectSelectionInput (client, stuff->selection,
pWin, stuff->eventMask);
}
int
SProcXFixesSelectSelectionInput (ClientPtr client)
{
REQUEST(xXFixesSelectSelectionInputReq);
REQUEST_SIZE_MATCH(xXFixesSelectSelectionInputReq);
swaps(&stuff->length);
swapl(&stuff->window);
swapl(&stuff->selection);
swapl(&stuff->eventMask);
return ProcXFixesSelectSelectionInput(client);
}
void
SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from,
xXFixesSelectionNotifyEvent *to)
{
to->type = from->type;
cpswaps (from->sequenceNumber, to->sequenceNumber);
cpswapl (from->window, to->window);
cpswapl (from->owner, to->owner);
cpswapl (from->selection, to->selection);
cpswapl (from->timestamp, to->timestamp);
cpswapl (from->selectionTimestamp, to->selectionTimestamp);
}
static int
SelectionFreeClient (void * data, XID id)
{
SelectionEventPtr old = (SelectionEventPtr) data;
SelectionEventPtr *prev, e;
for (prev = &selectionEvents; (e = *prev); prev = &e->next)
{
if (e == old)
{
*prev = e->next;
free (e);
CheckSelectionCallback ();
break;
}
}
return 1;
}
static int
SelectionFreeWindow (void * data, XID id)
{
WindowPtr pWindow = (WindowPtr) data;
SelectionEventPtr e, next;
for (e = selectionEvents; e; e = next)
{
next = e->next;
if (e->pWindow == pWindow)
{
FreeResource (e->clientResource, 0);
}
}
return 1;
}
Bool
XFixesSelectionInit (void)
{
SelectionClientType = CreateNewResourceType(SelectionFreeClient);
SelectionWindowType = CreateNewResourceType(SelectionFreeWindow);
return SelectionClientType && SelectionWindowType;
}

View File

@@ -0,0 +1,257 @@
/*
* Copyright © 2006 Sun Microsystems
*
* 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 Sun Microsystems not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Sun Microsystems makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL SUN MICROSYSTEMS 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.
*
* Copyright © 2002 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xfixesint.h"
#include "protocol-versions.h"
static unsigned char XFixesReqCode;
int XFixesEventBase;
int XFixesErrorBase;
static int XFixesClientPrivateIndex;
static int
ProcXFixesQueryVersion(ClientPtr client)
{
XFixesClientPtr pXFixesClient = GetXFixesClient (client);
xXFixesQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;
} else {
rep.majorVersion = SERVER_XFIXES_MAJOR_VERSION;
if (stuff->majorVersion == SERVER_XFIXES_MAJOR_VERSION &&
stuff->minorVersion < SERVER_XFIXES_MINOR_VERSION)
rep.minorVersion = stuff->minorVersion;
else
rep.minorVersion = SERVER_XFIXES_MINOR_VERSION;
}
pXFixesClient->major_version = rep.majorVersion;
pXFixesClient->minor_version = rep.minorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.majorVersion);
swapl(&rep.minorVersion);
}
WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep);
return(client->noClientException);
}
/* Major version controls available requests */
static const int version_requests[] = {
X_XFixesQueryVersion, /* before client sends QueryVersion */
X_XFixesGetCursorImage, /* Version 1 */
X_XFixesChangeCursorByName, /* Version 2 */
X_XFixesExpandRegion, /* Version 3 */
X_XFixesShowCursor, /* Version 4 */
};
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
ProcXFixesQueryVersion,
ProcXFixesChangeSaveSet,
ProcXFixesSelectSelectionInput,
ProcXFixesSelectCursorInput,
ProcXFixesGetCursorImage,
/*************** Version 2 ******************/
ProcXFixesCreateRegion,
ProcXFixesCreateRegionFromBitmap,
ProcXFixesCreateRegionFromWindow,
ProcXFixesCreateRegionFromGC,
ProcXFixesCreateRegionFromPicture,
ProcXFixesDestroyRegion,
ProcXFixesSetRegion,
ProcXFixesCopyRegion,
ProcXFixesCombineRegion,
ProcXFixesCombineRegion,
ProcXFixesCombineRegion,
ProcXFixesInvertRegion,
ProcXFixesTranslateRegion,
ProcXFixesRegionExtents,
ProcXFixesFetchRegion,
ProcXFixesSetGCClipRegion,
ProcXFixesSetWindowShapeRegion,
ProcXFixesSetPictureClipRegion,
ProcXFixesSetCursorName,
ProcXFixesGetCursorName,
ProcXFixesGetCursorImageAndName,
ProcXFixesChangeCursor,
ProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
ProcXFixesExpandRegion,
/*************** Version 4 ****************/
ProcXFixesHideCursor,
ProcXFixesShowCursor,
};
static int
ProcXFixesDispatch (ClientPtr client)
{
REQUEST(xXFixesReq);
XFixesClientPtr pXFixesClient = GetXFixesClient (client);
if (pXFixesClient->major_version >= NUM_VERSION_REQUESTS)
return BadRequest;
if (stuff->xfixesReqType > version_requests[pXFixesClient->major_version])
return BadRequest;
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
static int
SProcXFixesQueryVersion(ClientPtr client)
{
REQUEST(xXFixesQueryVersionReq);
swaps(&stuff->length);
swapl(&stuff->majorVersion);
swapl(&stuff->minorVersion);
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
}
static int (*SProcXFixesVector[XFixesNumberRequests])(ClientPtr) = {
/*************** Version 1 ******************/
SProcXFixesQueryVersion,
SProcXFixesChangeSaveSet,
SProcXFixesSelectSelectionInput,
SProcXFixesSelectCursorInput,
SProcXFixesGetCursorImage,
/*************** Version 2 ******************/
SProcXFixesCreateRegion,
SProcXFixesCreateRegionFromBitmap,
SProcXFixesCreateRegionFromWindow,
SProcXFixesCreateRegionFromGC,
SProcXFixesCreateRegionFromPicture,
SProcXFixesDestroyRegion,
SProcXFixesSetRegion,
SProcXFixesCopyRegion,
SProcXFixesCombineRegion,
SProcXFixesCombineRegion,
SProcXFixesCombineRegion,
SProcXFixesInvertRegion,
SProcXFixesTranslateRegion,
SProcXFixesRegionExtents,
SProcXFixesFetchRegion,
SProcXFixesSetGCClipRegion,
SProcXFixesSetWindowShapeRegion,
SProcXFixesSetPictureClipRegion,
SProcXFixesSetCursorName,
SProcXFixesGetCursorName,
SProcXFixesGetCursorImageAndName,
SProcXFixesChangeCursor,
SProcXFixesChangeCursorByName,
/*************** Version 3 ******************/
SProcXFixesExpandRegion,
/*************** Version 4 ****************/
SProcXFixesHideCursor,
SProcXFixesShowCursor,
};
static int
SProcXFixesDispatch (ClientPtr client)
{
REQUEST(xXFixesReq);
if (stuff->xfixesReqType >= XFixesNumberRequests)
return BadRequest;
return (*SProcXFixesVector[stuff->xfixesReqType]) (client);
}
static void
XFixesClientCallback (CallbackListPtr *list,
void *closure,
void *data)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
XFixesClientPtr pXFixesClient = GetXFixesClient (pClient);
pXFixesClient->major_version = 0;
pXFixesClient->minor_version = 0;
}
/*ARGSUSED*/
static void
XFixesResetProc (ExtensionEntry *extEntry)
{
DeleteCallback (&ClientStateCallback, XFixesClientCallback, 0);
}
void
XFixesExtensionInit(void)
{
ExtensionEntry *extEntry;
XFixesClientPrivateIndex = AllocateClientPrivateIndex ();
if (!AllocateClientPrivate (XFixesClientPrivateIndex,
sizeof (XFixesClientRec)))
return;
if (!AddCallback (&ClientStateCallback, XFixesClientCallback, 0))
return;
if (XFixesSelectionInit() && XFixesCursorInit () && XFixesRegionInit () &&
(extEntry = AddExtension(XFIXES_NAME, XFixesNumberEvents,
XFixesNumberErrors,
ProcXFixesDispatch, SProcXFixesDispatch,
XFixesResetProc, StandardMinorOpcode)) != 0)
{
XFixesReqCode = (unsigned char)extEntry->base;
XFixesEventBase = extEntry->eventBase;
XFixesErrorBase = extEntry->errorBase;
EventSwapVector[XFixesEventBase + XFixesSelectionNotify] =
(EventSwapPtr) SXFixesSelectionNotifyEvent;
EventSwapVector[XFixesEventBase + XFixesCursorNotify] =
(EventSwapPtr) SXFixesCursorNotifyEvent;
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright © 2002 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _XFIXES_H_
#define _XFIXES_H_
#include "resource.h"
extern RESTYPE RegionResType;
extern int XFixesErrorBase;
#define VERIFY_REGION(pRegion, rid, client, mode) { \
pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \
if (!pRegion) { \
client->errorValue = rid; \
return XFixesErrorBase + BadRegion; \
} \
}
#define VERIFY_REGION_OR_NONE(pRegion, rid, client, mode) { \
pRegion = 0; \
if (rid) VERIFY_REGION(pRegion, rid, client, mode); \
}
RegionPtr
XFixesRegionCopy (RegionPtr pRegion);
#endif /* _XFIXES_H_ */

View File

@@ -0,0 +1,271 @@
/*
* Copyright © 2006 Sun Microsystems
*
* 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 Sun Microsystems not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Sun Microsystems makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL SUN MICROSYSTEMS 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.
*
* Copyright © 2002 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.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifndef _XFIXESINT_H_
#define _XFIXESINT_H_
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include <nx-X11/extensions/xfixesproto.h>
#include "windowstr.h"
#include "selection.h"
#include "xfixes.h"
extern int XFixesEventBase;
typedef struct _XFixesClient {
CARD32 major_version;
CARD32 minor_version;
} XFixesClientRec, *XFixesClientPtr;
#define GetXFixesClient(pClient) ((XFixesClientPtr) (pClient)->devPrivates[XFixesClientPrivateIndex].ptr)
extern int (*ProcXFixesVector[XFixesNumberRequests])(ClientPtr);
/* Initialize extension at server startup time */
void
XFixesExtensionInit(void);
/* Save set */
int
ProcXFixesChangeSaveSet(ClientPtr client);
int
SProcXFixesChangeSaveSet(ClientPtr client);
/* Selection events */
int
ProcXFixesSelectSelectionInput (ClientPtr client);
int
SProcXFixesSelectSelectionInput (ClientPtr client);
void
SXFixesSelectionNotifyEvent (xXFixesSelectionNotifyEvent *from,
xXFixesSelectionNotifyEvent *to);
Bool
XFixesSelectionInit (void);
/* Cursor notification */
Bool
XFixesCursorInit (void);
int
ProcXFixesSelectCursorInput (ClientPtr client);
int
SProcXFixesSelectCursorInput (ClientPtr client);
void
SXFixesCursorNotifyEvent (xXFixesCursorNotifyEvent *from,
xXFixesCursorNotifyEvent *to);
int
ProcXFixesGetCursorImage (ClientPtr client);
int
SProcXFixesGetCursorImage (ClientPtr client);
/* Cursor names (Version 2) */
int
ProcXFixesSetCursorName (ClientPtr client);
int
SProcXFixesSetCursorName (ClientPtr client);
int
ProcXFixesGetCursorName (ClientPtr client);
int
SProcXFixesGetCursorName (ClientPtr client);
int
ProcXFixesGetCursorImageAndName (ClientPtr client);
int
SProcXFixesGetCursorImageAndName (ClientPtr client);
/* Cursor replacement (Version 2) */
int
ProcXFixesChangeCursor (ClientPtr client);
int
SProcXFixesChangeCursor (ClientPtr client);
int
ProcXFixesChangeCursorByName (ClientPtr client);
int
SProcXFixesChangeCursorByName (ClientPtr client);
/* Region objects (Version 2* */
Bool
XFixesRegionInit (void);
int
ProcXFixesCreateRegion (ClientPtr client);
int
SProcXFixesCreateRegion (ClientPtr client);
int
ProcXFixesCreateRegionFromBitmap (ClientPtr client);
int
SProcXFixesCreateRegionFromBitmap (ClientPtr client);
int
ProcXFixesCreateRegionFromWindow (ClientPtr client);
int
SProcXFixesCreateRegionFromWindow (ClientPtr client);
int
ProcXFixesCreateRegionFromGC (ClientPtr client);
int
SProcXFixesCreateRegionFromGC (ClientPtr client);
int
ProcXFixesCreateRegionFromPicture (ClientPtr client);
int
SProcXFixesCreateRegionFromPicture (ClientPtr client);
int
ProcXFixesDestroyRegion (ClientPtr client);
int
SProcXFixesDestroyRegion (ClientPtr client);
int
ProcXFixesSetRegion (ClientPtr client);
int
SProcXFixesSetRegion (ClientPtr client);
int
ProcXFixesCopyRegion (ClientPtr client);
int
SProcXFixesCopyRegion (ClientPtr client);
int
ProcXFixesCombineRegion (ClientPtr client);
int
SProcXFixesCombineRegion (ClientPtr client);
int
ProcXFixesInvertRegion (ClientPtr client);
int
SProcXFixesInvertRegion (ClientPtr client);
int
ProcXFixesTranslateRegion (ClientPtr client);
int
SProcXFixesTranslateRegion (ClientPtr client);
int
ProcXFixesRegionExtents (ClientPtr client);
int
SProcXFixesRegionExtents (ClientPtr client);
int
ProcXFixesFetchRegion (ClientPtr client);
int
SProcXFixesFetchRegion (ClientPtr client);
int
ProcXFixesSetGCClipRegion (ClientPtr client);
int
SProcXFixesSetGCClipRegion (ClientPtr client);
int
ProcXFixesSetWindowShapeRegion (ClientPtr client);
int
SProcXFixesSetWindowShapeRegion (ClientPtr client);
int
ProcXFixesSetPictureClipRegion (ClientPtr client);
int
SProcXFixesSetPictureClipRegion (ClientPtr client);
int
ProcXFixesExpandRegion (ClientPtr client);
int
SProcXFixesExpandRegion (ClientPtr client);
/* Cursor Visibility (Version 4) */
int
ProcXFixesHideCursor (ClientPtr client);
int
SProcXFixesHideCursor (ClientPtr client);
int
ProcXFixesShowCursor (ClientPtr client);
int
SProcXFixesShowCursor (ClientPtr client);
#endif /* _XFIXESINT_H_ */