summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2017-03-24 12:30:58 -0400
committerAdam Jackson <ajax@redhat.com>2017-03-27 15:59:47 -0400
commit33604187674ec78b2c0bf7f67af250acc80cf23a (patch)
treeae4f7590ff339c3149e7a9932c9af922962f961a /Xext
parent7f1ef9289d974fc2bacc968ae0b5d7714382cb9e (diff)
downloadxserver-33604187674ec78b2c0bf7f67af250acc80cf23a.tar.gz
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>
Diffstat (limited to 'Xext')
-rw-r--r--Xext/dpms.c28
-rw-r--r--Xext/dpmsproc.h11
-rw-r--r--Xext/saver.c1
3 files changed, 29 insertions, 11 deletions
diff --git a/Xext/dpms.c b/Xext/dpms.c
index abc67ef1f..efa715428 100644
--- a/Xext/dpms.c
+++ b/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);
}
diff --git a/Xext/dpmsproc.h b/Xext/dpmsproc.h
index 82dccbd67..1e24f1f55 100644
--- a/Xext/dpmsproc.h
+++ b/Xext/dpmsproc.h
@@ -9,7 +9,14 @@
#include "dixstruct.h"
-int _X_EXPORT DPMSSet(ClientPtr client, int level);
-Bool _X_EXPORT DPMSSupported(void);
+extern int DPMSSet(ClientPtr client, int level);
+extern Bool DPMSSupported(void);
+
+extern CARD32 DPMSStandbyTime;
+extern CARD32 DPMSSuspendTime;
+extern CARD32 DPMSOffTime;
+extern CARD16 DPMSPowerLevel;
+extern Bool DPMSEnabled;
+extern Bool DPMSDisabledSwitch;
#endif
diff --git a/Xext/saver.c b/Xext/saver.c
index bf3a23d9a..09497610a 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -53,6 +53,7 @@ in this Software without prior written authorization from the X Consortium.
#endif
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
+#include "dpmsproc.h"
#endif
#include "protocol-versions.h"