From f355b88b827b309746064c2ecf850052991d4e0b Mon Sep 17 00:00:00 2001 From: Zedhugh Chen Date: Tue, 23 Jun 2026 00:45:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(policy):=20=E8=B0=83=E6=95=B4=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E5=A4=A7=E5=B0=8F=E6=97=B6=E9=81=B5=E5=BE=AA=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E7=9A=84=20max/min=20size=20hints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/policy.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/core/policy.c b/src/core/policy.c index 2cf155b..a8475e3 100644 --- a/src/core/policy.c +++ b/src/core/policy.c @@ -517,6 +517,7 @@ static void route_pointer_motion( command_buffer_t *out ) { auto interaction = ctx->interaction; + auto window_id = interaction->window; switch (interaction->mode) { case ZDWM_WINDOW_INTERACTION_NONE: @@ -538,14 +539,23 @@ static void route_pointer_motion( command_buffer_push(out, &configure); } break; case ZDWM_WINDOW_INTERACTION_RESIZE: { + auto window = state_window_get(ctx->state, window_id); + auto rect = interaction->origin_rect; auto start = interaction->start_coordinate; auto end = data->root; + auto min_size = window->min_size; + auto max_size = window->max_size; + auto width = rect.width + (end.x - start.x); auto height = rect.height + (end.y - start.y); - width = MAX(width, 10); - height = MAX(height, 10); + width = MAX(width, min_size.width); + height = MAX(height, min_size.height); + width = MIN(width, max_size.width); + height = MIN(height, max_size.height); + + if (!window_need_resize(window, width, height)) break; command_t configure_cmd = { .type = ZDWM_COMMAND_CONFIGURE_WINDOW,