Merge lp:~3v1n0/unity/panel-shadow-over-off-windows into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Francis Ginther
Approved revision: no longer in the source branch.
Merged at revision: 3303
Proposed branch: lp:~3v1n0/unity/panel-shadow-over-off-windows
Merge into: lp:unity
Diff against target: 73 lines (+41/-17)
1 file modified
plugins/unityshell/src/unityshell.cpp (+41/-17)
To merge this branch: bzr merge lp:~3v1n0/unity/panel-shadow-over-off-windows
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Review via email: mp+158962@code.launchpad.net

Commit message

UnityWindow: paint the panel shadow over a window if it's under the panel.

Description of the change

When drawing the panel shadow, we now follow a simple rule:

if a window is maximized or below its display panel, then we draw the panel shadow under it, otherwise we draw it over it.

Result: http://ubuntuone.com/4qbARJX46ZrO6TbrFOfgeb

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:3302
http://jenkins.qa.ubuntu.com/job/unity-ci/18/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-raring-armhf-ci/18

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity-ci/18/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Code looks good to me. Works here.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Jenkins job was broken. Reapproving to land again.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2013-04-12 11:30:35 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2013-04-15 15:49:44 +0000
4@@ -2598,28 +2598,52 @@
5 uScreen->paintDisplay();
6 }
7
8- bool screen_transformed = (mask & PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
9-
10- if (window->type() == CompWindowTypeDesktopMask && !screen_transformed)
11- uScreen->setPanelShadowMatrix(matrix);
12-
13- Window active_window = screen->activeWindow();
14-
15- if (!screen_transformed &&
16- window->id() == active_window &&
17- window->type() != CompWindowTypeDesktopMask)
18- {
19+ enum class DrawPanelShadow
20+ {
21+ NO,
22+ BELOW_WINDOW,
23+ OVER_WINDOW,
24+ };
25+
26+ auto draw_panel_shadow = DrawPanelShadow::NO;
27+
28+ if (!(mask & PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK))
29+ {
30+ Window active_window = screen->activeWindow();
31+
32+ if (G_UNLIKELY(window->type() == CompWindowTypeDesktopMask))
33+ {
34+ uScreen->setPanelShadowMatrix(matrix);
35+
36+ if (active_window == 0 || active_window == window->id())
37+ draw_panel_shadow = DrawPanelShadow::OVER_WINDOW;
38+ }
39+ else
40+ {
41+ if (window->id() == active_window)
42+ {
43+ draw_panel_shadow = DrawPanelShadow::BELOW_WINDOW;
44+
45+ if (!(window->state() & MAXIMIZE_STATE))
46+ {
47+ auto const& output = uScreen->screen->currentOutputDev();
48+
49+ if (window->y() - window->border().top < output.y() + uScreen->panel_style_.panel_height)
50+ {
51+ draw_panel_shadow = DrawPanelShadow::OVER_WINDOW;
52+ }
53+ }
54+ }
55+ }
56+ }
57+
58+ if (draw_panel_shadow == DrawPanelShadow::BELOW_WINDOW)
59 uScreen->paintPanelShadow(region);
60- }
61
62 bool ret = gWindow->glDraw(matrix, attrib, region, mask);
63
64- if (!screen_transformed &&
65- (active_window == 0 || active_window == window->id()) &&
66- (window->type() == CompWindowTypeDesktopMask))
67- {
68+ if (draw_panel_shadow == DrawPanelShadow::OVER_WINDOW)
69 uScreen->paintPanelShadow(region);
70- }
71
72 return ret;
73 }