Merge lp:~azzar1/unity/fix-1044460 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2670
Proposed branch: lp:~azzar1/unity/fix-1044460
Merge into: lp:unity
Prerequisite: lp:~smspillaz/unity/unity.remove_modern_compiz_gl
Diff against target: 109 lines (+64/-9)
2 files modified
plugins/unityshell/src/unityshell.cpp (+60/-9)
plugins/unityshell/src/unityshell.h (+4/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1044460
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Review via email: mp+122815@code.launchpad.net

Commit message

Re-add code to draw panel background texture when the dash is open and there is a maximized window.

Description of the change

== Problem ==
Regression, bug 839480 - panel background when app is maximized

== Fix ==
Re-add the code to draw panel background behind dash when app is maximized.

== Test ==
Visual change. Not applicable.

To post a comment you must log in.
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Confirmed working, looks a lot better :)

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

Attempt to merge into lp:unity failed due to conflicts:

text conflict in plugins/unityshell/src/unityshell.h

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2012-09-07 11:05:34 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2012-09-07 12:42:23 +0000
4@@ -647,24 +647,28 @@
5 {
6 CompOutput *output = _last_output;
7
8+ DrawTopPanelBackground();
9+
10+ auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();
11+
12 nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture =
13- nux::GetGraphicsDisplay()->GetGpuDevice()->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (),
14- screen->width(), screen->height(), 1, nux::BITFMT_R8G8B8A8);
15-
16- nux::GetGraphicsDisplay()->GetGpuDevice()->backup_texture0_ = device_texture;
17-
18- nux::Geometry geo = nux::Geometry (0, 0, screen->width (), screen->height ());
19- nux::Geometry oGeo = nux::Geometry (output->x (), output->y (), output->width (), output->height ());
20+ gpu_device->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (),
21+ screen->width(), screen->height(), 1, nux::BITFMT_R8G8B8A8);
22+
23+ gpu_device->backup_texture0_ = device_texture;
24+
25+ nux::Geometry geo(0, 0, screen->width (), screen->height ());
26+ nux::Geometry outputGeo(output->x (), output->y (), output->width (), output->height ());
27 BackgroundEffectHelper::monitor_rect_ = geo;
28
29 GLint fboID;
30 // Nux renders to the referenceFramebuffer when it's embedded.
31 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fboID);
32- wt->GetWindowCompositor().SetReferenceFramebuffer(fboID, oGeo);
33+ wt->GetWindowCompositor().SetReferenceFramebuffer(fboID, outputGeo);
34
35 nuxPrologue();
36 _in_paint = true;
37- wt->RenderInterfaceFromForeignCmd (&oGeo);
38+ wt->RenderInterfaceFromForeignCmd (&outputGeo);
39 _in_paint = false;
40 nuxEpilogue();
41
42@@ -724,6 +728,53 @@
43 didShellRepaint = true;
44 }
45
46+void UnityScreen::DrawTopPanelBackground()
47+{
48+ auto graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine();
49+
50+ if (!graphics_engine->UsingGLSLCodePath() || !launcher_controller_->IsOverlayOpen() || !paint_panel_)
51+ return;
52+
53+ if (TopPanelBackgroundTextureNeedsUpdate())
54+ UpdateTopPanelBackgroundTexture();
55+
56+ if (panel_texture_.IsValid())
57+ {
58+ graphics_engine->ResetModelViewMatrixStack();
59+ graphics_engine->Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);
60+ graphics_engine->ResetProjectionMatrix();
61+ graphics_engine->SetOrthographicProjectionMatrix(screen->width (), screen->height());
62+
63+ nux::TexCoordXForm texxform;
64+ int panel_height = panel_style_.panel_height;
65+ graphics_engine->QRP_GLSL_1Tex(0, 0, screen->width (), panel_height, panel_texture_, texxform, nux::color::White);
66+ }
67+}
68+
69+bool UnityScreen::TopPanelBackgroundTextureNeedsUpdate() const
70+{
71+ return panel_texture_has_changed_ || !panel_texture_.IsValid();
72+}
73+
74+void UnityScreen::UpdateTopPanelBackgroundTexture()
75+{
76+ auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();
77+ auto &panel_style = panel::Style::Instance();
78+
79+ panel_texture_.Release();
80+
81+ std::unique_ptr<nux::NBitmapData> bitmap(panel_style.GetBackground(screen->width(), screen->height(), 1.0f));
82+ nux::ObjectPtr<nux::BaseTexture> texture2D(gpu_device->CreateSystemCapableTexture());
83+
84+ if (bitmap && texture2D)
85+ {
86+ texture2D->Update(bitmap.get());
87+ panel_texture_ = texture2D->GetDeviceTexture();
88+ }
89+
90+ panel_texture_has_changed_ = false;
91+}
92+
93 bool UnityScreen::forcePaintOnTop ()
94 {
95 return !allowWindowPaint ||
96
97=== modified file 'plugins/unityshell/src/unityshell.h'
98--- plugins/unityshell/src/unityshell.h 2012-09-07 11:05:34 +0000
99+++ plugins/unityshell/src/unityshell.h 2012-09-07 12:42:23 +0000
100@@ -241,6 +241,10 @@
101
102 void InitGesturesSupport();
103
104+ void DrawTopPanelBackground();
105+ bool TopPanelBackgroundTextureNeedsUpdate() const;
106+ void UpdateTopPanelBackgroundTexture();
107+
108 nux::animation::TickSource tick_source_;
109 nux::animation::AnimationController animation_controller_;
110