From 0e965e95833669f01df812d9461a02f9210cd341 Mon Sep 17 00:00:00 2001 From: speckitor Date: Sat, 25 Apr 2026 18:37:08 +0700 Subject: [PATCH] resize --- src/absinthe-toplevel.c | 8 ++++---- src/cursor.c | 20 ++++++++++---------- src/keyboard.c | 2 +- src/xdg-toplevel.c | 4 +--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/absinthe-toplevel.c b/src/absinthe-toplevel.c index 00299a0..f942394 100644 --- a/src/absinthe-toplevel.c +++ b/src/absinthe-toplevel.c @@ -195,6 +195,8 @@ struct absinthe_toplevel *absinthe_toplevel_at(struct absinthe_server *server, d void absinthe_toplevel_set_position(struct absinthe_toplevel *toplevel, int32_t x, int32_t y) { + toplevel->geometry.x = x; + toplevel->geometry.y = y; wlr_scene_node_set_position(&toplevel->scene_tree->node, x, y); } @@ -239,17 +241,15 @@ void absinthe_toplevel_set_fullscreen(struct absinthe_toplevel *toplevel, bool f if (fullscreen) { toplevel->prev_geometry = toplevel->geometry; - toplevel->geometry.x = output->geometry.x; - toplevel->geometry.y = output->geometry.y; toplevel->border_width = 0; absinthe_toplevel_set_size(toplevel, output->geometry.width, output->geometry.height); + absinthe_toplevel_set_position(toplevel, output->geometry.x, output->geometry.y); } else { - toplevel->geometry.x = toplevel->prev_geometry.x; - toplevel->geometry.y = toplevel->prev_geometry.y; toplevel->border_width = absinthe_toplevel_is_unmanaged(toplevel) ? 0 : ABSINTHE_TOPLEVEL_BORDER_WIDTH; absinthe_toplevel_set_size(toplevel, toplevel->prev_geometry.width, toplevel->prev_geometry.height); + absinthe_toplevel_set_position(toplevel, toplevel->prev_geometry.x, toplevel->prev_geometry.y); } } diff --git a/src/cursor.c b/src/cursor.c index fe95ec4..aa63501 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -47,18 +47,18 @@ static void apply_resize(struct absinthe_toplevel *toplevel, struct wlr_box *new if (max_height == 0) max_height = 10000; - if (new_geometry->width >= min_width && new_geometry->width <= max_width) { - toplevel->geometry.x = new_geometry->x; - resize = true; + if (!(new_geometry->width >= min_width && new_geometry->width <= max_width)) { + new_geometry->width = toplevel->geometry.width; + new_geometry->x = toplevel->geometry.x; + } + + if (!(new_geometry->height >= min_height && new_geometry->height <= max_height)) { + new_geometry->height = toplevel->geometry.height; + new_geometry->y = toplevel->geometry.y; } - if (new_geometry->height >= min_height && new_geometry->height <= max_height) { - toplevel->geometry.y = new_geometry->y; - resize = true; - } - - if (resize) - absinthe_toplevel_set_size(toplevel, new_geometry->width, new_geometry->height); + absinthe_toplevel_set_size(toplevel, new_geometry->width, new_geometry->height); + absinthe_toplevel_set_position(toplevel, new_geometry->x, new_geometry->y); } static void process_cursor_resize(struct absinthe_server *server) { diff --git a/src/keyboard.c b/src/keyboard.c index 6de4e96..bec5358 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -27,7 +27,7 @@ static bool keyboard_handle_keybind(struct absinthe_server *server, xkb_keysym_t break; case XKB_KEY_Return: if (fork() == 0) - execl("/bin/sh", "sh", "-c", "foot", NULL); + execl("/bin/sh", "sh", "-c", "ghostty", NULL); break; case XKB_KEY_r: if (fork() == 0) diff --git a/src/xdg-toplevel.c b/src/xdg-toplevel.c index ecdffb6..a54e74d 100644 --- a/src/xdg-toplevel.c +++ b/src/xdg-toplevel.c @@ -17,9 +17,7 @@ void xdg_toplevel_commit(struct wl_listener *listener, void *data) int32_t borders_width = 2 * toplevel->border_width; if (toplevel->toplevel.xdg->base->initial_commit) { - /* Let toplevel set preferred size */ - toplevel->geometry.width = toplevel->toplevel.xdg->base->geometry.width + borders_width; - toplevel->geometry.height = toplevel->toplevel.xdg->base->geometry.height + borders_width; + wlr_xdg_toplevel_set_activated(toplevel->toplevel.xdg, false); /* Forse server side decoration mode */ if (toplevel->decoration)