mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 03:44:06 +00:00
treewide: macros lambda-esque screen iteration
iterating over screen list via lambda-esque macros calls like this
DIX_FOR_EACH_SCREEN({
do_something
});
withing the body, the iterator variables `walkScreenIdx` and `walkScreen`
are defined and can be directly used (read-only). the code inside the body
is running in a separate scope.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
eaff5ba96c
commit
962580a15a
21
Xext/dpms.c
21
Xext/dpms.c
@@ -34,6 +34,7 @@ Equipment Corporation.
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/request_priv.h"
|
||||
#include "dix/screenint_priv.h"
|
||||
#include "dix/screensaver_priv.h"
|
||||
#include "miext/extinit_priv.h"
|
||||
#include "os/screensaver.h"
|
||||
@@ -237,17 +238,15 @@ Bool
|
||||
DPMSSupported(void)
|
||||
{
|
||||
/* For each screen, check if DPMS is supported */
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
if (walkScreen->DPMS != NULL)
|
||||
return TRUE;
|
||||
}
|
||||
});
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numGPUScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.gpuscreens[walkScreenIdx];
|
||||
DIX_FOR_EACH_GPU_SCREEN({
|
||||
if (walkScreen->DPMS != NULL)
|
||||
return TRUE;
|
||||
}
|
||||
});
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -287,17 +286,15 @@ DPMSSet(ClientPtr client, int level)
|
||||
return rc;
|
||||
}
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
if (walkScreen->DPMS != NULL)
|
||||
walkScreen->DPMS(walkScreen, level);
|
||||
}
|
||||
});
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numGPUScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.gpuscreens[walkScreenIdx];
|
||||
DIX_FOR_EACH_GPU_SCREEN({
|
||||
if (walkScreen->DPMS != NULL)
|
||||
walkScreen->DPMS(walkScreen, level);
|
||||
}
|
||||
});
|
||||
|
||||
if (DPMSPowerLevel != old_level)
|
||||
SendDPMSInfoNotify();
|
||||
|
||||
Reference in New Issue
Block a user