[beryl-commits] r1465 - branches/beryl-3d-plugin
roico at server.beryl-project.org
roico at server.beryl-project.org
Sat Dec 2 00:22:24 CET 2006
Author: roico
Date: 2006-12-02 00:22:22 +0100 (Sat, 02 Dec 2006)
New Revision: 1465
Modified:
branches/beryl-3d-plugin/3d.c
Log:
some more multiscreen fixes.
Modified: branches/beryl-3d-plugin/3d.c
===================================================================
--- branches/beryl-3d-plugin/3d.c 2006-11-30 13:13:33 UTC (rev 1464)
+++ branches/beryl-3d-plugin/3d.c 2006-12-01 23:22:22 UTC (rev 1465)
@@ -128,6 +128,8 @@
int mmModeAtom;
MultiMonitorMode currentMmMode;
+ Bool currentDifferentResolutions;
+
int currentScreenNum;
float mvm[16]; //ModelView Matrix.
@@ -189,31 +191,68 @@
return FALSE;
}
-static int
-horizontalScreenNum(CompScreen* s)
+static Bool
+differentResolutions(CompScreen* s)
{
- int i;
- int count = 0;
-
- for(i = 0; i < s->nOutputDev; i++)
+ //This code is taken from cube plugin... thanks for whoever wrote it (davidr i guess).
+
+ BoxPtr pBox0, pBox1;
+ int i, j, k;
+
+ k = 0;
+
+ for (i = 0; i < s->nOutputDev; i++)
{
- if( s->outputDev[i].region.extents.y1 == 0)
- count ++;
+ /* dimensions must match first output */
+ if (s->outputDev[i].width != s->outputDev[0].width ||
+ s->outputDev[i].height != s->outputDev[0].height)
+ continue;
+
+ pBox0 = &s->outputDev[0].region.extents;
+ pBox1 = &s->outputDev[i].region.extents;
+
+ /* top and bottom line must match first output */
+ if (pBox0->y1 != pBox1->y1 || pBox0->y2 != pBox1->y2)
+ continue;
+
+ k++;
+
+ for (j = 0; j < s->nOutputDev; j++)
+ {
+ pBox0 = &s->outputDev[j].region.extents;
+
+ /* must not intersect other output region */
+ if (i != j && pBox0->x2 > pBox1->x1 && pBox0->x1 < pBox1->x2)
+ {
+ k--;
+ break;
+ }
+ }
}
- return count;
+ if( k != s->nOutputDev)
+ return TRUE;
+
+ return FALSE;
}
#define VIEWPORT(x, s) ( ( ( ((x>=0)?x: x + s->hsize * s->width) ) / (s->width)) % (s->hsize) )
+#define SCREEN(x, s) (x / s->outputDev[0].width)
#define RIGHT_VIEWPORT(w) VIEWPORT(w->attrib.x + w->attrib.width -1, w->screen)
#define LEFT_VIEWPORT(w) VIEWPORT(w->attrib.x + 1, w->screen)
+#define RIGHT_SCREEN(w) SCREEN(w->attrib.x + w->attrib.width -1, w->screen)
+#define LEFT_SCREEN(w) SCREEN(w->attrib.x + 1, w->screen)
+
#define IS_IN_VIEWPORT(w, i) ( ( LEFT_VIEWPORT(w) > RIGHT_VIEWPORT(w) && !(LEFT_VIEWPORT(w) > i && i > RIGHT_VIEWPORT(w)) ) \
|| ( LEFT_VIEWPORT(w) <= i && i <= RIGHT_VIEWPORT(w) ) )
#define DO_3D(d) (compDisplayGetRequestFlagForAny (d, "ENABLE_3D"))
+#define MULTISCREENCUBE_MODE ( (tds->currentMmMode == Automatic && !tds->currentDifferentResolutions) \
+ || tds->currentMmMode == Multiscreen )
+
static void
reorder(CompScreen* screen)
{
@@ -329,14 +368,16 @@
if( tds->currentMmMode != IPCS_GetInt (IPCS_OBJECT(screen), tds->mmModeAtom)
|| tds->currentViewportNum != screen->hsize
- || tds->currentScreenNum != horizontalScreenNum(screen))
+ || tds->currentScreenNum != screen->nOutputDev
+ || tds->currentDifferentResolutions != differentResolutions(screen))
{
tds->currentViewportNum = screen->hsize;
tds->currentMmMode = IPCS_GetInt (IPCS_OBJECT(screen), tds->mmModeAtom);
- tds->currentScreenNum = horizontalScreenNum(screen);
+ tds->currentScreenNum = screen->nOutputDev;
+ tds->currentDifferentResolutions = differentResolutions(screen);
- if( tds->currentMmMode == Automatic || tds->currentMmMode == Multiscreen )
+ if( MULTISCREENCUBE_MODE )
tds->currentViewportNum *= tds->currentScreenNum;
@@ -346,7 +387,7 @@
tds->xMove = 0.0f;
- if( tds->currentMmMode == Automatic || tds->currentMmMode == Multiscreen )
+ if( MULTISCREENCUBE_MODE )
tds->currentViewportNum /= tds->currentScreenNum;
}
@@ -418,7 +459,7 @@
int output = tds->tmpOutput;
int width;
- if( output < w->screen->nOutputDev && (tds->currentMmMode == Multiscreen || tds->currentMmMode == Automatic))
+ if( output < w->screen->nOutputDev && MULTISCREENCUBE_MODE)
width = w->screen->outputDev[output].width;
else
width = w->screen->width;
@@ -501,12 +542,14 @@
}
}
- if(LEFT_VIEWPORT(w) != RIGHT_VIEWPORT(w))
+ if( !(MULTISCREENCUBE_MODE && tds->currentDifferentResolutions)
+ && ( LEFT_VIEWPORT(w) != RIGHT_VIEWPORT(w)
+ || LEFT_SCREEN(w) != RIGHT_SCREEN(w)) ) )
{
- if(LEFT_VIEWPORT(w) == 0)
+ if(LEFT_VIEWPORT(w) == 0 || LEFT_SCREEN(w) == output)
glTranslatef(width * tdw->currentZ * tds->xMove, 0.0f, 0.0f);
- else if(RIGHT_VIEWPORT(w) == 0)
+ else if(RIGHT_VIEWPORT(w) == 0 || RIGHT_SCREEN(w) == output)
glTranslatef(-width * tdw->currentZ * tds->xMove, 0.0f, 0.0f);
}
@@ -836,16 +879,16 @@
tds->tdWindowExists = FALSE;
//tds->reorder = TRUE;
tds->revertReorder = NULL;
-
- tds->currentViewportNum = s->hsize;
tds->mmModeAtom = IPCS_GetAtom (IPCS_OBJECT (s), IPCS_INT,
"MM_MODE", TRUE);
+
+ tds->currentViewportNum = s->hsize;
tds->currentMmMode = IPCS_GetInt (IPCS_OBJECT(s), tds->mmModeAtom);
-
- tds->currentScreenNum = horizontalScreenNum(s);
+ tds->currentScreenNum = s->nOutputDev;
+ tds->currentDifferentResolutions = differentResolutions(s);
- if( tds->currentMmMode == Automatic || tds->currentMmMode == Multiscreen )
+ if( MULTISCREENCUBE_MODE )
tds->currentViewportNum *= tds->currentScreenNum;
@@ -855,7 +898,7 @@
tds->xMove = 0.0f;
- if( tds->currentMmMode == Automatic || tds->currentMmMode == Multiscreen )
+ if( MULTISCREENCUBE_MODE )
tds->currentViewportNum /= tds->currentScreenNum;
WRAP(tds, s, paintTransformedScreen, tdPaintTransformedScreen);
More information about the commits
mailing list