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
dix/main.c
21
dix/main.c
@@ -202,17 +202,14 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||
InitExtensions(argc, argv);
|
||||
LogMessageVerb(X_INFO, 1, "Extensions initialized\n");
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numGPUScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.gpuscreens[walkScreenIdx];
|
||||
DIX_FOR_EACH_GPU_SCREEN({
|
||||
if (!PixmapScreenInit(walkScreen))
|
||||
FatalError("failed to create screen pixmap properties");
|
||||
if (!dixScreenRaiseCreateResources(walkScreen))
|
||||
FatalError("failed to create screen resources");
|
||||
}
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
|
||||
});
|
||||
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
if (!PixmapScreenInit(walkScreen))
|
||||
FatalError("failed to create screen pixmap properties");
|
||||
if (!dixScreenRaiseCreateResources(walkScreen))
|
||||
@@ -224,7 +221,7 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||
if (!CreateRootWindow(walkScreen))
|
||||
FatalError("failed to create root window");
|
||||
CallCallbacks(&RootWindowFinalizeCallback, walkScreen);
|
||||
}
|
||||
});
|
||||
|
||||
if (SetDefaultFontPath(defaultFontPath) != Success) {
|
||||
ErrorF("[dix] failed to set default font path '%s'",
|
||||
@@ -248,11 +245,10 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||
PanoramiXConsolidate();
|
||||
#endif /* XINERAMA */
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
InitRootWindow(walkScreen->root);
|
||||
CallCallbacks(&PostInitRootWindowCallback, walkScreen);
|
||||
}
|
||||
});
|
||||
|
||||
LogMessageVerb(X_INFO, 1, "Screen(s) initialized\n");
|
||||
|
||||
@@ -314,10 +310,7 @@ dix_main(int argc, char *argv[], char *envp[])
|
||||
|
||||
InputThreadFini();
|
||||
|
||||
for (unsigned int walkScreenIdx = 0; walkScreenIdx < screenInfo.numScreens; walkScreenIdx++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[walkScreenIdx];
|
||||
walkScreen->root = NullWindow;
|
||||
}
|
||||
DIX_FOR_EACH_SCREEN({ walkScreen->root = NullWindow; });
|
||||
|
||||
CloseDownDevices();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user