Fix some bad formatting.

Doing this:
    if (something) stmt;
is evil if you're debugging and want to break on stmt!
This commit is contained in:
Brian 2007-03-30 12:54:22 -06:00
parent 9f24798af5
commit 44acb2517d

View File

@ -198,7 +198,8 @@ static int *dmxSLCreate(void)
int *list = malloc(dmxNumScreens * sizeof(*list)); int *list = malloc(dmxNumScreens * sizeof(*list));
int i; int i;
for (i = 0; i < dmxNumScreens; i++) list[i] = 1; for (i = 0; i < dmxNumScreens; i++)
list[i] = 1;
return list; return list;
} }
@ -212,7 +213,9 @@ static void dmxSLFree(int *list)
static int dmxSLFindNext(int *list) static int dmxSLFindNext(int *list)
{ {
int i; int i;
for (i = 0; i < dmxNumScreens; i++) if (list[i]) return i; for (i = 0; i < dmxNumScreens; i++)
if (list[i])
return i;
return -1; return -1;
} }
@ -225,7 +228,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft)
int changed = 0; int changed = 0;
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
if (!screensLeft[i]) continue; if (!screensLeft[i])
continue;
screen = &dmxScreens[i]; screen = &dmxScreens[i];
switch (screen->where) { switch (screen->where) {
case PosAbsolute: case PosAbsolute:
@ -235,14 +239,16 @@ static int dmxTryComputeScreenOrigins(int *screensLeft)
break; break;
case PosRelative: case PosRelative:
ref = screen->whereRefScreen; ref = screen->whereRefScreen;
if (screensLeft[ref]) break; if (screensLeft[ref])
break;
dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + screen->whereX;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + screen->whereY;
++changed, screensLeft[i] = 0; ++changed, screensLeft[i] = 0;
break; break;
case PosRightOf: case PosRightOf:
ref = screen->whereRefScreen; ref = screen->whereRefScreen;
if (screensLeft[ref]) break; if (screensLeft[ref])
break;
pScreen = screenInfo.screens[ref]; pScreen = screenInfo.screens[ref];
dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width; dixScreenOrigins[i].x = dixScreenOrigins[ref].x + pScreen->width;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y; dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
@ -250,7 +256,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft)
break; break;
case PosLeftOf: case PosLeftOf:
ref = screen->whereRefScreen; ref = screen->whereRefScreen;
if (screensLeft[ref]) break; if (screensLeft[ref])
break;
pScreen = screenInfo.screens[i]; pScreen = screenInfo.screens[i];
dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width; dixScreenOrigins[i].x = dixScreenOrigins[ref].x - pScreen->width;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y; dixScreenOrigins[i].y = dixScreenOrigins[ref].y;
@ -258,7 +265,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft)
break; break;
case PosBelow: case PosBelow:
ref = screen->whereRefScreen; ref = screen->whereRefScreen;
if (screensLeft[ref]) break; if (screensLeft[ref])
break;
pScreen = screenInfo.screens[ref]; pScreen = screenInfo.screens[ref];
dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height; dixScreenOrigins[i].y = dixScreenOrigins[ref].y + pScreen->height;
@ -266,7 +274,8 @@ static int dmxTryComputeScreenOrigins(int *screensLeft)
break; break;
case PosAbove: case PosAbove:
ref = screen->whereRefScreen; ref = screen->whereRefScreen;
if (screensLeft[ref]) break; if (screensLeft[ref])
break;
pScreen = screenInfo.screens[i]; pScreen = screenInfo.screens[i];
dixScreenOrigins[i].x = dixScreenOrigins[ref].x; dixScreenOrigins[i].x = dixScreenOrigins[ref].x;
dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height; dixScreenOrigins[i].y = dixScreenOrigins[ref].y - pScreen->height;
@ -308,8 +317,10 @@ static void dmxComputeScreenOrigins(void)
minX = dixScreenOrigins[0].x; minX = dixScreenOrigins[0].x;
minY = dixScreenOrigins[0].y; minY = dixScreenOrigins[0].y;
for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */
if (dixScreenOrigins[i].x < minX) minX = dixScreenOrigins[i].x; if (dixScreenOrigins[i].x < minX)
if (dixScreenOrigins[i].y < minY) minY = dixScreenOrigins[i].y; minX = dixScreenOrigins[i].x;
if (dixScreenOrigins[i].y < minY)
minY = dixScreenOrigins[i].y;
} }
if (minX || minY) { if (minX || minY) {
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
@ -411,28 +422,36 @@ int dmxOnScreen(int x, int y, DMXScreenInfo *dmxScreen)
static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b) static int dmxDoesOverlap(DMXScreenInfo *a, DMXScreenInfo *b)
{ {
if (dmxOnScreen(a->rootXOrigin, if (dmxOnScreen(a->rootXOrigin,
a->rootYOrigin, b)) return 1; a->rootYOrigin, b))
return 1;
if (dmxOnScreen(a->rootXOrigin, if (dmxOnScreen(a->rootXOrigin,
a->rootYOrigin + a->scrnWidth, b)) return 1; a->rootYOrigin + a->scrnWidth, b))
return 1;
if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
a->rootYOrigin, b)) return 1; a->rootYOrigin, b))
return 1;
if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, if (dmxOnScreen(a->rootXOrigin + a->scrnHeight,
a->rootYOrigin + a->scrnWidth, b)) return 1; a->rootYOrigin + a->scrnWidth, b))
return 1;
if (dmxOnScreen(b->rootXOrigin, if (dmxOnScreen(b->rootXOrigin,
b->rootYOrigin, a)) return 1; b->rootYOrigin, a))
return 1;
if (dmxOnScreen(b->rootXOrigin, if (dmxOnScreen(b->rootXOrigin,
b->rootYOrigin + b->scrnWidth, a)) return 1; b->rootYOrigin + b->scrnWidth, a))
return 1;
if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
b->rootYOrigin, a)) return 1; b->rootYOrigin, a))
return 1;
if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, if (dmxOnScreen(b->rootXOrigin + b->scrnHeight,
b->rootYOrigin + b->scrnWidth, a)) return 1; b->rootYOrigin + b->scrnWidth, a))
return 1;
return 0; return 0;
} }
@ -476,7 +495,8 @@ static void *dmxTestSameDisplay(DMXScreenInfo *a, void *closure)
{ {
DMXScreenInfo *b = closure; DMXScreenInfo *b = closure;
if (a == b) return a; if (a == b)
return a;
return NULL; return NULL;
} }
@ -489,14 +509,16 @@ void dmxInitOverlap(void)
int i, j; int i, j;
DMXScreenInfo *a, *b, *pt; DMXScreenInfo *a, *b, *pt;
for (i = 0; i < dmxNumScreens; i++) dmxScreens[i].over = NULL; for (i = 0; i < dmxNumScreens; i++)
dmxScreens[i].over = NULL;
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
a = &dmxScreens[i]; a = &dmxScreens[i];
for (j = i+1; j < dmxNumScreens; j++) { for (j = i+1; j < dmxNumScreens; j++) {
b = &dmxScreens[j]; b = &dmxScreens[j];
if (b->over) continue; if (b->over)
continue;
if (dmxDoesOverlap(a, b)) { if (dmxDoesOverlap(a, b)) {
DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n", DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n",
@ -510,7 +532,8 @@ void dmxInitOverlap(void)
for (i = 0; i < dmxNumScreens; i++) { for (i = 0; i < dmxNumScreens; i++) {
a = &dmxScreens[i]; a = &dmxScreens[i];
if (!a->over) continue; if (!a->over)
continue;
/* Flag all pairs that are on same display */ /* Flag all pairs that are on same display */
for (pt = a->over; pt != a; pt = pt->over) { for (pt = a->over; pt != a; pt = pt->over) {
@ -521,7 +544,8 @@ void dmxInitOverlap(void)
* screens that mutually overlap on the backend display, * screens that mutually overlap on the backend display,
* so we call dmxDoesOverlap, which is stricter than the * so we call dmxDoesOverlap, which is stricter than the
* ->over set. */ * ->over set. */
if (!dmxDoesOverlap(a, pt)) continue; if (!dmxDoesOverlap(a, pt))
continue;
a->cursorNotShared = 1; a->cursorNotShared = 1;
pt->cursorNotShared = 1; pt->cursorNotShared = 1;
dmxLog(dmxInfo, dmxLog(dmxInfo,
@ -731,9 +755,11 @@ static Bool dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
return _dmxRealizeCursor(pScreen, pCursor); return _dmxRealizeCursor(pScreen, pCursor);
for (pt = start->over; /* condition at end of loop */; pt = pt->over) { for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
if (pt->cursorNotShared) continue; if (pt->cursorNotShared)
continue;
_dmxRealizeCursor(screenInfo.screens[pt->index], pCursor); _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor);
if (pt == start) break; if (pt == start)
break;
} }
return TRUE; return TRUE;
} }
@ -747,9 +773,11 @@ static Bool dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
return _dmxUnrealizeCursor(pScreen, pCursor); return _dmxUnrealizeCursor(pScreen, pCursor);
for (pt = start->over; /* condition at end of loop */; pt = pt->over) { for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
if (pt->cursorNotShared) continue; if (pt->cursorNotShared)
continue;
_dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor); _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor);
if (pt == start) break; if (pt == start)
break;
} }
return TRUE; return TRUE;
} }
@ -758,10 +786,13 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start)
{ {
DMXScreenInfo *pt; DMXScreenInfo *pt;
if (!start || !start->over) return GetSpriteCursor(); if (!start || !start->over)
return GetSpriteCursor();
for (pt = start->over; /* condition at end of loop */; pt = pt->over) { for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
if (pt->cursor) return pt->cursor; if (pt->cursor)
if (pt == start) break; return pt->cursor;
if (pt == start)
break;
} }
return GetSpriteCursor(); return GetSpriteCursor();
} }
@ -769,7 +800,12 @@ static CursorPtr dmxFindCursor(DMXScreenInfo *start)
/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This /** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This
* function is usually called via #dmxPointerSpriteFuncs, except during * function is usually called via #dmxPointerSpriteFuncs, except during
* reconfiguration when the cursor is repositioned to force an update on * reconfiguration when the cursor is repositioned to force an update on
* newley overlapping screens and on screens that no longer overlap. */ * newley overlapping screens and on screens that no longer overlap.
*
* The coords (x,y) are in global coord space. We'll loop over the
* back-end screens and see if they contain the global coord. If so, call
* _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen.
*/
void dmxMoveCursor(ScreenPtr pScreen, int x, int y) void dmxMoveCursor(ScreenPtr pScreen, int x, int y)
{ {
DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; DMXScreenInfo *start = &dmxScreens[pScreen->myNum];
@ -783,7 +819,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y)
} }
for (pt = start->over; /* condition at end of loop */; pt = pt->over) { for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
if (pt->cursorNotShared) continue; if (pt->cursorNotShared)
continue;
if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
if (/* pt != start && */ !pt->cursorVisible) { if (/* pt != start && */ !pt->cursorVisible) {
if (!pt->cursor) { if (!pt->cursor) {
@ -811,7 +848,8 @@ void dmxMoveCursor(ScreenPtr pScreen, int x, int y)
x + start->rootXOrigin - pt->rootXOrigin, x + start->rootXOrigin - pt->rootXOrigin,
y + start->rootYOrigin - pt->rootYOrigin); y + start->rootYOrigin - pt->rootYOrigin);
} }
if (pt == start) break; if (pt == start)
break;
} }
} }
@ -851,7 +889,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
} }
for (pt = start->over; /* condition at end of loop */; pt = pt->over) { for (pt = start->over; /* condition at end of loop */; pt = pt->over) {
if (pt->cursorNotShared) continue; if (pt->cursorNotShared)
continue;
if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) {
_dmxSetCursor(screenInfo.screens[pt->index], pCursor, _dmxSetCursor(screenInfo.screens[pt->index], pCursor,
x + start->rootXOrigin - pt->rootXOrigin, x + start->rootXOrigin - pt->rootXOrigin,
@ -861,7 +900,8 @@ static void dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
x + start->rootXOrigin - pt->rootXOrigin, x + start->rootXOrigin - pt->rootXOrigin,
y + start->rootYOrigin - pt->rootYOrigin); y + start->rootYOrigin - pt->rootYOrigin);
} }
if (pt == start) break; if (pt == start)
break;
} }
} }