diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2015-05-22 13:20:36 +0000 |
|---|---|---|
| committer | CI Train Bot <ci-train-bot@canonical.com> | 2015-05-22 13:20:36 +0000 |
| commit | e5e35384bf653cfd46783d5ccdd8996c527e6929 (patch) | |
| tree | 5c6b8ffcb90d37af6f41cd4d6273ab2e4f22bd25 /unity-shared | |
| parent | 4a62a9bfe09630a9175772a637b0b3cebaaceb49 (diff) | |
| parent | eee51d8b68e6c7d22e67fc9aef0b7ec50322b867 (diff) | |
ResultViewGrid: wait for double-click event only if the relative result needs the Preview
This was causing a 500ms delay between the user click and some results (apps) activation. Also, at this point, we can get rid of PREVIEW_LEFT_BUTTON activation type. Fixes: #1291950, #1447372 Approved by: Christopher Townsend, Brandon Schaefer, PS Jenkins bot (bzr r3967)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/BGHash.cpp | 7 | ||||
| -rw-r--r-- | unity-shared/SearchBar.cpp | 32 | ||||
| -rw-r--r-- | unity-shared/SearchBar.h | 4 |
3 files changed, 15 insertions, 28 deletions
diff --git a/unity-shared/BGHash.cpp b/unity-shared/BGHash.cpp index c2f065383..d0ec71b8e 100644 --- a/unity-shared/BGHash.cpp +++ b/unity-shared/BGHash.cpp @@ -116,8 +116,11 @@ void BGHash::TransitionToNewColor(nux::color::Color const& new_color, bool skip_ .SetDuration(skip_animation ? 0 : TRANSITION_DURATION) .Start(); - // This will make sure that the animation starts even if the screen is idle. - nux::GetWindowThread()->RequestRedraw(); + if (nux::WindowThread* wt = nux::GetWindowThread()) + { + // This will make sure that the animation starts even if the screen is idle. + wt->RequestRedraw(); + } } void BGHash::OnTransitionUpdated(nux::Color const& new_color) diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp index b9bf13452..658d9f842 100644 --- a/unity-shared/SearchBar.cpp +++ b/unity-shared/SearchBar.cpp @@ -141,6 +141,9 @@ SearchBar::SearchBar(bool show_filter_hint, NUX_FILE_LINE_DECL) : View(NUX_FILE_LINE_PARAM) , showing_filters(false) , can_refine_search(false) + , im_active([this] { return pango_entry_->im_active(); }) + , im_preedit([this] { return pango_entry_->im_preedit(); }) + , in_live_search([this] { return live_search_timeout_ && live_search_timeout_->IsRunning(); }) , live_search_wait(DEFAULT_LIVE_SEARCH_TIMEOUT) , scale(DEFAULT_SCALE) , show_filter_hint_(show_filter_hint) @@ -179,11 +182,11 @@ SearchBar::SearchBar(bool show_filter_hint, NUX_FILE_LINE_DECL) pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &SearchBar::OnEndKeyFocus)); pango_entry_->key_up.connect([this] (unsigned int, unsigned long, unsigned long) { - if (get_im_preedit()) - { - hint_->SetVisible(false); - hint_->QueueDraw(); - } + if (im_preedit()) + { + hint_->SetVisible(false); + hint_->QueueDraw(); + } }); layered_layout_ = new nux::LayeredLayout(); @@ -263,10 +266,8 @@ SearchBar::SearchBar(bool show_filter_hint, NUX_FILE_LINE_DECL) OnFontChanged(); search_hint.changed.connect([this](std::string const& s) { OnSearchHintChanged(); }); - search_string.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_search_string)); + search_string.SetGetterFunction([this] { return pango_entry_->GetText(); }); search_string.SetSetterFunction(sigc::mem_fun(this, &SearchBar::set_search_string)); - im_active.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_active)); - im_preedit.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_preedit)); showing_filters.changed.connect(sigc::mem_fun(this, &SearchBar::OnShowingFiltersChanged)); scale.changed.connect(sigc::mem_fun(this, &SearchBar::UpdateScale)); Settings::Instance().font_scaling.changed.connect(sigc::hide(sigc::mem_fun(this, &SearchBar::UpdateSearchBarSize))); @@ -633,11 +634,6 @@ nux::View* SearchBar::show_filters() const return expander_view_; } -std::string SearchBar::get_search_string() const -{ - return pango_entry_->GetText(); -} - bool SearchBar::set_search_string(std::string const& string) { pango_entry_->SetText(string.c_str()); @@ -649,16 +645,6 @@ bool SearchBar::set_search_string(std::string const& string) return true; } -bool SearchBar::get_im_active() const -{ - return pango_entry_->im_active(); -} - -bool SearchBar::get_im_preedit() const -{ - return pango_entry_->im_preedit(); -} - // // Highlight // diff --git a/unity-shared/SearchBar.h b/unity-shared/SearchBar.h index 9cc6440b6..d9efdf198 100644 --- a/unity-shared/SearchBar.h +++ b/unity-shared/SearchBar.h @@ -63,6 +63,7 @@ public: nux::Property<bool> can_refine_search; nux::ROProperty<bool> im_active; nux::ROProperty<bool> im_preedit; + nux::ROProperty<bool> in_live_search; nux::Property<unsigned> live_search_wait; nux::Property<double> scale; @@ -88,10 +89,7 @@ private: bool OnLiveSearchTimeout(); bool OnSpinnerStartCb(); - std::string get_search_string() const; bool set_search_string(std::string const& string); - bool get_im_active() const; - bool get_im_preedit() const; bool show_filter_hint_; std::string GetName() const; |
