From f83dd433cb64b2171b663264406cb583c6da52f7 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sat, 9 May 2026 13:54:58 +0800 Subject: [PATCH] fix: fix resize logic --- src/layout/arrange.h | 16 ++++------------ src/layout/dwindle.h | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/layout/arrange.h b/src/layout/arrange.h index b22e1fea..d9731acc 100644 --- a/src/layout/arrange.h +++ b/src/layout/arrange.h @@ -491,24 +491,16 @@ void resize_tile_master_vertical(Client *grabc, bool isdrag, int32_t offsetx, void resize_tile_dwindle(Client *grabc, bool isdrag, int32_t offsetx, int32_t offsety, uint32_t time, bool isvertical) { - if (!start_drag_window) { + if (!isdrag) { dwindle_resize_client_step(grabc->mon, grabc, offsetx, offsety); + return; } - if (isdrag) { - int32_t dx = (int32_t)round(cursor->x) - drag_begin_cursorx; - int32_t dy = (int32_t)round(cursor->y) - drag_begin_cursory; - dwindle_resize_client(grabc->mon, grabc, dx, dy); - } else if (last_apply_drap_time == 0 || - time - last_apply_drap_time > - config.drag_tile_refresh_interval) { + if (last_apply_drap_time == 0 || + time - last_apply_drap_time > config.drag_tile_refresh_interval) { dwindle_resize_client(grabc->mon, grabc, offsetx, offsety); last_apply_drap_time = time; } - - if (!isdrag) { - start_drag_window = false; - } } void resize_tile_scroller(Client *grabc, bool isdrag, int32_t offsetx, diff --git a/src/layout/dwindle.h b/src/layout/dwindle.h index 6ea564bc..40dd2b2e 100644 --- a/src/layout/dwindle.h +++ b/src/layout/dwindle.h @@ -187,6 +187,8 @@ static void dwindle_resize_client(Monitor *m, Client *c, int32_t dx, start_drag_window = true; dwindle_locked_h_node = NULL; dwindle_locked_v_node = NULL; + drag_begin_cursorx = cursor->x; + drag_begin_cursory = cursor->y; DwindleNode *node = leaf->parent; while (node) { if (node->split_h && !dwindle_locked_h_node) { @@ -262,8 +264,6 @@ static void dwindle_resize_client_step(Monitor *m, Client *c, int32_t dx, DwindleNode *h_node = NULL; DwindleNode *v_node = NULL; DwindleNode *node = leaf->parent; - drag_begin_cursorx = cursor->x; - drag_begin_cursory = cursor->y; while (node) { if (node->split_h && !h_node)