Merge lp:~sil2100/unity/fix-989291-5.0 into lp:unity/5.0

Proposed by Łukasz Zemczak on 2012-05-23
Status: Merged
Approved by: Gord Allott on 2012-05-23
Approved revision: 2350
Merged at revision: 2350
Proposed branch: lp:~sil2100/unity/fix-989291-5.0
Merge into: lp:unity/5.0
Diff against target: 282 lines (+89/-42)
9 files modified
manual-tests/ShortcutsOverlay.txt (+1/-0)
plugins/unityshell/src/ShortcutController.cpp (+1/-0)
plugins/unityshell/src/ShortcutView.cpp (+8/-0)
plugins/unityshell/src/ShortcutView.h (+3/-0)
plugins/unityshell/src/SwitcherView.h (+1/-3)
plugins/unityshell/src/UnityWindowView.cpp (+56/-38)
plugins/unityshell/src/UnityWindowView.h (+7/-1)
tests/autopilot/autopilot/emulators/unity/shortcut_hint.py (+6/-0)
tests/autopilot/autopilot/tests/test_shortcut_hint.py (+6/-0)
To merge this branch: bzr merge lp:~sil2100/unity/fix-989291-5.0
Reviewer Review Type Date Requested Status
Gord Allott (community) 2012-05-23 Approve on 2012-05-23
Review via email: mp+106989@code.launchpad.net

Commit message

Backported andyrock's fix from trunk - fix UnityViewWindow background when blur is disabled.

Description of the change

Backported andyrock's fix from lp:unity/6.0 for an SRU.

Original MRQ:
https://code.launchpad.net/~andyrock/unity/fix-989291/+merge/103853

Original description:

== Problem ==
When blur is disabled, shortcuts overlay and alt+tab switcher is completely transparent.

== Fix ==
Fix UnityWindowView::DrawContent.

== Test ==
Manual test added.

To post a comment you must log in.
Gord Allott (gordallott) wrote :

+!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/ShortcutsOverlay.txt'
2--- manual-tests/ShortcutsOverlay.txt 2012-04-10 22:23:44 +0000
3+++ manual-tests/ShortcutsOverlay.txt 2012-05-23 11:46:18 +0000
4@@ -12,3 +12,4 @@
5
6 Outcome:
7 The keyboard shortcuts overlay bottom is not truncated.
8+
9
10=== modified file 'plugins/unityshell/src/ShortcutController.cpp'
11--- plugins/unityshell/src/ShortcutController.cpp 2012-04-10 22:11:19 +0000
12+++ plugins/unityshell/src/ShortcutController.cpp 2012-05-23 11:46:18 +0000
13@@ -157,6 +157,7 @@
14 void Controller::ConstructView()
15 {
16 view_ = View::Ptr(new View());
17+ AddChild(view_.GetPointer());
18 view_->SetModel(model_);
19 view_->background_color = bg_color_;
20
21
22=== modified file 'plugins/unityshell/src/ShortcutView.cpp'
23--- plugins/unityshell/src/ShortcutView.cpp 2012-04-10 22:11:19 +0000
24+++ plugins/unityshell/src/ShortcutView.cpp 2012-05-23 11:46:18 +0000
25@@ -287,5 +287,13 @@
26 }
27 }
28
29+//
30+// Introspectable methods
31+//
32+std::string View::GetName() const
33+{
34+ return "ShortcutView";
35+}
36+
37 } // namespace shortcut
38 } // namespace unity
39
40=== modified file 'plugins/unityshell/src/ShortcutView.h'
41--- plugins/unityshell/src/ShortcutView.h 2012-04-10 22:11:19 +0000
42+++ plugins/unityshell/src/ShortcutView.h 2012-05-23 11:46:18 +0000
43@@ -58,6 +58,9 @@
44 void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry clip);
45 nux::Geometry GetBackgroundGeometry();
46
47+ // Introspectable methods
48+ std::string GetName() const;
49+
50 private:
51 // Private methods
52 nux::LinearLayout* CreateSectionLayout(const char* section_name);
53
54=== modified file 'plugins/unityshell/src/SwitcherView.h'
55--- plugins/unityshell/src/SwitcherView.h 2012-03-14 06:24:18 +0000
56+++ plugins/unityshell/src/SwitcherView.h 2012-05-23 11:46:18 +0000
57@@ -27,8 +27,6 @@
58 #include "BackgroundEffectHelper.h"
59 #include "UnityWindowView.h"
60
61-#include "Introspectable.h"
62-
63 #include <boost/shared_ptr.hpp>
64 #include <sigc++/sigc++.h>
65
66@@ -48,7 +46,7 @@
67 namespace switcher
68 {
69
70-class SwitcherView : public debug::Introspectable, public ui::UnityWindowView
71+class SwitcherView : public ui::UnityWindowView
72 {
73 NUX_DECLARE_OBJECT_TYPE(SwitcherView, ui::UnityWindowView);
74 public:
75
76=== modified file 'plugins/unityshell/src/UnityWindowView.cpp'
77--- plugins/unityshell/src/UnityWindowView.cpp 2012-04-17 09:59:00 +0000
78+++ plugins/unityshell/src/UnityWindowView.cpp 2012-05-23 11:46:18 +0000
79@@ -17,6 +17,8 @@
80 * Authored by: Jason Smith <jason.smith@canonical.com>
81 */
82
83+#include <UnityCore/Variant.h>
84+
85 #include "UnityWindowView.h"
86
87 namespace unity {
88@@ -56,7 +58,7 @@
89 // clear region
90 gPainter.PaintBackground(GfxContext, base);
91
92- nux::Geometry background_geo = GetBackgroundGeometry();
93+ nux::Geometry background_geo(GetBackgroundGeometry());
94 int internal_offset = style()->GetInternalOffset();
95
96 nux::Geometry internal_clip(background_geo.x + internal_offset,
97@@ -65,50 +67,54 @@
98 background_geo.height - internal_offset * 2);
99 GfxContext.PushClippingRectangle(internal_clip);
100
101- nux::Geometry geo_absolute = GetAbsoluteGeometry ();
102+ nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
103+ nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
104
105 if (BackgroundEffectHelper::blur_type != BLUR_NONE)
106 {
107- nux::Geometry blur_geo(geo_absolute.x, geo_absolute.y, base.width, base.height);
108- auto blur_texture = bg_helper_.GetBlurRegion(blur_geo);
109-
110- if (blur_texture.IsValid())
111- {
112- nux::TexCoordXForm texxform_blur_bg;
113- texxform_blur_bg.flip_v_coord = true;
114- texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
115- texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
116- texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
117-
118- nux::ROPConfig rop;
119- rop.Blend = false;
120- rop.SrcBlend = GL_ONE;
121- rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
122+ bg_texture_ = bg_helper_.GetBlurRegion(blur_geo);
123+ }
124+ else
125+ {
126+ bg_texture_ = bg_helper_.GetRegion(blur_geo);
127+ }
128+
129+ if (bg_texture_.IsValid())
130+ {
131+ nux::TexCoordXForm texxform_blur_bg;
132+ texxform_blur_bg.flip_v_coord = true;
133+ texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
134+ texxform_blur_bg.uoffset = ((float) base.x) / geo_absolute.width;
135+ texxform_blur_bg.voffset = ((float) base.y) / geo_absolute.height;
136+
137+ nux::ROPConfig rop;
138+ rop.Blend = false;
139+ rop.SrcBlend = GL_ONE;
140+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
141
142 #ifndef NUX_OPENGLES_20
143- if (GfxContext.UsingGLSLCodePath())
144- gPainter.PushDrawCompositionLayer(GfxContext, base,
145- blur_texture,
146- texxform_blur_bg,
147- nux::color::White,
148- background_color, nux::LAYER_BLEND_MODE_OVERLAY,
149- true, rop);
150- else
151- gPainter.PushDrawTextureLayer(GfxContext, base,
152- blur_texture,
153- texxform_blur_bg,
154- nux::color::White,
155- true,
156- rop);
157+ if (GfxContext.UsingGLSLCodePath())
158+ gPainter.PushDrawCompositionLayer(GfxContext, base,
159+ bg_texture_,
160+ texxform_blur_bg,
161+ nux::color::White,
162+ background_color, nux::LAYER_BLEND_MODE_OVERLAY,
163+ true, rop);
164+ else
165+ gPainter.PushDrawTextureLayer(GfxContext, base,
166+ bg_texture_,
167+ texxform_blur_bg,
168+ nux::color::White,
169+ true,
170+ rop);
171 #else
172- gPainter.PushDrawCompositionLayer(GfxContext, base,
173- blur_texture,
174- texxform_blur_bg,
175- nux::color::White,
176- background_color, nux::LAYER_BLEND_MODE_OVERLAY,
177- true, rop);
178+ gPainter.PushDrawCompositionLayer(GfxContext, base,
179+ bg_texture_,
180+ texxform_blur_bg,
181+ nux::color::White,
182+ background_color, nux::LAYER_BLEND_MODE_OVERLAY,
183+ true, rop);
184 #endif
185- }
186 }
187
188 nux::ROPConfig rop;
189@@ -240,6 +246,18 @@
190 GfxContext.GetRenderStates().SetBlend (FALSE);
191 }
192
193+// Introspectable methods
194+std::string UnityWindowView::GetName() const
195+{
196+ return "UnityWindowView";
197+}
198+
199+void UnityWindowView::AddProperties(GVariantBuilder* builder)
200+{
201+ unity::variant::BuilderWrapper(builder)
202+ .add("bg-texture-is-valid", bg_texture_.IsValid());
203+}
204+
205
206 }
207 }
208
209=== modified file 'plugins/unityshell/src/UnityWindowView.h'
210--- plugins/unityshell/src/UnityWindowView.h 2012-01-29 19:55:06 +0000
211+++ plugins/unityshell/src/UnityWindowView.h 2012-05-23 11:46:18 +0000
212@@ -21,6 +21,7 @@
213 #define UNITYWINDOWVIEW_H
214
215 #include "BackgroundEffectHelper.h"
216+#include "Introspectable.h"
217 #include "UnityWindowStyle.h"
218 #include <sigc++/sigc++.h>
219
220@@ -32,7 +33,7 @@
221 namespace unity {
222 namespace ui {
223
224-class UnityWindowView : public nux::View
225+class UnityWindowView : public debug::Introspectable, public nux::View
226 {
227 NUX_DECLARE_OBJECT_TYPE(UnityWindowView, nux::View)
228 public:
229@@ -53,10 +54,15 @@
230 virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {};
231 virtual nux::Geometry GetBackgroundGeometry() = 0;
232
233+ // Introspectable methods
234+ std::string GetName() const;
235+ void AddProperties(GVariantBuilder* builder);
236+
237 private:
238 void DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo);
239
240 BackgroundEffectHelper bg_helper_;
241+ nux::ObjectPtr<nux::IOpenGLBaseTexture> bg_texture_;
242 };
243
244 }
245
246=== modified file 'tests/autopilot/autopilot/emulators/unity/shortcut_hint.py'
247--- tests/autopilot/autopilot/emulators/unity/shortcut_hint.py 2012-04-19 05:43:12 +0000
248+++ tests/autopilot/autopilot/emulators/unity/shortcut_hint.py 2012-05-23 11:46:18 +0000
249@@ -15,10 +15,16 @@
250
251 logger = logging.getLogger(__name__)
252
253+class ShortcutView(UnityIntrospectionObject):
254+ """Proxy object for the shortcut view child of the controller."""
255
256 class ShortcutController(UnityIntrospectionObject, KeybindingsHelper):
257 """ShortcutController proxy class."""
258
259+ def get_shortcut_view(self):
260+ views = self.get_children_by_type(ShortcutView)
261+ return views[0] if views else None
262+
263 def show(self):
264 """Push the keys necessary to reveal the shortcut hint, but don't block."""
265 logger.debug("Revealing shortcut hint with keyboard.")
266
267=== modified file 'tests/autopilot/autopilot/tests/test_shortcut_hint.py'
268--- tests/autopilot/autopilot/tests/test_shortcut_hint.py 2012-04-19 05:43:12 +0000
269+++ tests/autopilot/autopilot/tests/test_shortcut_hint.py 2012-05-23 11:46:18 +0000
270@@ -85,6 +85,12 @@
271 self.shortcut_hint.cancel()
272 self.assertThat(self.shortcut_hint.visible, Eventually(Equals(False)))
273
274+ def test_shortcut_hint_no_blur(self):
275+ """"""
276+ self.shortcut_hint.ensure_visible()
277+ self.addCleanup(self.shortcut_hint.ensure_hidden)
278+
279+ self.assertThat(self.shortcut_hint.get_shortcut_view().bg_texture_is_valid, Eventually(Equals(True)))
280
281 class ShortcutHintInteractionsTests(BaseShortcutHintTests):
282 """Test the shortcuthint interactions with other Unity parts."""

Subscribers

People subscribed via source and target branches

to all changes: