focus_visible_window: Fix selecting with mouse click leaving keyboard in unusable state
Fixes #7390
This commit is contained in:
parent
9b14946176
commit
66d9db6d0a
3 changed files with 14 additions and 3 deletions
|
|
@ -58,6 +58,8 @@ Detailed list of changes
|
|||
- Graphics: Fix aspect ratio of images not being preserved when only a single
|
||||
dimension of the destination rectangle is specified (:iss:`7380`)
|
||||
|
||||
- :ac:`focus_visible_window`: Fix selecting with mouse click leaving keyboard in unusable state (:iss:`7390`)
|
||||
|
||||
0.34.1 [2024-04-19]
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
|
|
@ -1425,16 +1425,20 @@ def visual_window_select_action_trigger(self, window_id: int = 0) -> None:
|
|||
|
||||
def visual_window_select_mouse_handler(self, ev: WindowSystemMouseEvent) -> None:
|
||||
tab = self.active_tab
|
||||
def trigger(window_id: int = 0) -> None:
|
||||
self.visual_window_select_action_trigger(window_id)
|
||||
self.mappings.pop_keyboard_mode_if_is('__visual_select__')
|
||||
|
||||
if ev.button == GLFW_MOUSE_BUTTON_LEFT and ev.action == GLFW_PRESS and ev.window_id:
|
||||
w = self.window_id_map.get(ev.window_id)
|
||||
if w is not None and tab is not None and w in tab:
|
||||
if self.current_visual_select and self.current_visual_select.tab_id == tab.id:
|
||||
self.visual_window_select_action_trigger(w.id)
|
||||
trigger(w.id)
|
||||
else:
|
||||
self.visual_window_select_action_trigger()
|
||||
trigger()
|
||||
return
|
||||
if ev.button > -1 and tab is not None:
|
||||
self.visual_window_select_action_trigger()
|
||||
trigger()
|
||||
|
||||
def mouse_event(
|
||||
self, in_tab_bar: bool, window_id: int, action: int, modifiers: int, button: int,
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ def pop_keyboard_mode(self) -> bool:
|
|||
passthrough = False
|
||||
return passthrough
|
||||
|
||||
def pop_keyboard_mode_if_is(self, name: str) -> bool:
|
||||
if self.keyboard_mode_stack and self.keyboard_mode_stack[-1].name == name:
|
||||
return self.pop_keyboard_mode()
|
||||
return False
|
||||
|
||||
def _push_keyboard_mode(self, mode: KeyboardMode) -> None:
|
||||
self.keyboard_mode_stack.append(mode)
|
||||
self.set_ignore_os_keyboard_processing(True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue