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:
parent
7f1ef9289d
commit
3360418767
28
Xext/dpms.c
28
Xext/dpms.c
|
@ -43,6 +43,13 @@ Equipment Corporation.
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
|
|
||||||
|
CARD16 DPMSPowerLevel = 0;
|
||||||
|
Bool DPMSDisabledSwitch = FALSE;
|
||||||
|
CARD32 DPMSStandbyTime;
|
||||||
|
CARD32 DPMSSuspendTime;
|
||||||
|
CARD32 DPMSOffTime;
|
||||||
|
Bool DPMSEnabled;
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
DPMSSupported(void)
|
DPMSSupported(void)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +143,7 @@ ProcDPMSCapable(ClientPtr client)
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
.length = 0,
|
||||||
.capable = DPMSCapableFlag
|
.capable = TRUE
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
REQUEST_SIZE_MATCH(xDPMSCapableReq);
|
||||||
|
@ -204,11 +211,9 @@ ProcDPMSEnable(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
REQUEST_SIZE_MATCH(xDPMSEnableReq);
|
||||||
|
|
||||||
if (DPMSCapableFlag) {
|
DPMSEnabled = TRUE;
|
||||||
DPMSEnabled = TRUE;
|
if (!was_enabled)
|
||||||
if (!was_enabled)
|
SetScreenSaverTimer();
|
||||||
SetScreenSaverTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -427,7 +432,12 @@ DPMSCloseDownExtension(ExtensionEntry *e)
|
||||||
void
|
void
|
||||||
DPMSExtensionInit(void)
|
DPMSExtensionInit(void)
|
||||||
{
|
{
|
||||||
AddExtension(DPMSExtensionName, 0, 0,
|
DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
|
||||||
ProcDPMSDispatch, SProcDPMSDispatch,
|
DPMSPowerLevel = DPMSModeOn;
|
||||||
DPMSCloseDownExtension, StandardMinorOpcode);
|
DPMSEnabled = DPMSSupported();
|
||||||
|
|
||||||
|
if (DPMSEnabled)
|
||||||
|
AddExtension(DPMSExtensionName, 0, 0,
|
||||||
|
ProcDPMSDispatch, SProcDPMSDispatch,
|
||||||
|
DPMSCloseDownExtension, StandardMinorOpcode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,14 @@
|
||||||
|
|
||||||
#include "dixstruct.h"
|
#include "dixstruct.h"
|
||||||
|
|
||||||
int _X_EXPORT DPMSSet(ClientPtr client, int level);
|
extern int DPMSSet(ClientPtr client, int level);
|
||||||
Bool _X_EXPORT DPMSSupported(void);
|
extern Bool DPMSSupported(void);
|
||||||
|
|
||||||
|
extern CARD32 DPMSStandbyTime;
|
||||||
|
extern CARD32 DPMSSuspendTime;
|
||||||
|
extern CARD32 DPMSOffTime;
|
||||||
|
extern CARD16 DPMSPowerLevel;
|
||||||
|
extern Bool DPMSEnabled;
|
||||||
|
extern Bool DPMSDisabledSwitch;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,6 +53,7 @@ in this Software without prior written authorization from the X Consortium.
|
||||||
#endif
|
#endif
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
#include <X11/extensions/dpmsconst.h>
|
#include <X11/extensions/dpmsconst.h>
|
||||||
|
#include "dpmsproc.h"
|
||||||
#endif
|
#endif
|
||||||
#include "protocol-versions.h"
|
#include "protocol-versions.h"
|
||||||
|
|
||||||
|
|
|
@ -93,16 +93,6 @@ CARD32 ScreenSaverInterval;
|
||||||
int ScreenSaverBlanking;
|
int ScreenSaverBlanking;
|
||||||
int ScreenSaverAllowExposures;
|
int ScreenSaverAllowExposures;
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
|
||||||
CARD16 DPMSPowerLevel = 0;
|
|
||||||
Bool DPMSDisabledSwitch = FALSE;
|
|
||||||
Bool DPMSCapableFlag = FALSE;
|
|
||||||
CARD32 DPMSStandbyTime;
|
|
||||||
CARD32 DPMSSuspendTime;
|
|
||||||
CARD32 DPMSOffTime;
|
|
||||||
Bool DPMSEnabled;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
|
CARD32 defaultScreenSaverTime = DEFAULT_SCREEN_SAVER_TIME;
|
||||||
CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
|
CARD32 defaultScreenSaverInterval = DEFAULT_SCREEN_SAVER_INTERVAL;
|
||||||
int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
|
int defaultScreenSaverBlanking = DEFAULT_SCREEN_SAVER_BLANKING;
|
||||||
|
|
13
dix/main.c
13
dix/main.c
|
@ -148,11 +148,7 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||||
ScreenSaverInterval = defaultScreenSaverInterval;
|
ScreenSaverInterval = defaultScreenSaverInterval;
|
||||||
ScreenSaverBlanking = defaultScreenSaverBlanking;
|
ScreenSaverBlanking = defaultScreenSaverBlanking;
|
||||||
ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
|
ScreenSaverAllowExposures = defaultScreenSaverAllowExposures;
|
||||||
#ifdef DPMSExtension
|
|
||||||
DPMSStandbyTime = DPMSSuspendTime = DPMSOffTime = ScreenSaverTime;
|
|
||||||
DPMSEnabled = TRUE;
|
|
||||||
DPMSPowerLevel = 0;
|
|
||||||
#endif
|
|
||||||
InitBlockAndWakeupHandlers();
|
InitBlockAndWakeupHandlers();
|
||||||
/* Perform any operating system dependent initializations you'd like */
|
/* Perform any operating system dependent initializations you'd like */
|
||||||
OsInit();
|
OsInit();
|
||||||
|
@ -239,13 +235,6 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||||
defaultCursorFont);
|
defaultCursorFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
|
||||||
/* check all screens, looking for DPMS Capabilities */
|
|
||||||
DPMSCapableFlag = DPMSSupported();
|
|
||||||
if (!DPMSCapableFlag)
|
|
||||||
DPMSEnabled = FALSE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
/*
|
/*
|
||||||
* Consolidate window and colourmap information for each screen
|
* Consolidate window and colourmap information for each screen
|
||||||
|
|
|
@ -64,8 +64,10 @@
|
||||||
#include "loaderProcs.h"
|
#include "loaderProcs.h"
|
||||||
|
|
||||||
#include "xkbsrv.h"
|
#include "xkbsrv.h"
|
||||||
|
|
||||||
#include "picture.h"
|
#include "picture.h"
|
||||||
|
#ifdef DPMSExtension
|
||||||
|
#include "dpmsproc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These paths define the way the config file search is done. The escape
|
* These paths define the way the config file search is done. The escape
|
||||||
|
|
|
@ -26,16 +26,6 @@ extern _X_EXPORT char *SeatId;
|
||||||
extern _X_EXPORT char *ConnectionInfo;
|
extern _X_EXPORT char *ConnectionInfo;
|
||||||
extern _X_EXPORT sig_atomic_t inSignalContext;
|
extern _X_EXPORT sig_atomic_t inSignalContext;
|
||||||
|
|
||||||
#ifdef DPMSExtension
|
|
||||||
extern _X_EXPORT CARD32 DPMSStandbyTime;
|
|
||||||
extern _X_EXPORT CARD32 DPMSSuspendTime;
|
|
||||||
extern _X_EXPORT CARD32 DPMSOffTime;
|
|
||||||
extern _X_EXPORT CARD16 DPMSPowerLevel;
|
|
||||||
extern _X_EXPORT Bool DPMSEnabled;
|
|
||||||
extern _X_EXPORT Bool DPMSDisabledSwitch;
|
|
||||||
extern _X_EXPORT Bool DPMSCapableFlag;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
extern _X_EXPORT Bool PanoramiXExtensionDisabledHack;
|
extern _X_EXPORT Bool PanoramiXExtensionDisabledHack;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -135,6 +135,7 @@ Bool noDamageExtension = FALSE;
|
||||||
Bool noDbeExtension = FALSE;
|
Bool noDbeExtension = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef DPMSExtension
|
#ifdef DPMSExtension
|
||||||
|
#include "dpmsproc.h"
|
||||||
Bool noDPMSExtension = FALSE;
|
Bool noDPMSExtension = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef GLXEXT
|
#ifdef GLXEXT
|
||||||
|
|
Loading…
Reference in New Issue
Block a user