Don't poll gamepad input when the GUI is not focused/visible

This commit is contained in:
Cameron Gutman
2024-09-26 19:24:29 -05:00
parent 9b3d4c1ad7
commit 2a63ad53d7
5 changed files with 43 additions and 21 deletions
-6
View File
@@ -7,7 +7,6 @@ import ComputerModel 1.0
import ComputerManager 1.0
import StreamingPreferences 1.0
import SystemProperties 1.0
import SdlGamepadKeyNavigation 1.0
CenteredGridView {
property ComputerModel computerModel : createModel()
@@ -34,11 +33,6 @@ CenteredGridView {
// Setup signals on CM
ComputerManager.computerAddCompleted.connect(addComplete)
// This is a bit of a hack to do this here as opposed to main.qml, but
// we need it enabled before calling getConnectedGamepads() and PcView
// is never destroyed, so it should be okay.
SdlGamepadKeyNavigation.enable()
// Highlight the first item if a gamepad is connected
if (currentIndex == -1 && SdlGamepadKeyNavigation.getConnectedGamepads() > 0) {
currentIndex = 0