Fix focus changes not being sent to windows when focused window changes because of the previously focused window being closed

Fixes #3571
This commit is contained in:
Kovid Goyal 2021-05-05 14:45:57 +05:30
parent 5cf228e362
commit bf462e535a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Fix tab activity symbol not appearing if no other changes happen in tab bar even when
there is activity in a tab (:iss:`3571`)
- Fix focus changes not being sent to windows when focused window changes
because of the previously focused window being closed (:iss:`3571`)
0.20.2 [2021-04-28]
----------------------

View File

@ -436,6 +436,7 @@ class Boss:
mark_os_window_for_close(src_tab.os_window_id)
def on_child_death(self, window_id: int) -> None:
prev_active_window = self.active_window
window = self.window_id_map.pop(window_id, None)
if window is None:
return
@ -464,6 +465,12 @@ class Boss:
import traceback
traceback.print_exc()
window.action_on_close = window.action_on_removal = None
window = self.active_window
if window is not prev_active_window:
if prev_active_window is not None:
prev_active_window.focus_changed(False)
if window is not None:
window.focus_changed(True)
def close_window(self, window: Optional[Window] = None) -> None:
window = window or self.active_window