← Back to team overview

compiz team mailing list archive

[Merge] lp:~vanvugt/compiz-core/fix-731685 into lp:compiz-core

 

Daniel van Vugt has proposed merging lp:~vanvugt/compiz-core/fix-731685 into lp:compiz-core.

Requested reviews:
  Sam Spilsbury (smspillaz)
  compiz packagers (compiz)
Related bugs:
  Bug #731685 in unity: "Panel shadow conflicts with Window shadow in Ubuntu Classic Desktop Session"
  https://bugs.launchpad.net/unity/+bug/731685

For more details, see:
https://code.launchpad.net/~vanvugt/compiz-core/fix-731685/+merge/73633

Fix dock shadow artifacts with rounded window decorations. (LP: #731685)

Removes the assumption that all window decorations are rectangular when overlapping the shadow of a dock like gnome-panel.
-- 
https://code.launchpad.net/~vanvugt/compiz-core/fix-731685/+merge/73633
Your team compiz packagers is requested to review the proposed merge of lp:~vanvugt/compiz-core/fix-731685 into lp:compiz-core.
=== modified file 'plugins/decor/src/decor.cpp'
--- plugins/decor/src/decor.cpp	2011-08-19 14:25:11 +0000
+++ plugins/decor/src/decor.cpp	2011-09-01 07:24:26 +0000
@@ -93,34 +93,8 @@
 {
     shadowRegion = CompRegion (window->outputRect ());
 
-    if (window->type () == CompWindowTypeDockMask)
-    {
-        /* windows above this one in the stack should
-         * clip the shadow */
-
-        CompWindowList::iterator it = std::find (screen->windows ().begin (),
-                                                 screen->windows ().end (),
-                                                 window);
-
-        for (it--; it != screen->windows ().end (); it--)
-        {
-            CompRegion inter;
-
-            if (!(*it)->isViewable ())
-                continue;
-
-            if ((*it)->type () & CompWindowTypeDesktopMask)
-                continue;
-
-	    inter = shadowRegion.intersected ((*it)->borderRect ());
-
-            if (!inter.isEmpty ())
-		shadowRegion = shadowRegion.subtracted (inter);
-
-        }
-    }
-    else if (window->type () == CompWindowTypeDropdownMenuMask ||
-             window->type () == CompWindowTypePopupMenuMask)
+    if (window->type () == CompWindowTypeDropdownMenuMask ||
+        window->type () == CompWindowTypePopupMenuMask)
     {
         /* Other transient menus should clip
          * this menu's shadows, also the panel
@@ -245,6 +219,34 @@
 
     status = gWindow->glDraw (transform, attrib, region, mask);
 
+    /* Don't render dock decorations (shadows) on just any old window */
+    if (!(window->type () & CompWindowTypeDockMask))
+    {
+	glDecorate (transform, attrib, region, mask);
+	/* Render dock decorations (shadows) on desktop windows only */
+	if (window->type () & CompWindowTypeDesktopMask)
+	{
+	    foreach (CompWindow *w, dScreen->cScreen->getWindowPaintList ())
+	    {
+		if ((w->type () & CompWindowTypeDockMask) &&
+		    !(w->destroyed () || w->invisible ()))
+		{
+		    DecorWindow *d = DecorWindow::get (w);
+		    d->glDecorate (transform, attrib, region, mask);
+		}
+	    }
+	}
+    }
+
+    return status;
+}
+
+void
+DecorWindow::glDecorate (const GLMatrix     &transform,
+		         GLFragment::Attrib &attrib,
+		         const CompRegion   &region,
+		         unsigned int       mask)
+{
     const CompRegion reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
 			   infiniteRegion : shadowRegion.intersected (region);
 
@@ -283,7 +285,7 @@
 	if (gWindow->textures ().empty ())
 	    gWindow->bind ();
 	if (gWindow->textures ().empty ())
-	    return status;
+	    return;
 
 	if (gWindow->textures ().size () == 1)
 	{
@@ -310,8 +312,6 @@
 	    }
 	}
     }
-
-    return status;
 }
 
 static bool bindFailed;

=== modified file 'plugins/decor/src/decor.h'
--- plugins/decor/src/decor.h	2011-05-08 13:44:52 +0000
+++ plugins/decor/src/decor.h	2011-09-01 07:24:26 +0000
@@ -205,6 +205,8 @@
 
 	bool glDraw (const GLMatrix &, GLFragment::Attrib &,
 		     const CompRegion &, unsigned int);
+	void glDecorate (const GLMatrix &, GLFragment::Attrib &,
+		         const CompRegion &, unsigned int);
 
 	void windowNotify (CompWindowNotify n);
 


Follow ups