1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

click to focus window now focuses the pane under the mouse cursor

refs: https://github.com/wez/wezterm/issues/881
This commit is contained in:
Wez Furlong 2021-06-26 15:24:17 -07:00
parent e786968578
commit 2fc143e6dd
3 changed files with 18 additions and 7 deletions

View File

@ -46,6 +46,7 @@ As features stabilize some brief notes about them will accumulate here.
* Improved: `wezterm ls-fonts --list-system` shows all available fonts, `wezterm ls-fonts --text "hello"` explains which fonts are used for each glyph in the supplied text
* Fixed: mouse cursor is now Arrow rather than I-beam when the application in the terminal has enabled mouse reporting [#859](https://github.com/wez/wezterm/issues/859)
* Improved: DEC Special Graphics mode conformance and complete coverage of the graphics character set. Thanks to [Autumn Lamonte](https://gitlab.com/klamonte)! [#891](https://github.com/wez/wezterm/pull/891)
* Fixed: click to focus now focuses the pane under the mouse cursor [#881](https://github.com/wez/wezterm/issues/881)
### 20210502-154244-3f7122cb

View File

@ -95,13 +95,6 @@ impl super::TermWindow {
}
WMEK::Press(ref press) => {
if let Some(focused) = self.focused.as_ref() {
if focused.elapsed() <= Duration::from_millis(200) {
log::trace!("discard mouse click because it focused the window");
return;
}
}
// Perform click counting
let button = mouse_press_to_tmb(press);
@ -385,6 +378,14 @@ impl super::TermWindow {
break;
}
}
if let Some(focused) = self.focused.as_ref() {
if focused.elapsed() <= Duration::from_millis(200) {
if is_click_to_focus {
context.invalidate();
}
return;
}
}
let dims = pane.get_dimensions();
let stable_row = self

View File

@ -1483,6 +1483,10 @@ impl WindowView {
}
}
extern "C" fn accepts_first_mouse(_this: &mut Object, _sel: Sel, _nsevent: id) -> BOOL {
YES
}
extern "C" fn accepts_first_responder(_this: &mut Object, _sel: Sel) -> BOOL {
YES
}
@ -2118,6 +2122,11 @@ impl WindowView {
Self::accepts_first_responder as extern "C" fn(&mut Object, Sel) -> BOOL,
);
cls.add_method(
sel!(acceptsFirstMouse:),
Self::accepts_first_mouse as extern "C" fn(&mut Object, Sel, id) -> BOOL,
);
// NSTextInputClient
cls.add_method(