gui: allow mouse wheel to route to hovered pane

refs: https://github.com/wez/wezterm/issues/798
This commit is contained in:
Wez Furlong committed 2021-12-25 15:37:14 -07:00
1 parent c937f0c77c
commit 790b515c21
2 files changed
+19 -15

No files matched your search

+1
View File
@@ -43,6 +43,7 @@ As features stabilize some brief notes about them will accumulate here.
* Line/Bar cursors in [force_reverse_video_cursor](config/lua/config/force_reverse_video_cursor.md) mode now use the text foreground color rather than the cursor border color. [#1076](https://github.com/wez/wezterm/issues/1076)
* Improved logo appearance. Thanks to [@ghifarit53](https://github.com/ghifarit53)! [#1454](https://github.com/wez/wezterm/pull/1454)
* You can now pass [SendKey](config/lua/keyassignment/SendKey.md) to [wezterm.action](config/lua/wezterm/action.md) and make your `keys` config look more consistent
* Mouse wheel events are now routed to the hovered pane, rather than sent to the focused pane [#798](https://github.com/wez/wezterm/issues/798)
#### Fixed
+18 -15
View File
@@ -113,18 +113,6 @@ impl super::TermWindow {
self.current_mouse_buttons.push(*press);
}
WMEK::VertWheel(amount) if !pane.is_mouse_grabbed() && !pane.is_alt_screen_active() => {
// adjust viewport
let dims = pane.get_dimensions();
let position = self
.get_viewport(pane.pane_id())
.unwrap_or(dims.physical_top)
.saturating_sub(amount.into());
self.set_viewport(pane.pane_id(), Some(position), dims);
context.invalidate();
return;
}
WMEK::Move => {
if let Some(start) = self.window_drag_position.as_ref() {
// Dragging the window
@@ -453,9 +441,13 @@ impl super::TermWindow {
context.invalidate();
}
}
WMEK::Release(_) => {}
WMEK::VertWheel(_) => {}
WMEK::HorzWheel(_) => {}
WMEK::Release(_) | WMEK::HorzWheel(_) => {}
WMEK::VertWheel(_) => {
// Let wheel events route to the hovered pane,
// even if it doesn't have focus
pane = Rc::clone(&pos.pane);
context.invalidate();
}
}
}
x = x.saturating_sub(pos.left);
@@ -605,6 +597,17 @@ impl super::TermWindow {
None
}
}
WMEK::VertWheel(amount) if !pane.is_mouse_grabbed() && !pane.is_alt_screen_active() => {
// adjust viewport
let dims = pane.get_dimensions();
let position = self
.get_viewport(pane.pane_id())
.unwrap_or(dims.physical_top)
.saturating_sub((*amount).into());
self.set_viewport(pane.pane_id(), Some(position), dims);
context.invalidate();
return;
}
WMEK::VertWheel(_) | WMEK::HorzWheel(_) => None,
};