mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
dpms: Consolidate a bunch of stuff into Xext/dpms.c
Most of this is a legacy of the old "extmod" design where you could load _some_ extensions dynamically but only if the server had been built with support for them in the first place. Note that since we now only initialize the DPMS extension if at least one screen supports it, we no longer need DPMSCapableFlag: if it would be false, we would never read its value. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
28
Xext/dpms.c
28
Xext/dpms.c
@@ -43,6 +43,13 @@ Equipment Corporation.
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
|
||||
CARD16 DPMSPowerLevel = 0;
|
||||
Bool DPMSDisabledSwitch = FALSE;
|
||||
CARD32 DPMSStandbyTime;
|
||||
CARD32 DPMSSuspendTime;
|
||||
CARD32 DPMSOffTime;
|
||||
Bool DPMSEnabled;
|
||||
|
||||
Bool
|
||||
DPMSSupported(void)
|
||||
{
|
||||
@@ -136,7 +143,7 @@ ProcDPMSCapable(ClientPtr client)
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.capable = DPMSCapableFlag
|
||||
.capable = TRUE
|
||||
};
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||
@@ -204,11 +211,9 @@ ProcDPMSEnable(ClientPtr client)
|
||||
|
||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||
|
||||
if (DPMSCapableFlag) {
|
||||
DPMSEnabled = TRUE;
|
||||
if (!was_enabled)
|
||||
SetScreenSaverTimer();
|
||||
}
|
||||
DPMSEnabled = TRUE;
|
||||
if (!was_enabled)
|
||||
SetScreenSaverTimer();
|
||||
|
||||
return Success;
|
||||
}
|
||||
@@ -427,7 +432,12 @@ DPMSCloseDownExtension(ExtensionEntry *e)
|
||||
void
|
||||
DPMSExtensionInit(void)
|
||||
{
|
||||
AddExtension(DPMSExtensionName, 0, 0,
|
||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||
DPMSCloseDownExtension, StandardMinorOpcode);
|
||||
DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
|
||||
DPMSPowerLevel = DPMSModeOn;
|
||||
DPMSEnabled = DPMSSupported();
|
||||
|
||||
if (DPMSEnabled)
|
||||
AddExtension(DPMSExtensionName, 0, 0,
|
||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||
DPMSCloseDownExtension, StandardMinorOpcode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user