reset mouse cursor to arrow when mouse leaves the window

refs: https://github.com/wez/wezterm/issues/2471
This commit is contained in:
Wez Furlong committed 2022-09-01 18:45:20 -07:00
1 parent ab2c368a3c
commit 8adc78b587
2 files changed
+8 -1

No files matched your search

+1
View File
@@ -45,6 +45,7 @@ As features stabilize some brief notes about them will accumulate here.
* Scroll to the bottom on mouse input when mouse reporting is enabled [#2447](https://github.com/wez/wezterm/issues/2447)
* ssh: correctly expand `%h` ssh_config tokens [#2448](https://github.com/wez/wezterm/issues/2448)
* ssh: `CloseCurrentPane` wouldn't release all resources associated with the pane and could lead to a `too many open files` error for a long running `wezterm ssh` session. [#2466](https://github.com/wez/wezterm/issues/2466)
* mouse cursor is now reset to arrow when the mouse leaves the window [#2471](https://github.com/wez/wezterm/issues/2471)
### 20220807-113146-c2fee766
+7 -1
View File
@@ -235,6 +235,7 @@ impl super::TermWindow {
pub fn mouse_leave_impl(&mut self, context: &dyn WindowOps) {
self.current_mouse_event = None;
self.update_title();
context.set_cursor(Some(MouseCursor::Arrow));
context.invalidate();
}
@@ -709,11 +710,16 @@ impl super::TermWindow {
}
};
let outside_window = event.coords.x < 0
|| event.coords.x as usize > self.dimensions.pixel_width
|| event.coords.y < 0
|| event.coords.y as usize > self.dimensions.pixel_height;
context.set_cursor(Some(if self.current_highlight.is_some() {
// When hovering over a hyperlink, show an appropriate
// mouse cursor to give the cue that it is clickable
MouseCursor::Hand
} else if pane.is_mouse_grabbed() {
} else if pane.is_mouse_grabbed() || outside_window {
MouseCursor::Arrow
} else {
MouseCursor::Text