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
@@ -22,6 +22,7 @@
|
||||
#include <dix-config.h>
|
||||
|
||||
#include "dix/screen_hooks_priv.h"
|
||||
#include "dix/screenint_priv.h"
|
||||
#include "miext/extinit_priv.h"
|
||||
|
||||
#include "dri3_priv.h"
|
||||
@@ -76,7 +77,6 @@ void
|
||||
dri3_extension_init(void)
|
||||
{
|
||||
ExtensionEntry *extension;
|
||||
int i;
|
||||
|
||||
/* If no screens support DRI3, there's no point offering the
|
||||
* extension at all
|
||||
@@ -97,11 +97,10 @@ dri3_extension_init(void)
|
||||
|
||||
dri3_request = extension->base;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[i];
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
if (!dri3_screen_init(walkScreen, NULL))
|
||||
goto bail;
|
||||
}
|
||||
});
|
||||
|
||||
dri3_syncobj_type = CreateNewResourceType(dri3_syncobj_free, "DRI3Syncobj");
|
||||
if (!dri3_syncobj_type)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "dix/dix_priv.h"
|
||||
#include "dix/request_priv.h"
|
||||
#include "dix/screenint_priv.h"
|
||||
#include "os/client_priv.h"
|
||||
|
||||
#include "dri3_priv.h"
|
||||
@@ -73,8 +74,7 @@ proc_dri3_query_version(ClientPtr client)
|
||||
|
||||
REQUEST_SIZE_MATCH(xDRI3QueryVersionReq);
|
||||
|
||||
for (int i = 0; i < screenInfo.numScreens; i++) {
|
||||
ScreenPtr walkScreen = screenInfo.screens[i];
|
||||
DIX_FOR_EACH_SCREEN({
|
||||
if (!dri3_screen_can_one_point_two(walkScreen)) {
|
||||
rep.minorVersion = 0;
|
||||
break;
|
||||
@@ -83,10 +83,9 @@ proc_dri3_query_version(ClientPtr client)
|
||||
rep.minorVersion = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < screenInfo.numGPUScreens; i++) {
|
||||
ScreenPtr walkScreen = screenInfo.gpuscreens[i];
|
||||
DIX_FOR_EACH_GPU_SCREEN({
|
||||
if (!dri3_screen_can_one_point_two(walkScreen)) {
|
||||
rep.minorVersion = 0;
|
||||
break;
|
||||
@@ -95,7 +94,7 @@ proc_dri3_query_version(ClientPtr client)
|
||||
rep.minorVersion = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* From DRI3 proto:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user