xace: add hooks + new access codes: core protocol cursor requests
This commit is contained in:
parent
b424e01ec5
commit
dc84bb3418
92
dix/cursor.c
92
dix/cursor.c
|
@ -59,6 +59,7 @@ SOFTWARE.
|
||||||
#include "cursorstr.h"
|
#include "cursorstr.h"
|
||||||
#include "dixfontstr.h"
|
#include "dixfontstr.h"
|
||||||
#include "opaque.h"
|
#include "opaque.h"
|
||||||
|
#include "xace.h"
|
||||||
|
|
||||||
typedef struct _GlyphShare {
|
typedef struct _GlyphShare {
|
||||||
FontPtr font;
|
FontPtr font;
|
||||||
|
@ -161,23 +162,25 @@ CheckForEmptyMask(CursorBitsPtr bits)
|
||||||
* \param pmaskbits server-defined padding
|
* \param pmaskbits server-defined padding
|
||||||
* \param argb no padding
|
* \param argb no padding
|
||||||
*/
|
*/
|
||||||
CursorPtr
|
int
|
||||||
AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb,
|
AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
|
||||||
CursorMetricPtr cm,
|
CARD32 *argb, CursorMetricPtr cm,
|
||||||
unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
|
unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
|
||||||
unsigned backRed, unsigned backGreen, unsigned backBlue)
|
unsigned backRed, unsigned backGreen, unsigned backBlue,
|
||||||
|
CursorPtr *ppCurs, ClientPtr client, XID cid)
|
||||||
{
|
{
|
||||||
CursorBitsPtr bits;
|
CursorBitsPtr bits;
|
||||||
CursorPtr pCurs;
|
CursorPtr pCurs;
|
||||||
int nscr;
|
int rc, nscr;
|
||||||
ScreenPtr pscr;
|
ScreenPtr pscr;
|
||||||
|
|
||||||
|
*ppCurs = NULL;
|
||||||
pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
|
pCurs = (CursorPtr)xalloc(sizeof(CursorRec) + sizeof(CursorBits));
|
||||||
if (!pCurs)
|
if (!pCurs)
|
||||||
{
|
{
|
||||||
xfree(psrcbits);
|
xfree(psrcbits);
|
||||||
xfree(pmaskbits);
|
xfree(pmaskbits);
|
||||||
return (CursorPtr)NULL;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
|
bits = (CursorBitsPtr)((char *)pCurs + sizeof(CursorRec));
|
||||||
bits->source = psrcbits;
|
bits->source = psrcbits;
|
||||||
|
@ -207,6 +210,15 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb,
|
||||||
pCurs->backGreen = backGreen;
|
pCurs->backGreen = backGreen;
|
||||||
pCurs->backBlue = backBlue;
|
pCurs->backBlue = backBlue;
|
||||||
|
|
||||||
|
/* security creation/labeling check */
|
||||||
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
|
||||||
|
DixCreateAccess, pCurs);
|
||||||
|
if (rc != Success) {
|
||||||
|
FreeCursorBits(bits);
|
||||||
|
xfree(pCurs);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* realize the cursor for every screen
|
* realize the cursor for every screen
|
||||||
*/
|
*/
|
||||||
|
@ -222,59 +234,43 @@ AllocCursorARGB(unsigned char *psrcbits, unsigned char *pmaskbits, CARD32 *argb,
|
||||||
}
|
}
|
||||||
FreeCursorBits(bits);
|
FreeCursorBits(bits);
|
||||||
xfree(pCurs);
|
xfree(pCurs);
|
||||||
return (CursorPtr)NULL;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pCurs;
|
*ppCurs = pCurs;
|
||||||
}
|
return rc;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* \param psrcbits server-defined padding
|
|
||||||
* \param pmaskbits server-defined padding
|
|
||||||
*/
|
|
||||||
CursorPtr
|
|
||||||
AllocCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
|
|
||||||
CursorMetricPtr cm,
|
|
||||||
unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
|
|
||||||
unsigned backRed, unsigned backGreen, unsigned backBlue)
|
|
||||||
{
|
|
||||||
return AllocCursorARGB (psrcbits, pmaskbits, (CARD32 *) 0, cm,
|
|
||||||
foreRed, foreGreen, foreBlue,
|
|
||||||
backRed, backGreen, backBlue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
|
unsigned foreRed, unsigned foreGreen, unsigned foreBlue,
|
||||||
unsigned backRed, unsigned backGreen, unsigned backBlue,
|
unsigned backRed, unsigned backGreen, unsigned backBlue,
|
||||||
CursorPtr *ppCurs, ClientPtr client)
|
CursorPtr *ppCurs, ClientPtr client, XID cid)
|
||||||
{
|
{
|
||||||
FontPtr sourcefont, maskfont;
|
FontPtr sourcefont, maskfont;
|
||||||
unsigned char *srcbits;
|
unsigned char *srcbits;
|
||||||
unsigned char *mskbits;
|
unsigned char *mskbits;
|
||||||
CursorMetricRec cm;
|
CursorMetricRec cm;
|
||||||
int res;
|
int rc;
|
||||||
CursorBitsPtr bits;
|
CursorBitsPtr bits;
|
||||||
CursorPtr pCurs;
|
CursorPtr pCurs;
|
||||||
int nscr;
|
int nscr;
|
||||||
ScreenPtr pscr;
|
ScreenPtr pscr;
|
||||||
GlyphSharePtr pShare;
|
GlyphSharePtr pShare;
|
||||||
|
|
||||||
sourcefont = (FontPtr) SecurityLookupIDByType(client, source, RT_FONT,
|
rc = dixLookupResource((pointer *)&sourcefont, source, RT_FONT, client,
|
||||||
DixReadAccess);
|
DixUseAccess);
|
||||||
maskfont = (FontPtr) SecurityLookupIDByType(client, mask, RT_FONT,
|
if (rc != Success)
|
||||||
DixReadAccess);
|
|
||||||
|
|
||||||
if (!sourcefont)
|
|
||||||
{
|
{
|
||||||
client->errorValue = source;
|
client->errorValue = source;
|
||||||
return(BadFont);
|
return (rc == BadValue) ? BadFont : rc;
|
||||||
}
|
}
|
||||||
if (!maskfont && (mask != None))
|
rc = dixLookupResource((pointer *)&maskfont, mask, RT_FONT, client,
|
||||||
|
DixUseAccess);
|
||||||
|
if (rc != Success && mask != None)
|
||||||
{
|
{
|
||||||
client->errorValue = mask;
|
client->errorValue = mask;
|
||||||
return(BadFont);
|
return (rc == BadValue) ? BadFont : rc;
|
||||||
}
|
}
|
||||||
if (sourcefont != maskfont)
|
if (sourcefont != maskfont)
|
||||||
pShare = (GlyphSharePtr)NULL;
|
pShare = (GlyphSharePtr)NULL;
|
||||||
|
@ -322,13 +318,13 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
client->errorValue = maskChar;
|
client->errorValue = maskChar;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((res = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)) != 0)
|
if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
|
||||||
return res;
|
return rc;
|
||||||
}
|
}
|
||||||
if ((res = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)) != 0)
|
if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)))
|
||||||
{
|
{
|
||||||
xfree(mskbits);
|
xfree(mskbits);
|
||||||
return res;
|
return rc;
|
||||||
}
|
}
|
||||||
if (sourcefont != maskfont)
|
if (sourcefont != maskfont)
|
||||||
{
|
{
|
||||||
|
@ -398,6 +394,15 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
pCurs->backGreen = backGreen;
|
pCurs->backGreen = backGreen;
|
||||||
pCurs->backBlue = backBlue;
|
pCurs->backBlue = backBlue;
|
||||||
|
|
||||||
|
/* security creation/labeling check */
|
||||||
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR,
|
||||||
|
DixCreateAccess, pCurs);
|
||||||
|
if (rc != Success) {
|
||||||
|
FreeCursorBits(bits);
|
||||||
|
xfree(pCurs);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* realize the cursor for every screen
|
* realize the cursor for every screen
|
||||||
*/
|
*/
|
||||||
|
@ -447,7 +452,8 @@ CreateRootCursor(char *unused1, unsigned int unused2)
|
||||||
cm.xhot = 0;
|
cm.xhot = 0;
|
||||||
cm.yhot = 0;
|
cm.yhot = 0;
|
||||||
|
|
||||||
curs = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0);
|
AllocARGBCursor(NULL, NULL, NULL, &cm, 0, 0, 0, 0, 0, 0,
|
||||||
|
&curs, serverClient, (XID)0);
|
||||||
|
|
||||||
if (curs == NullCursor)
|
if (curs == NullCursor)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
@ -461,8 +467,8 @@ CreateRootCursor(char *unused1, unsigned int unused2)
|
||||||
cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
|
cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
|
||||||
if (!cursorfont)
|
if (!cursorfont)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
if (AllocGlyphCursor(fontID, 0, fontID, 1,
|
if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
|
||||||
0, 0, 0, ~0, ~0, ~0, &curs, serverClient) != Success)
|
&curs, serverClient, (XID)0) != Success)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3070,28 +3070,28 @@ ProcCreateCursor (ClientPtr client)
|
||||||
unsigned short width, height;
|
unsigned short width, height;
|
||||||
long n;
|
long n;
|
||||||
CursorMetricRec cm;
|
CursorMetricRec cm;
|
||||||
|
int rc;
|
||||||
|
|
||||||
REQUEST(xCreateCursorReq);
|
REQUEST(xCreateCursorReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCreateCursorReq);
|
REQUEST_SIZE_MATCH(xCreateCursorReq);
|
||||||
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
||||||
|
|
||||||
src = (PixmapPtr)SecurityLookupIDByType(client, stuff->source,
|
rc = dixLookupResource((pointer *)&src, stuff->source, RT_PIXMAP, client,
|
||||||
RT_PIXMAP, DixReadAccess);
|
DixReadAccess);
|
||||||
msk = (PixmapPtr)SecurityLookupIDByType(client, stuff->mask,
|
if (rc != Success) {
|
||||||
RT_PIXMAP, DixReadAccess);
|
|
||||||
if ( src == (PixmapPtr)NULL)
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->source;
|
client->errorValue = stuff->source;
|
||||||
return (BadPixmap);
|
return (rc == BadValue) ? BadPixmap : rc;
|
||||||
}
|
}
|
||||||
if ( msk == (PixmapPtr)NULL)
|
|
||||||
|
rc = dixLookupResource((pointer *)&msk, stuff->mask, RT_PIXMAP, client,
|
||||||
|
DixReadAccess);
|
||||||
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
if (stuff->mask != None)
|
if (stuff->mask != None)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->mask;
|
client->errorValue = stuff->mask;
|
||||||
return (BadPixmap);
|
return (rc == BadValue) ? BadPixmap : rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( src->drawable.width != msk->drawable.width
|
else if ( src->drawable.width != msk->drawable.width
|
||||||
|
@ -3139,13 +3139,17 @@ ProcCreateCursor (ClientPtr client)
|
||||||
cm.height = height;
|
cm.height = height;
|
||||||
cm.xhot = stuff->x;
|
cm.xhot = stuff->x;
|
||||||
cm.yhot = stuff->y;
|
cm.yhot = stuff->y;
|
||||||
pCursor = AllocCursor( srcbits, mskbits, &cm,
|
rc = AllocARGBCursor(srcbits, mskbits, NULL, &cm,
|
||||||
stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
|
stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
|
||||||
stuff->backRed, stuff->backGreen, stuff->backBlue);
|
stuff->backRed, stuff->backGreen, stuff->backBlue,
|
||||||
|
&pCursor, client, stuff->cid);
|
||||||
|
|
||||||
if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
if (rc != Success)
|
||||||
return (client->noClientException);
|
return rc;
|
||||||
return BadAlloc;
|
if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -3163,7 +3167,7 @@ ProcCreateGlyphCursor (ClientPtr client)
|
||||||
stuff->mask, stuff->maskChar,
|
stuff->mask, stuff->maskChar,
|
||||||
stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
|
stuff->foreRed, stuff->foreGreen, stuff->foreBlue,
|
||||||
stuff->backRed, stuff->backGreen, stuff->backBlue,
|
stuff->backRed, stuff->backGreen, stuff->backBlue,
|
||||||
&pCursor, client);
|
&pCursor, client, stuff->cid);
|
||||||
if (res != Success)
|
if (res != Success)
|
||||||
return res;
|
return res;
|
||||||
if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
if (AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
||||||
|
@ -3176,12 +3180,13 @@ int
|
||||||
ProcFreeCursor (ClientPtr client)
|
ProcFreeCursor (ClientPtr client)
|
||||||
{
|
{
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
|
int rc;
|
||||||
REQUEST(xResourceReq);
|
REQUEST(xResourceReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xResourceReq);
|
REQUEST_SIZE_MATCH(xResourceReq);
|
||||||
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->id,
|
rc = dixLookupResource((pointer *)&pCursor, stuff->id, RT_CURSOR, client,
|
||||||
RT_CURSOR, DixDestroyAccess);
|
DixDestroyAccess);
|
||||||
if (pCursor)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
FreeResource(stuff->id, RT_NONE);
|
FreeResource(stuff->id, RT_NONE);
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
|
@ -3189,7 +3194,7 @@ ProcFreeCursor (ClientPtr client)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->id;
|
client->errorValue = stuff->id;
|
||||||
return (BadCursor);
|
return (rc == BadValue) ? BadCursor : rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
dix/events.c
18
dix/events.c
|
@ -4115,12 +4115,12 @@ ProcChangeActivePointerGrab(ClientPtr client)
|
||||||
newCursor = NullCursor;
|
newCursor = NullCursor;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
|
int rc = dixLookupResource((pointer *)&newCursor, stuff->cursor,
|
||||||
RT_CURSOR, DixReadAccess);
|
RT_CURSOR, client, DixUseAccess);
|
||||||
if (!newCursor)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->cursor;
|
client->errorValue = stuff->cursor;
|
||||||
return BadCursor;
|
return (rc == BadValue) ? BadCursor : rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!grab)
|
if (!grab)
|
||||||
|
@ -4889,18 +4889,18 @@ int
|
||||||
ProcRecolorCursor(ClientPtr client)
|
ProcRecolorCursor(ClientPtr client)
|
||||||
{
|
{
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
int nscr;
|
int rc, nscr;
|
||||||
ScreenPtr pscr;
|
ScreenPtr pscr;
|
||||||
Bool displayed;
|
Bool displayed;
|
||||||
REQUEST(xRecolorCursorReq);
|
REQUEST(xRecolorCursorReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xRecolorCursorReq);
|
REQUEST_SIZE_MATCH(xRecolorCursorReq);
|
||||||
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
|
rc = dixLookupResource((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
||||||
RT_CURSOR, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if ( !pCursor)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->cursor;
|
client->errorValue = stuff->cursor;
|
||||||
return (BadCursor);
|
return (rc == BadValue) ? BadCursor : rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCursor->foreRed = stuff->foreRed;
|
pCursor->foreRed = stuff->foreRed;
|
||||||
|
|
|
@ -3541,7 +3541,8 @@ TileScreenSaver(int i, int kind)
|
||||||
{
|
{
|
||||||
for (j=0; j<BitmapBytePad(32)*16; j++)
|
for (j=0; j<BitmapBytePad(32)*16; j++)
|
||||||
srcbits[j] = mskbits[j] = 0x0;
|
srcbits[j] = mskbits[j] = 0x0;
|
||||||
cursor = AllocCursor(srcbits, mskbits, &cm, 0, 0, 0, 0, 0, 0);
|
result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
|
||||||
|
&cursor, serverClient, (XID)0);
|
||||||
if (cursor)
|
if (cursor)
|
||||||
{
|
{
|
||||||
cursorID = FakeClientID(0);
|
cursorID = FakeClientID(0);
|
||||||
|
|
|
@ -68,23 +68,7 @@ extern int FreeCursor(
|
||||||
pointer /*pCurs*/,
|
pointer /*pCurs*/,
|
||||||
XID /*cid*/);
|
XID /*cid*/);
|
||||||
|
|
||||||
/* Quartz support on Mac OS X pulls in the QuickDraw
|
extern int AllocARGBCursor(
|
||||||
framework whose AllocCursor function conflicts here. */
|
|
||||||
#ifdef __DARWIN__
|
|
||||||
#define AllocCursor Darwin_X_AllocCursor
|
|
||||||
#endif
|
|
||||||
extern CursorPtr AllocCursor(
|
|
||||||
unsigned char* /*psrcbits*/,
|
|
||||||
unsigned char* /*pmaskbits*/,
|
|
||||||
CursorMetricPtr /*cm*/,
|
|
||||||
unsigned /*foreRed*/,
|
|
||||||
unsigned /*foreGreen*/,
|
|
||||||
unsigned /*foreBlue*/,
|
|
||||||
unsigned /*backRed*/,
|
|
||||||
unsigned /*backGreen*/,
|
|
||||||
unsigned /*backBlue*/);
|
|
||||||
|
|
||||||
extern CursorPtr AllocCursorARGB(
|
|
||||||
unsigned char* /*psrcbits*/,
|
unsigned char* /*psrcbits*/,
|
||||||
unsigned char* /*pmaskbits*/,
|
unsigned char* /*pmaskbits*/,
|
||||||
CARD32* /*argb*/,
|
CARD32* /*argb*/,
|
||||||
|
@ -94,7 +78,10 @@ extern CursorPtr AllocCursorARGB(
|
||||||
unsigned /*foreBlue*/,
|
unsigned /*foreBlue*/,
|
||||||
unsigned /*backRed*/,
|
unsigned /*backRed*/,
|
||||||
unsigned /*backGreen*/,
|
unsigned /*backGreen*/,
|
||||||
unsigned /*backBlue*/);
|
unsigned /*backBlue*/,
|
||||||
|
CursorPtr* /*ppCurs*/,
|
||||||
|
ClientPtr /*client*/,
|
||||||
|
XID /*cid*/);
|
||||||
|
|
||||||
extern int AllocGlyphCursor(
|
extern int AllocGlyphCursor(
|
||||||
Font /*source*/,
|
Font /*source*/,
|
||||||
|
@ -108,7 +95,8 @@ extern int AllocGlyphCursor(
|
||||||
unsigned /*backGreen*/,
|
unsigned /*backGreen*/,
|
||||||
unsigned /*backBlue*/,
|
unsigned /*backBlue*/,
|
||||||
CursorPtr* /*ppCurs*/,
|
CursorPtr* /*ppCurs*/,
|
||||||
ClientPtr /*client*/);
|
ClientPtr /*client*/,
|
||||||
|
XID /*cid*/);
|
||||||
|
|
||||||
extern CursorPtr CreateRootCursor(
|
extern CursorPtr CreateRootCursor(
|
||||||
char* /*pfilename*/,
|
char* /*pfilename*/,
|
||||||
|
|
|
@ -1492,7 +1492,7 @@ ProcRenderCreateCursor (ClientPtr client)
|
||||||
CursorMetricRec cm;
|
CursorMetricRec cm;
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
CARD32 twocolor[3];
|
CARD32 twocolor[3];
|
||||||
int ncolor;
|
int rc, ncolor;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
|
REQUEST_SIZE_MATCH (xRenderCreateCursorReq);
|
||||||
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
||||||
|
@ -1659,16 +1659,20 @@ ProcRenderCreateCursor (ClientPtr client)
|
||||||
cm.height = height;
|
cm.height = height;
|
||||||
cm.xhot = stuff->x;
|
cm.xhot = stuff->x;
|
||||||
cm.yhot = stuff->y;
|
cm.yhot = stuff->y;
|
||||||
pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm,
|
rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm,
|
||||||
GetColor(twocolor[0], 16),
|
GetColor(twocolor[0], 16),
|
||||||
GetColor(twocolor[0], 8),
|
GetColor(twocolor[0], 8),
|
||||||
GetColor(twocolor[0], 0),
|
GetColor(twocolor[0], 0),
|
||||||
GetColor(twocolor[1], 16),
|
GetColor(twocolor[1], 16),
|
||||||
GetColor(twocolor[1], 8),
|
GetColor(twocolor[1], 8),
|
||||||
GetColor(twocolor[1], 0));
|
GetColor(twocolor[1], 0),
|
||||||
if (pCursor && AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
&pCursor, client, stuff->cid);
|
||||||
return (client->noClientException);
|
if (rc != Success)
|
||||||
return BadAlloc;
|
return rc;
|
||||||
|
if (!AddResource(stuff->cid, RT_CURSOR, (pointer)pCursor))
|
||||||
|
return BadAlloc;
|
||||||
|
|
||||||
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -980,6 +980,7 @@ createInvisibleCursor (void)
|
||||||
CursorPtr pCursor;
|
CursorPtr pCursor;
|
||||||
static unsigned int *psrcbits, *pmaskbits;
|
static unsigned int *psrcbits, *pmaskbits;
|
||||||
CursorMetricRec cm;
|
CursorMetricRec cm;
|
||||||
|
int rc;
|
||||||
|
|
||||||
psrcbits = (unsigned int *) xalloc(4);
|
psrcbits = (unsigned int *) xalloc(4);
|
||||||
pmaskbits = (unsigned int *) xalloc(4);
|
pmaskbits = (unsigned int *) xalloc(4);
|
||||||
|
@ -994,12 +995,13 @@ createInvisibleCursor (void)
|
||||||
cm.xhot = 0;
|
cm.xhot = 0;
|
||||||
cm.yhot = 0;
|
cm.yhot = 0;
|
||||||
|
|
||||||
pCursor = AllocCursor(
|
rc = AllocARGBCursor(
|
||||||
(unsigned char *)psrcbits,
|
(unsigned char *)psrcbits,
|
||||||
(unsigned char *)pmaskbits,
|
(unsigned char *)pmaskbits,
|
||||||
&cm,
|
NULL, &cm,
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
0, 0, 0);
|
0, 0, 0,
|
||||||
|
&pCursor, serverClient, (XID)0);
|
||||||
|
|
||||||
return pCursor;
|
return pCursor;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue