mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Minor cleanup in MoveFocus, set tags on screen roots for debugging
This commit is contained in:
parent
26e097923d
commit
f27850ec1d
@ -133,7 +133,7 @@ void LayoutViewHierarchy(const UIContext &dc, ViewGroup *root, bool ignoreInsets
|
||||
root->Layout();
|
||||
}
|
||||
|
||||
void MoveFocus(ViewGroup *root, FocusDirection direction) {
|
||||
static void MoveFocus(ViewGroup *root, FocusDirection direction) {
|
||||
View *focusedView = GetFocusedView();
|
||||
if (!focusedView) {
|
||||
// Nothing was focused when we got in here. Focus the first non-group in the hierarchy.
|
||||
|
@ -418,25 +418,6 @@ NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, Nei
|
||||
}
|
||||
}
|
||||
|
||||
if (direction == FOCUS_PREV || direction == FOCUS_NEXT) {
|
||||
switch (direction) {
|
||||
case FOCUS_PREV:
|
||||
// If view not found, no neighbor to find.
|
||||
if (num == -1)
|
||||
return NeighborResult(nullptr, 0.0f);
|
||||
return NeighborResult(views_[(num + views_.size() - 1) % views_.size()], 0.0f);
|
||||
|
||||
case FOCUS_NEXT:
|
||||
// If view not found, no neighbor to find.
|
||||
if (num == -1)
|
||||
return NeighborResult(0, 0.0f);
|
||||
return NeighborResult(views_[(num + 1) % views_.size()], 0.0f);
|
||||
default:
|
||||
// Can't happen
|
||||
return NeighborResult(nullptr, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
switch (direction) {
|
||||
case FOCUS_UP:
|
||||
case FOCUS_LEFT:
|
||||
@ -472,10 +453,19 @@ NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, Nei
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
case FOCUS_PREV_PAGE:
|
||||
case FOCUS_NEXT_PAGE:
|
||||
return FindScrollNeighbor(view, Point(INFINITY, INFINITY), direction, result);
|
||||
case FOCUS_PREV:
|
||||
// If view not found, no neighbor to find.
|
||||
if (num == -1)
|
||||
return NeighborResult(nullptr, 0.0f);
|
||||
return NeighborResult(views_[(num + views_.size() - 1) % views_.size()], 0.0f);
|
||||
case FOCUS_NEXT:
|
||||
// If view not found, no neighbor to find.
|
||||
if (num == -1)
|
||||
return NeighborResult(0, 0.0f);
|
||||
return NeighborResult(views_[(num + 1) % views_.size()], 0.0f);
|
||||
|
||||
default:
|
||||
ERROR_LOG(SYSTEM, "Bad focus direction %d", (int)direction);
|
||||
|
@ -1260,6 +1260,8 @@ void MainScreen::CreateViews() {
|
||||
root_->SetDefaultFocusView(tabHolder_);
|
||||
}
|
||||
|
||||
root_->SetTag("mainroot");
|
||||
|
||||
auto u = GetI18NCategory(I18NCat::UPGRADE);
|
||||
|
||||
upgradeBar_ = 0;
|
||||
|
@ -286,5 +286,6 @@ std::string OnScreenMessagesView::DescribeText() const {
|
||||
|
||||
void OSDOverlayScreen::CreateViews() {
|
||||
root_ = new UI::AnchorLayout();
|
||||
root_->SetTag("OSDOverlayScreen");
|
||||
root_->Add(new OnScreenMessagesView(new UI::AnchorLayoutParams(0.0f, 0.0f, 0.0f, 0.0f)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user