[beryl-commits] compiz mirror: Changes to 'master' (97a4a6c90a935088e75c73371a054b5c4b8d5d10)

compiz at server.beryl-project.org compiz at server.beryl-project.org
Fri Jun 1 01:35:28 CEST 2007


New commits:
commit 97a4a6c90a935088e75c73371a054b5c4b8d5d10
Merge: d3026e2adfdc1a55876000399446d4b64b37031f 0a1e76975d0dd55cb788db2c90a088c1125cb2a0
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Fri Jun 1 02:30:56 2007 +0200

    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/app/compiz
    
    Conflicts:
    
    	include/compiz.h
    	plugins/zoom.c

commit d3026e2adfdc1a55876000399446d4b64b37031f
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 19:17:40 2007 +0200

    Added a fullscreenOutput variable to CompScreen.

commit fea4af7bac8f7ce3f745eefa3264642c47939f43
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 19:03:43 2007 +0200

    Handle glViewport change correctly.

commit e07f9352baa1089b372565097d2a45192f1d5e8b
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 18:56:17 2007 +0200

    Applied temporary changes to cube to make it work with lastest core changes.

commit 139e256684237d4db4ff14ebdc0fb935721b084b
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 18:07:08 2007 +0200

    Applied temporary changes to clone to make it work with lastest core changes.

commit 17eb4953b7a6507395d80ece16609d69c768f87a
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:57:25 2007 +0200

    Use new paintScreen function in screenshot.

commit 0969a119f27336d80f707078f59229208d9c3865
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:48:29 2007 +0200

    Applied lastest core changes to blur.

commit 955ef3489ffdf96055d675ee33f0e9359fca1fc1
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:47:06 2007 +0200

    Applied lastest core changes to annotate, plane, resize, screenshot and switcher.

commit cd3a27dd52a6e4ed490d8412bfae07fbc6e1ccb7
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:46:15 2007 +0200

    Applied lastest core changes to wobbly, minimize, rotate and scale.

commit 2d261bf04f7f2d4a2ae681952ce0ef37daefc42b
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:44:15 2007 +0200

    Bump ABI version

commit 77e3efa7c1f7d1249c3b6451ac672aacb3e429ee
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:43:07 2007 +0200

    Added a new wrapable paintScreen function to allow plugins to maniplulate output device dependent painting.

commit 4f6c6408caf4e43fca3f6c73db39ef80c7782da5
Author: Dennis Kasprzyk <onestone at opencompositing.org>
Date:   Thu May 31 17:42:23 2007 +0200

    Renamed paint(Transformed)Screen to paint(Transfomed)Output.
    
    for FILE in `find . -name "*.[ch]"`; do
        BASE=`basename $FILE`
        cat $FILE | sed -e 's/aintScreen/aintOutput/g' -e 's/aintTransformedScreen/aintTransformedOutput/g' > /tmp/$BASE    cat /tmp/$BASE | sed -e 's/parePaintOutput/parePaintScreen/g' -e 's/onePaintOutput/onePaintScreen/g'  > $FILE
        rm /tmp/$BASE
    done


 include/compiz.h     |   48 ++++++++++++-------
 include/cube.h       |    6 +-
 plugins/annotate.c   |   16 +++---
 plugins/blur.c       |   48 +++++++++---------
 plugins/clone.c      |   23 ++++++---
 plugins/cube.c       |   77 +++++++++++++++++++-----------
 plugins/minimize.c   |   16 +++---
 plugins/plane.c      |   40 ++++++++--------
 plugins/resize.c     |   26 +++++-----
 plugins/rotate.c     |   16 +++---
 plugins/scale.c      |   16 +++---
 plugins/screenshot.c |   97 ++++++++++++++++++++++++--------------
 plugins/switcher.c   |   28 ++++++------
 plugins/wobbly.c     |   16 +++---
 plugins/zoom.c       |   20 ++++----
 src/display.c        |  127 ++++++++++++++++++++++++++++++--------------------
 src/paint.c          |   56 +++++++++++-----------
 src/screen.c         |   16 +++++-
 18 files changed, 398 insertions(+), 294 deletions(-)


Modified: compiz/include/compiz.h
===================================================================
--- compiz/include/compiz.h
+++ compiz/include/compiz.h
@@ -26,7 +26,7 @@
 #ifndef _COMPIZ_H
 #define _COMPIZ_H
 
-#define ABIVERSION 20070524
+#define ABIVERSION 20070601
 
 #include <stdio.h>
 #include <sys/time.h>
@@ -89,6 +89,7 @@ typedef struct _FragmentAttrib    FragmentAttrib;
 typedef struct _CompCursor	  CompCursor;
 typedef struct _CompMatch	  CompMatch;
 typedef struct _CompMetadata      CompMetadata;
+typedef struct _CompOutput        CompOutput;
 
 /* virtual modifiers */
 
@@ -1202,24 +1203,29 @@ typedef void (*DonePaintScreenProc) (CompScreen *screen);
 #define PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK (1 << 3)
 #define PAINT_SCREEN_CLEAR_MASK			   (1 << 4)
 
-typedef Bool (*PaintScreenProc) (CompScreen		 *screen,
+typedef void (*PaintScreenProc) (CompScreen   *screen,
+				 CompOutput   *outputs,
+				 int          numOutput,
+				 unsigned int mask);
+
+typedef Bool (*PaintOutputProc) (CompScreen		 *screen,
 				 const ScreenPaintAttrib *sAttrib,
 				 const CompTransform	 *transform,
 				 Region			 region,
-				 int		         output,
+				 CompOutput		 *output,
 				 unsigned int		 mask);
 
-typedef void (*PaintTransformedScreenProc) (CompScreen		    *screen,
+typedef void (*PaintTransformedOutputProc) (CompScreen		    *screen,
 					    const ScreenPaintAttrib *sAttrib,
 					    const CompTransform	    *transform,
 					    Region		    region,
-					    int			    output,
+					    CompOutput		    *output,
 					    unsigned int	    mask);
 
 /* XXX: ApplyScreenTransformProc will be removed */
 typedef void (*ApplyScreenTransformProc) (CompScreen		  *screen,
 					  const ScreenPaintAttrib *sAttrib,
-					  int			  output,
+					  CompOutput		  *output,
 					  CompTransform	          *transform);
 
 /*
@@ -1312,37 +1318,43 @@ donePaintScreen (CompScreen *screen);
 
 void
 transformToScreenSpace (CompScreen    *screen,
-			int	      output,
+			CompOutput    *output,
 			float         z,
 			CompTransform *transform);
 
 /* XXX: prepareXCoords will be removed */
 void
 prepareXCoords (CompScreen *screen,
-		int	   output,
+		CompOutput *output,
 		float      z);
 
 void
-paintTransformedScreen (CompScreen		*screen,
+paintTransformedOutput (CompScreen		*screen,
 			const ScreenPaintAttrib *sAttrib,
 			const CompTransform	*transform,
 			Region			region,
-			int			output,
+			CompOutput		*output,
 			unsigned int	        mask);
 
 /* XXX: applyScreenTransform will be removed */
 void
 applyScreenTransform (CompScreen	      *screen,
 		      const ScreenPaintAttrib *sAttrib,
-		      int		      output,
+		      CompOutput	      *output,
 		      CompTransform	      *transform);
 
+void
+paintScreen (CompScreen   *screen,
+	     CompOutput   *outputs,
+	     int          numOutput,
+	     unsigned int mask);
+
 Bool
-paintScreen (CompScreen		     *screen,
+paintOutput (CompScreen		     *screen,
 	     const ScreenPaintAttrib *sAttrib,
 	     const CompTransform     *transform,
 	     Region		     region,
-	     int		     output,
+	     CompOutput		     *output,
 	     unsigned int	     mask);
 
 Bool
@@ -1759,13 +1771,13 @@ struct _CompIcon {
     int		height;
 };
 
-typedef struct _CompOutput {
+struct _CompOutput {
     char       *name;
     REGION     region;
     int        width;
     int        height;
     XRectangle workArea;
-} CompOutput;
+};
 
 typedef struct _CompCursorImage {
     struct _CompCursorImage *next;
@@ -1852,6 +1864,7 @@ struct _CompScreen {
     CompOutput *outputDev;
     int	       nOutputDev;
     int	       currentOutputDev;
+    CompOutput fullscreenOutput;
 
     CompActiveWindowHistory history[ACTIVE_WINDOW_HISTORY_NUM];
     int			    currentHistory;
@@ -1969,7 +1982,8 @@ struct _CompScreen {
     PreparePaintScreenProc	   preparePaintScreen;
     DonePaintScreenProc		   donePaintScreen;
     PaintScreenProc		   paintScreen;
-    PaintTransformedScreenProc	   paintTransformedScreen;
+    PaintOutputProc		   paintOutput;
+    PaintTransformedOutputProc	   paintTransformedOutput;
     ApplyScreenTransformProc	   applyScreenTransform;
     PaintBackgroundProc		   paintBackground;
     PaintWindowProc		   paintWindow;
@@ -2213,7 +2227,7 @@ outputChangeNotify (CompScreen *s);
 
 void
 clearScreenOutput (CompScreen   *s,
-		   int	        output,
+		   CompOutput	*output,
 		   unsigned int mask);
 
 void

Modified: compiz/include/cube.h
===================================================================
--- compiz/include/cube.h
+++ compiz/include/cube.h
@@ -68,14 +68,14 @@ typedef void (*CubeClearTargetOutputProc) (CompScreen *s,
 typedef void (*CubePaintTopBottomProc) (CompScreen		*s,
 					const ScreenPaintAttrib *sAttrib,
 					const CompTransform	*transform,
-					int			output,
+					CompOutput		*output,
 					int			size);
 
 typedef struct _CubeScreen {
     PreparePaintScreenProc     preparePaintScreen;
     DonePaintScreenProc	       donePaintScreen;
-    PaintScreenProc	       paintScreen;
-    PaintTransformedScreenProc paintTransformedScreen;
+    PaintOutputProc	       paintOutput;
+    PaintTransformedOutputProc paintTransformedOutput;
     PaintBackgroundProc        paintBackground;
     ApplyScreenTransformProc   applyScreenTransform;
     SetScreenOptionProc	       setScreenOption;

Modified: compiz/plugins/annotate.c
===================================================================
--- compiz/plugins/annotate.c
+++ compiz/plugins/annotate.c
@@ -55,7 +55,7 @@ typedef struct _AnnoDisplay {
 } AnnoDisplay;
 
 typedef struct _AnnoScreen {
-    PaintScreenProc paintScreen;
+    PaintOutputProc paintOutput;
     int		    grabIndex;
 
     Pixmap	    pixmap;
@@ -583,20 +583,20 @@ annoClear (CompDisplay     *d,
 }
 
 static Bool
-annoPaintScreen (CompScreen		 *s,
+annoPaintOutput (CompScreen		 *s,
 		 const ScreenPaintAttrib *sAttrib,
 		 const CompTransform	 *transform,
 		 Region			 region,
-		 int			 output,
+		 CompOutput		 *output,
 		 unsigned int		 mask)
 {
     Bool status;
 
     ANNO_SCREEN (s);
 
-    UNWRAP (as, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (as, s, paintScreen, annoPaintScreen);
+    UNWRAP (as, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (as, s, paintOutput, annoPaintOutput);
 
     if (status && as->content && region->numRects)
     {
@@ -819,7 +819,7 @@ annoInitScreen (CompPlugin *p,
 
     initTexture (s, &as->texture);
 
-    WRAP (as, s, paintScreen, annoPaintScreen);
+    WRAP (as, s, paintOutput, annoPaintOutput);
 
     s->privates[ad->screenPrivateIndex].ptr = as;
 
@@ -843,7 +843,7 @@ annoFiniScreen (CompPlugin *p,
     if (as->pixmap)
 	XFreePixmap (s->display->display, as->pixmap);
 
-    UNWRAP (as, s, paintScreen);
+    UNWRAP (as, s, paintOutput);
 
     free (as);
 }

Modified: compiz/plugins/blur.c
===================================================================
--- compiz/plugins/blur.c
+++ compiz/plugins/blur.c
@@ -104,8 +104,8 @@ typedef struct _BlurScreen {
 
     PreparePaintScreenProc       preparePaintScreen;
     DonePaintScreenProc          donePaintScreen;
-    PaintScreenProc	         paintScreen;
-    PaintTransformedScreenProc	 paintTransformedScreen;
+    PaintOutputProc	         paintOutput;
+    PaintTransformedOutputProc	 paintTransformedOutput;
     PaintWindowProc	         paintWindow;
     DrawWindowProc	         drawWindow;
     DrawWindowTextureProc        drawWindowTexture;
@@ -135,7 +135,7 @@ typedef struct _BlurScreen {
     BoxRec stencilBox;
     GLint  stencilBits;
 
-    int output;
+    CompOutput *output;
     int count;
 
     GLuint texture[2];
@@ -849,11 +849,11 @@ blurPreparePaintScreen (CompScreen *s,
 }
 
 static Bool
-blurPaintScreen (CompScreen		 *s,
+blurPaintOutput (CompScreen		 *s,
 		 const ScreenPaintAttrib *sAttrib,
 		 const CompTransform	 *transform,
 		 Region			 region,
-		 int			 output,
+		 CompOutput		 *output,
 		 unsigned int		 mask)
 {
     Bool status;
@@ -893,19 +893,19 @@ blurPaintScreen (CompScreen		 *s,
 
     bs->output = output;
 
-    UNWRAP (bs, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (bs, s, paintScreen, blurPaintScreen);
+    UNWRAP (bs, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (bs, s, paintOutput, blurPaintOutput);
 
     return status;
 }
 
 static void
-blurPaintTransformedScreen (CompScreen		    *s,
+blurPaintTransformedOutput (CompScreen		    *s,
 			    const ScreenPaintAttrib *sAttrib,
 			    const CompTransform	    *transform,
 			    Region		    region,
-			    int			    output,
+			    CompOutput		    *output,
 			    unsigned int	    mask)
 {
     BLUR_SCREEN (s);
@@ -921,10 +921,10 @@ blurPaintTransformedScreen (CompScreen		    *s,
 			     GET_BLUR_WINDOW (w, bs)->clip);
     }
 
-    UNWRAP (bs, s, paintTransformedScreen);
-    (*s->paintTransformedScreen) (s, sAttrib, transform,
+    UNWRAP (bs, s, paintTransformedOutput);
+    (*s->paintTransformedOutput) (s, sAttrib, transform,
 				   region, output, mask);
-    WRAP (bs, s, paintTransformedScreen, blurPaintTransformedScreen);
+    WRAP (bs, s, paintTransformedOutput, blurPaintTransformedOutput);
 }
 
 static void
@@ -1266,7 +1266,7 @@ getDstBlurFragmentFunction (CompScreen  *s,
 
 static Bool
 projectVertices (CompScreen	     *s,
-		 int		     output,
+		 CompOutput	     *output,
 		 const CompTransform *transform,
 		 const float	     *object,
 		 float		     *screen,
@@ -1278,10 +1278,10 @@ projectVertices (CompScreen	     *s,
     double   x, y, z;
     int	     i;
 
-    viewport[0] = s->outputDev[output].region.extents.x1;
-    viewport[1] = s->height - s->outputDev[output].region.extents.y2;
-    viewport[2] = s->outputDev[output].width;
-    viewport[3] = s->outputDev[output].height;
+    viewport[0] = output->region.extents.x1;
+    viewport[1] = s->height - output->region.extents.y2;
+    viewport[2] = output->width;
+    viewport[3] = output->height;
 
     for (i = 0; i < 16; i++)
     {
@@ -1532,7 +1532,7 @@ fboUpdate (CompScreen *s,
 
 static void
 blurProjectRegion (CompWindow	       *w,
-		   int		       output,
+		   CompOutput	       *output,
 		   const CompTransform *transform)
 {
     CompScreen *s = w->screen;
@@ -2573,7 +2573,7 @@ blurInitScreen (CompPlugin *p,
 	return FALSE;
     }
 
-    bs->output = 0;
+    bs->output = NULL;
     bs->count  = 0;
 
     bs->filterRadius = 0;
@@ -2606,8 +2606,8 @@ blurInitScreen (CompPlugin *p,
 
     WRAP (bs, s, preparePaintScreen, blurPreparePaintScreen);
     WRAP (bs, s, donePaintScreen, blurDonePaintScreen);
-    WRAP (bs, s, paintScreen, blurPaintScreen);
-    WRAP (bs, s, paintTransformedScreen, blurPaintTransformedScreen);
+    WRAP (bs, s, paintOutput, blurPaintOutput);
+    WRAP (bs, s, paintTransformedOutput, blurPaintTransformedOutput);
     WRAP (bs, s, paintWindow, blurPaintWindow);
     WRAP (bs, s, drawWindow, blurDrawWindow);
     WRAP (bs, s, drawWindowTexture, blurDrawWindowTexture);
@@ -2652,8 +2652,8 @@ blurFiniScreen (CompPlugin *p,
 
     UNWRAP (bs, s, preparePaintScreen);
     UNWRAP (bs, s, donePaintScreen);
-    UNWRAP (bs, s, paintScreen);
-    UNWRAP (bs, s, paintTransformedScreen);
+    UNWRAP (bs, s, paintOutput);
+    UNWRAP (bs, s, paintTransformedOutput);
     UNWRAP (bs, s, paintWindow);
     UNWRAP (bs, s, drawWindow);
     UNWRAP (bs, s, drawWindowTexture);

Modified: compiz/plugins/clone.c
===================================================================
--- compiz/plugins/clone.c
+++ compiz/plugins/clone.c
@@ -55,7 +55,7 @@ typedef struct _CloneClone {
 typedef struct _CloneScreen {
     PreparePaintScreenProc preparePaintScreen;
     DonePaintScreenProc	   donePaintScreen;
-    PaintScreenProc	   paintScreen;
+    PaintOutputProc	   paintOutput;
     PaintWindowProc	   paintWindow;
     OutputChangeNotifyProc outputChangeNotify;
 
@@ -288,14 +288,20 @@ clonePaintScreen (CompScreen		  *s,
 		  const ScreenPaintAttrib *sAttrib,
 		  const CompTransform	  *transform,
 		  Region		  region,
-		  int			  output,
+		  CompOutput		  *outputPtr,
 		  unsigned int		  mask)
 {
     Bool status;
-    int  i, dst = output;
+    int  i, dst, output = 0;
 
     CLONE_SCREEN (s);
 
+    for (i = 0; i < s->nOutputDev; i++)
+	if (!memcmp (outputPtr, &s->outputDev[i], sizeof (CompOutput)))
+	    output = i;
+
+    dst = output;
+
     if (!cs->grab || cs->grabbedOutput != output)
     {
 	for (i = 0; i < cs->nClone; i++)
@@ -316,9 +322,10 @@ clonePaintScreen (CompScreen		  *s,
 	}
     }
 
-    UNWRAP (cs, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, dst, mask);
-    WRAP (cs, s, paintScreen, clonePaintScreen);
+    UNWRAP (cs, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region,
+				&s->outputDev[dst], mask);
+    WRAP (cs, s, paintOutput, clonePaintScreen);
 
     if (cs->grab)
     {
@@ -787,7 +794,7 @@ cloneInitScreen (CompPlugin *p,
 
     WRAP (cs, s, preparePaintScreen, clonePreparePaintScreen);
     WRAP (cs, s, donePaintScreen, cloneDonePaintScreen);
-    WRAP (cs, s, paintScreen, clonePaintScreen);
+    WRAP (cs, s, paintOutput, clonePaintScreen);
     WRAP (cs, s, paintWindow, clonePaintWindow);
     WRAP (cs, s, outputChangeNotify, cloneOutputChangeNotify);
 
@@ -804,7 +811,7 @@ cloneFiniScreen (CompPlugin *p,
 
     UNWRAP (cs, s, preparePaintScreen);
     UNWRAP (cs, s, donePaintScreen);
-    UNWRAP (cs, s, paintScreen);
+    UNWRAP (cs, s, paintOutput);
     UNWRAP (cs, s, paintWindow);
     UNWRAP (cs, s, outputChangeNotify);
 

Modified: compiz/plugins/cube.c
===================================================================
--- compiz/plugins/cube.c
+++ compiz/plugins/cube.c
@@ -794,14 +794,15 @@ cubePreparePaintScreen (CompScreen *s,
 }
 
 static Bool
-cubePaintScreen (CompScreen		 *s,
+cubePaintOutput (CompScreen		 *s,
 		 const ScreenPaintAttrib *sAttrib,
 		 const CompTransform	*transform,
 		 Region			 region,
-		 int			 output,
+		 CompOutput		 *output,
 		 unsigned int		 mask)
 {
     Bool status;
+    int i;
 
     CUBE_SCREEN (s);
 
@@ -811,11 +812,14 @@ cubePaintScreen (CompScreen		 *s,
 	mask |= PAINT_SCREEN_TRANSFORMED_MASK;
     }
 
-    cs->srcOutput = output;
+    cs->srcOutput = 0;
+    for (i = 0; i < s->nOutputDev; i++)
+	if (!memcmp (output, &s->outputDev[i], sizeof (CompOutput)))
+	    cs->srcOutput = i;
 
-    UNWRAP (cs, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (cs, s, paintScreen, cubePaintScreen);
+    UNWRAP (cs, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (cs, s, paintOutput, cubePaintOutput);
 
     return status;
 }
@@ -837,12 +841,18 @@ static void
 cubeMoveViewportAndPaint (CompScreen		  *s,
 			  const ScreenPaintAttrib *sAttrib,
 			  const CompTransform	  *transform,
-			  int			  output,
+			  CompOutput		  *outputPtr,
 			  unsigned int		  mask,
 			  int			  dx)
 {
+    int i, output = 0;
+    
     CUBE_SCREEN (s);
 
+    for (i = 0; i < s->nOutputDev; i++)
+	if (!memcmp (outputPtr, &s->outputDev[i], sizeof (CompOutput)))
+	    output = i;
+    
     if (cs->nOutput > 1)
     {
 	int cubeOutput, dView;
@@ -868,16 +878,16 @@ cubeMoveViewportAndPaint (CompScreen		  *s,
 	output = cs->srcOutput = cs->output[cubeOutput];
 
 	moveScreenViewport (s, -dView, 0, FALSE);
-	(*s->paintTransformedScreen) (s, sAttrib, transform,
+	(*s->paintTransformedOutput) (s, sAttrib, transform,
 				      &s->outputDev[output].region,
-				      output, mask);
+				      &s->outputDev[output], mask);
 	moveScreenViewport (s, dView, 0, FALSE);
     }
     else
     {
 	moveScreenViewport (s, dx, 0, FALSE);
-	(*s->paintTransformedScreen) (s, sAttrib, transform, &s->region,
-				      output, mask);
+	(*s->paintTransformedOutput) (s, sAttrib, transform, &s->region,
+				      outputPtr, mask);
 	moveScreenViewport (s, -dx, 0, FALSE);
     }
 }
@@ -928,7 +938,7 @@ static void
 cubePaintTopBottom (CompScreen		    *s,
 		    const ScreenPaintAttrib *sAttrib,
 		    const CompTransform	    *transform,
-		    int			    output,
+		    CompOutput		    *output,
 		    int			    size)
 {
     ScreenPaintAttrib sa = *sAttrib;
@@ -983,11 +993,11 @@ cubePaintTopBottom (CompScreen		    *s,
 }
 
 static void
-cubePaintTransformedScreen (CompScreen		    *s,
+cubePaintTransformedOutput (CompScreen		    *s,
 			    const ScreenPaintAttrib *sAttrib,
 			    const CompTransform	    *transform,
 			    Region		    region,
-			    int			    output,
+			    CompOutput		    *outputPtr,
 			    unsigned int	    mask)
 {
     ScreenPaintAttrib sa = *sAttrib;
@@ -995,9 +1005,14 @@ cubePaintTransformedScreen (CompScreen		    *s,
     int		      hsize, xMove = 0;
     float	      size;
     Bool	      clear;
+    int i, output = 0;
 
     CUBE_SCREEN (s);
 
+    for (i = 0; i < s->nOutputDev; i++)
+	if (!memcmp (outputPtr, &s->outputDev[i], sizeof (CompOutput)))
+	    output = i;
+
     hsize = s->hsize * cs->nOutput;
     size  = hsize;
 
@@ -1040,7 +1055,7 @@ cubePaintTransformedScreen (CompScreen		    *s,
 
     mask &= ~PAINT_SCREEN_CLEAR_MASK;
 
-    UNWRAP (cs, s, paintTransformedScreen);
+    UNWRAP (cs, s, paintTransformedOutput);
 
     sa.xTranslate = sAttrib->xTranslate;
     sa.yTranslate = sAttrib->yTranslate;
@@ -1103,7 +1118,7 @@ cubePaintTransformedScreen (CompScreen		    *s,
     if (!clear && cs->grabIndex == 0 && hsize > 2 &&
 	(cs->invert != 1 || sa.vRotate != 0.0f || sa.yTranslate != 0.0f))
     {
-	(*cs->paintTopBottom) (s, &sa, transform, output, hsize);
+	(*cs->paintTopBottom) (s, &sa, transform, outputPtr, hsize);
     }
 
     /* outside cube */
@@ -1123,7 +1138,7 @@ cubePaintTransformedScreen (CompScreen		    *s,
 
 	    for (i = 0; i < hsize; i++)
 	    {
-		cubeMoveViewportAndPaint (s, &sa, transform, output, mask,
+		cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
 					  xMove);
 
 		sa.yRotate -= 360.0f / size;
@@ -1138,7 +1153,7 @@ cubePaintTransformedScreen (CompScreen		    *s,
 	    {
 		xMove = cs->xrotations;
 
-		cubeMoveViewportAndPaint (s, &sa, transform, output, mask,
+		cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
 					  xMove);
 
 		xMove++;
@@ -1146,7 +1161,8 @@ cubePaintTransformedScreen (CompScreen		    *s,
 
 	    sa.yRotate -= 360.0f / size;
 
-	    cubeMoveViewportAndPaint (s, &sa, transform, output, mask, xMove);
+	    cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
+				      xMove);
 	}
     }
     else
@@ -1182,7 +1198,7 @@ cubePaintTransformedScreen (CompScreen		    *s,
 
 	    for (i = 0; i < hsize; i++)
 	    {
-		cubeMoveViewportAndPaint (s, &sa, transform, output, mask,
+		cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
 					  xMove);
 
 		sa.yRotate += 360.0f / size;
@@ -1193,21 +1209,24 @@ cubePaintTransformedScreen (CompScreen		    *s,
 	}
 	else
 	{
-	    cubeMoveViewportAndPaint (s, &sa, transform, output, mask, xMove);
+	    cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
+				      xMove);
 
 	    sa.yRotate += 360.0f / size;
 	    xMove = -cs->xrotations;
 
-	    cubeMoveViewportAndPaint (s, &sa, transform, output, mask, xMove);
+	    cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
+				      xMove);
 
 	    sa.yRotate += 360.0f / size;
 	    xMove = 1 - cs->xrotations;
 
-	    cubeMoveViewportAndPaint (s, &sa, transform, output, mask, xMove);
+	    cubeMoveViewportAndPaint (s, &sa, transform, outputPtr, mask,
+				      xMove);
 	}
     }
 
-    WRAP (cs, s, paintTransformedScreen, cubePaintTransformedScreen);
+    WRAP (cs, s, paintTransformedOutput, cubePaintTransformedOutput);
 }
 
 static void
@@ -1313,7 +1332,7 @@ cubePaintBackground (CompScreen   *s,
 static void
 cubeApplyScreenTransform (CompScreen		  *s,
 			  const ScreenPaintAttrib *sAttrib,
-			  int			  output,
+			  CompOutput		  *output,
 			  CompTransform	          *transform)
 {
     CUBE_SCREEN (s);
@@ -1698,8 +1717,8 @@ cubeInitScreen (CompPlugin *p,
 
     WRAP (cs, s, preparePaintScreen, cubePreparePaintScreen);
     WRAP (cs, s, donePaintScreen, cubeDonePaintScreen);
-    WRAP (cs, s, paintScreen, cubePaintScreen);
-    WRAP (cs, s, paintTransformedScreen, cubePaintTransformedScreen);
+    WRAP (cs, s, paintOutput, cubePaintOutput);
+    WRAP (cs, s, paintTransformedOutput, cubePaintTransformedOutput);
     WRAP (cs, s, paintBackground, cubePaintBackground);
     WRAP (cs, s, applyScreenTransform, cubeApplyScreenTransform);
     WRAP (cs, s, setScreenOption, cubeSetGlobalScreenOption);
@@ -1719,8 +1738,8 @@ cubeFiniScreen (CompPlugin *p,
 
     UNWRAP (cs, s, preparePaintScreen);
     UNWRAP (cs, s, donePaintScreen);
-    UNWRAP (cs, s, paintScreen);
-    UNWRAP (cs, s, paintTransformedScreen);
+    UNWRAP (cs, s, paintOutput);
+    UNWRAP (cs, s, paintTransformedOutput);
     UNWRAP (cs, s, paintBackground);
     UNWRAP (cs, s, applyScreenTransform);
     UNWRAP (cs, s, setScreenOption);

Modified: compiz/plugins/minimize.c
===================================================================
--- compiz/plugins/minimize.c
+++ compiz/plugins/minimize.c
@@ -55,7 +55,7 @@ typedef struct _MinScreen {
 
     PreparePaintScreenProc preparePaintScreen;
     DonePaintScreenProc    donePaintScreen;
-    PaintScreenProc        paintScreen;
+    PaintOutputProc        paintOutput;
     PaintWindowProc        paintWindow;
     DamageWindowRectProc   damageWindowRect;
     FocusWindowProc	   focusWindow;
@@ -495,11 +495,11 @@ minDonePaintScreen (CompScreen *s)
 }
 
 static Bool
-minPaintScreen (CompScreen		*s,
+minPaintOutput (CompScreen		*s,
 		const ScreenPaintAttrib *sAttrib,
 		const CompTransform	*transform,
 		Region		        region,
-		int			output,
+		CompOutput		*output,
 		unsigned int		mask)
 {
     Bool status;
@@ -509,9 +509,9 @@ minPaintScreen (CompScreen		*s,
     if (ms->moreAdjust)
 	mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
 
-    UNWRAP (ms, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (ms, s, paintScreen, minPaintScreen);
+    UNWRAP (ms, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (ms, s, paintOutput, minPaintOutput);
 
     return status;
 }
@@ -881,7 +881,7 @@ minInitScreen (CompPlugin *p,
 
     WRAP (ms, s, preparePaintScreen, minPreparePaintScreen);
     WRAP (ms, s, donePaintScreen, minDonePaintScreen);
-    WRAP (ms, s, paintScreen, minPaintScreen);
+    WRAP (ms, s, paintOutput, minPaintOutput);
     WRAP (ms, s, paintWindow, minPaintWindow);
     WRAP (ms, s, damageWindowRect, minDamageWindowRect);
     WRAP (ms, s, focusWindow, minFocusWindow);
@@ -901,7 +901,7 @@ minFiniScreen (CompPlugin *p,
 
     UNWRAP (ms, s, preparePaintScreen);
     UNWRAP (ms, s, donePaintScreen);
-    UNWRAP (ms, s, paintScreen);
+    UNWRAP (ms, s, paintOutput);
     UNWRAP (ms, s, paintWindow);
     UNWRAP (ms, s, damageWindowRect);
     UNWRAP (ms, s, focusWindow);

Modified: compiz/plugins/plane.c
===================================================================
--- compiz/plugins/plane.c
+++ compiz/plugins/plane.c
@@ -67,10 +67,10 @@ typedef struct _PlaneDisplay {
 } PlaneDisplay;
 
 typedef struct _PlaneScreen {
-    PaintTransformedScreenProc		paintTransformedScreen;
+    PaintTransformedOutputProc		paintTransformedOutput;
     PreparePaintScreenProc		preparePaintScreen;
     DonePaintScreenProc			donePaintScreen;
-    PaintScreenProc			paintScreen;
+    PaintOutputProc			paintOutput;
 
     WindowGrabNotifyProc		windowGrabNotify;
     WindowUngrabNotifyProc		windowUngrabNotify;
@@ -197,16 +197,16 @@ planePreparePaintScreen (CompScreen *s,
 }
 
 static void
-planePaintTransformedScreen (CompScreen		     *screen,
+planePaintTransformedOutput (CompScreen		     *screen,
 			     const ScreenPaintAttrib *sAttrib,
 			     const CompTransform     *transform,
 			     Region		     region,
-			     int                     output,
+			     CompOutput              *output,
 			     unsigned int	     mask)
 {
     PLANE_SCREEN (screen);
 
-    UNWRAP (ps, screen, paintTransformedScreen);
+    UNWRAP (ps, screen, paintTransformedOutput);
 
     if (ps->timeoutHandle)
     {
@@ -256,7 +256,7 @@ planePaintTransformedScreen (CompScreen		     *screen,
 
 	matrixTranslate (&sTransform, dx, -dy, 0.0);
 
-	(*screen->paintTransformedScreen) (screen, sAttrib, &sTransform,
+	(*screen->paintTransformedOutput) (screen, sAttrib, &sTransform,
 					   region, output, mask);
 
 	if (dx > 0)
@@ -270,7 +270,7 @@ planePaintTransformedScreen (CompScreen		     *screen,
 	    moveScreenViewport (screen, -1, 0, FALSE);
 	}
 
-	(*screen->paintTransformedScreen) (screen, sAttrib, &sTransform,
+	(*screen->paintTransformedOutput) (screen, sAttrib, &sTransform,
 					   region, output, mask);
 
 	if (dy > 0)
@@ -284,7 +284,7 @@ planePaintTransformedScreen (CompScreen		     *screen,
 	    moveScreenViewport (screen, 0, -1, FALSE);
 	}
 
-	(*screen->paintTransformedScreen) (screen, sAttrib, &sTransform,
+	(*screen->paintTransformedOutput) (screen, sAttrib, &sTransform,
 					   region, output, mask);
 
 	if (dx > 0)
@@ -298,7 +298,7 @@ planePaintTransformedScreen (CompScreen		     *screen,
 	    moveScreenViewport (screen, 1, 0, FALSE);
 	}
 
-	(*screen->paintTransformedScreen) (screen, sAttrib, &sTransform,
+	(*screen->paintTransformedOutput) (screen, sAttrib, &sTransform,
 					   region, output, mask);
 
 	if (dy > 0)
@@ -314,11 +314,11 @@ planePaintTransformedScreen (CompScreen		     *screen,
     }
     else
     {
-	(*screen->paintTransformedScreen) (screen, sAttrib, transform,
+	(*screen->paintTransformedOutput) (screen, sAttrib, transform,
 					   region, output, mask);
     }
 
-    WRAP (ps, screen, paintTransformedScreen, planePaintTransformedScreen);
+    WRAP (ps, screen, paintTransformedOutput, planePaintTransformedOutput);
 }
 
 static void
@@ -337,11 +337,11 @@ planeDonePaintScreen (CompScreen *s)
 }
 
 static Bool
-planePaintScreen (CompScreen		  *s,
+planePaintOutput (CompScreen		  *s,
 		  const ScreenPaintAttrib *sAttrib,
 		  const CompTransform	  *transform,
 		  Region		  region,
-		  int			  output,
+		  CompOutput		  *output,
 		  unsigned int		  mask)
 {
     Bool status;
@@ -354,9 +354,9 @@ planePaintScreen (CompScreen		  *s,
 	mask |= PAINT_SCREEN_TRANSFORMED_MASK;
     }
 
-    UNWRAP (ps, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (ps, s, paintScreen, planePaintScreen);
+    UNWRAP (ps, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (ps, s, paintOutput, planePaintOutput);
 
     return status;
 }
@@ -659,10 +659,10 @@ planeInitScreen (CompPlugin *p,
 
     ps->timeoutHandle = 0;
 
-    WRAP (ps, s, paintTransformedScreen, planePaintTransformedScreen);
+    WRAP (ps, s, paintTransformedOutput, planePaintTransformedOutput);
     WRAP (ps, s, preparePaintScreen, planePreparePaintScreen);
     WRAP (ps, s, donePaintScreen, planeDonePaintScreen);
-    WRAP (ps, s, paintScreen, planePaintScreen);
+    WRAP (ps, s, paintOutput, planePaintOutput);
     WRAP (ps, s, windowGrabNotify, planeWindowGrabNotify);
     WRAP (ps, s, windowUngrabNotify, planeWindowUngrabNotify);
 
@@ -677,10 +677,10 @@ planeFiniScreen (CompPlugin *p,
 {
     PLANE_SCREEN (s);
 
-    UNWRAP (ps, s, paintTransformedScreen);
+    UNWRAP (ps, s, paintTransformedOutput);
     UNWRAP (ps, s, preparePaintScreen);
     UNWRAP (ps, s, donePaintScreen);
-    UNWRAP (ps, s, paintScreen);
+    UNWRAP (ps, s, paintOutput);
     UNWRAP (ps, s, windowGrabNotify);
     UNWRAP (ps, s, windowUngrabNotify);
 

Modified: compiz/plugins/resize.c
===================================================================
--- compiz/plugins/resize.c
+++ compiz/plugins/resize.c
@@ -103,7 +103,7 @@ typedef struct _ResizeScreen {
     int grabIndex;
 
     WindowResizeNotifyProc windowResizeNotify;
-    PaintScreenProc	   paintScreen;
+    PaintOutputProc	   paintOutput;
     PaintWindowProc	   paintWindow;
     DamageWindowRectProc   damageWindowRect;
 
@@ -218,7 +218,7 @@ resizeSendResizeNotify (CompDisplay *d)
     xev.xclient.type    = ClientMessage;
     xev.xclient.display = d->display;
     xev.xclient.format  = 32;
-    
+
     xev.xclient.message_type = rd->resizeNotifyAtom;
     xev.xclient.window	     = rd->w->id;
 
@@ -247,7 +247,7 @@ resizeUpdateWindowProperty (CompDisplay *d)
     data[2] = rd->geometry.width;
     data[3] = rd->geometry.height;
 
-    XChangeProperty (d->display, rd->w->id, 
+    XChangeProperty (d->display, rd->w->id,
 		     rd->resizeInformationAtom,
 		     XA_CARDINAL, 32, PropModeReplace,
 		     (unsigned char*) data, 4);
@@ -872,7 +872,7 @@ static void
 resizePaintRectangle (CompScreen              *s,
 		      const ScreenPaintAttrib *sa,
 		      const CompTransform     *transform,
-		      int                     output,
+		      CompOutput              *output,
 		      unsigned short	      *borderColor,
 		      unsigned short	      *fillColor)
 {
@@ -912,11 +912,11 @@ resizePaintRectangle (CompScreen              *s,
 }
 
 static Bool
-resizePaintScreen (CompScreen              *s,
+resizePaintOutput (CompScreen              *s,
 		   const ScreenPaintAttrib *sAttrib,
 		   const CompTransform     *transform,
 		   Region                  region,
-		   int                     output,
+		   CompOutput              *output,
 		   unsigned int            mask)
 {
     Bool status;
@@ -930,9 +930,9 @@ resizePaintScreen (CompScreen              *s,
 	    mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
     }
 
-    UNWRAP (rs, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (rs, s, paintScreen, resizePaintScreen);
+    UNWRAP (rs, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (rs, s, paintOutput, resizePaintOutput);
 
     if (status && rd->w)
     {
@@ -1123,9 +1123,9 @@ resizeInitDisplay (CompPlugin  *p,
 
     rd->releaseButton = 0;
 
-    rd->resizeNotifyAtom      = XInternAtom (d->display, 
+    rd->resizeNotifyAtom      = XInternAtom (d->display,
 					     "_COMPIZ_RESIZE_NOTIFY", 0);
-    rd->resizeInformationAtom = XInternAtom (d->display, 
+    rd->resizeInformationAtom = XInternAtom (d->display,
 					     "_COMPIZ_RESIZE_INFORMATION", 0);
 
     for (i = 0; i < NUM_KEYS; i++)
@@ -1190,7 +1190,7 @@ resizeInitScreen (CompPlugin *p,
     rs->cursor[3] = rs->downCursor;
 
     WRAP (rs, s, windowResizeNotify, resizeWindowResizeNotify);
-    WRAP (rs, s, paintScreen, resizePaintScreen);
+    WRAP (rs, s, paintOutput, resizePaintOutput);
     WRAP (rs, s, paintWindow, resizePaintWindow);
     WRAP (rs, s, damageWindowRect, resizeDamageWindowRect);
 
@@ -1225,7 +1225,7 @@ resizeFiniScreen (CompPlugin *p,
 	XFreeCursor (s->display->display, rs->downRightCursor);
 
     UNWRAP (rs, s, windowResizeNotify);
-    UNWRAP (rs, s, paintScreen);
+    UNWRAP (rs, s, paintOutput);
     UNWRAP (rs, s, paintWindow);
     UNWRAP (rs, s, damageWindowRect);
 

Modified: compiz/plugins/rotate.c
===================================================================
--- compiz/plugins/rotate.c
+++ compiz/plugins/rotate.c
@@ -99,7 +99,7 @@ typedef struct _RotateDisplay {
 typedef struct _RotateScreen {
     PreparePaintScreenProc	 preparePaintScreen;
     DonePaintScreenProc		 donePaintScreen;
-    PaintScreenProc		 paintScreen;
+    PaintOutputProc		 paintOutput;
     SetScreenOptionForPluginProc setScreenOptionForPlugin;
     WindowGrabNotifyProc	 windowGrabNotify;
     WindowUngrabNotifyProc	 windowUngrabNotify;
@@ -442,11 +442,11 @@ rotateGetRotation (CompScreen *s,
 }
 
 static Bool
-rotatePaintScreen (CompScreen		   *s,
+rotatePaintOutput (CompScreen		   *s,
 		   const ScreenPaintAttrib *sAttrib,
 		   const CompTransform	   *transform,
 		   Region		   region,
-		   int			   output,
+		   CompOutput		   *output,
 		   unsigned int		   mask)
 {
     Bool status;
@@ -459,9 +459,9 @@ rotatePaintScreen (CompScreen		   *s,
 	mask |= PAINT_SCREEN_TRANSFORMED_MASK;
     }
 
-    UNWRAP (rs, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (rs, s, paintScreen, rotatePaintScreen);
+    UNWRAP (rs, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (rs, s, paintOutput, rotatePaintOutput);
 
     return status;
 }
@@ -1759,7 +1759,7 @@ rotateInitScreen (CompPlugin *p,
 
     WRAP (rs, s, preparePaintScreen, rotatePreparePaintScreen);
     WRAP (rs, s, donePaintScreen, rotateDonePaintScreen);
-    WRAP (rs, s, paintScreen, rotatePaintScreen);
+    WRAP (rs, s, paintOutput, rotatePaintOutput);
     WRAP (rs, s, setScreenOptionForPlugin, rotateSetScreenOptionForPlugin);
     WRAP (rs, s, windowGrabNotify, rotateWindowGrabNotify);
     WRAP (rs, s, windowUngrabNotify, rotateWindowUngrabNotify);
@@ -1784,7 +1784,7 @@ rotateFiniScreen (CompPlugin *p,
 
     UNWRAP (rs, s, preparePaintScreen);
     UNWRAP (rs, s, donePaintScreen);
-    UNWRAP (rs, s, paintScreen);
+    UNWRAP (rs, s, paintOutput);
     UNWRAP (rs, s, setScreenOptionForPlugin);
     UNWRAP (rs, s, windowGrabNotify);
     UNWRAP (rs, s, windowUngrabNotify);

Modified: compiz/plugins/scale.c
===================================================================
--- compiz/plugins/scale.c
+++ compiz/plugins/scale.c
@@ -100,7 +100,7 @@ typedef struct _ScaleScreen {
 
     PreparePaintScreenProc preparePaintScreen;
     DonePaintScreenProc    donePaintScreen;
-    PaintScreenProc        paintScreen;
+    PaintOutputProc        paintOutput;
     PaintWindowProc        paintWindow;
     DamageWindowRectProc   damageWindowRect;
 
@@ -819,11 +819,11 @@ adjustScaleVelocity (CompWindow *w)
 }
 
 static Bool
-scalePaintScreen (CompScreen		  *s,
+scalePaintOutput (CompScreen		  *s,
 		  const ScreenPaintAttrib *sAttrib,
 		  const CompTransform	  *transform,
 		  Region		  region,
-		  int			  output,
+		  CompOutput		  *output,
 		  unsigned int		  mask)
 {
     Bool status;
@@ -833,9 +833,9 @@ scalePaintScreen (CompScreen		  *s,
     if (ss->state != SCALE_STATE_NONE)
 	mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
 
-    UNWRAP (ss, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (ss, s, paintScreen, scalePaintScreen);
+    UNWRAP (ss, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (ss, s, paintOutput, scalePaintOutput);
 
     return status;
 }
@@ -1886,7 +1886,7 @@ scaleInitScreen (CompPlugin *p,
 
     WRAP (ss, s, preparePaintScreen, scalePreparePaintScreen);
     WRAP (ss, s, donePaintScreen, scaleDonePaintScreen);
-    WRAP (ss, s, paintScreen, scalePaintScreen);
+    WRAP (ss, s, paintOutput, scalePaintOutput);
     WRAP (ss, s, paintWindow, scalePaintWindow);
     WRAP (ss, s, damageWindowRect, scaleDamageWindowRect);
 
@@ -1905,7 +1905,7 @@ scaleFiniScreen (CompPlugin *p,
 
     UNWRAP (ss, s, preparePaintScreen);
     UNWRAP (ss, s, donePaintScreen);
-    UNWRAP (ss, s, paintScreen);
+    UNWRAP (ss, s, paintOutput);
     UNWRAP (ss, s, paintWindow);
     UNWRAP (ss, s, damageWindowRect);
 

Modified: compiz/plugins/screenshot.c
===================================================================
--- compiz/plugins/screenshot.c
+++ compiz/plugins/screenshot.c
@@ -46,6 +46,7 @@ typedef struct _ShotDisplay {
 } ShotDisplay;
 
 typedef struct _ShotScreen {
+    PaintOutputProc paintOutput;
     PaintScreenProc paintScreen;
     int		    grabIndex;
 
@@ -177,23 +178,19 @@ shotSort (const void *_a,
 	return al - bl;
 }
 
-static Bool
-shotPaintScreen (CompScreen		 *s,
-		 const ScreenPaintAttrib *sAttrib,
-		 const CompTransform	 *transform,
-		 Region			 region,
-		 int			 output,
-		 unsigned int		 mask)
+static void
+shotPaintScreen (CompScreen   *s,
+		 CompOutput   *outputs,
+		 int          numOutput,  
+		 unsigned int mask)
 {
-    Bool status;
-
     SHOT_SCREEN (s);
 
     UNWRAP (ss, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
+    (*s->paintScreen) (s, outputs, numOutput, mask);
     WRAP (ss, s, paintScreen, shotPaintScreen);
 
-    if (status && ss->grab)
+    if (ss->grab)
     {
 	int x1, x2, y1, y2;
 
@@ -201,30 +198,8 @@ shotPaintScreen (CompScreen		 *s,
 	y1 = MIN (ss->y1, ss->y2);
 	x2 = MAX (ss->x1, ss->x2);
 	y2 = MAX (ss->y1, ss->y2);
-
-	if (ss->grabIndex)
-	{
-	    glPushMatrix ();
-
-	    prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
-
-	    glDisableClientState (GL_TEXTURE_COORD_ARRAY);
-	    glEnable (GL_BLEND);
-	    glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
-	    glRecti (x1, y2, x2, y1);
-	    glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
-	    glBegin (GL_LINE_LOOP);
-	    glVertex2i (x1, y1);
-	    glVertex2i (x2, y1);
-	    glVertex2i (x2, y2);
-	    glVertex2i (x1, y2);
-	    glEnd ();
-	    glColor4usv (defaultColor);
-	    glDisable (GL_BLEND);
-	    glEnableClientState (GL_TEXTURE_COORD_ARRAY);
-	    glPopMatrix ();
-	}
-	else if (output == (s->nOutputDev - 1))
+	
+	if (!ss->grabIndex)
 	{
 	    int w = x2 - x1;
 	    int h = y2 - y1;
@@ -302,6 +277,56 @@ shotPaintScreen (CompScreen		 *s,
 	    ss->grab = FALSE;
 	}
     }
+}
+
+static Bool
+shotPaintOutput (CompScreen		 *s,
+		 const ScreenPaintAttrib *sAttrib,
+		 const CompTransform	 *transform,
+		 Region			 region,
+		 CompOutput		 *output,
+		 unsigned int		 mask)
+{
+    Bool status;
+
+    SHOT_SCREEN (s);
+
+    UNWRAP (ss, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (ss, s, paintOutput, shotPaintOutput);
+
+    if (status && ss->grab)
+    {
+	int x1, x2, y1, y2;
+
+	x1 = MIN (ss->x1, ss->x2);
+	y1 = MIN (ss->y1, ss->y2);
+	x2 = MAX (ss->x1, ss->x2);
+	y2 = MAX (ss->y1, ss->y2);
+
+	if (ss->grabIndex)
+	{
+	    glPushMatrix ();
+
+	    prepareXCoords (s, output, -DEFAULT_Z_CAMERA);
+
+	    glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+	    glEnable (GL_BLEND);
+	    glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
+	    glRecti (x1, y2, x2, y1);
+	    glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
+	    glBegin (GL_LINE_LOOP);
+	    glVertex2i (x1, y1);
+	    glVertex2i (x2, y1);
+	    glVertex2i (x2, y2);
+	    glVertex2i (x1, y2);
+	    glEnd ();
+	    glColor4usv (defaultColor);
+	    glDisable (GL_BLEND);
+	    glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+	    glPopMatrix ();
+	}
+    }
 
     return status;
 }
@@ -471,6 +496,7 @@ shotInitScreen (CompPlugin *p,
     ss->grab	  = FALSE;
 
     WRAP (ss, s, paintScreen, shotPaintScreen);
+    WRAP (ss, s, paintOutput, shotPaintOutput);
 
     s->privates[sd->screenPrivateIndex].ptr = ss;
 
@@ -484,6 +510,7 @@ shotFiniScreen (CompPlugin *p,
     SHOT_SCREEN (s);
 
     UNWRAP (ss, s, paintScreen);
+    UNWRAP (ss, s, paintOutput);
 
     free (ss);
 }

Modified: compiz/plugins/switcher.c
===================================================================
--- compiz/plugins/switcher.c
+++ compiz/plugins/switcher.c
@@ -76,7 +76,7 @@ typedef struct _SwitchDisplay {
 typedef struct _SwitchScreen {
     PreparePaintScreenProc preparePaintScreen;
     DonePaintScreenProc    donePaintScreen;
-    PaintScreenProc	   paintScreen;
+    PaintOutputProc	   paintOutput;
     PaintWindowProc        paintWindow;
     PaintBackgroundProc    paintBackground;
     DamageWindowRectProc   damageWindowRect;
@@ -1288,11 +1288,11 @@ switchPreparePaintScreen (CompScreen *s,
 }
 
 static Bool
-switchPaintScreen (CompScreen		   *s,
+switchPaintOutput (CompScreen		   *s,
 		   const ScreenPaintAttrib *sAttrib,
 		   const CompTransform	   *transform,
 		   Region		   region,
-		   int			   output,
+		   CompOutput		   *output,
 		   unsigned int		   mask)
 {
     Bool status;
@@ -1345,9 +1345,9 @@ switchPaintScreen (CompScreen		   *s,
 	    zoomed = NULL;
 	}
 
-	UNWRAP (ss, s, paintScreen);
-	status = (*s->paintScreen) (s, &sa, transform, region, output, mask);
-	WRAP (ss, s, paintScreen, switchPaintScreen);
+	UNWRAP (ss, s, paintOutput);
+	status = (*s->paintOutput) (s, &sa, transform, region, output, mask);
+	WRAP (ss, s, paintOutput, switchPaintOutput);
 
 	if (ss->zooming)
 	{
@@ -1357,10 +1357,10 @@ switchPaintScreen (CompScreen		   *s,
 
 	    sa.zCamera += MIN (ss->sTranslate, ss->translate);
 
-	    UNWRAP (ss, s, paintScreen);
-	    status = (*s->paintScreen) (s, &sa, transform, region, output,
+	    UNWRAP (ss, s, paintOutput);
+	    status = (*s->paintOutput) (s, &sa, transform, region, output,
 					mask);
-	    WRAP (ss, s, paintScreen, switchPaintScreen);
+	    WRAP (ss, s, paintOutput, switchPaintOutput);
 	}
 
 	if (zoomed)
@@ -1393,10 +1393,10 @@ switchPaintScreen (CompScreen		   *s,
     }
     else
     {
-	UNWRAP (ss, s, paintScreen);
-	status = (*s->paintScreen) (s, sAttrib, transform, region, output,
+	UNWRAP (ss, s, paintOutput);
+	status = (*s->paintOutput) (s, sAttrib, transform, region, output,
 				    mask);
-	WRAP (ss, s, paintScreen, switchPaintScreen);
+	WRAP (ss, s, paintOutput, switchPaintOutput);
     }
 
     return status;
@@ -1973,7 +1973,7 @@ switchInitScreen (CompPlugin *p,
 
     WRAP (ss, s, preparePaintScreen, switchPreparePaintScreen);
     WRAP (ss, s, donePaintScreen, switchDonePaintScreen);
-    WRAP (ss, s, paintScreen, switchPaintScreen);
+    WRAP (ss, s, paintOutput, switchPaintOutput);
     WRAP (ss, s, paintWindow, switchPaintWindow);
     WRAP (ss, s, paintBackground, switchPaintBackground);
     WRAP (ss, s, damageWindowRect, switchDamageWindowRect);
@@ -1991,7 +1991,7 @@ switchFiniScreen (CompPlugin *p,
 
     UNWRAP (ss, s, preparePaintScreen);
     UNWRAP (ss, s, donePaintScreen);
-    UNWRAP (ss, s, paintScreen);
+    UNWRAP (ss, s, paintOutput);
     UNWRAP (ss, s, paintWindow);
     UNWRAP (ss, s, paintBackground);
     UNWRAP (ss, s, damageWindowRect);

Modified: compiz/plugins/wobbly.c
===================================================================
--- compiz/plugins/wobbly.c
+++ compiz/plugins/wobbly.c
@@ -145,7 +145,7 @@ typedef struct _WobblyScreen {
 
     PreparePaintScreenProc preparePaintScreen;
     DonePaintScreenProc	   donePaintScreen;
-    PaintScreenProc	   paintScreen;
+    PaintOutputProc	   paintOutput;
     PaintWindowProc	   paintWindow;
     DamageWindowRectProc   damageWindowRect;
     AddWindowGeometryProc  addWindowGeometry;
@@ -2625,11 +2625,11 @@ wobblyWindowUngrabNotify (CompWindow *w)
 
 
 static Bool
-wobblyPaintScreen (CompScreen		   *s,
+wobblyPaintOutput (CompScreen		   *s,
 		   const ScreenPaintAttrib *sAttrib,
 		   const CompTransform	   *transform,
 		   Region		   region,
-		   int			   output,
+		   CompOutput		   *output,
 		   unsigned int		   mask)
 {
     Bool status;
@@ -2639,9 +2639,9 @@ wobblyPaintScreen (CompScreen		   *s,
     if (ws->wobblyWindows)
 	mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK;
 
-    UNWRAP (ws, s, paintScreen);
-    status = (*s->paintScreen) (s, sAttrib, transform, region, output, mask);
-    WRAP (ws, s, paintScreen, wobblyPaintScreen);
+    UNWRAP (ws, s, paintOutput);
+    status = (*s->paintOutput) (s, sAttrib, transform, region, output, mask);
+    WRAP (ws, s, paintOutput, wobblyPaintOutput);
 
     return status;
 }
@@ -2789,7 +2789,7 @@ wobblyInitScreen (CompPlugin *p,
 
     WRAP (ws, s, preparePaintScreen, wobblyPreparePaintScreen);
     WRAP (ws, s, donePaintScreen, wobblyDonePaintScreen);
-    WRAP (ws, s, paintScreen, wobblyPaintScreen);
+    WRAP (ws, s, paintOutput, wobblyPaintOutput);
     WRAP (ws, s, paintWindow, wobblyPaintWindow);
     WRAP (ws, s, damageWindowRect, wobblyDamageWindowRect);
     WRAP (ws, s, addWindowGeometry, wobblyAddWindowGeometry);
@@ -2813,7 +2813,7 @@ wobblyFiniScreen (CompPlugin *p,
 
     UNWRAP (ws, s, preparePaintScreen);
     UNWRAP (ws, s, donePaintScreen);
-    UNWRAP (ws, s, paintScreen);
+    UNWRAP (ws, s, paintOutput);
     UNWRAP (ws, s, paintWindow);
     UNWRAP (ws, s, damageWindowRect);
     UNWRAP (ws, s, addWindowGeometry);

Modified: compiz/plugins/zoom.c
===================================================================
--- compiz/plugins/zoom.c
+++ compiz/plugins/zoom.c
@@ -66,7 +66,7 @@ typedef struct _ZoomBox {
 typedef struct _ZoomScreen {
     PreparePaintScreenProc	 preparePaintScreen;
     DonePaintScreenProc		 donePaintScreen;
-    PaintScreenProc		 paintScreen;
+    PaintOutputProc		 paintOutput;
 
     CompOption opt[ZOOM_SCREEN_OPTION_NUM];
 
@@ -246,7 +246,7 @@ zoomDonePaintScreen (CompScreen *s)
 }
 
 static Bool
-zoomPaintScreen (CompScreen		 *s,
+zoomPaintOutput (CompScreen		 *s,
 		 const ScreenPaintAttrib *sAttrib,
 		 const CompTransform	 *transform,
 		 Region		         region,
@@ -291,19 +291,19 @@ zoomPaintScreen (CompScreen		 *s,
 	if ((zs->zoomOutput != output || !zs->adjust) && scale > 3.9f)
 	    s->filter[SCREEN_TRANS_FILTER] = COMP_TEXTURE_FILTER_FAST;
 
-	UNWRAP (zs, s, paintScreen);
-	status = (*s->paintScreen) (s, sAttrib, &zTransform, region, output,
+	UNWRAP (zs, s, paintOutput);
+	status = (*s->paintOutput) (s, sAttrib, &zTransform, region, output,
 				    mask);
-	WRAP (zs, s, paintScreen, zoomPaintScreen);
+	WRAP (zs, s, paintOutput, zoomPaintOutput);
 
 	s->filter[SCREEN_TRANS_FILTER] = saveFilter;
     }
     else
     {
-	UNWRAP (zs, s, paintScreen);
-	status = (*s->paintScreen) (s, sAttrib, transform, region, output,
+	UNWRAP (zs, s, paintOutput);
+	status = (*s->paintOutput) (s, sAttrib, transform, region, output,
 				    mask);
-	WRAP (zs, s, paintScreen, zoomPaintScreen);
+	WRAP (zs, s, paintOutput, zoomPaintOutput);
     }
 
     if (status && zs->grab)
@@ -1007,7 +1007,7 @@ zoomInitScreen (CompPlugin *p,
 
     WRAP (zs, s, preparePaintScreen, zoomPreparePaintScreen);
     WRAP (zs, s, donePaintScreen, zoomDonePaintScreen);
-    WRAP (zs, s, paintScreen, zoomPaintScreen);
+    WRAP (zs, s, paintOutput, zoomPaintOutput);
 
     s->privates[zd->screenPrivateIndex].ptr = zs;
 
@@ -1025,7 +1025,7 @@ zoomFiniScreen (CompPlugin *p,
 
     UNWRAP (zs, s, preparePaintScreen);
     UNWRAP (zs, s, donePaintScreen);
-    UNWRAP (zs, s, paintScreen);
+    UNWRAP (zs, s, paintOutput);
 
     compFiniScreenOptions (s, zs->opt, ZOOM_SCREEN_OPTION_NUM);
 

Modified: compiz/src/display.c
===================================================================
--- compiz/src/display.c
+++ compiz/src/display.c
@@ -77,7 +77,12 @@ static int               nWatchFds = 0;
 static CompFileWatchHandle lastFileWatchHandle = 1;
 
 static CompScreen *targetScreen = NULL;
-static int        targetOutput = 0;
+static CompOutput *targetOutput;
+static Region	  tmpRegion, outputRegion;
+static int        curViewportX = 0;
+static int        curViewportY = 0;
+static int        curViewportW = 0;
+static int        curViewportH = 0;
 
 static Bool inHandleEvent = FALSE;
 
@@ -1444,13 +1449,78 @@ waitForVideoSync (CompScreen *s)
     }
 }
 
+
+void
+paintScreen (CompScreen   *s,
+	     CompOutput   *outputs,
+	     int          numOutput,
+	     unsigned int mask)
+{
+    int i;
+
+    for (i = 0; i < numOutput; i++)
+    {
+	targetScreen = s;
+	targetOutput = &outputs[i];
+
+	if (curViewportX != outputs[i].region.extents.x1 ||
+	    curViewportY != s->height - outputs[i].region.extents.x2 ||
+	    curViewportW != outputs[i].width ||
+	    curViewportH != outputs[i].height)
+	{
+	    glViewport (outputs[i].region.extents.x1,
+			s->height -
+			outputs[i].region.extents.y2,
+			outputs[i].width,
+			outputs[i].height);
+	    curViewportX = outputs[i].region.extents.x1;
+	    curViewportY = s->height - outputs[i].region.extents.x2;
+	    curViewportW = outputs[i].width;
+	    curViewportH = outputs[i].height;
+	}
+
+	if (mask & COMP_SCREEN_DAMAGE_ALL_MASK)
+	{
+	    (*s->paintOutput) (s,
+			       &defaultScreenPaintAttrib,
+			       &identity,
+			       &outputs[i].region, &outputs[i],
+			       PAINT_SCREEN_REGION_MASK |
+			       PAINT_SCREEN_FULL_MASK);
+	}
+	else if (mask & COMP_SCREEN_DAMAGE_REGION_MASK)
+	{
+	    XIntersectRegion (tmpRegion,
+			      &outputs[i].region,
+			      outputRegion);
+
+	    if (!(*s->paintOutput) (s,
+				    &defaultScreenPaintAttrib,
+				    &identity,
+				    outputRegion, &outputs[i],
+				    PAINT_SCREEN_REGION_MASK))
+	    {
+		(*s->paintOutput) (s,
+				   &defaultScreenPaintAttrib,
+				   &identity,
+				   &outputs[i].region, &outputs[i],
+				   PAINT_SCREEN_FULL_MASK);
+
+		XUnionRegion (tmpRegion,
+			      &outputs[i].region,
+			      tmpRegion);
+
+	    }
+	}
+    }
+}
+
 void
 eventLoop (void)
 {
     XEvent	   event;
-    int		   timeDiff, i;
+    int		   timeDiff;
     struct timeval tv;
-    Region	   tmpRegion, outputRegion;
     CompDisplay    *display = compDisplays;
     CompScreen	   *s;
     int		   time, timeToNextRedraw = 0;
@@ -1640,55 +1710,12 @@ eventLoop (void)
 			    glClear (GL_COLOR_BUFFER_BIT);
 		    }
 
-		    for (i = 0; i < s->nOutputDev; i++)
-		    {
-			targetScreen = s;
-			targetOutput = i;
-
-			if (s->nOutputDev > 1)
-			    glViewport (s->outputDev[i].region.extents.x1,
-					s->height -
-					s->outputDev[i].region.extents.y2,
-					s->outputDev[i].width,
-					s->outputDev[i].height);
-
-			if (mask & COMP_SCREEN_DAMAGE_ALL_MASK)
-			{
-			    (*s->paintScreen) (s,
-					       &defaultScreenPaintAttrib,
-					       &identity,
-					       &s->outputDev[i].region, i,
-					       PAINT_SCREEN_REGION_MASK |
-					       PAINT_SCREEN_FULL_MASK);
-			}
-			else if (mask & COMP_SCREEN_DAMAGE_REGION_MASK)
-			{
-			    XIntersectRegion (tmpRegion,
-					      &s->outputDev[i].region,
-					      outputRegion);
-
-			    if (!(*s->paintScreen) (s,
-						    &defaultScreenPaintAttrib,
-						    &identity,
-						    outputRegion, i,
-						    PAINT_SCREEN_REGION_MASK))
-			    {
-				(*s->paintScreen) (s,
-						   &defaultScreenPaintAttrib,
-						   &identity,
-						   &s->outputDev[i].region, i,
-						   PAINT_SCREEN_FULL_MASK);
-
-				XUnionRegion (tmpRegion,
-					      &s->outputDev[i].region,
-					      tmpRegion);
-
-			    }
-			}
-		    }
+		    (*s->paintScreen) (s, s->outputDev,
+				       s->nOutputDev,
+				       mask);
 
 		    targetScreen = NULL;
-		    targetOutput = 0;
+		    targetOutput = &s->outputDev[0];
 
 		    waitForVideoSync (s);
 

Modified: compiz/src/paint.c
===================================================================
--- compiz/src/paint.c
+++ compiz/src/paint.c
@@ -49,7 +49,7 @@ donePaintScreen (CompScreen *screen) {}
 void
 applyScreenTransform (CompScreen	      *screen,
 		      const ScreenPaintAttrib *sAttrib,
-		      int		      output,
+		      CompOutput	      *output,
 		      CompTransform	      *transform)
 {
     matrixTranslate (transform,
@@ -69,32 +69,32 @@ applyScreenTransform (CompScreen	      *screen,
 
 void
 transformToScreenSpace (CompScreen    *screen,
-			int	      output,
+			CompOutput    *output,
 			float         z,
 			CompTransform *transform)
 {
     matrixTranslate (transform, -0.5f, -0.5f, z);
     matrixScale (transform,
-		 1.0f  / screen->outputDev[output].width,
-		 -1.0f / screen->outputDev[output].height,
+		 1.0f  / output->width,
+		 -1.0f / output->height,
 		 1.0f);
     matrixTranslate (transform,
-		     -screen->outputDev[output].region.extents.x1,
-		     -screen->outputDev[output].region.extents.y2,
+		     -output->region.extents.x1,
+		     -output->region.extents.y2,
 		     0.0f);
 }
 
 void
 prepareXCoords (CompScreen *screen,
-		int	   output,
+		CompOutput *output,
 		float      z)
 {
     glTranslatef (-0.5f, -0.5f, z);
-    glScalef (1.0f  / screen->outputDev[output].width,
-	      -1.0f / screen->outputDev[output].height,
+    glScalef (1.0f  / output->width,
+	      -1.0f / output->height,
 	      1.0f);
-    glTranslatef (-screen->outputDev[output].region.extents.x1,
-		  -screen->outputDev[output].region.extents.y2,
+    glTranslatef (-output->region.extents.x1,
+		  -output->region.extents.y2,
 		  0.0f);
 }
 
@@ -150,10 +150,10 @@ paintCursor (CompCursor		 *c,
    transformed screen case should be made optional for those who do
    see a difference. */
 static void
-paintScreenRegion (CompScreen	       *screen,
+paintOutputRegion (CompScreen	       *screen,
 		   const CompTransform *transform,
 		   Region	       region,
-		   int		       output,
+		   CompOutput	       *output,
 		   unsigned int	       mask)
 {
     static Region tmpRegion = NULL;
@@ -248,11 +248,11 @@ paintScreenRegion (CompScreen	       *screen,
 			 PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_MASK)
 
 void
-paintTransformedScreen (CompScreen		*screen,
+paintTransformedOutput (CompScreen		*screen,
 			const ScreenPaintAttrib *sAttrib,
 			const CompTransform	*transform,
 			Region			region,
-			int			output,
+			CompOutput		*output,
 			unsigned int		mask)
 {
     CompTransform sTransform = *transform;
@@ -271,11 +271,11 @@ paintTransformedScreen (CompScreen		*screen,
 	GLdouble p1[2] = { region->extents.x1, h - region->extents.y2 };
 	GLdouble p2[2] = { region->extents.x2, h - region->extents.y1 };
 
-	GLdouble halfW = screen->outputDev[output].width / 2.0;
-	GLdouble halfH = screen->outputDev[output].height / 2.0;
+	GLdouble halfW = output->width / 2.0;
+	GLdouble halfH = output->height / 2.0;
 
-	GLdouble cx = screen->outputDev[output].region.extents.x1 + halfW;
-	GLdouble cy = (h - screen->outputDev[output].region.extents.y2) + halfH;
+	GLdouble cx = output->region.extents.x1 + halfW;
+	GLdouble cy = (h - output->region.extents.y2) + halfH;
 
 	GLdouble top[4]    = { 0.0, halfH / (cy - p1[1]), 0.0, 0.5 };
 	GLdouble bottom[4] = { 0.0, halfH / (cy - p2[1]), 0.0, 0.5 };
@@ -300,7 +300,7 @@ paintTransformedScreen (CompScreen		*screen,
 
 	glLoadMatrixf (sTransform.m);
 
-	paintScreenRegion (screen, &sTransform, region, output, mask);
+	paintOutputRegion (screen, &sTransform, region, output, mask);
 
 	glDisable (GL_CLIP_PLANE0);
 	glDisable (GL_CLIP_PLANE1);
@@ -317,18 +317,18 @@ paintTransformedScreen (CompScreen		*screen,
 	glPushMatrix ();
 	glLoadMatrixf (sTransform.m);
 
-	paintScreenRegion (screen, &sTransform, region, output, mask);
+	paintOutputRegion (screen, &sTransform, region, output, mask);
 
 	glPopMatrix ();
     }
 }
 
 Bool
-paintScreen (CompScreen		     *screen,
+paintOutput (CompScreen		     *screen,
 	     const ScreenPaintAttrib *sAttrib,
 	     const CompTransform     *transform,
 	     Region		     region,
-	     int		     output,
+	     CompOutput		     *output,
 	     unsigned int	     mask)
 {
     CompTransform sTransform = *transform;
@@ -339,9 +339,9 @@ paintScreen (CompScreen		     *screen,
 	{
 	    if (mask & PAINT_SCREEN_FULL_MASK)
 	    {
-		region = &screen->outputDev[output].region;
+		region = &output->region;
 
-		(*screen->paintTransformedScreen) (screen, sAttrib,
+		(*screen->paintTransformedOutput) (screen, sAttrib,
 						   &sTransform, region,
 						   output, mask);
 
@@ -355,8 +355,8 @@ paintScreen (CompScreen		     *screen,
     }
     else if (mask & PAINT_SCREEN_FULL_MASK)
     {
-	(*screen->paintTransformedScreen) (screen, sAttrib, &sTransform,
-					   &screen->outputDev[output].region,
+	(*screen->paintTransformedOutput) (screen, sAttrib, &sTransform,
+					   &output->region,
 					   output, mask);
 
 	return TRUE;
@@ -371,7 +371,7 @@ paintScreen (CompScreen		     *screen,
     glPushMatrix ();
     glLoadMatrixf (sTransform.m);
 
-    paintScreenRegion (screen, &sTransform, region, output, mask);
+    paintOutputRegion (screen, &sTransform, region, output, mask);
 
     glPopMatrix ();
 

Modified: compiz/src/screen.c
===================================================================
--- compiz/src/screen.c
+++ compiz/src/screen.c
@@ -821,6 +821,15 @@ reshape (CompScreen *s,
     s->width  = w;
     s->height = h;
 
+    s->fullscreenOutput.name             = "fullscreen";
+    s->fullscreenOutput.width            = w;
+    s->fullscreenOutput.height           = h;
+    s->fullscreenOutput.region           = s->region;
+    s->fullscreenOutput.workArea.x       = 0;
+    s->fullscreenOutput.workArea.y       = 0;
+    s->fullscreenOutput.workArea.width   = w;
+    s->fullscreenOutput.workArea.height  = h;
+ 
     updateScreenEdges (s);
 }
 
@@ -1514,7 +1523,8 @@ addScreen (CompDisplay *display,
     s->preparePaintScreen	  = preparePaintScreen;
     s->donePaintScreen		  = donePaintScreen;
     s->paintScreen		  = paintScreen;
-    s->paintTransformedScreen	  = paintTransformedScreen;
+    s->paintOutput		  = paintOutput;
+    s->paintTransformedOutput	  = paintTransformedOutput;
     s->applyScreenTransform	  = applyScreenTransform;
     s->paintBackground		  = paintBackground;
     s->paintWindow		  = paintWindow;
@@ -3604,10 +3614,10 @@ outputChangeNotify (CompScreen *s)
 
 void
 clearScreenOutput (CompScreen	*s,
-		   int		output,
+		   CompOutput	*output,
 		   unsigned int mask)
 {
-    BoxPtr pBox = &s->outputDev[output].region.extents;
+    BoxPtr pBox = &output->region.extents;
 
     if (pBox->x1 != 0	     ||
 	pBox->y1 != 0	     ||



More information about the commits mailing list