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
=== modified file 'plugins/unityshell/src/PanelController.cpp'
--- plugins/unityshell/src/PanelController.cpp 2011-08-24 14:56:40 +0000
+++ plugins/unityshell/src/PanelController.cpp 2011-09-02 15:28:08 +0000
@@ -52,6 +52,14 @@
52 }52 }
53}53}
5454
55unsigned int PanelController::GetTrayXid ()
56{
57 if (!_windows.empty ())
58 return ViewForWindow (_windows.front ())->GetTrayXid ();
59 else
60 return 0;
61}
62
55void63void
56PanelController::StartFirstMenuShow()64PanelController::StartFirstMenuShow()
57{65{
5866
=== modified file 'plugins/unityshell/src/PanelController.h'
--- plugins/unityshell/src/PanelController.h 2011-08-24 14:56:40 +0000
+++ plugins/unityshell/src/PanelController.h 2011-09-02 15:28:08 +0000
@@ -37,6 +37,8 @@
37 void SetOpacity(float opacity);37 void SetOpacity(float opacity);
38 void QueueRedraw();38 void QueueRedraw();
3939
40 unsigned int GetTrayXid ();
41
40protected:42protected:
41 const gchar* GetName();43 const gchar* GetName();
42 void AddProperties(GVariantBuilder* builder);44 void AddProperties(GVariantBuilder* builder);
4345
=== modified file 'plugins/unityshell/src/PanelTray.cpp'
--- plugins/unityshell/src/PanelTray.cpp 2011-08-31 08:46:29 +0000
+++ plugins/unityshell/src/PanelTray.cpp 2011-09-02 15:28:08 +0000
@@ -44,6 +44,15 @@
44 RealInit();44 RealInit();
45}45}
4646
47unsigned int
48PanelTray::xid ()
49{
50 if (!_window)
51 return 0;
52
53 return gdk_x11_window_get_xid (gtk_widget_get_window (_window));
54}
55
47void PanelTray::RealInit()56void PanelTray::RealInit()
48{57{
49 _window = gtk_window_new(GTK_WINDOW_TOPLEVEL);58 _window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
5059
=== modified file 'plugins/unityshell/src/PanelTray.h'
--- plugins/unityshell/src/PanelTray.h 2011-08-30 13:31:22 +0000
+++ plugins/unityshell/src/PanelTray.h 2011-09-02 15:28:08 +0000
@@ -44,9 +44,10 @@
44 ~PanelTray();44 ~PanelTray();
4545
46 void Draw(nux::GraphicsEngine& gfx_content, bool force_draw);46 void Draw(nux::GraphicsEngine& gfx_content, bool force_draw);
47
48 void Sync();47 void Sync();
4948
49 unsigned int xid ();
50
50 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);51 virtual void OnEntryAdded(unity::indicator::Entry::Ptr const& proxy);
5152
52public:53public:
5354
=== modified file 'plugins/unityshell/src/PanelView.cpp'
--- plugins/unityshell/src/PanelView.cpp 2011-09-01 17:09:49 +0000
+++ plugins/unityshell/src/PanelView.cpp 2011-09-02 15:28:08 +0000
@@ -112,6 +112,14 @@
112 delete _bg_layer;112 delete _bg_layer;
113}113}
114114
115unsigned int PanelView::GetTrayXid ()
116{
117 if (!_tray)
118 return 0;
119
120 return _tray->xid ();
121}
122
115void PanelView::OnBackgroundUpdate (GVariant *data, PanelView *self)123void PanelView::OnBackgroundUpdate (GVariant *data, PanelView *self)
116{124{
117 gdouble red, green, blue, alpha;125 gdouble red, green, blue, alpha;
118126
=== modified file 'plugins/unityshell/src/PanelView.h'
--- plugins/unityshell/src/PanelView.h 2011-08-24 14:56:40 +0000
+++ plugins/unityshell/src/PanelView.h 2011-09-02 15:28:08 +0000
@@ -70,6 +70,8 @@
7070
71 void SetOpacity(float opacity);71 void SetOpacity(float opacity);
7272
73 unsigned int GetTrayXid ();
74
73protected:75protected:
74 // Introspectable methods76 // Introspectable methods
75 const gchar* GetName();77 const gchar* GetName();
7678
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-09-01 17:18:02 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-09-02 15:28:08 +0000
@@ -114,6 +114,7 @@
114 , mActiveFbo (0)114 , mActiveFbo (0)
115 , dash_is_open_ (false)115 , dash_is_open_ (false)
116 , grab_index_ (0)116 , grab_index_ (0)
117 , painting_tray_ (false)
117{118{
118 Timer timer;119 Timer timer;
119 configure_logging();120 configure_logging();
@@ -460,6 +461,7 @@
460void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask)461void UnityScreen::paintDisplay(const CompRegion& region, const GLMatrix& transform, unsigned int mask)
461{462{
462 CompOutput *output = _last_output;463 CompOutput *output = _last_output;
464 Window tray_xid = panelController->GetTrayXid ();
463465
464 mFbos[output]->unbind ();466 mFbos[output]->unbind ();
465467
@@ -478,6 +480,47 @@
478 wt->RenderInterfaceFromForeignCmd (&geo);480 wt->RenderInterfaceFromForeignCmd (&geo);
479 nuxEpilogue();481 nuxEpilogue();
480482
483 if (tray_xid && !allowWindowPaint)
484 {
485 CompWindow *tray = screen->findWindow (tray_xid);
486
487 if (tray)
488 {
489 GLMatrix oTransform;
490 UnityWindow *uTrayWindow = UnityWindow::get (tray);
491 GLFragment::Attrib attrib (uTrayWindow->gWindow->lastPaintAttrib());
492 unsigned int oldGlAddGeometryIndex = uTrayWindow->gWindow->glAddGeometryGetCurrentIndex ();
493 unsigned int oldGlDrawIndex = uTrayWindow->gWindow->glDrawGetCurrentIndex ();
494 unsigned int oldGlDrawGeometryIndex = uTrayWindow->gWindow->glDrawGeometryGetCurrentIndex ();
495
496 attrib.setOpacity (OPAQUE);
497 attrib.setBrightness (BRIGHT);
498 attrib.setSaturation (COLOR);
499
500 oTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
501
502 glPushMatrix ();
503 glLoadMatrixf (oTransform.getMatrix ());
504
505 painting_tray_ = true;
506
507 /* force the use of the core functions */
508 uTrayWindow->gWindow->glDrawSetCurrentIndex (MAXSHORT);
509 uTrayWindow->gWindow->glAddGeometrySetCurrentIndex ( MAXSHORT);
510 uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (MAXSHORT);
511 uTrayWindow->gWindow->glDraw (oTransform, attrib, infiniteRegion,
512 PAINT_WINDOW_TRANSFORMED_MASK |
513 PAINT_WINDOW_BLEND_MASK |
514 PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK);
515 uTrayWindow->gWindow->glDrawGeometrySetCurrentIndex (oldGlDrawGeometryIndex);
516 uTrayWindow->gWindow->glAddGeometrySetCurrentIndex (oldGlAddGeometryIndex);
517 uTrayWindow->gWindow->glDrawSetCurrentIndex (oldGlDrawIndex);
518 painting_tray_ = false;
519
520 glPopMatrix ();
521 }
522 }
523
481 if (switcherController->Visible ())524 if (switcherController->Visible ())
482 {525 {
483 LayoutWindowList targets = switcherController->ExternalRenderTargets ();526 LayoutWindowList targets = switcherController->ExternalRenderTargets ();
@@ -1296,7 +1339,15 @@
1296 }1339 }
1297 else if (mShowdesktopHandler)1340 else if (mShowdesktopHandler)
1298 mShowdesktopHandler->paintAttrib (wAttrib);1341 mShowdesktopHandler->paintAttrib (wAttrib);
1299 1342
1343 if (uScreen->panelController->GetTrayXid () == window->id () && !allowWindowPaint)
1344 {
1345 if (!uScreen->painting_tray_)
1346 {
1347 uScreen->tray_paint_mask_ = mask;
1348 mask |= PAINT_WINDOW_NO_CORE_INSTANCE_MASK;
1349 }
1350 }
13001351
1301 /* Don't bother detecting occlusions if we're not doing updates1352 /* Don't bother detecting occlusions if we're not doing updates
1302 * or we don't want to repaint the shell this pass. We also1353 * or we don't want to repaint the shell this pass. We also
13031354
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2011-09-01 17:18:02 +0000
+++ plugins/unityshell/src/unityshell.h 2011-09-02 15:28:08 +0000
@@ -311,6 +311,8 @@
311 bool dash_is_open_;311 bool dash_is_open_;
312 CompScreen::GrabHandle grab_index_;312 CompScreen::GrabHandle grab_index_;
313 CompWindowList fullscreen_windows_;313 CompWindowList fullscreen_windows_;
314 bool painting_tray_;
315 unsigned int tray_paint_mask_;
314316
315 friend class UnityWindow;317 friend class UnityWindow;
316};318};