From 6781f3493034dfb81c1c63a3774406d1fc0511f6 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 1 Mar 2024 19:06:52 -0800 Subject: [PATCH] fix(wm): restore full mouse resize functionality This commit fixes a regression that was most likely introduced in #678 which changed a bunch of stuff related to window and border dimension calculation. See commit 4e98d7d36d392592febd90b7555caf47ceb49552 for more information as the same approach to fix the behaviour there has been applied here. --- komorebi/src/process_event.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index 8be0d173..4feb4e24 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -479,17 +479,17 @@ impl WindowManager { let mut ops = vec![]; macro_rules! resize_op { - ($coordinate:expr, $comparator:tt, $direction:expr) => {{ - let adjusted = $coordinate * 2; - let sizing = if adjusted $comparator 0 { - Sizing::Decrease - } else { - Sizing::Increase - }; + ($coordinate:expr, $comparator:tt, $direction:expr) => {{ + let adjusted = $coordinate * 2; + let sizing = if adjusted $comparator 0 { + Sizing::Decrease + } else { + Sizing::Increase + }; - ($direction, sizing, adjusted.abs()) - }}; - } + ($direction, sizing, adjusted.abs()) + }}; + } if resize.left != 0 { ops.push(resize_op!(resize.left, >, OperationDirection::Left)); @@ -499,11 +499,14 @@ impl WindowManager { ops.push(resize_op!(resize.top, >, OperationDirection::Up)); } - if resize.right != 0 && resize.left == 0 { + let top_left_constant = BORDER_WIDTH.load(Ordering::SeqCst) + + BORDER_OFFSET.load(Ordering::SeqCst); + + if resize.right != 0 && resize.left == top_left_constant { ops.push(resize_op!(resize.right, <, OperationDirection::Right)); } - if resize.bottom != 0 && resize.top == 0 { + if resize.bottom != 0 && resize.top == top_left_constant { ops.push(resize_op!(resize.bottom, <, OperationDirection::Down)); }