Commit cd23f7a0c305
tarball1 file changed+11-10
@@ -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
- dx711
- } else {712
- dy709
+ 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;