mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
More focus behaviour tweaking.
This commit is contained in:
parent
27bb0b01d3
commit
af35f06390
@ -154,6 +154,15 @@ Point View::GetFocusPosition(FocusDirection dir) {
|
||||
}
|
||||
}
|
||||
|
||||
bool View::SetFocus() {
|
||||
if (IsFocusMovementEnabled()) {
|
||||
if (CanBeFocused()) {
|
||||
SetFocusedView(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Clickable::Click() {
|
||||
UI::EventParams e;
|
||||
|
@ -328,13 +328,7 @@ public:
|
||||
virtual void ReplaceLayoutParams(LayoutParams *newLayoutParams) { layoutParams_.reset(newLayoutParams); }
|
||||
const Bounds &GetBounds() const { return bounds_; }
|
||||
|
||||
virtual bool SetFocus() {
|
||||
if (CanBeFocused()) {
|
||||
SetFocusedView(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual bool SetFocus();
|
||||
|
||||
virtual bool CanBeFocused() const { return true; }
|
||||
virtual bool SubviewFocused(View *view) { return false; }
|
||||
|
@ -431,7 +431,7 @@ void LinearLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec v
|
||||
}
|
||||
|
||||
weightZeroSum += spacing_ * (numVisible - 1);
|
||||
|
||||
|
||||
// Awright, got the sum. Let's take the remaining space after the fixed-size views,
|
||||
// and distribute among the weighted ones.
|
||||
if (orientation_ == ORIENT_HORIZONTAL) {
|
||||
@ -1194,7 +1194,11 @@ void UpdateViewHierarchy(const InputState &input_state, ViewGroup *root) {
|
||||
lock_guard lock(focusLock);
|
||||
EnableFocusMovement(true);
|
||||
if (!GetFocusedView()) {
|
||||
root->SetFocus();
|
||||
if (root->GetDefaultFocusView()) {
|
||||
root->GetDefaultFocusView()->SetFocus();
|
||||
} else {
|
||||
root->SetFocus();
|
||||
}
|
||||
root->SubviewFocused(GetFocusedView());
|
||||
} else {
|
||||
for (size_t i = 0; i < focusMoves.size(); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user