Merge lp:~canonical-dx-team/unity/unity.paint_order_fixes_gl_draw into lp:unity

Proposed by Sam Spilsbury
Status: Merged
Approved by: Jason Smith
Approved revision: no longer in the source branch.
Merged at revision: 622
Proposed branch: lp:~canonical-dx-team/unity/unity.paint_order_fixes_gl_draw
Merge into: lp:unity
Diff against target: 127 lines (+27/-24)
2 files modified
src/unity.cpp (+25/-24)
src/unity.h (+2/-0)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.paint_order_fixes_gl_draw
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+41715@code.launchpad.net

Commit message

Fixes the unity interface drawing on top of the gnome-screensaver by finding windows in the draw queue that should be on top of the unity shell and painting the unity shell directly underneath them.

Description of the change

Fixes the unity interface drawing on top of the gnome-screensaver by finding windows in the draw queue that should be on top of the unity shell and painting the unity shell directly underneath them.

Testing:
 -> Unity shell should always be visible on screen under normal usage
 -> Normal windows should go underneath the unity shell (eg Unityshell's input windows should be stacked underneath them
 -> gnome-screensaver should obstruct unityshell. (Eg no more shell visible on lock screen)

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

Awesome

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity.cpp'
2--- src/unity.cpp 2010-11-15 23:07:58 +0000
3+++ src/unity.cpp 2010-11-24 11:41:22 +0000
4@@ -49,8 +49,6 @@
5 * and the current time of the execution of the functions in milliseconds). It's part of the composite
6 * plugin's interface
7 */
8-
9-static bool paint_required = false;
10 static UnityScreen *uScreen = 0;
11
12 void
13@@ -58,8 +56,8 @@
14 {
15 /* At the end of every function, you must call BaseClass->functionName (args) in order to pass on
16 * the call chain */
17+
18 cScreen->preparePaint (ms);
19- paint_required = true;
20 }
21
22 void
23@@ -108,6 +106,8 @@
24 nuxPrologue ();
25 wt->RenderInterfaceFromForeignCmd ();
26 nuxEpilogue ();
27+
28+ doShellRepaint = false;
29 }
30
31 /* This is the guts of the paint function. You can transform the way the entire output is painted
32@@ -123,12 +123,14 @@
33 {
34 bool ret;
35
36+ doShellRepaint = true;
37+
38 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
39 ret = gScreen->glPaintOutput (attrib, transform, region, output, mask);
40-
41- if (paint_required)
42- paintDisplay (region);
43-
44+
45+ if (doShellRepaint)
46+ paintDisplay (region);
47+
48 return ret;
49 }
50
51@@ -191,9 +193,9 @@
52
53 if (screen->otherGrabExist ("deco", "move", NULL))
54 {
55- wt->ProcessForeignEvent (event, NULL);
56+ wt->ProcessForeignEvent (event, NULL);
57 }
58-}
59+}
60
61 bool
62 UnityScreen::initPluginForScreen (CompPlugin *p)
63@@ -238,7 +240,6 @@
64 * attributes like brightness/saturation etc to play around with. GLMatrix is the window's
65 * transformation matrix. the unsigned int is the mask, have a look at opengl.h on what you can do
66 * with it */
67-
68 bool
69 UnityWindow::glPaint (const GLWindowPaintAttrib &attrib, // Brightness, Saturation, Opacity etc
70 const GLMatrix &transform, // Transformation Matrix
71@@ -256,22 +257,21 @@
72 const CompRegion &region,
73 unsigned int mask)
74 {
75- bool ret;
76-
77- if (paint_required && uScreen && window->type () & (CompWindowTypeMenuMask |
78- CompWindowTypeDropdownMenuMask |
79- CompWindowTypePopupMenuMask |
80- CompWindowTypeComboMask |
81- CompWindowTypeTooltipMask |
82- CompWindowTypeDndMask
83- ))
84+ if (uScreen->doShellRepaint)
85 {
86- uScreen->paintDisplay (region);
87- paint_required = false;
88+ const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList ();
89+
90+ for (CompWindow *w = window; w; w = w->prev)
91+ {
92+ if (std::find (xwns.begin (), xwns.end (), w->id ()) != xwns.end ())
93+ {
94+ uScreen->paintDisplay (region);
95+ }
96+ }
97 }
98
99- ret = gWindow->glDraw (matrix, attrib, region, mask);
100-
101+ bool ret = gWindow->glDraw (matrix, attrib, region, mask);
102+
103 return ret;
104 }
105 /* This get's called whenever a window's rect is damaged. You can do stuff here or you can adjust the damage
106@@ -424,7 +424,8 @@
107 PluginClassHandler <UnityScreen, CompScreen> (screen), // Initiate PluginClassHandler class template
108 screen (screen),
109 cScreen (CompositeScreen::get (screen)),
110- gScreen (GLScreen::get (screen))
111+ gScreen (GLScreen::get (screen)),
112+ doShellRepaint (false)
113 {
114 int (*old_handler) (Display *, XErrorEvent *);
115 old_handler = XSetErrorHandler (NULL);
116
117=== modified file 'src/unity.h'
118--- src/unity.h 2010-11-12 10:58:04 +0000
119+++ src/unity.h 2010-11-24 11:41:22 +0000
120@@ -156,6 +156,8 @@
121
122 bool
123 initPluginForScreen (CompPlugin *p);
124+
125+ bool doShellRepaint;
126
127 private:
128