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
1=== modified file 'src/unity.cpp'
2--- src/unity.cpp 2010-11-26 08:12:02 +0000
3+++ src/unity.cpp 2010-11-26 09:25:48 +0000
4@@ -230,20 +230,25 @@
5 return "Unity";
6 }
7
8-bool
9-UnityWindow::glPaint (const GLWindowPaintAttrib &attrib, const GLMatrix &matrix,
10- const CompRegion &region, unsigned int mask)
11+const CompWindowList &
12+UnityScreen::getWindowPaintList ()
13 {
14+ CompWindowList &pl = _withRemovedNuxWindows = cScreen->getWindowPaintList ();
15+ CompWindowList::iterator it = pl.end ();
16 const std::list <Window> &xwns = nux::XInputWindow::NativeHandleList ();
17- GLWindowPaintAttrib new_tribs (attrib);
18
19- if (std::find (xwns.begin (), xwns.end (), window->id ()) != xwns.end ())
20+ while (it != pl.begin ())
21 {
22- new_tribs.opacity = 0;
23+ it--;
24+
25+ if (std::find (xwns.begin (), xwns.end (), (*it)->id ()) != xwns.end ())
26+ {
27+ CompWindowList::iterator pit = it;
28+ pl.erase (pit);
29+ }
30 }
31
32-
33- return gWindow->glPaint (new_tribs, matrix, region, mask);
34+ return pl;
35 }
36
37 /* handle window painting in an opengl context
38@@ -355,6 +360,7 @@
39
40 /* Wrap compiz interfaces */
41 ScreenInterface::setHandler (screen);
42+ CompositeScreenInterface::setHandler (cScreen);
43 GLScreenInterface::setHandler (gScreen);
44
45 StartupNotifyService::Default ()->SetSnDisplay (screen->snDisplay (), screen->screenNum ());
46
47=== modified file 'src/unity.h'
48--- src/unity.h 2010-11-26 08:12:02 +0000
49+++ src/unity.h 2010-11-26 09:25:48 +0000
50@@ -84,6 +84,9 @@
51 CompOutput *,
52 unsigned int);
53
54+ /* Pop our InputOutput windows from the paint list */
55+ const CompWindowList & getWindowPaintList ();
56+
57 /* handle X11 events */
58 void handleEvent (XEvent *);
59
60@@ -138,6 +141,7 @@
61 /* handle paint order */
62 bool doShellRepaint;
63 bool allowWindowPaint;
64+ CompWindowList _withRemovedNuxWindows;
65
66 friend class UnityWindow;
67 };
68@@ -157,10 +161,6 @@
69 CompWindow *window;
70 GLWindow *gWindow;
71
72- bool
73- glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
74- const CompRegion &, unsigned int);
75-
76 /* basic window draw function */
77 bool
78 glDraw (const GLMatrix &matrix,