[PATCH 2/3] panoramiX: convert 0->panoramiXNumScreens loops to macro (v2)
Dave Airlie
airlied at gmail.com
Wed Mar 9 15:23:34 PST 2011
From: Dave Airlie <airlied at redhat.com>
This just uses the FOR_NSCREENS macro instead.
also convert one num - 1 -> 0 loop.
v2: remove some of the 1->x loops.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
Xext/panoramiX.c | 10 +++++-----
Xext/panoramiXprocs.c | 2 +-
Xext/saver.c | 2 +-
Xext/xvdisp.c | 2 +-
dix/events.c | 4 ++--
dix/window.c | 4 ++--
hw/dmx/dmxcb.c | 7 ++++---
hw/dmx/dmxextension.c | 4 ++--
8 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index e6334bd..d10af70 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -393,7 +393,7 @@ static void XineramaInitData(ScreenPtr pScreen)
int i, w, h;
RegionNull(&PanoramiXScreenRegion);
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
BoxRec TheBox;
RegionRec ScreenRegion;
@@ -478,7 +478,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
* run in non-PanoramiXeen mode.
*/
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
pScreen = screenInfo.screens[i];
pScreenPriv = malloc(sizeof(PanoramiXScreenRec));
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
@@ -836,7 +836,7 @@ PanoramiXConsolidate(void)
saver = malloc(sizeof(PanoramiXRes));
saver->type = XRT_WINDOW;
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
ScreenPtr pScreen = screenInfo.screens[i];
root->info[i].id = pScreen->root->drawable.id;
root->u.win.class = InputOutput;
@@ -1074,7 +1074,7 @@ ProcXineramaQueryScreens(ClientPtr client)
xXineramaScreenInfo scratch;
int i;
- for(i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
scratch.x_org = screenInfo.screens[i]->x;
scratch.y_org = screenInfo.screens[i]->y;
scratch.width = screenInfo.screens[i]->width;
@@ -1179,7 +1179,7 @@ XineramaGetImageData(
depth = (format == XYPixmap) ? 1 : pDraw->depth;
- for(i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
BoxRec TheBox;
ScreenPtr pScreen;
pDraw = pDrawables[i];
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 3e68d0a..4eb9a13 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -2186,7 +2186,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client)
newCmap->type = XRT_COLORMAP;
panoramix_setup_ids(newCmap, client, stuff->mid);
- FOR_NSCREENS_BACKWARD(j){
+ FOR_NSCREENS_BACKWARD(j) {
stuff->srcCmap = cmap->info[j].id;
stuff->mid = newCmap->info[j].id;
result = (* SavedProcVector[X_CopyColormapAndFree])(client);
diff --git a/Xext/saver.c b/Xext/saver.c
index 1888603..492a54f 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1288,7 +1288,7 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
if (rc != Success)
return (rc == BadValue) ? BadDrawable : rc;
- for(i = PanoramiXNumScreens - 1; i > 0; i--) {
+ FOR_NSCREENS_BACKWARD(i) {
stuff->drawable = draw->info[i].id;
ScreenSaverUnsetAttributes(client);
}
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index deddebd..beb26a9 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -1927,7 +1927,7 @@ void XineramifyXv(void)
if(!port)
break;
- for(k = 0; k < PanoramiXNumScreens; k++) {
+ FOR_NSCREENS(k) {
if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j))
port->info[k].id = MatchingAdaptors[k]->base_id + j;
else
diff --git a/dix/events.c b/dix/events.c
index df62e83..5151f74 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -558,7 +558,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
if(pWin == screenInfo.screens[0]->root) {
int i;
- for (i = 0; i < PanoramiXNumScreens; i++)
+ FOR_NSCREENS(i)
pSprite->windows[i] = screenInfo.screens[i]->root;
} else {
PanoramiXRes *win;
@@ -569,7 +569,7 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
if (rc != Success)
return FALSE;
- for(i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
rc = dixLookupWindow(pSprite->windows + i, win->info[i].id,
serverClient, DixReadAccess);
if (rc != Success) /* window is being unmapped */
diff --git a/dix/window.c b/dix/window.c
index 9be7064..3668370 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -3067,7 +3067,7 @@ SendVisibilityNotify(WindowPtr pWin)
switch(visibility) {
case VisibilityUnobscured:
- for(i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
if(i == Scrnum) continue;
rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
@@ -3089,7 +3089,7 @@ SendVisibilityNotify(WindowPtr pWin)
}
break;
case VisibilityFullyObscured:
- for(i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
if(i == Scrnum) continue;
rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
diff --git a/hw/dmx/dmxcb.c b/hw/dmx/dmxcb.c
index 4e7279a..d0eb351 100644
--- a/hw/dmx/dmxcb.c
+++ b/hw/dmx/dmxcb.c
@@ -46,6 +46,7 @@
extern int connBlockScreenStart;
#ifdef PANORAMIX
+#include "panoramiXsrv.h"
extern int PanoramiXPixWidth;
extern int PanoramiXPixHeight;
extern int PanoramiXNumScreens;
@@ -137,7 +138,7 @@ void dmxConnectionBlockCallback(void)
}
dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n",
PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight);
- for (i = 0; i < PanoramiXNumScreens; i++) found[i] = FALSE;
+ FOR_NSCREENS(i) found[i] = FALSE;
} else {
#endif
/* This never happens because we're
@@ -177,7 +178,7 @@ void dmxConnectionBlockCallback(void)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
int k;
- for (k = 0; k < PanoramiXNumScreens; k++) {
+ FOR_NSCREENS(k) {
DMXScreenInfo *dmxScreen = &dmxScreens[k];
if (dmxScreen->beDisplay) {
@@ -203,7 +204,7 @@ void dmxConnectionBlockCallback(void)
#ifdef PANORAMIX
if (!noPanoramiXExtension) {
Bool fatal = FALSE;
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
fatal |= !found[i];
if (!found[i]) {
dmxLog(dmxError,
diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c
index bd326ce..db5709e 100644
--- a/hw/dmx/dmxextension.c
+++ b/hw/dmx/dmxextension.c
@@ -703,7 +703,7 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type,
RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv = NULL;
@@ -1372,7 +1372,7 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type,
RT_PIXMAP, NullClient, DixUnknownAccess);
if (pPix != pDst) return; /* Not a match.... Next! */
- for (i = 0; i < PanoramiXNumScreens; i++) {
+ FOR_NSCREENS(i) {
PixmapPtr pSrc;
dmxPixPrivPtr pSrcPriv = NULL;
--
1.7.3.4
More information about the xorg-devel
mailing list