aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86DPMS.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86DPMS.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86DPMS.c68
1 files changed, 32 insertions, 36 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86DPMS.c b/xorg-server/hw/xfree86/common/xf86DPMS.c
index 613c7cf73..75f034239 100644
--- a/xorg-server/hw/xfree86/common/xf86DPMS.c
+++ b/xorg-server/hw/xfree86/common/xf86DPMS.c
@@ -53,7 +53,6 @@ static Bool DPMSClose(int i, ScreenPtr pScreen);
static int DPMSCount = 0;
#endif
-
Bool
xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
{
@@ -65,28 +64,28 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
DPMSKey = &DPMSKeyRec;
- if (!dixRegisterPrivateKey(&DPMSKeyRec, PRIVATE_SCREEN, sizeof (DPMSRec)))
- return FALSE;
+ if (!dixRegisterPrivateKey(&DPMSKeyRec, PRIVATE_SCREEN, sizeof(DPMSRec)))
+ return FALSE;
pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
pScrn->DPMSSet = set;
pDPMS->Flags = flags;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
if (DPMSDisabledSwitch) {
- enabled_from = X_CMDLINE;
- DPMSEnabled = FALSE;
+ enabled_from = X_CMDLINE;
+ DPMSEnabled = FALSE;
}
else if (DPMSOpt) {
- enabled_from = X_CONFIG;
- DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
- xf86MarkOptionUsed(DPMSOpt);
+ enabled_from = X_CONFIG;
+ DPMSEnabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
+ xf86MarkOptionUsed(DPMSOpt);
}
else {
- enabled_from = X_DEFAULT;
- DPMSEnabled = TRUE;
+ enabled_from = X_DEFAULT;
+ DPMSEnabled = TRUE;
}
if (DPMSEnabled)
- xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
+ xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
pDPMS->Enabled = DPMSEnabled;
pDPMS->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DPMSClose;
@@ -97,7 +96,6 @@ xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
#endif
}
-
#ifdef DPMSExtension
static Bool
@@ -107,13 +105,13 @@ DPMSClose(int i, ScreenPtr pScreen)
/* This shouldn't happen */
if (DPMSKey == NULL)
- return FALSE;
+ return FALSE;
pDPMS = dixLookupPrivate(&pScreen->devPrivates, DPMSKey);
/* This shouldn't happen */
if (!pDPMS)
- return FALSE;
+ return FALSE;
pScreen->CloseScreen = pDPMS->CloseScreen;
@@ -124,15 +122,14 @@ DPMSClose(int i, ScreenPtr pScreen)
* to deal with this internally.
*/
if (xf86Screens[i]->vtSema && xf86Screens[i]->DPMSSet) {
- xf86Screens[i]->DPMSSet(xf86Screens[i],DPMSModeOn,0);
+ xf86Screens[i]->DPMSSet(xf86Screens[i], DPMSModeOn, 0);
}
-
+
if (--DPMSCount == 0)
- DPMSKey = NULL;
+ DPMSKey = NULL;
return pScreen->CloseScreen(i, pScreen);
}
-
/*
* DPMSSet --
* Device dependent DPMS mode setting hook. This is called whenever
@@ -148,28 +145,27 @@ DPMSSet(ClientPtr client, int level)
DPMSPowerLevel = level;
if (DPMSKey == NULL)
- return Success;
+ return Success;
if (level != DPMSModeOn) {
- rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
- if (rc != Success)
- return rc;
+ rc = dixSaveScreens(client, SCREEN_SAVER_FORCER, ScreenSaverActive);
+ if (rc != Success)
+ return rc;
}
/* For each screen, set the DPMS level */
for (i = 0; i < xf86NumScreens; i++) {
- pScrn = xf86Screens[i];
- pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
- if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
- xf86VGAarbiterLock(pScrn);
- pScrn->DPMSSet(pScrn, level, 0);
- xf86VGAarbiterUnlock(pScrn);
- }
+ pScrn = xf86Screens[i];
+ pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
+ if (pDPMS && pScrn->DPMSSet && pDPMS->Enabled && pScrn->vtSema) {
+ xf86VGAarbiterLock(pScrn);
+ pScrn->DPMSSet(pScrn, level, 0);
+ xf86VGAarbiterUnlock(pScrn);
+ }
}
return Success;
}
-
/*
* DPMSSupported --
* Return TRUE if any screen supports DPMS.
@@ -182,17 +178,17 @@ DPMSSupported(void)
ScrnInfoPtr pScrn;
if (DPMSKey == NULL) {
- return FALSE;
+ return FALSE;
}
/* For each screen, check if DPMS is supported */
for (i = 0; i < xf86NumScreens; i++) {
- pScrn = xf86Screens[i];
- pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
- if (pDPMS && pScrn->DPMSSet)
- return TRUE;
+ pScrn = xf86Screens[i];
+ pDPMS = dixLookupPrivate(&screenInfo.screens[i]->devPrivates, DPMSKey);
+ if (pDPMS && pScrn->DPMSSet)
+ return TRUE;
}
return FALSE;
}
-#endif /* DPMSExtension */
+#endif /* DPMSExtension */