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 /Xext/saver.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 'Xext/saver.c')
-rw-r--r-- | Xext/saver.c | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/Xext/saver.c b/Xext/saver.c index 99b87aae2..d4786b9b8 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -48,6 +48,7 @@ in this Software without prior written authorization from the X Consortium. #include "gcstruct.h" #include "cursorstr.h" #include "colormapst.h" +#include "xace.h" #ifdef PANORAMIX #include "panoramiX.h" #include "panoramiXsrv.h" @@ -61,9 +62,6 @@ in this Software without prior written authorization from the X Consortium. #include "modinit.h" -#if 0 -static unsigned char ScreenSaverReqCode = 0; -#endif static int ScreenSaverEventBase = 0; static DISPATCH_PROC(ProcScreenSaverQueryInfo); @@ -234,10 +232,12 @@ MakeScreenPrivate ( ScreenPtr /* pScreen */ ); -static int ScreenPrivateIndex; +static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey; -#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr) -#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v); +#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \ + dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey)) +#define SetScreenPrivate(s,v) \ + dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v); #define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL) #define New(t) ((t *) xalloc (sizeof (t))) @@ -260,21 +260,17 @@ ScreenSaverExtensionInit(INITARGS) AttrType = CreateNewResourceType(ScreenSaverFreeAttr); EventType = CreateNewResourceType(ScreenSaverFreeEvents); SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend); - ScreenPrivateIndex = AllocateScreenPrivateIndex (); for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; SetScreenPrivate (pScreen, NULL); } - if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 && + if (AttrType && EventType && SuspendType && (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, ProcScreenSaverDispatch, SProcScreenSaverDispatch, ScreenSaverResetProc, StandardMinorOpcode))) { -#if 0 - ScreenSaverReqCode = (unsigned char)extEntry->base; -#endif ScreenSaverEventBase = extEntry->eventBase; EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; } @@ -454,8 +450,8 @@ ScreenSaverFreeAttr (value, id) pPriv->attr = NULL; if (pPriv->hasWindow) { - SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset); - SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive); + dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + dixSaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive); } CheckScreenPrivate (pScreen); return TRUE; @@ -788,7 +784,11 @@ ProcScreenSaverQueryInfo (client) REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); + if (rc != Success) + return rc; + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen, + DixGetAttrAccess); if (rc != Success) return rc; @@ -857,9 +857,15 @@ ProcScreenSaverSelectInput (client) REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq); rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; + + rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen, + DixSetAttrAccess); + if (rc != Success) + return rc; + if (!setEventMask (pDraw->pScreen, client, stuff->eventMask)) return BadAlloc; return Success; @@ -893,12 +899,16 @@ ScreenSaverSetAttributes (ClientPtr client) REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (ret != Success) return ret; pScreen = pDraw->pScreen; pParent = WindowTable[pScreen->myNum]; + ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess); + if (ret != Success) + return ret; + len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; @@ -1054,8 +1064,9 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); - if (pPixmap != (PixmapPtr) NULL) + ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (ret == Success) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1069,7 +1080,7 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = BadPixmap; + ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1091,8 +1102,9 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP); - if (pPixmap) + ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP, + client, DixReadAccess); + if (ret == Success) { if ((pPixmap->drawable.depth != depth) || (pPixmap->drawable.pScreen != pScreen)) @@ -1106,7 +1118,7 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = BadPixmap; + ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1184,10 +1196,11 @@ ScreenSaverSetAttributes (ClientPtr client) break; case CWColormap: cmap = (Colormap) *pVlist; - pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP); - if (!pCmap) + ret = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP, + client, DixUseAccess); + if (ret != Success) { - ret = BadColor; + ret = (ret == BadValue) ? BadColor : ret; client->errorValue = cmap; goto PatchUp; } @@ -1207,10 +1220,11 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR); - if (!pCursor) + ret = dixLookupResource((pointer *)&pCursor, cursorID, + RT_CURSOR, client, DixUseAccess); + if (ret != Success) { - ret = BadCursor; + ret = (ret == BadValue) ? BadCursor : ret; client->errorValue = cursorID; goto PatchUp; } @@ -1252,7 +1266,7 @@ ScreenSaverUnsetAttributes (ClientPtr client) REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixUnknownAccess); + DixGetAttrAccess); if (rc != Success) return rc; pPriv = GetScreenPrivate (pDraw->pScreen); |