2006-11-26 11:13:41 -07:00
|
|
|
/*
|
2011-11-05 07:32:40 -06:00
|
|
|
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
|
|
|
* Copyright 2010 Red Hat, Inc.
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
2010-07-27 13:02:24 -06:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
2010-07-27 13:02:24 -06:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
|
2006-11-26 11:13:41 -07:00
|
|
|
*
|
|
|
|
* 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 "scrnintstr.h"
|
|
|
|
#include "cursorstr.h"
|
|
|
|
#include "dixevents.h"
|
|
|
|
#include "servermd.h"
|
2011-11-05 07:32:40 -06:00
|
|
|
#include "mipointer.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "inputstr.h"
|
|
|
|
#include "windowstr.h"
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "xace.h"
|
2011-11-05 07:32:40 -06:00
|
|
|
#include "list.h"
|
2013-06-07 11:28:45 -06:00
|
|
|
#include "xibarriers.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static RESTYPE CursorClientType;
|
|
|
|
static RESTYPE CursorHideCountType;
|
|
|
|
static RESTYPE CursorWindowType;
|
|
|
|
static CursorPtr CursorCurrent[MAXDEVICES];
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
static DevPrivateKeyRec CursorScreenPrivateKeyRec;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
#define CursorScreenPrivateKey (&CursorScreenPrivateKeyRec)
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static void deleteCursorHideCountsForScreen(ScreenPtr pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
#define VERIFY_CURSOR(pCursor, cursor, client, access) \
|
|
|
|
do { \
|
|
|
|
int err; \
|
2014-09-27 11:52:59 -06:00
|
|
|
err = dixLookupResourceByType((void **) &pCursor, cursor, \
|
2010-07-27 13:02:24 -06:00
|
|
|
RT_CURSOR, client, access); \
|
2010-12-05 08:36:02 -07:00
|
|
|
if (err != Success) { \
|
2010-07-27 13:02:24 -06:00
|
|
|
client->errorValue = cursor; \
|
|
|
|
return err; \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/*
|
|
|
|
* There is a global list of windows selecting for cursor events
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _CursorEvent *CursorEventPtr;
|
|
|
|
|
|
|
|
typedef struct _CursorEvent {
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorEventPtr next;
|
|
|
|
CARD32 eventMask;
|
|
|
|
ClientPtr pClient;
|
|
|
|
WindowPtr pWindow;
|
|
|
|
XID clientResource;
|
2006-11-26 11:13:41 -07:00
|
|
|
} CursorEventRec;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static CursorEventPtr cursorEvents;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Each screen has a list of clients which have requested
|
|
|
|
* that the cursor be hid, and the number of times each
|
|
|
|
* client has requested.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _CursorHideCountRec *CursorHideCountPtr;
|
|
|
|
|
|
|
|
typedef struct _CursorHideCountRec {
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorHideCountPtr pNext;
|
|
|
|
ClientPtr pClient;
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
int hideCount;
|
|
|
|
XID resource;
|
2006-11-26 11:13:41 -07:00
|
|
|
} CursorHideCountRec;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Wrap DisplayCursor to catch cursor change events
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _CursorScreen {
|
2012-06-10 07:21:05 -06:00
|
|
|
DisplayCursorProcPtr DisplayCursor;
|
|
|
|
CloseScreenProcPtr CloseScreen;
|
|
|
|
CursorHideCountPtr pCursorHideCounts;
|
2006-11-26 11:13:41 -07:00
|
|
|
} CursorScreenRec, *CursorScreenPtr;
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
|
|
|
|
#define GetCursorScreenIfSet(s) GetCursorScreen(s)
|
|
|
|
#define SetCursorScreen(s,p) dixSetPrivate(&(s)->devPrivates, CursorScreenPrivateKey, p)
|
2006-11-26 11:13:41 -07:00
|
|
|
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
|
2010-07-27 13:02:24 -06:00
|
|
|
#define Unwrap(as,s,elt,backup) (((backup) = (s)->elt), (s)->elt = (as)->elt)
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
/* The cursor doesn't show up until the first XDefineCursor() */
|
2014-05-02 13:27:46 -06:00
|
|
|
Bool CursorVisible = FALSE;
|
2010-07-27 13:02:24 -06:00
|
|
|
Bool EnableCursor = TRUE;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
static Bool
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
|
|
|
Bool ret;
|
2010-07-27 13:02:24 -06:00
|
|
|
DisplayCursorProcPtr backupProc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
Unwrap(cs, pScreen, DisplayCursor, backupProc);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-05-02 13:27:46 -06:00
|
|
|
CursorVisible = CursorVisible && EnableCursor;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
|
|
|
if (cs->pCursorHideCounts != NULL || !CursorVisible) {
|
2012-06-10 07:21:05 -06:00
|
|
|
ret = (*pScreen->DisplayCursor) (pDev, pScreen, NullCursor);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pCursor != CursorCurrent[pDev->id]) {
|
|
|
|
CursorEventPtr e;
|
|
|
|
|
|
|
|
CursorCurrent[pDev->id] = pCursor;
|
|
|
|
for (e = cursorEvents; e; e = e->next) {
|
|
|
|
if ((e->eventMask & XFixesDisplayCursorNotifyMask)) {
|
2013-06-07 11:28:45 -06:00
|
|
|
xXFixesCursorNotifyEvent ev = {
|
|
|
|
.type = XFixesEventBase + XFixesCursorNotify,
|
|
|
|
.subtype = XFixesDisplayCursorNotify,
|
|
|
|
.window = e->pWindow->drawable.id,
|
|
|
|
.cursorSerial = pCursor ? pCursor->serialNumber : 0,
|
|
|
|
.timestamp = currentTime.milliseconds,
|
|
|
|
.name = pCursor ? pCursor->name : None
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteEventsToClient(e->pClient, 1, (xEvent *) &ev);
|
|
|
|
}
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
Wrap(cs, pScreen, DisplayCursor, backupProc);
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2013-06-07 11:28:45 -06:00
|
|
|
CursorCloseScreen(ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
|
|
|
Bool ret;
|
|
|
|
_X_UNUSED CloseScreenProcPtr close_proc;
|
|
|
|
_X_UNUSED DisplayCursorProcPtr display_proc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
Unwrap(cs, pScreen, CloseScreen, close_proc);
|
|
|
|
Unwrap(cs, pScreen, DisplayCursor, display_proc);
|
2006-11-26 11:13:41 -07:00
|
|
|
deleteCursorHideCountsForScreen(pScreen);
|
2013-06-07 11:28:45 -06:00
|
|
|
ret = (*pScreen->CloseScreen) (pScreen);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(cs);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CursorAllEvents (XFixesDisplayCursorNotifyMask)
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorEventPtr *prev, e;
|
2014-09-27 11:52:59 -06:00
|
|
|
void *val;
|
2010-07-27 13:02:24 -06:00
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
|
|
|
|
if (e->pClient == pClient && e->pWindow == pWindow) {
|
|
|
|
break;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!eventMask) {
|
|
|
|
if (e) {
|
|
|
|
FreeResource(e->clientResource, 0);
|
|
|
|
}
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!e) {
|
|
|
|
e = (CursorEventPtr) malloc(sizeof(CursorEventRec));
|
|
|
|
if (!e)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
e->next = 0;
|
|
|
|
e->pClient = pClient;
|
|
|
|
e->pWindow = pWindow;
|
|
|
|
e->clientResource = FakeClientID(pClient->index);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Add a resource hanging from the window to
|
|
|
|
* catch window destroy
|
|
|
|
*/
|
|
|
|
rc = dixLookupResourceByType(&val, pWindow->drawable.id,
|
|
|
|
CursorWindowType, serverClient,
|
|
|
|
DixGetAttrAccess);
|
|
|
|
if (rc != Success)
|
|
|
|
if (!AddResource(pWindow->drawable.id, CursorWindowType,
|
2014-09-27 11:52:59 -06:00
|
|
|
(void *) pWindow)) {
|
2012-06-10 07:21:05 -06:00
|
|
|
free(e);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
if (!AddResource(e->clientResource, CursorClientType, (void *) e))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
*prev = e;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
e->eventMask = eventMask;
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesSelectCursorInput(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xXFixesSelectCursorInputReq);
|
|
|
|
WindowPtr pWin;
|
|
|
|
int rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
2007-11-24 10:55:21 -07:00
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
2012-06-10 07:21:05 -06:00
|
|
|
if (stuff->eventMask & ~CursorAllEvents) {
|
|
|
|
client->errorValue = stuff->eventMask;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
return XFixesSelectCursorInput(client, pWin, stuff->eventMask);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
GetBit(unsigned char *line, int x)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char mask;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (screenInfo.bitmapBitOrder == LSBFirst)
|
2012-06-10 07:21:05 -06:00
|
|
|
mask = (1 << (x & 7));
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
mask = (0x80 >> (x & 7));
|
2006-11-26 11:13:41 -07:00
|
|
|
/* XXX assumes byte order is host byte order */
|
|
|
|
line += (x >> 3);
|
|
|
|
if (*line & mask)
|
2012-06-10 07:21:05 -06:00
|
|
|
return 1;
|
2006-11-26 11:13:41 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesSelectCursorInput(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSelectCursorInputReq);
|
2017-10-14 03:22:49 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesSelectCursorInputReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
swapl(&stuff->window);
|
|
|
|
swapl(&stuff->eventMask);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
void
|
2012-06-10 07:21:05 -06:00
|
|
|
SXFixesCursorNotifyEvent(xXFixesCursorNotifyEvent * from,
|
|
|
|
xXFixesCursorNotifyEvent * to)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
to->type = from->type;
|
2012-06-10 07:21:05 -06:00
|
|
|
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
|
|
|
cpswapl(from->window, to->window);
|
|
|
|
cpswapl(from->cursorSerial, to->cursorSerial);
|
|
|
|
cpswapl(from->timestamp, to->timestamp);
|
|
|
|
cpswapl(from->name, to->name);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
CopyCursorToImage(CursorPtr pCursor, CARD32 *image)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
int width = pCursor->bits->width;
|
|
|
|
int height = pCursor->bits->height;
|
|
|
|
int npixels = width * height;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (pCursor->bits->argb)
|
2012-06-10 07:21:05 -06:00
|
|
|
memcpy(image, pCursor->bits->argb, npixels * sizeof(CARD32));
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
unsigned char *srcLine = pCursor->bits->source;
|
|
|
|
unsigned char *mskLine = pCursor->bits->mask;
|
|
|
|
int stride = BitmapBytePad(width);
|
|
|
|
int x, y;
|
|
|
|
CARD32 fg, bg;
|
|
|
|
|
|
|
|
fg = (0xff000000 |
|
|
|
|
((pCursor->foreRed & 0xff00) << 8) |
|
|
|
|
(pCursor->foreGreen & 0xff00) | (pCursor->foreBlue >> 8));
|
|
|
|
bg = (0xff000000 |
|
|
|
|
((pCursor->backRed & 0xff00) << 8) |
|
|
|
|
(pCursor->backGreen & 0xff00) | (pCursor->backBlue >> 8));
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
for (x = 0; x < width; x++) {
|
|
|
|
if (GetBit(mskLine, x)) {
|
|
|
|
if (GetBit(srcLine, x))
|
|
|
|
*image++ = fg;
|
|
|
|
else
|
|
|
|
*image++ = bg;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*image++ = 0;
|
|
|
|
}
|
|
|
|
srcLine += stride;
|
|
|
|
mskLine += stride;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesGetCursorImage(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xXFixesGetCursorImageReq); */
|
2012-06-10 07:21:05 -06:00
|
|
|
xXFixesGetCursorImageReply *rep;
|
|
|
|
CursorPtr pCursor;
|
|
|
|
CARD32 *image;
|
|
|
|
int npixels, width, height, rc, x, y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesGetCursorImageReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
pCursor = CursorCurrent[PickPointer(client)->id];
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pCursor)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadCursor;
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
|
2012-06-10 07:21:05 -06:00
|
|
|
pCursor, RT_NONE, NULL, DixReadAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
|
|
|
GetSpritePosition(PickPointer(client), &x, &y);
|
2006-11-26 11:13:41 -07:00
|
|
|
width = pCursor->bits->width;
|
|
|
|
height = pCursor->bits->height;
|
|
|
|
npixels = width * height;
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
|
|
|
|
1);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!rep)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
rep->type = X_Reply;
|
|
|
|
rep->sequenceNumber = client->sequence;
|
|
|
|
rep->length = npixels;
|
|
|
|
rep->width = width;
|
|
|
|
rep->height = height;
|
|
|
|
rep->x = x;
|
|
|
|
rep->y = y;
|
|
|
|
rep->xhot = pCursor->bits->xhot;
|
2012-06-10 07:21:05 -06:00
|
|
|
rep->yhot = pCursor->bits->yhot;
|
2006-11-26 11:13:41 -07:00
|
|
|
rep->cursorSerial = pCursor->serialNumber;
|
|
|
|
|
|
|
|
image = (CARD32 *) (rep + 1);
|
2012-06-10 07:21:05 -06:00
|
|
|
CopyCursorToImage(pCursor, image);
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep->sequenceNumber);
|
|
|
|
swapl(&rep->length);
|
|
|
|
swaps(&rep->x);
|
|
|
|
swaps(&rep->y);
|
|
|
|
swaps(&rep->width);
|
|
|
|
swaps(&rep->height);
|
|
|
|
swaps(&rep->xhot);
|
|
|
|
swaps(&rep->yhot);
|
|
|
|
swapl(&rep->cursorSerial);
|
|
|
|
SwapLongs(image, npixels);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client,
|
|
|
|
sizeof(xXFixesGetCursorImageReply) + (npixels << 2), rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(rep);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesGetCursorImage(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesGetCursorImageReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesSetCursorName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
CursorPtr pCursor;
|
|
|
|
char *tchar;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesSetCursorNameReq);
|
|
|
|
Atom atom;
|
|
|
|
|
2017-10-14 03:22:49 -06:00
|
|
|
REQUEST_FIXED_SIZE(xXFixesSetCursorNameReq, stuff->nbytes);
|
2008-11-02 08:26:08 -07:00
|
|
|
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixSetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
tchar = (char *) &stuff[1];
|
2012-06-10 07:21:05 -06:00
|
|
|
atom = MakeAtom(tchar, stuff->nbytes, TRUE);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (atom == BAD_RESOURCE)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
pCursor->name = atom;
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesSetCursorName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesSetCursorNameReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesSetCursorNameReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->cursor);
|
|
|
|
swaps(&stuff->nbytes);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesGetCursorName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorPtr pCursor;
|
|
|
|
xXFixesGetCursorNameReply reply;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesGetCursorNameReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
const char *str;
|
2006-11-26 11:13:41 -07:00
|
|
|
int len;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq);
|
2008-11-02 08:26:08 -07:00
|
|
|
VERIFY_CURSOR(pCursor, stuff->cursor, client, DixGetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (pCursor->name)
|
2012-06-10 07:21:05 -06:00
|
|
|
str = NameForAtom(pCursor->name);
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
str = "";
|
|
|
|
len = strlen(str);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
reply = (xXFixesGetCursorNameReply) {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = bytes_to_int32(len),
|
|
|
|
.atom = pCursor->name,
|
|
|
|
.nbytes = len
|
|
|
|
};
|
2012-06-10 07:21:05 -06:00
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&reply.sequenceNumber);
|
|
|
|
swapl(&reply.length);
|
|
|
|
swapl(&reply.atom);
|
|
|
|
swaps(&reply.nbytes);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
WriteReplyToClient(client, sizeof(xXFixesGetCursorNameReply), &reply);
|
2010-07-27 13:02:24 -06:00
|
|
|
WriteToClient(client, len, str);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesGetCursorName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesGetCursorNameReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesGetCursorNameReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->cursor);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesGetCursorImageAndName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xXFixesGetCursorImageAndNameReq); */
|
2012-06-10 07:21:05 -06:00
|
|
|
xXFixesGetCursorImageAndNameReply *rep;
|
|
|
|
CursorPtr pCursor;
|
|
|
|
CARD32 *image;
|
|
|
|
int npixels;
|
|
|
|
const char *name;
|
|
|
|
int nbytes, nbytesRound;
|
|
|
|
int width, height;
|
|
|
|
int rc, x, y;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesGetCursorImageAndNameReq);
|
2010-07-27 13:02:24 -06:00
|
|
|
pCursor = CursorCurrent[PickPointer(client)->id];
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!pCursor)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadCursor;
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, pCursor->id, RT_CURSOR,
|
2012-06-10 07:21:05 -06:00
|
|
|
pCursor, RT_NONE, NULL, DixReadAccess | DixGetAttrAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
|
|
|
GetSpritePosition(PickPointer(client), &x, &y);
|
2006-11-26 11:13:41 -07:00
|
|
|
width = pCursor->bits->width;
|
|
|
|
height = pCursor->bits->height;
|
|
|
|
npixels = width * height;
|
2012-06-10 07:21:05 -06:00
|
|
|
name = pCursor->name ? NameForAtom(pCursor->name) : "";
|
|
|
|
nbytes = strlen(name);
|
2010-07-27 13:02:24 -06:00
|
|
|
nbytesRound = pad_to_int32(nbytes);
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
|
|
|
|
npixels * sizeof(CARD32) + nbytesRound, 1);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (!rep)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
rep->type = X_Reply;
|
|
|
|
rep->sequenceNumber = client->sequence;
|
2010-07-27 13:02:24 -06:00
|
|
|
rep->length = npixels + bytes_to_int32(nbytesRound);
|
2006-11-26 11:13:41 -07:00
|
|
|
rep->width = width;
|
|
|
|
rep->height = height;
|
|
|
|
rep->x = x;
|
|
|
|
rep->y = y;
|
|
|
|
rep->xhot = pCursor->bits->xhot;
|
2012-06-10 07:21:05 -06:00
|
|
|
rep->yhot = pCursor->bits->yhot;
|
2006-11-26 11:13:41 -07:00
|
|
|
rep->cursorSerial = pCursor->serialNumber;
|
|
|
|
rep->cursorName = pCursor->name;
|
|
|
|
rep->nbytes = nbytes;
|
|
|
|
|
|
|
|
image = (CARD32 *) (rep + 1);
|
2012-06-10 07:21:05 -06:00
|
|
|
CopyCursorToImage(pCursor, image);
|
|
|
|
memcpy((image + npixels), name, nbytes);
|
|
|
|
if (client->swapped) {
|
|
|
|
swaps(&rep->sequenceNumber);
|
|
|
|
swapl(&rep->length);
|
|
|
|
swaps(&rep->x);
|
|
|
|
swaps(&rep->y);
|
|
|
|
swaps(&rep->width);
|
|
|
|
swaps(&rep->height);
|
|
|
|
swaps(&rep->xhot);
|
|
|
|
swaps(&rep->yhot);
|
|
|
|
swapl(&rep->cursorSerial);
|
|
|
|
swapl(&rep->cursorName);
|
|
|
|
swaps(&rep->nbytes);
|
|
|
|
SwapLongs(image, npixels);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) +
|
2013-06-07 11:28:45 -06:00
|
|
|
(npixels << 2) + nbytesRound, rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(rep);
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesGetCursorImageAndName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesGetCursorImageAndNameReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find every cursor reference in the system, ask testCursor
|
|
|
|
* whether it should be replaced with a reference to pCursor.
|
|
|
|
*/
|
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
typedef Bool (*TestCursorFunc) (CursorPtr pOld, void *closure);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
RESTYPE type;
|
|
|
|
TestCursorFunc testCursor;
|
|
|
|
CursorPtr pNew;
|
2014-09-27 11:52:59 -06:00
|
|
|
void *closure;
|
2006-11-26 11:13:41 -07:00
|
|
|
} ReplaceCursorLookupRec, *ReplaceCursorLookupPtr;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static const RESTYPE CursorRestypes[] = {
|
2006-11-26 11:13:41 -07:00
|
|
|
RT_WINDOW, RT_PASSIVEGRAB, RT_CURSOR
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NUM_CURSOR_RESTYPES (sizeof (CursorRestypes) / sizeof (CursorRestypes[0]))
|
|
|
|
|
|
|
|
static Bool
|
2014-09-27 11:52:59 -06:00
|
|
|
ReplaceCursorLookup(void *value, XID id, void *closure)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
ReplaceCursorLookupPtr rcl = (ReplaceCursorLookupPtr) closure;
|
|
|
|
WindowPtr pWin;
|
|
|
|
GrabPtr pGrab;
|
|
|
|
CursorPtr pCursor = 0, *pCursorRef = 0;
|
|
|
|
XID cursor = 0;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
switch (rcl->type) {
|
|
|
|
case RT_WINDOW:
|
2012-06-10 07:21:05 -06:00
|
|
|
pWin = (WindowPtr) value;
|
|
|
|
if (pWin->optional) {
|
|
|
|
pCursorRef = &pWin->optional->cursor;
|
|
|
|
pCursor = *pCursorRef;
|
|
|
|
}
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case RT_PASSIVEGRAB:
|
2012-06-10 07:21:05 -06:00
|
|
|
pGrab = (GrabPtr) value;
|
|
|
|
pCursorRef = &pGrab->cursor;
|
|
|
|
pCursor = *pCursorRef;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
case RT_CURSOR:
|
2012-06-10 07:21:05 -06:00
|
|
|
pCursorRef = 0;
|
|
|
|
pCursor = (CursorPtr) value;
|
|
|
|
cursor = id;
|
|
|
|
break;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pCursor && pCursor != rcl->pNew) {
|
|
|
|
if ((*rcl->testCursor) (pCursor, rcl->closure)) {
|
2013-09-28 09:36:30 -06:00
|
|
|
CursorPtr curs = RefCursor(rcl->pNew);
|
2012-06-10 07:21:05 -06:00
|
|
|
/* either redirect reference or update resource database */
|
|
|
|
if (pCursorRef)
|
2013-09-28 09:36:30 -06:00
|
|
|
*pCursorRef = curs;
|
2012-06-10 07:21:05 -06:00
|
|
|
else
|
2013-09-28 09:36:30 -06:00
|
|
|
ChangeResourceValue(id, RT_CURSOR, curs);
|
2012-06-10 07:21:05 -06:00
|
|
|
FreeCursor(pCursor, cursor);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
return FALSE; /* keep walking */
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-09-27 11:52:59 -06:00
|
|
|
ReplaceCursor(CursorPtr pCursor, TestCursorFunc testCursor, void *closure)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int clientIndex;
|
2006-11-26 11:13:41 -07:00
|
|
|
int resIndex;
|
2012-06-10 07:21:05 -06:00
|
|
|
ReplaceCursorLookupRec rcl;
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Cursors exist only in the resource database, windows and grabs.
|
|
|
|
* All of these are always pointed at by the resource database. Walk
|
|
|
|
* the whole thing looking for cursors
|
|
|
|
*/
|
|
|
|
rcl.testCursor = testCursor;
|
|
|
|
rcl.pNew = pCursor;
|
|
|
|
rcl.closure = closure;
|
|
|
|
|
|
|
|
/* for each client */
|
2012-06-10 07:21:05 -06:00
|
|
|
for (clientIndex = 0; clientIndex < currentMaxClients; clientIndex++) {
|
|
|
|
if (!clients[clientIndex])
|
|
|
|
continue;
|
|
|
|
for (resIndex = 0; resIndex < NUM_CURSOR_RESTYPES; resIndex++) {
|
|
|
|
rcl.type = CursorRestypes[resIndex];
|
|
|
|
/*
|
|
|
|
* This function walks the entire client resource database
|
|
|
|
*/
|
|
|
|
LookupClientResourceComplex(clients[clientIndex],
|
|
|
|
rcl.type,
|
2014-09-27 11:52:59 -06:00
|
|
|
ReplaceCursorLookup, (void *) &rcl);
|
2012-06-10 07:21:05 -06:00
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
/* this "knows" that WindowHasNewCursor doesn't depend on it's argument */
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowHasNewCursor(screenInfo.screens[0]->root);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
static Bool
|
2014-09-27 11:52:59 -06:00
|
|
|
TestForCursor(CursorPtr pCursor, void *closure)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
return (pCursor == (CursorPtr) closure);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesChangeCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorPtr pSource, pDestination;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesChangeCursorReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesChangeCursorReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
VERIFY_CURSOR(pSource, stuff->source, client,
|
|
|
|
DixReadAccess | DixGetAttrAccess);
|
|
|
|
VERIFY_CURSOR(pDestination, stuff->destination, client,
|
|
|
|
DixWriteAccess | DixSetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
ReplaceCursor(pSource, TestForCursor, (void *) pDestination);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesChangeCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesChangeCursorReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesChangeCursorReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->source);
|
|
|
|
swapl(&stuff->destination);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2014-09-27 11:52:59 -06:00
|
|
|
TestForCursorName(CursorPtr pCursor, void *closure)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2008-11-02 08:26:08 -07:00
|
|
|
Atom *pName = closure;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return pCursor->name == *pName;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesChangeCursorByName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorPtr pSource;
|
|
|
|
Atom name;
|
|
|
|
char *tchar;
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesChangeCursorByNameReq);
|
|
|
|
|
|
|
|
REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes);
|
2008-11-02 08:26:08 -07:00
|
|
|
VERIFY_CURSOR(pSource, stuff->source, client,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixReadAccess | DixGetAttrAccess);
|
2006-11-26 11:13:41 -07:00
|
|
|
tchar = (char *) &stuff[1];
|
2012-06-10 07:21:05 -06:00
|
|
|
name = MakeAtom(tchar, stuff->nbytes, FALSE);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (name)
|
2012-06-10 07:21:05 -06:00
|
|
|
ReplaceCursor(pSource, TestForCursorName, &name);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesChangeCursorByName(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesChangeCursorByNameReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesChangeCursorByNameReq);
|
|
|
|
swapl(&stuff->source);
|
|
|
|
swaps(&stuff->nbytes);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Routines for manipulating the per-screen hide counts list.
|
2015-09-16 13:10:19 -06:00
|
|
|
* This list indicates which clients have requested cursor hiding
|
2006-11-26 11:13:41 -07:00
|
|
|
* for that screen.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Return the screen's hide-counts list element for the given client */
|
|
|
|
static CursorHideCountPtr
|
2012-06-10 07:21:05 -06:00
|
|
|
findCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
CursorHideCountPtr pChc;
|
|
|
|
|
|
|
|
for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) {
|
2012-06-10 07:21:05 -06:00
|
|
|
if (pChc->pClient == pClient) {
|
|
|
|
return pChc;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
return NULL;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
CursorHideCountPtr pChc;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec));
|
2006-11-26 11:13:41 -07:00
|
|
|
if (pChc == NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
pChc->pClient = pClient;
|
|
|
|
pChc->pScreen = pScreen;
|
|
|
|
pChc->hideCount = 1;
|
|
|
|
pChc->resource = FakeClientID(pClient->index);
|
|
|
|
pChc->pNext = cs->pCursorHideCounts;
|
|
|
|
cs->pCursorHideCounts = pChc;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Create a resource for this element so it can be deleted
|
|
|
|
* when the client goes away.
|
|
|
|
*/
|
2016-05-29 06:02:34 -06:00
|
|
|
if (!AddResource(pChc->resource, CursorHideCountType, (void *) pChc))
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadAlloc;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Delete the given hide-counts list element from its screen list.
|
|
|
|
*/
|
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
deleteCursorHideCount(CursorHideCountPtr pChcToDel, ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
CursorHideCountPtr pChc, pNext;
|
|
|
|
CursorHideCountPtr pChcLast = NULL;
|
|
|
|
|
|
|
|
pChc = cs->pCursorHideCounts;
|
|
|
|
while (pChc != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pNext = pChc->pNext;
|
|
|
|
if (pChc == pChcToDel) {
|
|
|
|
free(pChc);
|
|
|
|
if (pChcLast == NULL) {
|
|
|
|
cs->pCursorHideCounts = pNext;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pChcLast->pNext = pNext;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pChcLast = pChc;
|
|
|
|
pChc = pNext;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Delete all the hide-counts list elements for this screen.
|
|
|
|
*/
|
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
deleteCursorHideCountsForScreen(ScreenPtr pScreen)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorScreenPtr cs = GetCursorScreen(pScreen);
|
2006-11-26 11:13:41 -07:00
|
|
|
CursorHideCountPtr pChc, pTmp;
|
|
|
|
|
|
|
|
pChc = cs->pCursorHideCounts;
|
|
|
|
while (pChc != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pTmp = pChc->pNext;
|
|
|
|
FreeResource(pChc->resource, 0);
|
|
|
|
pChc = pTmp;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2012-06-10 07:21:05 -06:00
|
|
|
cs->pCursorHideCounts = NULL;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
ProcXFixesHideCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
CursorHideCountPtr pChc;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesHideCursorReq);
|
|
|
|
int ret;
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
ret = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixGetAttrAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (ret != Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return ret;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
|
|
|
* Has client hidden the cursor before on this screen?
|
|
|
|
* If so, just increment the count.
|
2006-11-26 11:13:41 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
|
|
|
|
if (pChc != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
pChc->hideCount++;
|
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
|
|
|
* This is the first time this client has hid the cursor
|
2006-11-26 11:13:41 -07:00
|
|
|
* for this screen.
|
|
|
|
*/
|
2008-11-02 08:26:08 -07:00
|
|
|
ret = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixHideAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (ret != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return ret;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
ret = createCursorHideCount(client, pWin->drawable.pScreen);
|
|
|
|
|
|
|
|
if (ret == Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
DeviceIntPtr dev;
|
|
|
|
|
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
|
|
|
if (IsMaster(dev) && IsPointerDevice(dev))
|
|
|
|
CursorDisplayCursor(dev, pWin->drawable.pScreen,
|
|
|
|
CursorCurrent[dev->id]);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
SProcXFixesHideCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesHideCursorReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesHideCursorReq);
|
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
ProcXFixesShowCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
WindowPtr pWin;
|
|
|
|
CursorHideCountPtr pChc;
|
2008-11-02 08:26:08 -07:00
|
|
|
int rc;
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST(xXFixesShowCursorReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2014-09-27 11:52:59 -06:00
|
|
|
rc = dixLookupResourceByType((void **) &pWin, stuff->window, RT_WINDOW,
|
2012-06-10 07:21:05 -06:00
|
|
|
client, DixGetAttrAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success) {
|
2012-06-10 07:21:05 -06:00
|
|
|
client->errorValue = stuff->window;
|
|
|
|
return rc;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
/*
|
2006-11-26 11:13:41 -07:00
|
|
|
* Has client hidden the cursor on this screen?
|
|
|
|
* If not, generate an error.
|
|
|
|
*/
|
|
|
|
pChc = findCursorHideCount(client, pWin->drawable.pScreen);
|
|
|
|
if (pChc == NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
rc = XaceHook(XACE_SCREEN_ACCESS, client, pWin->drawable.pScreen,
|
2012-06-10 07:21:05 -06:00
|
|
|
DixShowAccess);
|
2008-11-02 08:26:08 -07:00
|
|
|
if (rc != Success)
|
2012-06-10 07:21:05 -06:00
|
|
|
return rc;
|
2008-11-02 08:26:08 -07:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
pChc->hideCount--;
|
|
|
|
if (pChc->hideCount <= 0) {
|
2012-06-10 07:21:05 -06:00
|
|
|
FreeResource(pChc->resource, 0);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
int
|
|
|
|
SProcXFixesShowCursor(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesShowCursorReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesShowCursorReq);
|
|
|
|
swapl(&stuff->window);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (*ProcXFixesVector[stuff->xfixesReqType]) (client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
CursorFreeClient(void *data, XID id)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorEventPtr old = (CursorEventPtr) data;
|
|
|
|
CursorEventPtr *prev, e;
|
|
|
|
|
|
|
|
for (prev = &cursorEvents; (e = *prev); prev = &e->next) {
|
|
|
|
if (e == old) {
|
|
|
|
*prev = e->next;
|
|
|
|
free(e);
|
|
|
|
break;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
CursorFreeHideCount(void *data, XID id)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
CursorHideCountPtr pChc = (CursorHideCountPtr) data;
|
|
|
|
ScreenPtr pScreen = pChc->pScreen;
|
2010-07-27 13:02:24 -06:00
|
|
|
DeviceIntPtr dev;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
deleteCursorHideCount(pChc, pChc->pScreen);
|
2012-06-10 07:21:05 -06:00
|
|
|
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
2010-07-27 13:02:24 -06:00
|
|
|
if (IsMaster(dev) && IsPointerDevice(dev))
|
|
|
|
CursorDisplayCursor(dev, pScreen, CursorCurrent[dev->id]);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-09-27 11:52:59 -06:00
|
|
|
CursorFreeWindow(void *data, XID id)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
WindowPtr pWindow = (WindowPtr) data;
|
|
|
|
CursorEventPtr e, next;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
for (e = cursorEvents; e; e = next) {
|
|
|
|
next = e->next;
|
|
|
|
if (e->pWindow == pWindow) {
|
|
|
|
FreeResource(e->clientResource, 0);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-11-05 07:32:40 -06:00
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesCreatePointerBarrier(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xXFixesCreatePointerBarrierReq);
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
|
2011-11-05 07:32:40 -06:00
|
|
|
LEGAL_NEW_RESOURCE(stuff->barrier, client);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
return XICreatePointerBarrier(client, stuff);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesCreatePointerBarrier(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesCreatePointerBarrierReq);
|
2013-06-07 11:28:45 -06:00
|
|
|
int i;
|
|
|
|
CARD16 *in_devices = (CARD16 *) &stuff[1];
|
2011-11-05 07:32:40 -06:00
|
|
|
|
2017-10-14 03:22:49 -06:00
|
|
|
REQUEST_AT_LEAST_SIZE(xXFixesCreatePointerBarrierReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2013-06-07 11:28:45 -06:00
|
|
|
swaps(&stuff->num_devices);
|
|
|
|
REQUEST_FIXED_SIZE(xXFixesCreatePointerBarrierReq, pad_to_int32(stuff->num_devices));
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->barrier);
|
|
|
|
swapl(&stuff->window);
|
|
|
|
swaps(&stuff->x1);
|
|
|
|
swaps(&stuff->y1);
|
|
|
|
swaps(&stuff->x2);
|
|
|
|
swaps(&stuff->y2);
|
|
|
|
swapl(&stuff->directions);
|
2013-06-07 11:28:45 -06:00
|
|
|
for (i = 0; i < stuff->num_devices; i++) {
|
|
|
|
swaps(in_devices + i);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
return ProcXFixesVector[stuff->xfixesReqType] (client);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcXFixesDestroyPointerBarrier(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
REQUEST(xXFixesDestroyPointerBarrierReq);
|
2011-11-05 07:32:40 -06:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
return XIDestroyPointerBarrier(client, stuff);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcXFixesDestroyPointerBarrier(ClientPtr client)
|
2011-11-05 07:32:40 -06:00
|
|
|
{
|
|
|
|
REQUEST(xXFixesDestroyPointerBarrierReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2011-11-05 07:32:40 -06:00
|
|
|
REQUEST_SIZE_MATCH(xXFixesDestroyPointerBarrierReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&stuff->barrier);
|
|
|
|
return ProcXFixesVector[stuff->xfixesReqType] (client);
|
2011-11-05 07:32:40 -06:00
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
Bool
|
2012-06-10 07:21:05 -06:00
|
|
|
XFixesCursorInit(void)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
int i;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
|
|
|
if (party_like_its_1989)
|
2012-06-10 07:21:05 -06:00
|
|
|
CursorVisible = EnableCursor;
|
2014-09-27 11:52:59 -06:00
|
|
|
else
|
|
|
|
CursorVisible = FALSE;
|
2010-12-05 08:36:02 -07:00
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!dixRegisterPrivateKey(&CursorScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
|
|
|
ScreenPtr pScreen = screenInfo.screens[i];
|
|
|
|
CursorScreenPtr cs;
|
|
|
|
|
|
|
|
cs = (CursorScreenPtr) calloc(1, sizeof(CursorScreenRec));
|
|
|
|
if (!cs)
|
|
|
|
return FALSE;
|
|
|
|
Wrap(cs, pScreen, CloseScreen, CursorCloseScreen);
|
|
|
|
Wrap(cs, pScreen, DisplayCursor, CursorDisplayCursor);
|
|
|
|
cs->pCursorHideCounts = NULL;
|
|
|
|
SetCursorScreen(pScreen, cs);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-07-27 13:02:24 -06:00
|
|
|
CursorClientType = CreateNewResourceType(CursorFreeClient,
|
2012-06-10 07:21:05 -06:00
|
|
|
"XFixesCursorClient");
|
2010-07-27 13:02:24 -06:00
|
|
|
CursorHideCountType = CreateNewResourceType(CursorFreeHideCount,
|
2012-06-10 07:21:05 -06:00
|
|
|
"XFixesCursorHideCount");
|
2010-07-27 13:02:24 -06:00
|
|
|
CursorWindowType = CreateNewResourceType(CursorFreeWindow,
|
2012-06-10 07:21:05 -06:00
|
|
|
"XFixesCursorWindow");
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
return CursorClientType && CursorHideCountType && CursorWindowType;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|