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