Merge lp:~vanvugt/compiz/fix-731685-trunk into lp:~compiz/compiz/ubuntu

Proposed by Daniel van Vugt
Status: Superseded
Proposed branch: lp:~vanvugt/compiz/fix-731685-trunk
Merge into: lp:~compiz/compiz/ubuntu
Diff against target: 127 lines (+117/-0)
2 files modified
debian/patches/fix_dock_shadow_artifacts.patch (+116/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~vanvugt/compiz/fix-731685-trunk
Reviewer Review Type Date Requested Status
Sam Spilsbury Pending
compiz packagers Pending
Review via email: mp+70836@code.launchpad.net

This proposal has been superseded by a proposal from 2011-09-01.

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. This false assumption was added to compiz 0.9.4 apparently for performance reasons, however it causes visible artifacts where the shadow should be visible.

The patch contained in this proposal was developed and tested on natty, however it appears to be compatible with oneiric also (thankfully).

Fixing bug 731685 is particularly useful because it opens the door for us to be able to eliminate and simplify the redundant shadowing code in unity (panel). This should allow us to fix other outstanding unity shadow bugs quite easily.

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

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 :

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 :

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 :

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 :

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 :(

Unmerged revisions

639. By Daniel van Vugt

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

638. By Sam Spilsbury

Remove symbols that we're not shipping anymore

637. By Didier Roche-Tolomelli

* New upstream release
* debian/compiz-gnome.install:
  - install gsettings schemas

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'debian/patches/fix_dock_shadow_artifacts.patch'
2--- debian/patches/fix_dock_shadow_artifacts.patch 1970-01-01 00:00:00 +0000
3+++ debian/patches/fix_dock_shadow_artifacts.patch 2011-08-09 09:33:27 +0000
4@@ -0,0 +1,116 @@
5+Description: Fix dock shadow artifacts with rounded window decorations.
6+ Removes the assumption that all window decorations are rectangular when
7+ overlapping the shadow of a dock like gnome-panel. This false assumption
8+ was added to compiz 0.9.4 apparently for performance reasons, however it
9+ causes visible artifacts where the shadow should be visible.
10+Bug-Ubuntu: https://launchpad.net/bugs/731685
11+Author: Daniel van Vugt <vanvugt@gmail.com>
12+Forwarded: no
13+
14+=== modified file 'plugins/decor/src/decor.cpp'
15+--- old/plugins/decor/src/decor.cpp 2011-06-01 10:23:26 +0000
16++++ new/plugins/decor/src/decor.cpp 2011-08-09 08:59:21 +0000
17+@@ -79,34 +79,8 @@
18+ {
19+ shadowRegion = CompRegion (window->outputRect ());
20+
21+- if (window->type () == CompWindowTypeDockMask)
22+- {
23+- /* windows above this one in the stack should
24+- * clip the shadow */
25+-
26+- CompWindowList::iterator it = std::find (screen->windows ().begin (),
27+- screen->windows ().end (),
28+- window);
29+-
30+- for (it--; it != screen->windows ().end (); it--)
31+- {
32+- CompRegion inter;
33+-
34+- if (!(*it)->isViewable ())
35+- continue;
36+-
37+- if ((*it)->type () & CompWindowTypeDesktopMask)
38+- continue;
39+-
40+- inter = shadowRegion.intersected ((*it)->borderRect ());
41+-
42+- if (!inter.isEmpty ())
43+- shadowRegion = shadowRegion.subtracted (inter);
44+-
45+- }
46+- }
47+- else if (window->type () == CompWindowTypeDropdownMenuMask ||
48+- window->type () == CompWindowTypePopupMenuMask)
49++ if (window->type () == CompWindowTypeDropdownMenuMask ||
50++ window->type () == CompWindowTypePopupMenuMask)
51+ {
52+ /* Other transient menus should clip
53+ * this menu's shadows, also the panel
54+@@ -175,6 +149,34 @@
55+
56+ status = gWindow->glDraw (transform, attrib, region, mask);
57+
58++ /* Don't render dock decorations (shadows) on just any old window */
59++ if (!(window->type () & CompWindowTypeDockMask))
60++ {
61++ glDecorate (transform, attrib, region, mask);
62++ /* Render dock decorations (shadows) on desktop windows only */
63++ if (window->type () & CompWindowTypeDesktopMask)
64++ {
65++ foreach (CompWindow *w, dScreen->cScreen->getWindowPaintList ())
66++ {
67++ if ((w->type () & CompWindowTypeDockMask) &&
68++ !(w->destroyed () || w->invisible ()))
69++ {
70++ DecorWindow *d = DecorWindow::get (w);
71++ d->glDecorate (transform, attrib, region, mask);
72++ }
73++ }
74++ }
75++ }
76++
77++ return status;
78++}
79++
80++void
81++DecorWindow::glDecorate (const GLMatrix &transform,
82++ GLFragment::Attrib &attrib,
83++ const CompRegion &region,
84++ unsigned int mask)
85++{
86+ const CompRegion reg = (mask & PAINT_WINDOW_TRANSFORMED_MASK) ?
87+ infiniteRegion : shadowRegion.intersected (region);
88+
89+@@ -213,7 +215,7 @@
90+ if (gWindow->textures ().empty ())
91+ gWindow->bind ();
92+ if (gWindow->textures ().empty ())
93+- return status;
94++ return;
95+
96+ if (gWindow->textures ().size () == 1)
97+ {
98+@@ -240,8 +242,6 @@
99+ }
100+ }
101+ }
102+-
103+- return status;
104+ }
105+
106+ static bool bindFailed;
107+
108+=== modified file 'plugins/decor/src/decor.h'
109+--- old/plugins/decor/src/decor.h 2011-02-24 17:31:29 +0000
110++++ new/plugins/decor/src/decor.h 2011-08-09 08:59:21 +0000
111+@@ -182,6 +182,8 @@
112+
113+ bool glDraw (const GLMatrix &, GLFragment::Attrib &,
114+ const CompRegion &, unsigned int);
115++ void glDecorate (const GLMatrix &, GLFragment::Attrib &,
116++ const CompRegion &, unsigned int);
117+
118+ void windowNotify (CompWindowNotify n);
119+
120+
121
122=== modified file 'debian/patches/series'
123--- debian/patches/series 2011-07-19 05:18:01 +0000
124+++ debian/patches/series 2011-08-09 09:33:27 +0000
125@@ -1,1 +1,2 @@
126 01_don_t_init_a11y.patch
127+fix_dock_shadow_artifacts.patch

Subscribers

People subscribed via source and target branches

to all changes: