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

Proposed by Andrea Azzarone
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2447
Proposed branch: lp:~azzar1/unity/fix-1016239
Merge into: lp:unity
Diff against target: 59 lines (+10/-2)
2 files modified
hud/HudButton.cpp (+8/-1)
hud/HudView.cpp (+2/-1)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1016239
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
jenkins (community) continuous-integration Approve
Review via email: mp+112104@code.launchpad.net

Commit message

Set a min/max width for the hudbutton to avoid layout issues.

Description of the change

== Problem ==
Searching in the HUD freezes unity.

== Fix ==
Set a min/max width for the hudbutton to avoid layout issues.

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :

PASSED: Continuous integration, rev:2440
http://s-jenkins:8080/job/unity-ci/22/

review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool, it works.

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

No commit message specified.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hud/HudButton.cpp'
2--- hud/HudButton.cpp 2012-05-30 19:49:57 +0000
3+++ hud/HudButton.cpp 2012-06-26 13:14:20 +0000
4@@ -131,6 +131,7 @@
5 void HudButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
6 {
7 nux::Geometry const& geo = GetGeometry();
8+ GfxContext.PushClippingRectangle(geo);
9 gPainter.PaintBackground(GfxContext, geo);
10
11 // set up our texture mode
12@@ -170,12 +171,18 @@
13 nux::color::White);
14
15 GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
16+
17+ GfxContext.PopClippingRectangle();
18 }
19
20 void HudButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
21 {
22 if (IsFullRedraw())
23+ {
24+ GfxContext.PushClippingRectangle(GetGeometry());
25 hlayout_->ProcessDraw(GfxContext, force_draw);
26+ GfxContext.PopClippingRectangle();
27+ }
28 }
29
30 void HudButton::SetQuery(Query::Ptr query)
31@@ -188,7 +195,7 @@
32 hlayout_->Clear();
33 for (auto item : items)
34 {
35- nux::StaticCairoText* text = new nux::StaticCairoText(item.first.c_str());
36+ nux::StaticCairoText* text = new nux::StaticCairoText(item.first);
37 text->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, item.second ? 1.0f : 0.5f));
38 text->SetFont(button_font);
39 hlayout_->AddView(text, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
40
41=== modified file 'hud/HudView.cpp'
42--- hud/HudView.cpp 2012-06-25 23:38:44 +0000
43+++ hud/HudView.cpp 2012-06-26 13:14:20 +0000
44@@ -238,6 +238,8 @@
45
46 HudButton::Ptr button(new HudButton());
47 buttons_.push_front(button);
48+ button->SetMinimumWidth(content_width);
49+ button->SetMaximumWidth(content_width);
50 button->SetQuery(query);
51
52 button_views_->AddView(button.GetPointer(), 0, nux::MINOR_POSITION_LEFT);
53@@ -255,7 +257,6 @@
54 query_selected.emit(dynamic_cast<HudButton*>(area)->GetQuery());
55 });
56
57- button->SetMinimumWidth(content_width);
58 ++found_items;
59 }
60