atagen

monolith

public
Star0
Watch0

Commit cd23f7a0c305

tarball

atagen <boss@atagen.co>2026-10-19 10:59 UTC

1 file changed+11-10
input: follow the pointer's offset from the press in a split drag

Each motion applied its increment to the split and then reset the origin to the pointer, so a clamp at the minimum share swallowed the overshoot and the split stayed behind the pointer when it came back. The target edge is now the press-time edge plus the offset from the press.
Modified file: crates/monolith/src/input.rs+11 additions−10 deletions
@@ -4,7 +4,7 @@
44 use crate::constraints::Constraint;
55 use crate::state::{Input, State};
66 use crate::wm::Resizing;
7-use monolith_layout::{Axis, Dir, Layout, MIN_FLOAT_SIZE, Rect, WindowId, clamp_float};
7+use monolith_layout::{Dir, Layout, MIN_FLOAT_SIZE, Rect, WindowId, clamp_float};
88 use smithay::backend::input::{ButtonState, InputTime, KeyState};
99 use smithay::backend::session::Session;
1010 use smithay::input::keyboard::{FilterResult, Keycode, xkb};
@@ -704,17 +704,18 @@ fn drag_to(state: &mut State, pos: Point<f64, Logical>) -> bool {
704704 };
705705 let (dx, dy) = (pos.x - d.from.x, pos.y - d.from.y);
706706 if let (true, Some(e)) = (d.tiled, d.edges) {
707- let id = d.window;
707+ let (id, start) = (d.window, d.rect);
708708 for dir in e.dirs() {
709- let px = if dir.axis() == Axis::Horizontal {
710- dx
711- } else {
712- dy
709+ let Some(now) = window_rect(&state.wm.layout, id) else {
710+ continue;
713711 };
714- state.wm.layout.move_split(id, dir, px);
715- }
716- if let Some(d) = state.input.drag.as_mut() {
717- d.from = pos;
712+ let (at, was, offset) = match dir {
713+ Dir::Left => (now.x, start.x, dx),
714+ Dir::Right => (now.right(), start.right(), dx),
715+ Dir::Up => (now.y, start.y, dy),
716+ Dir::Down => (now.bottom(), start.bottom(), dy),
717+ };
718+ state.wm.layout.move_split(id, dir, was + offset - at);
718719 }
719720 state.apply_layout();
720721 return true;