Merge lp:~canonical-dx-team/unity/unity.remove-io-from-pl into lp:unity

Proposed by Sam Spilsbury
Status: Merged
Merged at revision: 652
Proposed branch: lp:~canonical-dx-team/unity/unity.remove-io-from-pl
Merge into: lp:unity
Diff against target: 78 lines (+18/-12)
2 files modified
src/unity.cpp (+14/-8)
src/unity.h (+4/-4)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.remove-io-from-pl
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+41936@code.launchpad.net

Description of the change

Hook getWindowPaintList and remove our input windows.

This ensures that we don't have lots of useless wrapped function calls on glPaint (small optimization). Also means that other plugins are not trying to do things to our windows which never get painted anyways.

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Works well, code looks good, approved.

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-26 08:12:02 +0000
+++ src/unity.cpp 2010-11-26 09:25:48 +0000
@@ -230,20 +230,25 @@
230 return "Unity";230 return "Unity";
231}231}
232232
233bool233const CompWindowList &
234UnityWindow::glPaint (const GLWindowPaintAttrib &attrib, const GLMatrix &matrix,234UnityScreen::getWindowPaintList ()
235 const CompRegion &region, unsigned int mask)
236{235{
236 CompWindowList &pl = _withRemovedNuxWindows = cScreen->getWindowPaintList ();
237 CompWindowList::iterator it = pl.end ();
237 const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList ();238 const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList ();
238 GLWindowPaintAttrib new_tribs (attrib);
239239
240 if (std::find (xwns.begin (), xwns.end (), window->id ()) != xwns.end ())240 while (it != pl.begin ())
241 {241 {
242 new_tribs.opacity = 0;242 it--;
243
244 if (std::find (xwns.begin (), xwns.end (), (*it)->id ()) != xwns.end ())
245 {
246 CompWindowList::iterator pit = it;
247 pl.erase (pit);
248 }
243 }249 }
244250
245251 return pl;
246 return gWindow->glPaint (new_tribs, matrix, region, mask);
247}252}
248253
249/* handle window painting in an opengl context254/* handle window painting in an opengl context
@@ -355,6 +360,7 @@
355360
356 /* Wrap compiz interfaces */361 /* Wrap compiz interfaces */
357 ScreenInterface::setHandler (screen);362 ScreenInterface::setHandler (screen);
363 CompositeScreenInterface::setHandler (cScreen);
358 GLScreenInterface::setHandler (gScreen);364 GLScreenInterface::setHandler (gScreen);
359 365
360 StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ());366 StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ());
361367
=== modified file 'src/unity.h'
--- src/unity.h 2010-11-26 08:12:02 +0000
+++ src/unity.h 2010-11-26 09:25:48 +0000
@@ -84,6 +84,9 @@
84 CompOutput *,84 CompOutput *,
85 unsigned int);85 unsigned int);
8686
87 /* Pop our InputOutput windows from the paint list */
88 const CompWindowList & getWindowPaintList ();
89
87 /* handle X11 events */90 /* handle X11 events */
88 void handleEvent (XEvent *);91 void handleEvent (XEvent *);
8992
@@ -138,6 +141,7 @@
138 /* handle paint order */141 /* handle paint order */
139 bool doShellRepaint;142 bool doShellRepaint;
140 bool allowWindowPaint;143 bool allowWindowPaint;
144 CompWindowList _withRemovedNuxWindows;
141145
142 friend class UnityWindow;146 friend class UnityWindow;
143};147};
@@ -157,10 +161,6 @@
157 CompWindow *window;161 CompWindow *window;
158 GLWindow *gWindow;162 GLWindow *gWindow;
159 163
160 bool
161 glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
162 const CompRegion &, unsigned int);
163
164 /* basic window draw function */164 /* basic window draw function */
165 bool 165 bool
166 glDraw (const GLMatrix &matrix,166 glDraw (const GLMatrix &matrix,