diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-01-03 17:04:54 +1030 |
commit | 8da83836b60f7cdb75d08482f4311fa0e2ab4e1d (patch) | |
tree | 092efcfc39e3e293baaf04c4c84027ee453d3e13 /render/animcur.c | |
parent | eace88989c3b65d5c20e9f37ea9b23c7c8e19335 (diff) | |
parent | ae869fc7669764729e13fdd70149ed636753f2a3 (diff) |
Merge branch 'master' into mpx
Conflicts:
XTrap/xtrapddmi.c
Xext/security.c
Xext/xprint.c
Xext/xtest.c
Xext/xvdisp.c
Xi/exevents.c
Xi/grabdevb.c
Xi/grabdevk.c
Xi/opendev.c
Xi/ungrdev.c
Xi/ungrdevb.c
Xi/ungrdevk.c
dix/cursor.c
dix/devices.c
dix/dixutils.c
dix/events.c
dix/getevents.c
dix/main.c
dix/window.c
hw/xfree86/ramdac/xf86Cursor.c
include/dix.h
include/input.h
include/inputstr.h
mi/midispcur.c
mi/miinitext.c
mi/misprite.c
render/animcur.c
xfixes/cursor.c
xkb/xkbAccessX.c
Diffstat (limited to 'render/animcur.c')
-rw-r--r-- | render/animcur.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/render/animcur.c b/render/animcur.c index 1172877dc..a87718d12 100644 --- a/render/animcur.c +++ b/render/animcur.c @@ -45,6 +45,7 @@ #include "opaque.h" #include "picturestr.h" #include "inputstr.h" +#include "xace.h" typedef struct _AnimCurElt { CursorPtr pCursor; /* cursor to show */ @@ -89,14 +90,14 @@ static CursorBits animCursorBits = { empty, empty, 2, 1, 1, 0, 0, 1 }; -static int AnimCurScreenPrivateIndex = -1; static int AnimCurGeneration; +static DevPrivateKey AnimCurScreenPrivateKey = &AnimCurScreenPrivateKey; #define IsAnimCur(c) ((c)->bits == &animCursorBits) #define GetAnimCur(c) ((AnimCurPtr) ((c) + 1)) -#define GetAnimCurScreen(s) ((AnimCurScreenPtr) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr)) -#define GetAnimCurScreenIfSet(s) ((AnimCurScreenPrivateIndex != -1) ? GetAnimCurScreen(s) : NULL) -#define SetAnimCurScreen(s,p) ((s)->devPrivates[AnimCurScreenPrivateIndex].ptr = (pointer) (p)) +#define GetAnimCurScreen(s) ((AnimCurScreenPtr)dixLookupPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey)) +#define GetAnimCurScreenIfSet(s) GetAnimCurScreen(s) +#define SetAnimCurScreen(s,p) dixSetPrivate(&(s)->devPrivates, AnimCurScreenPrivateKey, p) #define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func) #define Unwrap(as,s,elt) ((s)->elt = (as)->elt) @@ -132,8 +133,6 @@ AnimCurCloseScreen (int index, ScreenPtr pScreen) SetAnimCurScreen(pScreen,0); ret = (*pScreen->CloseScreen) (index, pScreen); xfree (as); - if (index == 0) - AnimCurScreenPrivateIndex = -1; return ret; } @@ -352,9 +351,6 @@ AnimCurInit (ScreenPtr pScreen) if (AnimCurGeneration != serverGeneration) { int i; - AnimCurScreenPrivateIndex = AllocateScreenPrivateIndex (); - if (AnimCurScreenPrivateIndex < 0) - return FALSE; AnimCurGeneration = serverGeneration; for (i = 0; i < MAX_DEVICES; i++) { animCurState[i].pCursor = 0; @@ -381,10 +377,10 @@ AnimCurInit (ScreenPtr pScreen) } int -AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor) +AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *ppCursor, ClientPtr client, XID cid) { CursorPtr pCursor; - int i; + int rc, i; AnimCurPtr ac; for (i = 0; i < screenInfo.numScreens; i++) @@ -401,7 +397,6 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp if (!pCursor) return BadAlloc; pCursor->bits = &animCursorBits; - animCursorBits.refcnt++; pCursor->refcnt = 1; pCursor->foreRed = cursors[0]->foreRed; @@ -412,9 +407,22 @@ AnimCursorCreate (CursorPtr *cursors, CARD32 *deltas, int ncursor, CursorPtr *pp pCursor->backGreen = cursors[0]->backGreen; pCursor->backBlue = cursors[0]->backBlue; + pCursor->id = cid; + pCursor->devPrivates = NULL; + + /* security creation/labeling check */ + rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor, + RT_NONE, NULL, DixCreateAccess); + if (rc != Success) { + dixFreePrivates(pCursor->devPrivates); + xfree(pCursor); + return rc; + } + /* * Fill in the AnimCurRec */ + animCursorBits.refcnt++; ac = GetAnimCur (pCursor); ac->nelt = ncursor; ac->elts = (AnimCurElt *) (ac + 1); |