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

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 2798
Merged at revision: 2805
Proposed branch: lp:~vanvugt/compiz-core/fix-731685
Merge into: lp:compiz-core/0.9.5
Diff against target: 105 lines (+33/-31)
2 files modified
plugins/decor/src/decor.cpp (+31/-31)
plugins/decor/src/decor.h (+2/-0)
To merge this branch: bzr merge lp:~vanvugt/compiz-core/fix-731685
Reviewer Review Type Date Requested Status
compiz packagers Pending
Sam Spilsbury Pending
Review via email: mp+73633@code.launchpad.net

This proposal supersedes a proposal from 2011-08-09.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Indeed this assumption (window is not transformed) is in place.

However, I'd prefer not to render shadows on top of the desktop window. I think that there's a better way to handle this and ensure that we're not rendering the decoration twice. It might be worth clipping the shadow based on the frame region rather than the border rect itself.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

The code is not fresh in my mind, however I think you will find that:

* This fix is much smaller, simpler to maintain and probably faster than the clipping/stencilling you talk about.
* This fix potentially supports smoothed window decorations, but clipping/stencilling would not.
* This fix works right now. No other working fix exists AFAIK :)

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Also, I don't think this proposal is "rendering the decoration twice".

It avoids rendering all dock shadows until it draws the desktop window. Only then does it render the dock shadow for the first time. You might have to apply the patch and look at the resulting DecorWindow::glDraw() to see why.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Thu, Sep 1, 2011 at 12:09 PM, Daniel van Vugt <email address hidden> wrote:
> The code is not fresh in my mind, however I think you will find that:
>
> * This fix is much smaller, simpler to maintain and probably faster than the clipping/stencilling you talk about.
> * This fix potentially supports smoothed window decorations, but clipping/stencilling would not.
> * This fix works right now. No other working fix exists AFAIK :)

Yeah, I agree with all this. In that case, I've changed my mind about
this and will be happy to take it, but I'll note here that decorations
really ought to be moved into their own independently paintable
objects in the paint stack, rather than hooking the paint function for
the desktop window (the primary problem with this approach is that a
plugin can inhibit the painting of a desktop window and then the panel
will have no shadow, which doesn't make any sense to me). However,
since we don't have the infrastructure in core to do that yet, we'll
have to do it this way for now.

>
> --
> https://code.launchpad.net/~vanvugt/compiz/fix-731685-trunk/+merge/70836
> You are requested to review the proposed merge of lp:~vanvugt/compiz/fix-731685-trunk into lp:compiz.
>

--
Sam Spilsbury

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Trying to resubmit the proposal
from: ~vanvugt/compiz-core/fix-731685
to: lp:compiz-core

But Launchpad is just timing out every time. Please wait :(

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

+1 as per previous discussion

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/decor/src/decor.cpp'
2--- plugins/decor/src/decor.cpp 2011-08-19 14:25:11 +0000
3+++ plugins/decor/src/decor.cpp 2011-09-01 07:24:26 +0000
4@@ -93,34 +93,8 @@
5 {
6 shadowRegion = CompRegion (window->outputRect ());
7
8- if (window->type () == CompWindowTypeDockMask)
9- {
10- /* windows above this one in the stack should
11- * clip the shadow */
12-
13- CompWindowList::iterator it = std::find (screen->windows ().begin (),
14- screen->windows ().end (),
15- window);
16-
17- for (it--; it != screen->windows ().end (); it--)
18- {
19- CompRegion inter;
20-
21- if (!(*it)->isViewable ())
22- continue;
23-
24- if ((*it)->type () & CompWindowTypeDesktopMask)
25- continue;
26-
27- inter = shadowRegion.intersected ((*it)->borderRect ());
28-
29- if (!inter.isEmpty ())
30- shadowRegion = shadowRegion.subtracted (inter);
31-
32- }
33- }
34- else if (window->type () == CompWindowTypeDropdownMenuMask ||
35- window->type () == CompWindowTypePopupMenuMask)
36+ if (window->type () == CompWindowTypeDropdownMenuMask ||
37+ window->type () == CompWindowTypePopupMenuMask)
38 {
39 /* Other transient menus should clip
40 * this menu's shadows, also the panel
41@@ -245,6 +219,34 @@
42
43 status = gWindow->glDraw (transform, attrib, region, mask);
44
45+ /* Don't render dock decorations (shadows) on just any old window */
46+ if (!(window->type () & CompWindowTypeDockMask))
47+ {
48+ glDecorate (transform, attrib, region, mask);
49+ /* Render dock decorations (shadows) on desktop windows only */
50+ if (window->type () & CompWindowTypeDesktopMask)
51+ {
52+ foreach (CompWindow *w, dScreen->cScreen->getWindowPaintList ())
53+ {
54+ if ((w->type () & CompWindowTypeDockMask) &&
55+ !(w->destroyed () || w->invisible ()))
56+ {
57+ DecorWindow *d = DecorWindow::get (w);
58+ d->glDecorate (transform, attrib, region, mask);
59+ }
60+ }
61+ }
62+ }
63+
64+ return status;
65+}
66+
67+void
68+DecorWindow::glDecorate (const GLMatrix &transform,
69+ GLFragment::Attrib &attrib,
70+ const CompRegion &region,
71+ unsigned int mask)
72+{
73 const CompRegion reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
74 infiniteRegion : shadowRegion.intersected (region);
75
76@@ -283,7 +285,7 @@
77 if (gWindow->textures ().empty ())
78 gWindow->bind ();
79 if (gWindow->textures ().empty ())
80- return status;
81+ return;
82
83 if (gWindow->textures ().size () == 1)
84 {
85@@ -310,8 +312,6 @@
86 }
87 }
88 }
89-
90- return status;
91 }
92
93 static bool bindFailed;
94
95=== modified file 'plugins/decor/src/decor.h'
96--- plugins/decor/src/decor.h 2011-05-08 13:44:52 +0000
97+++ plugins/decor/src/decor.h 2011-09-01 07:24:26 +0000
98@@ -205,6 +205,8 @@
99
100 bool glDraw (const GLMatrix &, GLFragment::Attrib &,
101 const CompRegion &, unsigned int);
102+ void glDecorate (const GLMatrix &, GLFragment::Attrib &,
103+ const CompRegion &, unsigned int);
104
105 void windowNotify (CompWindowNotify n);
106

Subscribers

People subscribed via source and target branches