Commit b82557c9 authored by Eamon Walsh's avatar Eamon Walsh Committed by Eamon Walsh

xace: add hooks + new access codes: core protocol screensaver requests

parent 568ae737
......@@ -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);
}
......
......@@ -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);
......
......@@ -46,7 +46,7 @@ int DPMSGet(int *plevel)
return -1;
}
void DPMSSet(int level)
int DPMSSet(ClientPtr client, int level)
{
}
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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();
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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) {
......
......@@ -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)
......
......@@ -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);
......
......@@ -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*/);
......
......@@ -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];
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment