Merge lp:~azzar1/unity/fix-932531-5.0 into lp:unity/5.0

Proposed by Andrea Azzarone
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2383
Proposed branch: lp:~azzar1/unity/fix-932531-5.0
Merge into: lp:unity/5.0
Diff against target: 104 lines (+28/-2)
3 files modified
plugins/unityshell/src/HudButton.cpp (+15/-0)
plugins/unityshell/src/HudButton.h (+8/-2)
plugins/unityshell/src/HudView.cpp (+5/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-932531-5.0
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+113275@code.launchpad.net

Commit message

Description of the change

== Problem ==
HUD Draws improperly while searching for results.

== Fix ==
We don't draw the buttons unless they fit in the currently available area. We do it using a flag.

== Test ==
Visual change. Not applicable.

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
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/HudButton.cpp'
2--- plugins/unityshell/src/HudButton.cpp 2012-06-27 12:30:07 +0000
3+++ plugins/unityshell/src/HudButton.cpp 2012-07-03 19:00:31 +0000
4@@ -52,10 +52,13 @@
5 namespace hud
6 {
7
8+NUX_IMPLEMENT_OBJECT_TYPE(HudButton);
9+
10 HudButton::HudButton (NUX_FILE_LINE_DECL)
11 : nux::Button (NUX_FILE_LINE_PARAM)
12 , is_rounded(false)
13 , is_focused_(false)
14+ , skip_draw_(true)
15 {
16 hlayout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
17 hlayout_->SetLeftAndRightPadding(hlayout_left_padding, -1);
18@@ -131,6 +134,9 @@
19
20 void HudButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
21 {
22+ if (skip_draw_)
23+ return;
24+
25 nux::Geometry const& geo = GetGeometry();
26 GfxContext.PushClippingRectangle(geo);
27 gPainter.PaintBackground(GfxContext, geo);
28@@ -176,6 +182,9 @@
29
30 void HudButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
31 {
32+ if (skip_draw_)
33+ return;
34+
35 if (IsFullRedraw())
36 {
37 GfxContext.PushClippingRectangle(GetGeometry());
38@@ -206,6 +215,12 @@
39 return query_;
40 }
41
42+void HudButton::SetSkipDraw(bool skip_draw)
43+{
44+ skip_draw_ = skip_draw;
45+}
46+
47+
48 // Introspectable
49 std::string HudButton::GetName() const
50 {
51
52=== modified file 'plugins/unityshell/src/HudButton.h'
53--- plugins/unityshell/src/HudButton.h 2012-05-31 09:03:00 +0000
54+++ plugins/unityshell/src/HudButton.h 2012-07-03 19:00:31 +0000
55@@ -41,8 +41,8 @@
56
57 class HudButton : public nux::Button, public unity::debug::Introspectable
58 {
59- typedef nux::ObjectPtr<nux::BaseTexture> BaseTexturePtr;
60- typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
61+ NUX_DECLARE_OBJECT_TYPE(HudButton, nux::Button);
62+
63 public:
64 typedef nux::ObjectPtr<HudButton> Ptr;
65
66@@ -52,6 +52,8 @@
67 void SetQuery(Query::Ptr query);
68 std::shared_ptr<Query> GetQuery();
69
70+ void SetSkipDraw(bool skip_draw);
71+
72 nux::Property<std::string> label;
73 nux::Property<std::string> hint;
74 nux::Property<bool> is_rounded;
75@@ -70,9 +72,13 @@
76 void RedrawTheme(nux::Geometry const& geom, cairo_t* cr, nux::ButtonVisualState faked_state);
77
78 private:
79+ typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
80+
81 Query::Ptr query_;
82 nux::Geometry cached_geometry_;
83+
84 bool is_focused_;
85+ bool skip_draw_;
86
87 NuxCairoPtr prelight_;
88 NuxCairoPtr active_;
89
90=== modified file 'plugins/unityshell/src/HudView.cpp'
91--- plugins/unityshell/src/HudView.cpp 2012-06-27 12:30:07 +0000
92+++ plugins/unityshell/src/HudView.cpp 2012-07-03 19:00:31 +0000
93@@ -154,6 +154,11 @@
94 current_height_ = new_height;
95 }
96
97+ for (auto button : buttons_)
98+ {
99+ button->SetSkipDraw((button->GetAbsoluteY() + button->GetBaseHeight()) > (GetAbsoluteY() + current_height_));
100+ }
101+
102 QueueDraw();
103
104 if (diff > grow_anim_length + pause_before_grow_length)

Subscribers

People subscribed via source and target branches

to all changes: