formatting, focus, toplevel handlers to separate file

This commit is contained in:
2026-04-28 18:46:46 +07:00
parent bcd2422950
commit 66fc7d0bf5
19 changed files with 381 additions and 343 deletions
+10 -7
View File
@@ -1,5 +1,4 @@
#include <stdlib.h>
#include <wlr/util/log.h>
#include "types.h"
@@ -13,7 +12,8 @@ void output_frame(struct wl_listener *listener, void *data)
struct wlr_scene_output *scene_output = wlr_scene_get_scene_output(scene, output->wlr_output);
struct absinthe_toplevel *toplevel;
wl_list_for_each(toplevel, &output->server->toplevels, link) {
wl_list_for_each(toplevel, &output->server->toplevels, link)
{
if (toplevel->resizing && toplevel->output == output)
goto skip;
}
@@ -50,7 +50,8 @@ void outputs_update(struct wl_listener *listener, void *data)
UNUSED(data);
struct absinthe_server *server = wl_container_of(listener, server, output_layout_change);
struct absinthe_output *output;
wl_list_for_each(output, &server->outputs, link) {
wl_list_for_each(output, &server->outputs, link)
{
wlr_output_layout_get_box(server->output_layout, output->wlr_output, &output->geometry);
}
}
@@ -60,13 +61,15 @@ void update_focused_output(struct absinthe_server *server)
struct absinthe_output *output;
int32_t cursor_x = server->cursor->x;
int32_t cursor_y = server->cursor->y;
wl_list_for_each(output, &server->outputs, link) {
bool cursor_in_output_x = cursor_x >= output->geometry.x && cursor_x <= output->geometry.x + output->geometry.width;
bool cursor_in_output_y = cursor_y >= output->geometry.y && cursor_y <= output->geometry.y + output->geometry.height;
wl_list_for_each(output, &server->outputs, link)
{
bool cursor_in_output_x =
cursor_x >= output->geometry.x && cursor_x <= output->geometry.x + output->geometry.width;
bool cursor_in_output_y =
cursor_y >= output->geometry.y && cursor_y <= output->geometry.y + output->geometry.height;
if (cursor_in_output_x && cursor_in_output_y) {
server->focused_output = output;
break;
}
}
}