feat(window): 添加判断窗口能否调整大小的辅助函数

This commit is contained in:
2026-06-23 02:43:28 +08:00
parent f355b88b82
commit 71f050c2f3
3 changed files with 9 additions and 0 deletions

View File

@@ -540,6 +540,7 @@ static void route_pointer_motion(
} break; } break;
case ZDWM_WINDOW_INTERACTION_RESIZE: { case ZDWM_WINDOW_INTERACTION_RESIZE: {
auto window = state_window_get(ctx->state, window_id); auto window = state_window_get(ctx->state, window_id);
if (!window_can_resize(window)) break;
auto rect = interaction->origin_rect; auto rect = interaction->origin_rect;
auto start = interaction->start_coordinate; auto start = interaction->start_coordinate;

View File

@@ -171,3 +171,10 @@ bool window_should_fix_size(const window_t *window) {
auto min = window->min_size; auto min = window->min_size;
return max.width == min.width && max.height == min.height; return max.width == min.width && max.height == min.height;
} }
bool window_can_resize(const window_t *window) {
if (window->fullscreen || window->maximized) return false;
if (window_should_fix_size(window)) return false;
return true;
}

View File

@@ -130,3 +130,4 @@ bool window_need_move(const window_t *window, int32_t x, int32_t y);
bool window_need_resize(const window_t *window, int32_t width, int32_t height); bool window_need_resize(const window_t *window, int32_t width, int32_t height);
bool window_should_has_border(const window_t *window); bool window_should_has_border(const window_t *window);
bool window_should_fix_size(const window_t *window); bool window_should_fix_size(const window_t *window);
bool window_can_resize(const window_t *window);