fix: fix resize logic

This commit is contained in:
DreamMaoMao 2026-05-09 13:54:58 +08:00
parent 5f440e5fd5
commit f83dd433cb
2 changed files with 6 additions and 14 deletions

View file

@ -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,

View file

@ -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)