gui: skip mouse event handling if window is not focused

The intent is to workaround what appears to be an i3 bug.
Not totally sure this is a good change, but let's try it!

Might also help with an issue on macos.

refs: #1140
refs: #1310
This commit is contained in:
Wez Furlong committed 2021-12-10 10:33:00 -07:00
1 parent 7b402678e4
commit 04cb8d1d3b
1 file changed
+8
+8
View File
@@ -424,6 +424,14 @@ impl super::TermWindow {
event: MouseEvent,
context: &dyn WindowOps,
) {
if self.focused.is_none() {
// Ignore the mouse event if the window doesn't have focus.
// Some Window managers can send events in a strange order
// <https://github.com/wez/wezterm/issues/1140#issuecomment-921031466>
// and that can confuse neovim for example.
return;
}
let mut is_click_to_focus = false;
for pos in self.get_panes_to_render() {