[fusion-commits] compiz mirror: Changes to 'master' (8090d5e9ddeafec574acd36cc3c1394536a115fc)

compiz at server.beryl-project.org compiz at server.beryl-project.org
Fri Jul 6 07:58:04 CEST 2007


New commits:
commit 8090d5e9ddeafec574acd36cc3c1394536a115fc
Author: Danny Baumann <dannybaumann at web.de>
Date:   Fri Jul 6 07:55:39 2007 +0200

    Added wrap-able function that can be used for preventing scaled window drawing and adjusting paint attributes for scaled window drawing.


 include/scale.h |    6 +++-
 plugins/scale.c |   98 ++++++++++++++++++++++++++++++++-----------------------
 2 files changed, 62 insertions(+), 42 deletions(-)


Modified: compiz/include/scale.h
===================================================================
--- compiz/include/scale.h
+++ compiz/include/scale.h
@@ -25,7 +25,7 @@
 
 #include <compiz.h>
 
-#define SCALE_ABIVERSION 20070607
+#define SCALE_ABIVERSION 20070706
 
 #define SCALE_STATE_NONE 0
 #define SCALE_STATE_OUT  1
@@ -94,6 +94,9 @@ typedef enum {
 
 typedef Bool (*ScaleLayoutSlotsAndAssignWindowsProc) (CompScreen *s);
 
+typedef Bool (*ScaleSetScaledPaintAttributesProc) (CompWindow        *w,
+						   WindowPaintAttrib *attrib);
+
 typedef void (*ScalePaintDecorationProc) (CompWindow		  *w,
 					  const WindowPaintAttrib *attrib,
 					  const CompTransform     *transform,
@@ -110,6 +113,7 @@ typedef struct _ScaleScreen {
     DamageWindowRectProc   damageWindowRect;
 
     ScaleLayoutSlotsAndAssignWindowsProc layoutSlotsAndAssignWindows;
+    ScaleSetScaledPaintAttributesProc    setScaledPaintAttributes;
     ScalePaintDecorationProc		 scalePaintDecoration;
 
     CompOption opt[SCALE_SCREEN_OPTION_NUM];

Modified: compiz/plugins/scale.c
===================================================================
--- compiz/plugins/scale.c
+++ compiz/plugins/scale.c
@@ -305,6 +305,59 @@ scalePaintDecoration (CompWindow	      *w,
 }
 
 static Bool
+setScaledPaintAttributes (CompWindow        *w,
+			  WindowPaintAttrib *attrib)
+{
+    Bool drawScaled = FALSE;
+
+    SCALE_SCREEN (w->screen);
+    SCALE_WINDOW (w);
+
+    if (sw->adjust || sw->slot)
+    {
+	SCALE_DISPLAY (w->screen->display);
+
+	if (w->id	    != sd->selectedWindow &&
+	    ss->opacity != OPAQUE		  &&
+	    ss->state   != SCALE_STATE_IN)
+	{
+    	    /* modify opacity of windows that are not active */
+	    attrib->opacity = (attrib->opacity * ss->opacity) >> 16;
+	}
+
+     	drawScaled = TRUE;
+    }
+    else if (ss->state != SCALE_STATE_IN)
+    {
+	if (ss->opt[SCALE_SCREEN_OPTION_DARKEN_BACK].value.b)
+	{
+	    /* modify brightness of the other windows */
+	    attrib->brightness = attrib->brightness / 2;
+	}
+
+     	/* hide windows on the outputs used for scaling 
+	   that are not in scale mode */
+	if (!isNeverScaleWin (w))
+	{
+	    int moMode;
+	    moMode = ss->opt[SCALE_SCREEN_OPTION_MULTIOUTPUT_MODE].value.i;
+
+	    switch (moMode) {
+	    case SCALE_MOMODE_CURRENT:
+    		if (outputDeviceForWindow (w) == w->screen->currentOutputDev)
+		    attrib->opacity = 0;
+		break;
+	    default:
+	      	attrib->opacity = 0;
+		break;
+	    }
+	}
+    }
+
+    return drawScaled;
+}
+
+static Bool
 scalePaintWindow (CompWindow		  *w,
 		  const WindowPaintAttrib *attrib,
 		  const CompTransform	  *transform,
@@ -319,52 +372,14 @@ scalePaintWindow (CompWindow		  *w,
     if (ss->state != SCALE_STATE_NONE)
     {
 	WindowPaintAttrib sAttrib = *attrib;
-	Bool		  scaled = FALSE;
+	Bool		  scaled;
 
 	SCALE_WINDOW (w);
 
-	if (sw->adjust || sw->slot)
-	{
-	    SCALE_DISPLAY (s->display);
-
-	    if (w->id	    != sd->selectedWindow &&
-		ss->opacity != OPAQUE		  &&
-		ss->state   != SCALE_STATE_IN)
-	    {
-		/* modify opacity of windows that are not active */
-		sAttrib.opacity = (sAttrib.opacity * ss->opacity) >> 16;
-	    }
-
-	    scaled = TRUE;
+	scaled = (*ss->setScaledPaintAttributes) (w, &sAttrib);
 
+	if (sw->adjust || sw->slot)
 	    mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
-	}
-	else if (ss->state != SCALE_STATE_IN)
-	{
-	    if (ss->opt[SCALE_SCREEN_OPTION_DARKEN_BACK].value.b)
-	    {
-		/* modify brightness of the other windows */
-		sAttrib.brightness = sAttrib.brightness / 2;
-	    }
-
-	    /* hide windows on the outputs used for scaling 
-	       that are not in scale mode */
-	    if (!isNeverScaleWin (w))
-	    {
-		int moMode;
-		moMode = ss->opt[SCALE_SCREEN_OPTION_MULTIOUTPUT_MODE].value.i;
-
-		switch (moMode) {
-		case SCALE_MOMODE_CURRENT:
-		    if (outputDeviceForWindow (w) == s->currentOutputDev)
-			sAttrib.opacity = 0;
-		    break;
-		default:
-		    sAttrib.opacity = 0;
-		    break;
-		}
-	    }
-	}
 
 	UNWRAP (ss, s, paintWindow);
 	status = (*s->paintWindow) (w, &sAttrib, transform, region, mask);
@@ -1963,6 +1978,7 @@ scaleInitScreen (CompPlugin *p,
     matchInit (&ss->match);
 
     ss->layoutSlotsAndAssignWindows = layoutSlotsAndAssignWindows;
+    ss->setScaledPaintAttributes    = setScaledPaintAttributes;
     ss->scalePaintDecoration	    = scalePaintDecoration;
 
     WRAP (ss, s, preparePaintScreen, scalePreparePaintScreen);


More information about the commits mailing list