fix(settings): fix virtual keyboard

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-11-23 15:28:30 +05:00
parent b7804fdd01
commit bbfbc00c11

View File

@@ -724,7 +724,7 @@ class InputManager(QObject):
logger.error(f"Error restoring gamepad handlers from Settings: {e}")
def handle_settings_button(self, button_code, value):
if self.settings_dialog is None or value == 0:
if self.settings_dialog is None:
return
try:
@@ -732,17 +732,28 @@ class InputManager(QObject):
kb = getattr(self.settings_dialog, 'keyboard', None)
if kb and kb.isVisible():
if button_code in BUTTONS['back']:
if value != 0: # Only handle press, not release
kb.hide()
if kb.current_input_widget:
kb.current_input_widget.setFocus()
return # Return early to avoid dialog closing logic
elif button_code in (BUTTONS['confirm'] | BUTTONS['context_menu']):
if value != 0: # Only handle press, not release
kb.activateFocusedKey()
return
elif button_code in BUTTONS['prev_tab']:
if value != 0: # Only handle press, not release
kb.on_lang_click()
return
elif button_code in BUTTONS['next_tab']:
if value != 0: # Only handle press, not release
kb.on_shift_click(not kb.shift_pressed)
return
elif button_code in BUTTONS['add_game']:
if value != 0: # Press event
kb.on_backspace_pressed()
else: # Release event
kb.stop_backspace_repeat()
return
# Handle common UI elements like QMessageBox, QMenu, etc.
@@ -750,6 +761,7 @@ class InputManager(QObject):
return
# Handle other QDialogs
if value != 0: # Only handle press events, not releases
popup = QApplication.activePopupWidget()
if isinstance(popup, QDialog):
if button_code in BUTTONS['confirm']: