Fix VS200 double shifting by handling non-long-press buttons correctly

Co-authored-by: jonasbark <1151304+jonasbark@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-14 07:49:25 +00:00
parent 7b2f16772d
commit d2a41fc2fa

View File

@@ -69,18 +69,21 @@ abstract class BaseDevice {
Future<void> connect();
Future<void> handleButtonsClickedWithoutLongPressSupport(List<ControllerButton> clickedButtons) async {
await handleButtonsClicked(clickedButtons, longPress: true);
if (clickedButtons.length == 1) {
final keyPair = core.actionHandler.supportedApp?.keymap.getKeyPair(clickedButtons.single);
if (keyPair != null && (keyPair.isLongPress || keyPair.inGameAction?.isLongPress == true)) {
// simulate release after click
// For long press actions: perform down, wait, then release
await handleButtonsClicked(clickedButtons, longPress: true);
_longPressTimer?.cancel();
await Future.delayed(const Duration(milliseconds: 800));
await handleButtonsClicked([], longPress: true);
} else {
await handleButtonsClicked([], longPress: true);
// For non-long-press actions: perform a single click
await handleButtonsClicked(clickedButtons, longPress: false);
await handleButtonsClicked([], longPress: false);
}
} else {
await handleButtonsClicked(clickedButtons);
await handleButtonsClicked([]);
}
}