mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-02-18 00:17:40 +01:00
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:
@@ -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([]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user