Merge lp:~vanvugt/unity/fix-1021541 into lp:unity

Proposed by Daniel van Vugt
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: no longer in the source branch.
Merged at revision: 2473
Proposed branch: lp:~vanvugt/unity/fix-1021541
Merge into: lp:unity
Diff against target: 160 lines (+37/-33)
3 files modified
manual-tests/Dash.txt (+15/-0)
plugins/unityshell/src/unityshell.cpp (+20/-32)
plugins/unityshell/src/unityshell.h (+2/-1)
To merge this branch: bzr merge lp:~vanvugt/unity/fix-1021541
Reviewer Review Type Date Requested Status
Łukasz Zemczak Approve
Review via email: mp+113685@code.launchpad.net

Commit message

Ensure the unity shell gets drawn before (below) windows stacked above it,
like DnD icons (LP: #1021541)

Description of the change

Ensure the unity shell gets drawn before (below) windows stacked above it,
like DnD icons (LP: #1021541)

UNBLOCK

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

This looks okay.

If you're having trouble with override redirect windows not visually obscuring the dash and launcher, but logically doing so and thus causing the dash and launcher to flicker, I'd suggest using CompWindow::region () instead of CompWindow::geometry (), as the former will include the XShape region.

Either that or don't include override redirect windows in the calculation when the cursor is grabbed.

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

A second note here, while it is not appropriate to enforce autotesting at this point since we're unblocking a release, however I'd strongly suggest using automated unit and integration testing as a means to test this code in future, or at least make it a priority to get it covered by autotest. People running trunk don't manually go through all the manual tests and the feedback loop that we have on the manual tests is quite (this is a fact of life).

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

Oh wow, language fail, "while ..., I'd" ...

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Code looks fine and tested branch fixes the issue, +1

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-unity/898/console reported an error when processing this lp:~vanvugt/unity/fix-1021541 branch.
Not merging it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Dash.txt'
2--- manual-tests/Dash.txt 2012-06-21 06:55:53 +0000
3+++ manual-tests/Dash.txt 2012-07-06 05:55:25 +0000
4@@ -204,6 +204,21 @@
5 Outcome:
6 The Dash should close and the music file should open up in Firefox.
7
8+
9+DnD stacking
10+------------
11+
12+Setup:
13+#. Open the Dash (Super).
14+
15+Action:
16+#. Drag any icon from the dash and wave it over the dash and launcher area.
17+
18+Outcome:
19+ The icon being dragged is drawn on top of the dash and launcher. Never
20+ below it.
21+
22+
23 Lens Tests
24 ============
25
26
27=== modified file 'plugins/unityshell/src/unityshell.cpp'
28--- plugins/unityshell/src/unityshell.cpp 2012-07-04 02:37:23 +0000
29+++ plugins/unityshell/src/unityshell.cpp 2012-07-06 05:55:25 +0000
30@@ -916,7 +916,8 @@
31 bool UnityScreen::forcePaintOnTop ()
32 {
33 return !allowWindowPaint ||
34- ((switcher_controller_->Visible() || launcher_controller_->IsOverlayOpen())
35+ ((switcher_controller_->Visible() ||
36+ PluginAdapter::Default()->IsExpoActive())
37 && !fullscreen_windows_.empty () && (!(screen->grabbed () && !screen->otherGrabExist (NULL))));
38 }
39
40@@ -1241,14 +1242,14 @@
41 #endif
42
43 // CompRegion has no clear() method. So this is the fastest alternative.
44- aboveShell = CompRegion();
45+ fullscreenRegion = CompRegion();
46 nuxRegion = CompRegion();
47
48 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
49 ret = gScreen->glPaintOutput(attrib, transform, region, output, mask);
50
51 #ifndef USE_MODERN_COMPIZ_GL
52- if (doShellRepaint && !force && aboveShell.contains(*output))
53+ if (doShellRepaint && !force && fullscreenRegion.contains(*output))
54 doShellRepaint = false;
55
56 if (doShellRepaint)
57@@ -1313,6 +1314,7 @@
58 compizDamageNux(cScreen->currentDamage());
59
60 didShellRepaint = false;
61+ firstWindowAboveShell = NULL;
62 }
63
64 void UnityScreen::donePaint()
65@@ -2286,13 +2288,17 @@
66 /*
67 * The occlusion pass tests windows from TOP to BOTTOM. That's opposite to
68 * the actual painting loop.
69+ *
70+ * Detect uScreen->fullscreenRegion here. That represents the region which
71+ * fully covers the shell on its output. It does not include regular windows
72+ * stacked above the shell like DnD icons or Onboard etc.
73 */
74 if (isNuxWindow(window))
75 {
76 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
77 {
78 uScreen->nuxRegion += window->geometry();
79- uScreen->nuxRegion -= uScreen->aboveShell;
80+ uScreen->nuxRegion -= uScreen->fullscreenRegion;
81 }
82 return false; // Ensure nux windows are never painted by compiz
83 }
84@@ -2302,14 +2308,17 @@
85 PAINT_WINDOW_TRANSLUCENT_MASK |
86 PAINT_WINDOW_TRANSFORMED_MASK |
87 PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
88- if (!(mask & nonOcclusionBits))
89+ if (!(mask & nonOcclusionBits) &&
90+ (window->state() & CompWindowStateFullscreenMask))
91 // And I've been advised to test other things, but they don't work:
92 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw
93 // && !window->alpha() <-- Doesn't work; Opaque windows often have alpha
94 {
95- uScreen->aboveShell += window->geometry();
96- uScreen->aboveShell -= uScreen->nuxRegion;
97+ uScreen->fullscreenRegion += window->geometry();
98+ uScreen->fullscreenRegion -= uScreen->nuxRegion;
99 }
100+ if (uScreen->nuxRegion.isEmpty())
101+ uScreen->firstWindowAboveShell = window;
102 }
103
104 GLWindowPaintAttrib wAttrib = attrib;
105@@ -2370,38 +2379,17 @@
106 }
107 }
108
109- /*
110- * Paint the shell in *roughly* the compiz stacking order. This is only
111- * approximate because we're painting all the nux windows as soon as we find
112- * the bottom-most nux window (from bottom to top).
113- * But remember to avoid painting the shell if it's within the aboveShell
114- * region.
115- */
116 if (uScreen->doShellRepaint &&
117 !uScreen->forcePaintOnTop () &&
118- !uScreen->aboveShell.contains(window->geometry())
119+ window == uScreen->firstWindowAboveShell &&
120+ !uScreen->fullscreenRegion.contains(window->geometry())
121 )
122 {
123- std::vector<Window> const& xwns = nux::XInputWindow::NativeHandleList();
124- unsigned int size = xwns.size();
125-
126- for (CompWindow* w = window; w && uScreen->doShellRepaint; w = w->prev)
127- {
128- auto id = w->id();
129-
130- for (unsigned int i = 0; i < size; ++i)
131- {
132- if (xwns[i] == id)
133- {
134 #ifdef USE_MODERN_COMPIZ_GL
135- uScreen->paintDisplay();
136+ uScreen->paintDisplay();
137 #else
138- uScreen->paintDisplay(region, matrix, mask);
139+ uScreen->paintDisplay(region, matrix, mask);
140 #endif
141- break;
142- }
143- }
144- }
145 }
146
147 if (window->type() == CompWindowTypeDesktopMask)
148
149=== modified file 'plugins/unityshell/src/unityshell.h'
150--- plugins/unityshell/src/unityshell.h 2012-07-04 02:37:23 +0000
151+++ plugins/unityshell/src/unityshell.h 2012-07-06 05:55:25 +0000
152@@ -283,7 +283,8 @@
153 CompOutput* _last_output;
154
155 CompRegion nuxRegion;
156- CompRegion aboveShell;
157+ CompRegion fullscreenRegion;
158+ CompWindow* firstWindowAboveShell;
159
160 nux::Property<nux::Geometry> primary_monitor_;
161