x11 borders fix

This commit is contained in:
2026-04-26 22:34:31 +07:00
parent 9d8dff3372
commit 68b274628c
7 changed files with 34 additions and 9 deletions
-2
View File
@@ -1,5 +1,3 @@
absinthe absinthe
xdg-shell-protocol.h xdg-shell-protocol.h
TAGS
tags tags
compile_commands.json
+5
View File
@@ -3,6 +3,11 @@
#include "types.h" #include "types.h"
void focus_toplevel(struct absinthe_toplevel *toplevel); void focus_toplevel(struct absinthe_toplevel *toplevel);
struct absinthe_toplevel *focus_get_topmost(struct absinthe_server *server); struct absinthe_toplevel *focus_get_topmost(struct absinthe_server *server);
struct absinthe_toplevel *focus_get_first_tiled(struct absinthe_output *output);
struct absinthe_toplevel *focus_get_last_tiled(struct absinthe_output *output);
void focus_next(struct absinthe_server *server); void focus_next(struct absinthe_server *server);
void focus_prev(struct absinthe_server *server); void focus_prev(struct absinthe_server *server);
+1
View File
@@ -142,6 +142,7 @@ struct absinthe_toplevel {
struct wlr_xdg_toplevel_decoration_v1 *decoration; struct wlr_xdg_toplevel_decoration_v1 *decoration;
bool tiled, floating, fullscreen, maximized; bool tiled, floating, fullscreen, maximized;
bool urgent;
uint32_t resizing; uint32_t resizing;
struct wlr_box geometry; struct wlr_box geometry;
+7 -3
View File
@@ -109,10 +109,10 @@ void absinthe_toplevel_unmap(struct wl_listener *listener, void *data)
wl_list_remove(&toplevel->link); wl_list_remove(&toplevel->link);
wl_list_remove(&toplevel->flink); wl_list_remove(&toplevel->flink);
wlr_scene_node_destroy(&toplevel->scene_tree->node); if (toplevel->output == toplevel->server->focused_output)
layout_arrange(toplevel->output);
layout_arrange(toplevel->output); wlr_scene_node_destroy(&toplevel->scene_tree->node);
focus_next(toplevel->server);
} }
void absinthe_toplevel_destroy(struct wl_listener *listener, void *data) void absinthe_toplevel_destroy(struct wl_listener *listener, void *data)
@@ -240,6 +240,8 @@ void absinthe_toplevel_set_size(struct absinthe_toplevel *toplevel, int32_t widt
absinthe_toplevel_set_position(toplevel, toplevel->geometry.x + toplevel->border_width, toplevel->geometry.y + toplevel->border_width); absinthe_toplevel_set_position(toplevel, toplevel->geometry.x + toplevel->border_width, toplevel->geometry.y + toplevel->border_width);
} }
#endif #endif
absinthe_toplevel_update_borders_geometry(toplevel);
} }
void absinthe_toplevel_set_fullscreen(struct absinthe_toplevel *toplevel, bool fullscreen) void absinthe_toplevel_set_fullscreen(struct absinthe_toplevel *toplevel, bool fullscreen)
@@ -263,6 +265,8 @@ void absinthe_toplevel_set_fullscreen(struct absinthe_toplevel *toplevel, bool f
absinthe_toplevel_set_size(toplevel, toplevel->prev_geometry.width, toplevel->prev_geometry.height); 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); absinthe_toplevel_set_position(toplevel, toplevel->prev_geometry.x, toplevel->prev_geometry.y);
} }
absinthe_toplevel_update_borders_geometry(toplevel);
} }
void absinthe_toplevel_set_border_color(struct absinthe_toplevel *toplevel, const float color[4]) void absinthe_toplevel_set_border_color(struct absinthe_toplevel *toplevel, const float color[4])
+20
View File
@@ -59,6 +59,26 @@ struct absinthe_toplevel *focus_get_topmost(struct absinthe_server *server)
return NULL; return NULL;
} }
struct absinthe_toplevel *focus_get_first_tiled(struct absinthe_output *output)
{
struct absinthe_toplevel *toplevel;
wl_list_for_each(toplevel, &output->server->focus_stack, flink) {
if (toplevel->tiled && toplevel->output == output)
return toplevel;
}
return NULL;
}
struct absinthe_toplevel *focus_get_last_tiled(struct absinthe_output *output)
{
struct absinthe_toplevel *toplevel;
wl_list_for_each_reverse(toplevel, &output->server->focus_stack, flink) {
if (toplevel->tiled && toplevel->output == output)
return toplevel;
}
return NULL;
}
void focus_next(struct absinthe_server *server) void focus_next(struct absinthe_server *server)
{ {
struct absinthe_toplevel *toplevel = focus_get_topmost(server); struct absinthe_toplevel *toplevel = focus_get_topmost(server);
+1 -1
View File
@@ -28,7 +28,7 @@ static bool keyboard_handle_keybind(struct absinthe_server *server, xkb_keysym_t
break; break;
case XKB_KEY_Return: case XKB_KEY_Return:
if (fork() == 0) if (fork() == 0)
execl("/bin/sh", "sh", "-c", "foot", NULL); execl("/bin/sh", "sh", "-c", "alacritty", NULL);
break; break;
case XKB_KEY_r: case XKB_KEY_r:
if (fork() == 0) if (fork() == 0)
-3
View File
@@ -25,9 +25,6 @@ void xdg_toplevel_commit(struct wl_listener *listener, void *data)
return; return;
} }
/* Update borders and position only after client prepared new buffer */
absinthe_toplevel_set_position(toplevel, toplevel->geometry.x, toplevel->geometry.y);
absinthe_toplevel_update_borders_geometry(toplevel);
if (toplevel->resizing && toplevel->resizing <= toplevel->toplevel.xdg->base->current.configure_serial) if (toplevel->resizing && toplevel->resizing <= toplevel->toplevel.xdg->base->current.configure_serial)
toplevel->resizing = 0; toplevel->resizing = 0;
} }