mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 03:33:44 +01:00
Fix issue with chat button / DevMenu button becoming focusable
This made gameplay a bit difficult when these buttons were enabled.
This commit is contained in:
1 parent
e009d182ff
commit
e4b90c0471
6 files changed
+18
-5
No files matched your search
+5
-3
@@ -124,6 +124,8 @@ void EnableFocusMovement(bool enable) {
|
||||
focusMoves.clear();
|
||||
heldKeys.clear();
|
||||
focusedView = nullptr;
|
||||
} else {
|
||||
enable = enable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +363,7 @@ restart:
|
||||
}
|
||||
}
|
||||
|
||||
DialogResult UpdateViewHierarchy(ViewGroup *root) {
|
||||
DialogResult UpdateViewHierarchy(ViewGroup *root, bool canEnableFocusMovement) {
|
||||
ProcessHeldKeys(root);
|
||||
frameCount++;
|
||||
|
||||
@@ -370,7 +372,7 @@ DialogResult UpdateViewHierarchy(ViewGroup *root) {
|
||||
return DR_NONE;
|
||||
}
|
||||
|
||||
if (focusMoves.size()) {
|
||||
if (focusMoves.size() && canEnableFocusMovement) {
|
||||
EnableFocusMovement(true);
|
||||
if (!GetFocusedView()) {
|
||||
// Find a view to focus.
|
||||
@@ -397,8 +399,8 @@ DialogResult UpdateViewHierarchy(ViewGroup *root) {
|
||||
}
|
||||
}
|
||||
}
|
||||
focusMoves.clear();
|
||||
}
|
||||
focusMoves.clear();
|
||||
|
||||
root->Update();
|
||||
return DispatchEvents();
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ DialogResult DispatchEvents();
|
||||
class ViewGroup;
|
||||
|
||||
void LayoutViewHierarchy(const UIContext &dc, const UI::Margins &rootMargins, UI::ViewGroup *root, ViewLayoutMode layoutMode, bool immersiveMode);
|
||||
DialogResult UpdateViewHierarchy(ViewGroup *root);
|
||||
DialogResult UpdateViewHierarchy(ViewGroup *root, bool canEnableFocusMovement = true);
|
||||
|
||||
enum class KeyEventResult {
|
||||
IGNORE_KEY, // Don't let it be processed.
|
||||
|
||||
@@ -104,7 +104,7 @@ void UIScreen::update() {
|
||||
DoRecreateViews();
|
||||
|
||||
if (root_) {
|
||||
DialogResult result = UpdateViewHierarchy(root_);
|
||||
DialogResult result = UpdateViewHierarchy(root_, AllowFocusMovement());
|
||||
if (result != DR_NONE) {
|
||||
TriggerFinish(result);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void CreateViews() = 0;
|
||||
virtual bool AllowFocusMovement() const { return true; }
|
||||
|
||||
Bounds GetLayoutBounds(UIContext &dc) const;
|
||||
|
||||
|
||||
@@ -1738,6 +1738,14 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
|
||||
return screenRenderFlags;
|
||||
}
|
||||
|
||||
bool EmuScreen::AllowFocusMovement() const {
|
||||
if (chatMenu_ && chatMenu_->GetVisibility() == UI::V_VISIBLE) {
|
||||
return true;
|
||||
}
|
||||
// We have just a game controller and possibly a chat and debug button. Don't allow focus movement.
|
||||
return false;
|
||||
}
|
||||
|
||||
ScreenRenderFlags EmuScreen::RunEmulation(bool skipBufferEffects) {
|
||||
using namespace Draw;
|
||||
ScreenRenderFlags flags = ScreenRenderFlags::NONE;
|
||||
|
||||
@@ -77,6 +77,8 @@ protected:
|
||||
void SetPSPAnalog(int rotation, int stick, float x, float y) override;
|
||||
ViewLayoutMode LayoutMode() const override;
|
||||
|
||||
bool AllowFocusMovement() const override;
|
||||
|
||||
private:
|
||||
void CreateViews() override;
|
||||
ScreenRenderFlags RunEmulation(bool skipBufferEffects);
|
||||
|
||||
Reference in new issue
Block a user