Skip to content

Commit eee78c9

Browse files
committed
fix: also clear the SHOW_KEYBOARD latch in resetPressedKeys
showKeyboardPressed has the same lifetime as the screenshot combo state: if the keyboard binding is held when a menu/editor steals focus, its ACTION_UP is routed away and the latch stays true, so the next SHOW_KEYBOARD press is ignored. Reset it alongside the combo state. Addresses PR utkarshdalal#1627 review feedback.
1 parent ac7f21f commit eee78c9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app/src/main/java/app/gamenative/ui/screen/xserver/PhysicalControllerHandler.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,15 @@ class PhysicalControllerHandler(
9898

9999
/**
100100
* Clear held-key tracking. Call when key events stop being forwarded to this handler (e.g. an
101-
* overlay/menu/editor opens), so a combo key whose ACTION_UP is routed elsewhere can't linger in
102-
* [pressedKeyCodesByDevice] and later falsely satisfy the screenshot combo on a partial press.
101+
* overlay/menu/editor opens), so a held binding whose ACTION_UP is routed elsewhere can't linger:
102+
* a combo key would otherwise falsely satisfy the screenshot combo on a partial press, and a held
103+
* SHOW_KEYBOARD binding would leave [showKeyboardPressed] latched so the next press is ignored.
103104
*/
104105
fun resetPressedKeys() {
105-
if (pressedKeyCodesByDevice.isEmpty() && !screenshotComboFired) return
106+
if (pressedKeyCodesByDevice.isEmpty() && !screenshotComboFired && !showKeyboardPressed) return
106107
pressedKeyCodesByDevice.clear()
107108
screenshotComboFired = false
109+
showKeyboardPressed = false
108110
}
109111

110112
/**

0 commit comments

Comments
 (0)