Merge lp:~smspillaz/unity/unity.fix_na_tray_expo into lp:unity

Proposed by Sam Spilsbury
Status: Merged
Approved by: Jason Smith
Approved revision: no longer in the source branch.
Merged at revision: 1483
Proposed branch: lp:~smspillaz/unity/unity.fix_na_tray_expo
Merge into: lp:unity
Diff against target: 197 lines (+85/-2)
8 files modified
plugins/unityshell/src/PanelController.cpp (+8/-0)
plugins/unityshell/src/PanelController.h (+2/-0)
plugins/unityshell/src/PanelTray.cpp (+9/-0)
plugins/unityshell/src/PanelTray.h (+2/-1)
plugins/unityshell/src/PanelView.cpp (+8/-0)
plugins/unityshell/src/PanelView.h (+2/-0)
plugins/unityshell/src/unityshell.cpp (+52/-1)
plugins/unityshell/src/unityshell.h (+2/-0)
To merge this branch: bzr merge lp:~smspillaz/unity/unity.fix_na_tray_expo
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+73674@code.launchpad.net

Description of the change

Fixes NaTray to always go on top of everything during expo so that it appears in the right place on the panel

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

+1 looks good with fix

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/PanelController.cpp'
2--- plugins/unityshell/src/PanelController.cpp 2011-08-24 14:56:40 +0000
3+++ plugins/unityshell/src/PanelController.cpp 2011-09-02 15:28:08 +0000
4@@ -52,6 +52,14 @@
5 }
6 }
7
8+unsigned int PanelController::GetTrayXid ()
9+{
10+ if (!_windows.empty ())
11+ return ViewForWindow (_windows.front ())->GetTrayXid ();
12+ else
13+ return 0;
14+}
15+
16 void
17 PanelController::StartFirstMenuShow()
18 {
19
20=== modified file 'plugins/unityshell/src/PanelController.h'
21--- plugins/unityshell/src/PanelController.h 2011-08-24 14:56:40 +0000
22+++ plugins/unityshell/src/PanelController.h 2011-09-02 15:28:08 +0000
23@@ -37,6 +37,8 @@
24 void SetOpacity(float opacity);
25 void QueueRedraw();
26
27+ unsigned int GetTrayXid ();
28+
29 protected:
30 const gchar* GetName();
31 void AddProperties(GVariantBuilder* builder);
32
33=== modified file 'plugins/unityshell/src/PanelTray.cpp'
34--- plugins/unityshell/src/PanelTray.cpp 2011-08-31 08:46:29 +0000
35+++ plugins/unityshell/src/PanelTray.cpp 2011-09-02 15:28:08 +0000
36@@ -44,6 +44,15 @@
37 RealInit();
38 }
39
40+unsigned int
41+PanelTray::xid ()
42+{
43+ if (!_window)
44+ return 0;
45+
46+ return gdk_x11_window_get_xid (gtk_widget_get_window (_window));
47+}
48+
49 void PanelTray::RealInit()
50 {
51 _window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
52
53=== modified file 'plugins/unityshell/src/PanelTray.h'
54--- plugins/unityshell/src/PanelTray.h 2011-08-30 13:31:22 +0000
55+++ plugins/unityshell/src/PanelTray.h 2011-09-02 15:28:08 +0000
56@@ -44,9 +44,10 @@
57 ~PanelTray();
58
59 void Draw(nux::GraphicsEngine& gfx_content, bool force_draw);
60-
61 void Sync();
62
63+ unsigned int xid ();
64+
65 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);
66
67 public:
68
69=== modified file 'plugins/unityshell/src/PanelView.cpp'
70--- plugins/unityshell/src/PanelView.cpp 2011-09-01 17:09:49 +0000
71+++ plugins/unityshell/src/PanelView.cpp 2011-09-02 15:28:08 +0000
72@@ -112,6 +112,14 @@
73 delete _bg_layer;
74 }
75
76+unsigned int PanelView::GetTrayXid ()
77+{
78+ if (!_tray)
79+ return 0;
80+
81+ return _tray->xid ();
82+}
83+
84 void PanelView::OnBackgroundUpdate (GVariant *data, PanelView *self)
85 {
86 gdouble red, green, blue, alpha;
87
88=== modified file 'plugins/unityshell/src/PanelView.h'
89--- plugins/unityshell/src/PanelView.h 2011-08-24 14:56:40 +0000
90+++ plugins/unityshell/src/PanelView.h 2011-09-02 15:28:08 +0000
91@@ -70,6 +70,8 @@
92
93 void SetOpacity(float opacity);
94
95+ unsigned int GetTrayXid ();
96+
97 protected:
98 // Introspectable methods
99 const gchar* GetName();
100
101=== modified file 'plugins/unityshell/src/unityshell.cpp'
102--- plugins/unityshell/src/unityshell.cpp 2011-09-01 17:18:02 +0000
103+++ plugins/unityshell/src/unityshell.cpp 2011-09-02 15:28:08 +0000
104@@ -114,6 +114,7 @@
105 , mActiveFbo (0)
106 , dash_is_open_ (false)
107 , grab_index_ (0)
108+ , painting_tray_ (false)
109 {
110 Timer timer;
111 configure_logging();
112@@ -460,6 +461,7 @@
113 void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask)
114 {
115 CompOutput *output = _last_output;
116+ Window tray_xid = panelController->GetTrayXid ();
117
118 mFbos[output]->unbind ();
119
120@@ -478,6 +480,47 @@
121 wt->RenderInterfaceFromForeignCmd (&geo);
122 nuxEpilogue();
123
124+ if (tray_xid && !allowWindowPaint)
125+ {
126+ CompWindow *tray = screen->findWindow (tray_xid);
127+
128+ if (tray)
129+ {
130+ GLMatrix oTransform;
131+ UnityWindow *uTrayWindow = UnityWindow::get (tray);
132+ GLFragment::Attrib attrib (uTrayWindow->gWindow->lastPaintAttrib());
133+ unsigned int oldGlAddGeometryIndex = uTrayWindow->gWindow->glAddGeometryGetCurrentIndex ();
134+ unsigned int oldGlDrawIndex = uTrayWindow->gWindow->glDrawGetCurrentIndex ();
135+ unsigned int oldGlDrawGeometryIndex = uTrayWindow->gWindow->glDrawGeometryGetCurrentIndex ();
136+
137+ attrib.setOpacity (OPAQUE);
138+ attrib.setBrightness (BRIGHT);
139+ attrib.setSaturation (COLOR);
140+
141+ oTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
142+
143+ glPushMatrix ();
144+ glLoadMatrixf (oTransform.getMatrix ());
145+
146+ painting_tray_ = true;
147+
148+ /* force the use of the core functions */
149+ uTrayWindow->gWindow->glDrawSetCurrentIndex (MAXSHORT);
150+ uTrayWindow->gWindow->glAddGeometrySetCurrentIndex ( MAXSHORT);
151+ uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (MAXSHORT);
152+ uTrayWindow->gWindow->glDraw (oTransform, attrib, infiniteRegion,
153+ PAINT_WINDOW_TRANSFORMED_MASK |
154+ PAINT_WINDOW_BLEND_MASK |
155+ PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
156+ uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (oldGlDrawGeometryIndex);
157+ uTrayWindow->gWindow->glAddGeometrySetCurrentIndex (oldGlAddGeometryIndex);
158+ uTrayWindow->gWindow->glDrawSetCurrentIndex (oldGlDrawIndex);
159+ painting_tray_ = false;
160+
161+ glPopMatrix ();
162+ }
163+ }
164+
165 if (switcherController->Visible ())
166 {
167 LayoutWindowList targets = switcherController->ExternalRenderTargets ();
168@@ -1296,7 +1339,15 @@
169 }
170 else if (mShowdesktopHandler)
171 mShowdesktopHandler->paintAttrib (wAttrib);
172-
173+
174+ if (uScreen->panelController->GetTrayXid () == window->id () && !allowWindowPaint)
175+ {
176+ if (!uScreen->painting_tray_)
177+ {
178+ uScreen->tray_paint_mask_ = mask;
179+ mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
180+ }
181+ }
182
183 /* Don't bother detecting occlusions if we're not doing updates
184 * or we don't want to repaint the shell this pass. We also
185
186=== modified file 'plugins/unityshell/src/unityshell.h'
187--- plugins/unityshell/src/unityshell.h 2011-09-01 17:18:02 +0000
188+++ plugins/unityshell/src/unityshell.h 2011-09-02 15:28:08 +0000
189@@ -311,6 +311,8 @@
190 bool dash_is_open_;
191 CompScreen::GrabHandle grab_index_;
192 CompWindowList fullscreen_windows_;
193+ bool painting_tray_;
194+ unsigned int tray_paint_mask_;
195
196 friend class UnityWindow;
197 };