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
=== modified file 'src/unity.cpp'
--- src/unity.cpp 2010-11-15 23:07:58 +0000
+++ src/unity.cpp 2010-11-24 11:41:22 +0000
@@ -49,8 +49,6 @@
49 * and the current time of the execution of the functions in milliseconds). It's part of the composite49 * and the current time of the execution of the functions in milliseconds). It's part of the composite
50 * plugin's interface50 * plugin's interface
51 */51 */
52
53static bool paint_required = false;
54static UnityScreen *uScreen = 0;52static UnityScreen *uScreen = 0;
5553
56void54void
@@ -58,8 +56,8 @@
58{56{
59 /* At the end of every function, you must call BaseClass->functionName (args) in order to pass on57 /* At the end of every function, you must call BaseClass->functionName (args) in order to pass on
60 * the call chain */58 * the call chain */
59
61 cScreen->preparePaint (ms);60 cScreen->preparePaint (ms);
62 paint_required = true;
63}61}
6462
65void63void
@@ -108,6 +106,8 @@
108 nuxPrologue ();106 nuxPrologue ();
109 wt->RenderInterfaceFromForeignCmd ();107 wt->RenderInterfaceFromForeignCmd ();
110 nuxEpilogue ();108 nuxEpilogue ();
109
110 doShellRepaint = false;
111}111}
112112
113/* This is the guts of the paint function. You can transform the way the entire output is painted113/* This is the guts of the paint function. You can transform the way the entire output is painted
@@ -123,12 +123,14 @@
123{123{
124 bool ret;124 bool ret;
125125
126 doShellRepaint = true;
127
126 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */128 /* glPaintOutput is part of the opengl plugin, so we need the GLScreen base class. */
127 ret = gScreen->glPaintOutput (attrib, transform, region, output, mask);129 ret = gScreen->glPaintOutput (attrib, transform, region, output, mask);
128 130
129 if (paint_required)131 if (doShellRepaint)
130 paintDisplay (region);132 paintDisplay (region);
131 133
132 return ret;134 return ret;
133}135}
134136
@@ -191,9 +193,9 @@
191193
192 if (screen->otherGrabExist ("deco", "move", NULL))194 if (screen->otherGrabExist ("deco", "move", NULL))
193 {195 {
194 wt->ProcessForeignEvent (event, NULL);196 wt->ProcessForeignEvent (event, NULL);
195 }197 }
196}198}
197199
198bool200bool
199UnityScreen::initPluginForScreen (CompPlugin *p)201UnityScreen::initPluginForScreen (CompPlugin *p)
@@ -238,7 +240,6 @@
238 * attributes like brightness/saturation etc to play around with. GLMatrix is the window's240 * attributes like brightness/saturation etc to play around with. GLMatrix is the window's
239 * transformation matrix. the unsigned int is the mask, have a look at opengl.h on what you can do241 * transformation matrix. the unsigned int is the mask, have a look at opengl.h on what you can do
240 * with it */242 * with it */
241
242bool243bool
243UnityWindow::glPaint (const GLWindowPaintAttrib &attrib, // Brightness, Saturation, Opacity etc244UnityWindow::glPaint (const GLWindowPaintAttrib &attrib, // Brightness, Saturation, Opacity etc
244 const GLMatrix &transform, // Transformation Matrix245 const GLMatrix &transform, // Transformation Matrix
@@ -256,22 +257,21 @@
256 const CompRegion &region,257 const CompRegion &region,
257 unsigned int mask)258 unsigned int mask)
258{259{
259 bool ret;260 if (uScreen->doShellRepaint)
260
261 if (paint_required && uScreen && window->type () & (CompWindowTypeMenuMask |
262 CompWindowTypeDropdownMenuMask |
263 CompWindowTypePopupMenuMask |
264 CompWindowTypeComboMask |
265 CompWindowTypeTooltipMask |
266 CompWindowTypeDndMask
267 ))
268 {261 {
269 uScreen->paintDisplay (region);262 const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList ();
270 paint_required = false;263
264 for (CompWindow *w = window; w; w = w->prev)
265 {
266 if (std::find (xwns.begin (), xwns.end (), w->id ()) != xwns.end ())
267 {
268 uScreen->paintDisplay (region);
269 }
270 }
271 }271 }
272272
273 ret = gWindow->glDraw (matrix, attrib, region, mask);273 bool ret = gWindow->glDraw (matrix, attrib, region, mask);
274274
275 return ret;275 return ret;
276}276}
277/* This get's called whenever a window's rect is damaged. You can do stuff here or you can adjust the damage277/* This get's called whenever a window's rect is damaged. You can do stuff here or you can adjust the damage
@@ -424,7 +424,8 @@
424 PluginClassHandler <UnityScreen, CompScreen> (screen), // Initiate PluginClassHandler class template424 PluginClassHandler <UnityScreen, CompScreen> (screen), // Initiate PluginClassHandler class template
425 screen (screen),425 screen (screen),
426 cScreen (CompositeScreen::get (screen)),426 cScreen (CompositeScreen::get (screen)),
427 gScreen (GLScreen::get (screen))427 gScreen (GLScreen::get (screen)),
428 doShellRepaint (false)
428{429{
429 int (*old_handler) (Display *, XErrorEvent *);430 int (*old_handler) (Display *, XErrorEvent *);
430 old_handler = XSetErrorHandler (NULL);431 old_handler = XSetErrorHandler (NULL);
431432
=== modified file 'src/unity.h'
--- src/unity.h 2010-11-12 10:58:04 +0000
+++ src/unity.h 2010-11-24 11:41:22 +0000
@@ -156,6 +156,8 @@
156 156
157 bool157 bool
158 initPluginForScreen (CompPlugin *p);158 initPluginForScreen (CompPlugin *p);
159
160 bool doShellRepaint;
159 161
160 private:162 private:
161 163