diff options
| author | Brandon Schaefer <brandon.schaefer@canonical.com> | 2013-03-19 14:32:30 -0700 |
|---|---|---|
| committer | Brandon Schaefer <brandon.schaefer@canonical.com> | 2013-03-19 14:32:30 -0700 |
| commit | 71f2c3351ab18f17d6cadbf3fa24d8c20c02ba4d (patch) | |
| tree | ef090883077d816465243a421177dd53fd163463 /hud | |
| parent | dc24cb119220c5fbd63bc05446b440ea5c0df176 (diff) | |
| parent | 14973632a9b01cae21e5bdf9453729431beef766 (diff) | |
* Merge Trunk, Fix Conflict
(bzr r3215.3.3)
Diffstat (limited to 'hud')
| -rw-r--r-- | hud/HudController.cpp | 4 | ||||
| -rw-r--r-- | hud/HudView.cpp | 31 |
2 files changed, 19 insertions, 16 deletions
diff --git a/hud/HudController.cpp b/hud/HudController.cpp index 2c57aea12..71895a679 100644 --- a/hud/HudController.cpp +++ b/hud/HudController.cpp @@ -484,7 +484,7 @@ void Controller::OnSearchChanged(std::string search_string) void Controller::OnSearchActivated(std::string search_string) { - unsigned int timestamp = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent().x11_timestamp; + unsigned int timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; hud_service_.ExecuteQueryBySearch(search_string, timestamp); ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST); } @@ -492,7 +492,7 @@ void Controller::OnSearchActivated(std::string search_string) void Controller::OnQueryActivated(Query::Ptr query) { LOG_DEBUG(logger) << "Activating query, " << query->formatted_text; - unsigned int timestamp = nux::GetWindowThread()->GetGraphicsDisplay().GetCurrentEvent().x11_timestamp; + unsigned int timestamp = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp; hud_service_.ExecuteQuery(query, timestamp); ubus.SendMessage(UBUS_HUD_CLOSE_REQUEST); } diff --git a/hud/HudView.cpp b/hud/HudView.cpp index ebea81ae4..e32190218 100644 --- a/hud/HudView.cpp +++ b/hud/HudView.cpp @@ -114,6 +114,11 @@ View::View() } }); + mouse_move.connect([this] (int x, int y, int dx, int dy, unsigned long mouse_button, unsigned long special_key) { + for (auto button : buttons_) + button->SetInputEventSensitivity(true); + }); + mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown)); QueueDraw(); @@ -133,7 +138,6 @@ void View::ProcessGrowShrink() { float diff = g_get_monotonic_time() - start_time_; int target_height = content_layout_->GetGeometry().height; - // only animate if we are after our defined pause time if (diff > pause_before_grow_length) { @@ -151,12 +155,18 @@ void View::ProcessGrowShrink() //shrink new_height = last_height - ((last_height - target_height) * progress); } + LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")" << "View height: " << GetGeometry().height; current_height_ = new_height; } + for (auto button : buttons_) + { + button->SetSkipDraw((button->GetAbsoluteY() + button->GetBaseHeight()) > (GetAbsoluteY() + current_height_)); + } + if (diff > grow_anim_length + pause_before_grow_length) { // ensure we are at our final location and update last known height @@ -175,13 +185,8 @@ void View::ProcessGrowShrink() return false; })); } - - // Do this after we check if we are finished, it will skip drawing buttons otherwise - for (auto button : buttons_) - button->SetSkipDraw((button->GetAbsoluteY() + button->GetBaseHeight()) > (GetAbsoluteY() + current_height_)); } - void View::ResetToDefault() { SetQueries(Hud::Queries()); @@ -227,6 +232,7 @@ void View::SetQueries(Hud::Queries queries) HudButton::Ptr button(new HudButton()); buttons_.push_front(button); + button->SetInputEventSensitivity(false); button->SetMinimumWidth(content_width); button->SetMaximumWidth(content_width); button->SetQuery(query); @@ -237,7 +243,7 @@ void View::SetQueries(Hud::Queries queries) query_activated.emit(dynamic_cast<HudButton*>(view)->GetQuery()); }); - button->mouse_move.connect([&](int x, int y, int dx, int dy, unsigned long mouse_button, unsigned long special_key) { + button->mouse_move.connect([this](int x, int y, int dx, int dy, unsigned long mouse_button, unsigned long special_key) { if (keyboard_stole_focus_) { MouseStealsHudButtonFocus(); @@ -245,19 +251,19 @@ void View::SetQueries(Hud::Queries queries) } }); - button->mouse_enter.connect([&](int x, int y, unsigned long mouse_button, unsigned long special_key) { + button->mouse_enter.connect([this](int x, int y, unsigned long mouse_button, unsigned long special_key) { MouseStealsHudButtonFocus(); }); - button->mouse_leave.connect([&](int x, int y, unsigned long mouse_button, unsigned long special_key) { + button->mouse_leave.connect([this](int x, int y, unsigned long mouse_button, unsigned long special_key) { SelectLastFocusedButton(); }); - button->key_nav_focus_activate.connect([&](nux::Area* area) { + button->key_nav_focus_activate.connect([this](nux::Area* area) { query_activated.emit(dynamic_cast<HudButton*>(area)->GetQuery()); }); - button->key_nav_focus_change.connect([&](nux::Area* area, bool recieving, nux::KeyNavDirection direction){ + button->key_nav_focus_change.connect([this](nux::Area* area, bool recieving, nux::KeyNavDirection direction){ if (recieving) query_selected.emit(dynamic_cast<HudButton*>(area)->GetQuery()); }); @@ -346,7 +352,6 @@ void View::AboutToHide() visible_ = false; overlay_window_buttons_->Hide(); renderer_.AboutToHide(); - ResetToDefault(); } void View::SetupViews() @@ -419,9 +424,7 @@ void View::OnSearchChanged(std::string const& search_string) search_changed.emit(search_string); for(auto button : buttons_) - { button->fake_focused = false; - } if (!buttons_.empty()) buttons_.back()->fake_focused = true; |
