aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input/mouse.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-04 11:59:21 +0100
committerGitHub <noreply@github.com>2026-02-04 11:59:21 +0100
commit690a1e4506854c1e7637cf4c27f75e39b923972d (patch)
treeecedd56de5971abe1db82d83402815e52e9df3b2 /zellij-utils/src/input/mouse.rs
parentfix(layout): Correctly handle relative layout paths from CLI (#4664) (diff)
downloadsl0ppij-690a1e4506854c1e7637cf4c27f75e39b923972d.tar.gz
sl0ppij-690a1e4506854c1e7637cf4c27f75e39b923972d.tar.xz
sl0ppij-690a1e4506854c1e7637cf4c27f75e39b923972d.zip
Allow resizing panes with the mouse (#4678)
* initial implementation * improve edge detection * fix up/down resize increment bug * temporarily disable alt-mouse grouping * fix inverting strategies and simplify edge detection * resize of floating -> ctrl click, resize of tiled -> (ctrl)click * fix old functionality and tests * refactor and fixes * refactor mouse click handling * move mouse click handling to separate module * resize scroll up/down with scroll wheel * tests for scroll resize * implement hover help * fix occlusion bug * allow disabling with config * fix focus pinned pane on frame * use strategy invert resize directly rather than function parameter * remove annoying log message * cleanups and formatting * add pr
Diffstat (limited to 'zellij-utils/src/input/mouse.rs')
-rw-r--r--zellij-utils/src/input/mouse.rs120
1 files changed, 120 insertions, 0 deletions
diff --git a/zellij-utils/src/input/mouse.rs b/zellij-utils/src/input/mouse.rs
index 0977d5e7..a8fcb5a7 100644
--- a/zellij-utils/src/input/mouse.rs
+++ b/zellij-utils/src/input/mouse.rs
@@ -238,6 +238,126 @@ impl MouseEvent {
};
event
}
+ pub fn new_left_press_with_ctrl_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Press,
+ left: true,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: false,
+ shift: false,
+ alt: false,
+ ctrl: true,
+ position,
+ };
+ event
+ }
+ pub fn new_left_motion_with_ctrl_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Motion,
+ left: true,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: false,
+ shift: false,
+ alt: false,
+ ctrl: true,
+ position,
+ };
+ event
+ }
+ pub fn new_left_release_with_ctrl_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Release,
+ left: true,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: false,
+ shift: false,
+ alt: false,
+ ctrl: true,
+ position,
+ };
+ event
+ }
+ pub fn new_left_motion_with_alt_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Motion,
+ left: true,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: false,
+ shift: false,
+ alt: true,
+ ctrl: false,
+ position,
+ };
+ event
+ }
+ pub fn new_scroll_up_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Press,
+ left: false,
+ right: false,
+ middle: false,
+ wheel_up: true,
+ wheel_down: false,
+ shift: false,
+ alt: false,
+ ctrl: false,
+ position,
+ };
+ event
+ }
+ pub fn new_scroll_down_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Press,
+ left: false,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: true,
+ shift: false,
+ alt: false,
+ ctrl: false,
+ position,
+ };
+ event
+ }
+ pub fn new_ctrl_scroll_up_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Press,
+ left: false,
+ right: false,
+ middle: false,
+ wheel_up: true,
+ wheel_down: false,
+ shift: false,
+ alt: false,
+ ctrl: true,
+ position,
+ };
+ event
+ }
+ pub fn new_ctrl_scroll_down_event(position: Position) -> Self {
+ let event = MouseEvent {
+ event_type: MouseEventType::Press,
+ left: false,
+ right: false,
+ middle: false,
+ wheel_up: false,
+ wheel_down: true,
+ shift: false,
+ alt: false,
+ ctrl: true,
+ position,
+ };
+ event
+ }
}
impl Default for MouseEvent {