summaryrefslogtreecommitdiff
diff options
-rw-r--r--dash/DashView.cpp34
-rw-r--r--dash/DashView.h2
-rwxr-xr-xdash/PlacesGroup.cpp15
-rw-r--r--dash/PlacesGroup.h1
4 files changed, 50 insertions, 2 deletions
diff --git a/dash/DashView.cpp b/dash/DashView.cpp
index 8afde747f..391ffe625 100644
--- a/dash/DashView.cpp
+++ b/dash/DashView.cpp
@@ -1547,6 +1547,32 @@ void DashView::ProcessDndEnter()
ubus_manager_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
}
+nux::Area* DashView::SkipUnexpandableHeaderKeyNav()
+{
+ PlacesGroup::Ptr prev_view;
+ auto category_views = active_scope_view_->GetOrderedCategoryViews();
+
+ for (auto category : category_views)
+ {
+ if (category->GetLayout() != nullptr)
+ {
+ auto header = category->GetHeaderFocusableView();
+ if (header && header->HasKeyFocus() && !category->IsExpandable())
+ {
+ if (prev_view)
+ return prev_view->GetChildView();
+ else
+ return search_bar_->text_entry();
+ }
+
+ if (category->IsVisible())
+ prev_view = category;
+ }
+ }
+
+ return nullptr;
+}
+
nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol,
unsigned long x11_key_code,
unsigned long special_keys_state)
@@ -1698,6 +1724,14 @@ nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol,
}
}
+ if (direction == KEY_NAV_UP)
+ {
+ if (auto skip_view = SkipUnexpandableHeaderKeyNav())
+ {
+ return skip_view;
+ }
+ }
+
bool search_key = false;
if (direction == KEY_NAV_NONE)
diff --git a/dash/DashView.h b/dash/DashView.h
index 5c7e5c0e6..cdcf70767 100644
--- a/dash/DashView.h
+++ b/dash/DashView.h
@@ -137,6 +137,8 @@ private:
nux::Area* KeyNavIteration(nux::KeyNavDirection direction);
+ nux::Area* SkipUnexpandableHeaderKeyNav();
+
UBusManager ubus_manager_;
Scopes::Ptr scopes_;
ScopeViews scope_views_;
diff --git a/dash/PlacesGroup.cpp b/dash/PlacesGroup.cpp
index 590a6270c..f0ba9087f 100755
--- a/dash/PlacesGroup.cpp
+++ b/dash/PlacesGroup.cpp
@@ -212,7 +212,12 @@ PlacesGroup::PlacesGroup(dash::StyleInterface& style)
if(direction == nux::KEY_NAV_UP)
nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction);
else
- nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction);
+ {
+ if (IsExpandable())
+ nux::GetWindowCompositor().SetKeyFocusArea(GetHeaderFocusableView(), direction);
+ else
+ nux::GetWindowCompositor().SetKeyFocusArea(_child_view, direction);
+ }
});
UpdatePlacesGroupSize();
@@ -570,6 +575,12 @@ PlacesGroup::SetCounts(unsigned n_total_items)
}
bool
+PlacesGroup::IsExpandable() const
+{
+ return (_n_visible_items_in_unexpand_mode < _n_total_items);
+}
+
+bool
PlacesGroup::GetExpanded() const
{
return _is_expanded;
@@ -652,7 +663,7 @@ nux::View* PlacesGroup::GetHeaderFocusableView() const
bool PlacesGroup::ShouldBeHighlighted() const
{
- return HeaderHasKeyFocus();
+ return (HeaderHasKeyFocus() && IsExpandable());
}
void PlacesGroup::SetResultsPreviewAnimationValue(float preview_animation)
diff --git a/dash/PlacesGroup.h b/dash/PlacesGroup.h
index ec86ac45d..6b1295b95 100644
--- a/dash/PlacesGroup.h
+++ b/dash/PlacesGroup.h
@@ -77,6 +77,7 @@ public:
void SetCounts(unsigned n_total_items);
+ virtual bool IsExpandable() const;
virtual void SetExpanded(bool is_expanded);
virtual bool GetExpanded() const;