2006-11-26 11:13:41 -07:00
|
|
|
/*****************************************************************
|
|
|
|
|
|
|
|
Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
2015-09-16 13:10:19 -06:00
|
|
|
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
|
|
|
|
BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
2006-11-26 11:13:41 -07:00
|
|
|
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
2015-09-16 13:10:19 -06:00
|
|
|
Except as contained in this notice, the name of Digital Equipment Corporation
|
2006-11-26 11:13:41 -07:00
|
|
|
shall not be used in advertising or otherwise to promote the sale, use or other
|
2015-09-16 13:10:19 -06:00
|
|
|
dealings in this Software without prior written authorization from Digital
|
2006-11-26 11:13:41 -07:00
|
|
|
Equipment Corporation.
|
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
|
|
|
#include "misc.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
#include "extnsionst.h"
|
|
|
|
#include "opaque.h"
|
2010-04-13 13:54:46 -06:00
|
|
|
#include <X11/extensions/dpmsproto.h>
|
2006-11-26 11:13:41 -07:00
|
|
|
#include "dpmsproc.h"
|
2013-06-07 11:28:45 -06:00
|
|
|
#include "extinit.h"
|
2019-07-27 01:57:06 -06:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
|
|
|
|
CARD16 DPMSPowerLevel = 0;
|
|
|
|
Bool DPMSDisabledSwitch = FALSE;
|
|
|
|
CARD32 DPMSStandbyTime = -1;
|
|
|
|
CARD32 DPMSSuspendTime = -1;
|
|
|
|
CARD32 DPMSOffTime = -1;
|
|
|
|
Bool DPMSEnabled;
|
|
|
|
|
|
|
|
Bool
|
|
|
|
DPMSSupported(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* For each screen, check if DPMS is supported */
|
|
|
|
for (i = 0; i < screenInfo.numScreens; i++)
|
|
|
|
if (screenInfo.screens[i]->DPMS != NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numGPUScreens; i++)
|
|
|
|
if (screenInfo.gpuscreens[i]->DPMS != NULL)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
isUnblank(int mode)
|
|
|
|
{
|
|
|
|
switch (mode) {
|
|
|
|
case SCREEN_SAVER_OFF:
|
|
|
|
case SCREEN_SAVER_FORCER:
|
|
|
|
return TRUE;
|
|
|
|
case SCREEN_SAVER_ON:
|
|
|
|
case SCREEN_SAVER_CYCLE:
|
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
DPMSSet(ClientPtr client, int level)
|
|
|
|
{
|
|
|
|
int rc, i;
|
|
|
|
|
|
|
|
DPMSPowerLevel = level;
|
|
|
|
|
|
|
|
if (level != DPMSModeOn) {
|
|
|
|
if (isUnblank(screenIsSaved)) {
|
|
|
|
rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
} else if (!isUnblank(screenIsSaved)) {
|
|
|
|
rc = dixSaveScreens(client, SCREEN_SAVER_OFF, ScreenSaverReset);
|
|
|
|
if (rc != Success)
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numScreens; i++)
|
|
|
|
if (screenInfo.screens[i]->DPMS != NULL)
|
|
|
|
screenInfo.screens[i]->DPMS(screenInfo.screens[i], level);
|
|
|
|
|
|
|
|
for (i = 0; i < screenInfo.numGPUScreens; i++)
|
|
|
|
if (screenInfo.gpuscreens[i]->DPMS != NULL)
|
|
|
|
screenInfo.gpuscreens[i]->DPMS(screenInfo.gpuscreens[i], level);
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSGetVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xDPMSGetVersionReq); */
|
2013-06-07 11:28:45 -06:00
|
|
|
xDPMSGetVersionReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.majorVersion = DPMSMajorVersion,
|
|
|
|
.minorVersion = DPMSMinorVersion
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swaps(&rep.majorVersion);
|
|
|
|
swaps(&rep.minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-09-06 13:44:18 -06:00
|
|
|
ProcDPMSCapable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xDPMSCapableReq); */
|
2013-06-07 11:28:45 -06:00
|
|
|
xDPMSCapableReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
2019-07-27 01:57:06 -06:00
|
|
|
.capable = TRUE
|
2013-06-07 11:28:45 -06:00
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSGetTimeouts(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xDPMSGetTimeoutsReq); */
|
2013-06-07 11:28:45 -06:00
|
|
|
xDPMSGetTimeoutsReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.standby = DPMSStandbyTime / MILLI_PER_SECOND,
|
|
|
|
.suspend = DPMSSuspendTime / MILLI_PER_SECOND,
|
|
|
|
.off = DPMSOffTime / MILLI_PER_SECOND
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swaps(&rep.standby);
|
|
|
|
swaps(&rep.suspend);
|
|
|
|
swaps(&rep.off);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSSetTimeouts(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSSetTimeoutsReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
|
|
|
|
client->errorValue = stuff->off;
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
|
|
|
|
client->errorValue = stuff->suspend;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
|
|
|
|
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
|
|
|
|
DPMSOffTime = stuff->off * MILLI_PER_SECOND;
|
|
|
|
SetScreenSaverTimer();
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSEnable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2008-06-14 18:17:32 -06:00
|
|
|
Bool was_enabled = DPMSEnabled;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
DPMSEnabled = TRUE;
|
|
|
|
if (!was_enabled)
|
|
|
|
SetScreenSaverTimer();
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSDisable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xDPMSDisableReq); */
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
DPMSSet(client, DPMSModeOn);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
DPMSEnabled = FALSE;
|
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-07-27 13:02:24 -06:00
|
|
|
ProcDPMSForceLevel(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSForceLevelReq);
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
|
|
|
|
|
|
|
if (!DPMSEnabled)
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadMatch;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2009-10-31 08:09:43 -06:00
|
|
|
if (stuff->level != DPMSModeOn &&
|
|
|
|
stuff->level != DPMSModeStandby &&
|
2012-06-10 07:21:05 -06:00
|
|
|
stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
|
|
|
|
client->errorValue = stuff->level;
|
|
|
|
return BadValue;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2008-11-02 08:26:08 -07:00
|
|
|
DPMSSet(client, stuff->level);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-09-06 13:44:18 -06:00
|
|
|
ProcDPMSInfo(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
/* REQUEST(xDPMSInfoReq); */
|
2013-06-07 11:28:45 -06:00
|
|
|
xDPMSInfoReply rep = {
|
|
|
|
.type = X_Reply,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0,
|
|
|
|
.power_level = DPMSPowerLevel,
|
|
|
|
.state = DPMSEnabled
|
|
|
|
};
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
|
|
|
|
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep.sequenceNumber);
|
|
|
|
swaps(&rep.power_level);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
|
2010-12-05 08:36:02 -07:00
|
|
|
return Success;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-06-10 07:21:05 -06:00
|
|
|
ProcDPMSDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSGetVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSGetVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSCapable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSCapable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSGetTimeouts:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSGetTimeouts(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSSetTimeouts:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSSetTimeouts(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSEnable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSEnable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSDisable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSDisable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSForceLevel:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSForceLevel(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSInfo:
|
2012-06-10 07:21:05 -06:00
|
|
|
return ProcDPMSInfo(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSGetVersion(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSGetVersionReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->majorVersion);
|
|
|
|
swaps(&stuff->minorVersion);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcDPMSGetVersion(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2009-09-06 13:44:18 -06:00
|
|
|
SProcDPMSCapable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSCapableReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
|
|
|
|
|
|
|
return ProcDPMSCapable(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSGetTimeouts(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSGetTimeoutsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
|
|
|
|
|
|
|
|
return ProcDPMSGetTimeouts(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSSetTimeouts(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSSetTimeoutsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->standby);
|
|
|
|
swaps(&stuff->suspend);
|
|
|
|
swaps(&stuff->off);
|
2006-11-26 11:13:41 -07:00
|
|
|
return ProcDPMSSetTimeouts(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSEnable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSEnableReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
|
|
|
|
|
|
|
return ProcDPMSEnable(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSDisable(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSDisableReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSDisableReq);
|
|
|
|
|
|
|
|
return ProcDPMSDisable(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSForceLevel(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSForceLevelReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->level);
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
return ProcDPMSForceLevel(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2010-07-27 13:02:24 -06:00
|
|
|
SProcDPMSInfo(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xDPMSInfoReq);
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
REQUEST_SIZE_MATCH(xDPMSInfoReq);
|
|
|
|
|
|
|
|
return ProcDPMSInfo(client);
|
|
|
|
}
|
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static int _X_COLD
|
2012-06-10 07:21:05 -06:00
|
|
|
SProcDPMSDispatch(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
switch (stuff->data) {
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSGetVersion:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSGetVersion(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSCapable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSCapable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSGetTimeouts:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSGetTimeouts(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSSetTimeouts:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSSetTimeouts(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSEnable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSEnable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSDisable:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSDisable(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSForceLevel:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSForceLevel(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
case X_DPMSInfo:
|
2012-06-10 07:21:05 -06:00
|
|
|
return SProcDPMSInfo(client);
|
2006-11-26 11:13:41 -07:00
|
|
|
default:
|
2012-06-10 07:21:05 -06:00
|
|
|
return BadRequest;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
2010-07-27 13:02:24 -06:00
|
|
|
|
2019-07-27 01:57:06 -06:00
|
|
|
static void
|
|
|
|
DPMSCloseDownExtension(ExtensionEntry *e)
|
|
|
|
{
|
|
|
|
DPMSSet(serverClient, DPMSModeOn);
|
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
void
|
2013-06-07 11:28:45 -06:00
|
|
|
DPMSExtensionInit(void)
|
2010-07-27 13:02:24 -06:00
|
|
|
{
|
2019-07-27 01:57:06 -06:00
|
|
|
#define CONDITIONALLY_SET_DPMS_TIMEOUT(_timeout_value_) \
|
|
|
|
if (_timeout_value_ == -1) { /* not yet set from config */ \
|
|
|
|
_timeout_value_ = ScreenSaverTime; \
|
|
|
|
}
|
|
|
|
|
|
|
|
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSStandbyTime)
|
|
|
|
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSSuspendTime)
|
|
|
|
CONDITIONALLY_SET_DPMS_TIMEOUT(DPMSOffTime)
|
|
|
|
|
|
|
|
DPMSPowerLevel = DPMSModeOn;
|
|
|
|
DPMSEnabled = DPMSSupported();
|
|
|
|
|
|
|
|
if (DPMSEnabled)
|
|
|
|
AddExtension(DPMSExtensionName, 0, 0,
|
|
|
|
ProcDPMSDispatch, SProcDPMSDispatch,
|
|
|
|
DPMSCloseDownExtension, StandardMinorOpcode);
|
2010-07-27 13:02:24 -06:00
|
|
|
}
|