forked from Boria138/PortProtonQt
fix(input_manager): Prioritize tab switching over game card navigation on left arrow key press
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
parent
636ab73580
commit
c460737bed
@ -390,6 +390,20 @@ class InputManager(QObject):
|
|||||||
focused._show_context_menu(pos)
|
focused._show_context_menu(pos)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
# Tab switching with Left/Right keys (non-GameCard focus or no focus)
|
||||||
|
idx = self._parent.stackedWidget.currentIndex()
|
||||||
|
total = len(self._parent.tabButtons)
|
||||||
|
if key == Qt.Key.Key_Left and (not isinstance(focused, GameCard) or focused is None):
|
||||||
|
new = (idx - 1) % total
|
||||||
|
self._parent.switchTab(new)
|
||||||
|
self._parent.tabButtons[new].setFocus()
|
||||||
|
return True
|
||||||
|
if key == Qt.Key.Key_Right and (not isinstance(focused, GameCard) or focused is None):
|
||||||
|
new = (idx + 1) % total
|
||||||
|
self._parent.switchTab(new)
|
||||||
|
self._parent.tabButtons[new].setFocus()
|
||||||
|
return True
|
||||||
|
|
||||||
# Library tab navigation
|
# Library tab navigation
|
||||||
if self._parent.stackedWidget.currentIndex() == 0:
|
if self._parent.stackedWidget.currentIndex() == 0:
|
||||||
game_cards = self._parent.gamesListWidget.findChildren(GameCard)
|
game_cards = self._parent.gamesListWidget.findChildren(GameCard)
|
||||||
@ -497,20 +511,6 @@ class InputManager(QObject):
|
|||||||
self._parent.tabButtons[0].setFocus()
|
self._parent.tabButtons[0].setFocus()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Tab switching with Left/Right keys (non-GameCard focus)
|
|
||||||
idx = self._parent.stackedWidget.currentIndex()
|
|
||||||
total = len(self._parent.tabButtons)
|
|
||||||
if key == Qt.Key.Key_Left and not isinstance(focused, GameCard):
|
|
||||||
new = (idx - 1) % total
|
|
||||||
self._parent.switchTab(new)
|
|
||||||
self._parent.tabButtons[new].setFocus()
|
|
||||||
return True
|
|
||||||
if key == Qt.Key.Key_Right and not isinstance(focused, GameCard):
|
|
||||||
new = (idx + 1) % total
|
|
||||||
self._parent.switchTab(new)
|
|
||||||
self._parent.tabButtons[new].setFocus()
|
|
||||||
return True
|
|
||||||
|
|
||||||
# Navigate down into tab content
|
# Navigate down into tab content
|
||||||
if key == Qt.Key.Key_Down:
|
if key == Qt.Key.Key_Down:
|
||||||
if isinstance(focused, NavLabel):
|
if isinstance(focused, NavLabel):
|
||||||
@ -520,11 +520,6 @@ class InputManager(QObject):
|
|||||||
if focusables:
|
if focusables:
|
||||||
focusables[0].setFocus()
|
focusables[0].setFocus()
|
||||||
return True
|
return True
|
||||||
else:
|
|
||||||
if focused is not None:
|
|
||||||
focused.focusNextChild()
|
|
||||||
return True
|
|
||||||
|
|
||||||
# Navigate up through tab content
|
# Navigate up through tab content
|
||||||
if key == Qt.Key.Key_Up:
|
if key == Qt.Key.Key_Up:
|
||||||
if isinstance(focused, NavLabel):
|
if isinstance(focused, NavLabel):
|
||||||
@ -557,7 +552,6 @@ class InputManager(QObject):
|
|||||||
|
|
||||||
return super().eventFilter(obj, event)
|
return super().eventFilter(obj, event)
|
||||||
|
|
||||||
|
|
||||||
def init_gamepad(self) -> None:
|
def init_gamepad(self) -> None:
|
||||||
self.check_gamepad()
|
self.check_gamepad()
|
||||||
threading.Thread(target=self.run_udev_monitor, daemon=True).start()
|
threading.Thread(target=self.run_udev_monitor, daemon=True).start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user