fix(windows): release gamepad handles on window blur

This commit is contained in:
edde746
2026-02-23 08:05:55 +01:00
parent 3670383fde
commit 964b89aa67
3 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -101,7 +101,10 @@ class GamepadService with WindowListener {
}
@override
void onWindowFocus() => _windowFocused = true;
void onWindowFocus() {
_windowFocused = true;
Gamepad.instance.resume();
}
@override
void onWindowBlur() {
@@ -123,6 +126,9 @@ class GamepadService with WindowListener {
_leftStickDown = false;
_leftStickLeft = false;
_leftStickRight = false;
// Release native device handles so other apps can use the gamepad.
Gamepad.instance.pause();
}
void _handleGamepadEvent(GamepadEvent event) {
+2 -2
View File
@@ -1263,10 +1263,10 @@ packages:
dependency: "direct main"
description:
name: universal_gamepad
sha256: afd3106195aa2052ec23fe61069cad8d0caed255c7e2e6ed33a403e0a94f365e
sha256: b638bd9d2bf25c15cf815c7f1a66629d56e8d5229178d7347ffc68efd7c646dd
url: "https://pub.dev"
source: hosted
version: "1.4.4"
version: "1.5.0"
url_launcher:
dependency: "direct main"
description:
+1 -1
View File
@@ -38,7 +38,7 @@ dependencies:
path: wakelock_plus
path_provider: ^2.1.0
path: ^1.9.0
universal_gamepad: ^1.4.4
universal_gamepad: ^1.5.0
drift: ^2.28.2
sqlite3_flutter_libs: ^0.5.41
workmanager: ^0.9.0+3