DPMS: Simplify command line parsing

This commit is contained in:
Adam Jackson 2009-04-03 17:51:55 -04:00
parent 2d0a4fff79
commit c1cf36ee29
4 changed files with 4 additions and 9 deletions

View File

@ -100,8 +100,7 @@ CARD32 defaultDPMSSuspendTime = DEFAULT_SCREEN_SAVER_TIME;
CARD32 defaultDPMSOffTime = DEFAULT_SCREEN_SAVER_TIME;
CARD16 DPMSPowerLevel = 0;
Bool defaultDPMSEnabled = TRUE;
Bool DPMSEnabledSwitch = FALSE; /* these denote the DPMS command */
Bool DPMSDisabledSwitch = FALSE; /* line switch states */
Bool DPMSDisabledSwitch = FALSE;
Bool DPMSCapableFlag = FALSE;
CARD32 DPMSStandbyTime;
CARD32 DPMSSuspendTime;

View File

@ -64,8 +64,6 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
DPMSKey = &DPMSKeyIndex;
if (DPMSDisabledSwitch)
DPMSEnabled = FALSE;
if (!dixSetPrivate(&pScreen->devPrivates, DPMSKey,
xcalloc(sizeof(DPMSRec), 1)))
return FALSE;
@ -74,9 +72,9 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
pScrn->DPMSSet = set;
pDPMS->Flags = flags;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
if (DPMSEnabledSwitch || DPMSDisabledSwitch) {
if (DPMSDisabledSwitch) {
enabled_from = X_CMDLINE;
DPMSEnabled = !DPMSDisabledSwitch && DPMSEnabledSwitch;
DPMSEnabled = FALSE;
}
else if (DPMSOpt) {
enabled_from = X_CONFIG;

View File

@ -37,7 +37,6 @@ extern CARD32 DPMSOffTime;
extern CARD16 DPMSPowerLevel;
extern Bool defaultDPMSEnabled;
extern Bool DPMSEnabled;
extern Bool DPMSEnabledSwitch;
extern Bool DPMSDisabledSwitch;
extern Bool DPMSCapableFlag;
#endif

View File

@ -487,7 +487,6 @@ void UseMsg(void)
ErrorF("-core generate core dump on fatal error\n");
ErrorF("-dpi int screen resolution in dots per inch\n");
#ifdef DPMSExtension
ErrorF("dpms enables VESA DPMS monitor control\n");
ErrorF("-dpms disables VESA DPMS monitor control\n");
#endif
ErrorF("-deferglyphs [none|all|16] defer loading of [no|all|16-bit] glyphs\n");
@ -673,7 +672,7 @@ ProcessCommandLine(int argc, char *argv[])
}
#ifdef DPMSExtension
else if ( strcmp( argv[i], "dpms") == 0)
DPMSEnabledSwitch = TRUE;
/* ignored for compatibility */ ;
else if ( strcmp( argv[i], "-dpms") == 0)
DPMSDisabledSwitch = TRUE;
#endif