From 9d8dff337229d7e4138c5f4494015597ca53c9da Mon Sep 17 00:00:00 2001 From: speckitor Date: Sun, 26 Apr 2026 15:08:37 +0700 Subject: [PATCH] tiled focus --- src/cursor.c | 11 +++++++++++ src/layout.c | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cursor.c b/src/cursor.c index 9606f09..1696c18 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -3,6 +3,7 @@ #include "types.h" #include "absinthe-toplevel.h" +#include "layout.h" void reset_cursor_mode(struct absinthe_server *server) { @@ -30,6 +31,11 @@ static void process_cursor_move(struct absinthe_server *server) { toplevel->geometry.x = new_x; toplevel->geometry.y = new_y; absinthe_toplevel_set_position(toplevel, new_x, new_y); + + if (toplevel->tiled) { + toplevel->tiled = false; + layout_arrange(toplevel->output); + } } static void apply_resize(struct absinthe_toplevel *toplevel, struct wlr_box *new_geometry) @@ -72,6 +78,11 @@ static void process_cursor_resize(struct absinthe_server *server) { if (toplevel->fullscreen) absinthe_toplevel_set_fullscreen(toplevel, false); + if (toplevel->tiled) { + toplevel->tiled = false; + layout_arrange(toplevel->output); + } + int32_t new_x, new_y, new_width, new_height; new_x = server->grabbed_geometry.x; new_y = server->grabbed_geometry.y; diff --git a/src/layout.c b/src/layout.c index d40a305..c8e7e65 100644 --- a/src/layout.c +++ b/src/layout.c @@ -10,7 +10,7 @@ void layout_arrange(struct absinthe_output *output) struct absinthe_toplevel *toplevel; size_t toplevels_count = 0; wl_list_for_each(toplevel, &output->server->toplevels, link) { - if (toplevel->tiled && toplevel->output == output) { + if (toplevel->output == output && toplevel->tiled) { toplevels_count++; wlr_scene_node_set_enabled(&toplevel->scene_tree->node, true); } @@ -23,7 +23,7 @@ void layout_arrange(struct absinthe_output *output) if (toplevels_count == 1) { wl_list_for_each(toplevel, &output->server->toplevels, link) { - if (toplevel->output == output) + if (toplevel->output == output && toplevel->tiled) break; } toplevel->geometry.x = output->geometry.x + output_gap;