summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-08-16 10:36:05 -0400
committerEamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil>2007-08-16 10:36:05 -0400
commitb82557c9fb60f11fd2696c8fb2ae17b9dfd915ed (patch)
treed21b202f1b12078d2ca46e7b2de2445fc4df38d0
parent568ae737d1d5d476a0bf85659d88910c4e0ef5e0 (diff)
xace: add hooks + new access codes: core protocol screensaver requests
-rw-r--r--Xext/dpms.c4
-rw-r--r--Xext/dpmsproc.h4
-rw-r--r--Xext/dpmsstubs.c2
-rw-r--r--Xext/saver.c4
-rw-r--r--Xext/xtest.c2
-rw-r--r--dix/dispatch.c26
-rw-r--r--dix/main.c4
-rw-r--r--dix/window.c16
-rw-r--r--hw/darwin/darwinEvents.c2
-rw-r--r--hw/dmx/dmxdpms.c2
-rw-r--r--hw/xfree86/common/xf86DPMS.c16
-rw-r--r--hw/xfree86/common/xf86Events.c6
-rw-r--r--hw/xfree86/common/xf86Init.c2
-rw-r--r--hw/xfree86/common/xf86PM.c2
-rw-r--r--include/window.h7
-rw-r--r--mi/mieq.c4
-rw-r--r--os/WaitFor.c4
17 files changed, 69 insertions, 38 deletions
diff --git a/Xext/dpms.c b/Xext/dpms.c
index aced40639..97622cb96 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -218,7 +218,7 @@ ProcDPMSDisable(client)
REQUEST_SIZE_MATCH(xDPMSDisableReq);
- DPMSSet(DPMSModeOn);
+ DPMSSet(client, DPMSModeOn);
DPMSEnabled = FALSE;
@@ -253,7 +253,7 @@ ProcDPMSForceLevel(client)
return BadValue;
}
- DPMSSet(stuff->level);
+ DPMSSet(client, stuff->level);
return(client->noClientException);
}
diff --git a/Xext/dpmsproc.h b/Xext/dpmsproc.h
index f5485ea79..d57f57318 100644
--- a/Xext/dpmsproc.h
+++ b/Xext/dpmsproc.h
@@ -8,7 +8,9 @@
#ifndef _DPMSPROC_H_
#define _DPMSPROC_H_
-void DPMSSet(int level);
+#include "dixstruct.h"
+
+int DPMSSet(ClientPtr client, int level);
int DPMSGet(int *plevel);
Bool DPMSSupported(void);
diff --git a/Xext/dpmsstubs.c b/Xext/dpmsstubs.c
index 9f99a2d22..8d58935da 100644
--- a/Xext/dpmsstubs.c
+++ b/Xext/dpmsstubs.c
@@ -46,7 +46,7 @@ int DPMSGet(int *plevel)
return -1;
}
-void DPMSSet(int level)
+int DPMSSet(ClientPtr client, int level)
{
}
diff --git a/Xext/saver.c b/Xext/saver.c
index a9f1dd36c..dabfbea1b 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -454,8 +454,8 @@ ScreenSaverFreeAttr (value, id)
pPriv->attr = NULL;
if (pPriv->hasWindow)
{
- SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverReset);
- SaveScreens (SCREEN_SAVER_FORCER, ScreenSaverActive);
+ SaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens (serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
}
CheckScreenPrivate (pScreen);
return TRUE;
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 94d8974b6..8d879c7df 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -458,7 +458,7 @@ ProcXTestFakeInput(client)
break;
}
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
ev->u.keyButtonPointer.time = currentTime.milliseconds;
(*dev->public.processInputProc)(ev, dev, nev);
return client->noClientException;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 0bf92de3c..2dc32a525 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3244,10 +3244,17 @@ ProcQueryBestSize (ClientPtr client)
int
ProcSetScreenSaver (ClientPtr client)
{
- int blankingOption, exposureOption;
+ int rc, i, blankingOption, exposureOption;
REQUEST(xSetScreenSaverReq);
-
REQUEST_SIZE_MATCH(xSetScreenSaverReq);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixSetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+
blankingOption = stuff->preferBlank;
if ((blankingOption != DontPreferBlanking) &&
(blankingOption != PreferBlanking) &&
@@ -3301,8 +3308,16 @@ int
ProcGetScreenSaver(ClientPtr client)
{
xGetScreenSaverReply rep;
-
+ int rc, i;
REQUEST_SIZE_MATCH(xReq);
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ }
+
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -3523,6 +3538,7 @@ ProcChangeCloseDownMode(ClientPtr client)
int ProcForceScreenSaver(ClientPtr client)
{
+ int rc;
REQUEST(xForceScreenSaverReq);
REQUEST_SIZE_MATCH(xForceScreenSaverReq);
@@ -3533,7 +3549,9 @@ int ProcForceScreenSaver(ClientPtr client)
client->errorValue = stuff->mode;
return BadValue;
}
- SaveScreens(SCREEN_SAVER_FORCER, (int)stuff->mode);
+ rc = SaveScreens(client, SCREEN_SAVER_FORCER, (int)stuff->mode);
+ if (rc != Success)
+ return rc;
return client->noClientException;
}
diff --git a/dix/main.c b/dix/main.c
index 4ae09dc4e..3e5d0e438 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -430,7 +430,7 @@ main(int argc, char *argv[], char *envp[])
for (i = 0; i < screenInfo.numScreens; i++)
InitRootWindow(WindowTable[i]);
DefineInitialRootWindow(WindowTable[0]);
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
@@ -449,7 +449,7 @@ main(int argc, char *argv[], char *envp[])
/* Now free up whatever must be freed */
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
FreeScreenSaverTimer();
CloseDownExtensions();
diff --git a/dix/window.c b/dix/window.c
index 9d1947a53..597c55dbb 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3369,12 +3369,10 @@ static void DrawLogo(
);
#endif
-_X_EXPORT void
-SaveScreens(int on, int mode)
+_X_EXPORT int
+SaveScreens(ClientPtr client, int on, int mode)
{
- int i;
- int what;
- int type;
+ int rc, i, what, type;
if (on == SCREEN_SAVER_FORCER)
{
@@ -3393,6 +3391,13 @@ SaveScreens(int on, int mode)
if (what == screenIsSaved)
type = SCREEN_SAVER_CYCLE;
}
+
+ for (i = 0; i < screenInfo.numScreens; i++) {
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, screenInfo.screens[i],
+ DixShowAccess | DixHideAccess);
+ if (rc != Success)
+ return rc;
+ }
for (i = 0; i < screenInfo.numScreens; i++)
{
if (on == SCREEN_SAVER_FORCER)
@@ -3480,6 +3485,7 @@ SaveScreens(int on, int mode)
screenIsSaved = what;
if (mode == ScreenSaverReset)
SetScreenSaverTimer();
+ return Success;
}
static Bool
diff --git a/hw/darwin/darwinEvents.c b/hw/darwin/darwinEvents.c
index 3d7f268ca..97ad8577e 100644
--- a/hw/darwin/darwinEvents.c
+++ b/hw/darwin/darwinEvents.c
@@ -276,7 +276,7 @@ void ProcessInputEvents(void) {
while (darwinEventQueue.head != darwinEventQueue.tail)
{
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
e = &darwinEventQueue.events[darwinEventQueue.head];
xe = e->event;
diff --git a/hw/dmx/dmxdpms.c b/hw/dmx/dmxdpms.c
index 5c176dfc3..ea0d66c3c 100644
--- a/hw/dmx/dmxdpms.c
+++ b/hw/dmx/dmxdpms.c
@@ -175,7 +175,7 @@ void dmxDPMSTerm(DMXScreenInfo *dmxScreen)
void dmxDPMSWakeup(void)
{
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens(SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
if (DPMSPowerLevel) DPMSSet(0);
#endif
diff --git a/hw/xfree86/common/xf86DPMS.c b/hw/xfree86/common/xf86DPMS.c
index 3aa83e882..a4ae67e46 100644
--- a/hw/xfree86/common/xf86DPMS.c
+++ b/hw/xfree86/common/xf86DPMS.c
@@ -144,20 +144,23 @@ DPMSClose(int i, ScreenPtr pScreen)
* Device dependent DPMS mode setting hook. This is called whenever
* the DPMS mode is to be changed.
*/
-_X_EXPORT void
-DPMSSet(int level)
+_X_EXPORT int
+DPMSSet(ClientPtr client, int level)
{
- int i;
+ int rc, i;
DPMSPtr pDPMS;
ScrnInfoPtr pScrn;
DPMSPowerLevel = level;
if (DPMSIndex < 0)
- return;
+ return Success;
- if (level != DPMSModeOn)
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (level != DPMSModeOn) {
+ rc = SaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (rc != Success)
+ return rc;
+ }
/* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) {
@@ -168,6 +171,7 @@ DPMSSet(int level)
pScrn->DPMSSet(pScrn, level, 0);
}
}
+ return Success;
}
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index dd9c34e5c..7c2c2503f 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -853,7 +853,7 @@ xf86VTSwitch()
#endif
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
for (i = 0; i < xf86NumScreens; i++) {
if (!(dispatchException & DE_TERMINATE))
@@ -902,7 +902,7 @@ xf86VTSwitch()
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
@@ -966,7 +966,7 @@ xf86VTSwitch()
}
/* Turn screen saver off when switching back */
- SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index bf7dac6da..27bc9ad0f 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1086,7 +1086,7 @@ AbortDDX()
#endif
#ifdef DPMSExtension /* Turn screens back on */
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
if (xf86Screens) {
if (xf86Screens[0]->vtSema)
diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c
index a6bcc3421..278a51474 100644
--- a/hw/xfree86/common/xf86PM.c
+++ b/hw/xfree86/common/xf86PM.c
@@ -116,7 +116,7 @@ resume(pmEvent event, Bool undo)
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
}
- SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
+ SaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
EnableDevice(pInfo->dev);
diff --git a/include/window.h b/include/window.h
index 472f37973..d5437a759 100644
--- a/include/window.h
+++ b/include/window.h
@@ -207,9 +207,10 @@ extern RegionPtr NotClippedByChildren(
extern void SendVisibilityNotify(
WindowPtr /*pWin*/);
-extern void SaveScreens(
- int /*on*/,
- int /*mode*/);
+extern int SaveScreens(
+ ClientPtr client,
+ int on,
+ int mode);
extern WindowPtr FindWindowWithOptional(
WindowPtr /*w*/);
diff --git a/mi/mieq.c b/mi/mieq.c
index 20c4b6201..5093023c7 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -200,13 +200,13 @@ mieqProcessInputEvents(void)
while (miEventQueue.head != miEventQueue.tail) {
if (screenIsSaved == SCREEN_SAVER_ON)
- SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
+ SaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
else if (DPMSPowerLevel != DPMSModeOn)
SetScreenSaverTimer();
if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(DPMSModeOn);
+ DPMSSet(serverClient, DPMSModeOn);
#endif
e = &miEventQueue.events[miEventQueue.head];
diff --git a/os/WaitFor.c b/os/WaitFor.c
index ec1592c01..1ef79bc34 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -583,7 +583,7 @@ TimerInit(void)
#define DPMS_CHECK_MODE(mode,time)\
if (time > 0 && DPMSPowerLevel < mode && timeout >= time)\
- DPMSSet(mode);
+ DPMSSet(serverClient, mode);
#define DPMS_CHECK_TIMEOUT(time)\
if (time > 0 && (time - timeout) > 0)\
@@ -652,7 +652,7 @@ ScreenSaverTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
}
ResetOsBuffers(); /* not ideal, but better than nothing */
- SaveScreens(SCREEN_SAVER_ON, ScreenSaverActive);
+ SaveScreens(serverClient, SCREEN_SAVER_ON, ScreenSaverActive);
if (ScreenSaverInterval > 0)
{