From 85c33c00bde225cd66a99cdc9d8ed70c81876ec3 Mon Sep 17 00:00:00 2001 From: rozodru Date: Sun, 20 Jul 2025 07:14:02 -0400 Subject: [PATCH] panel positioning fix in relation to frames/windows --- layer_shell.c | 40 ++++++++++++++++++++++++++++++---------- meson_options.txt | 2 +- output.c | 8 ++++++++ output.h | 3 +++ workspace.c | 4 ++-- 5 files changed, 44 insertions(+), 13 deletions(-) diff --git a/layer_shell.c b/layer_shell.c index a9b70bc..35d9eee 100644 --- a/layer_shell.c +++ b/layer_shell.c @@ -5,6 +5,8 @@ #include "output.h" #include "server.h" #include "util.h" +#include "view.h" +#include "workspace.h" #include #include @@ -318,15 +320,10 @@ static void arrange_layer(struct nedm_output *output, int layer_index, struct wlr_layer_surface_v1 *layer_surface = scene_layer_surface->layer_surface; - wlr_log(WLR_ERROR, "Found layer surface: namespace='%s' exclusive_zone=%d anchor=%d size=%dx%d", - layer_surface->namespace, layer_surface->current.exclusive_zone, - layer_surface->current.anchor, layer_surface->current.actual_width, layer_surface->current.actual_height); // Only arrange surfaces with exclusive zones in the exclusive pass // and non-exclusive surfaces in the non-exclusive pass if ((layer_surface->current.exclusive_zone > 0) != exclusive) { - wlr_log(WLR_ERROR, "Skipping surface (exclusive_zone=%d, exclusive_pass=%s)", - layer_surface->current.exclusive_zone, exclusive ? "true" : "false"); continue; } @@ -335,9 +332,6 @@ static void arrange_layer(struct nedm_output *output, int layer_index, continue; } - wlr_log(WLR_ERROR, "CONFIGURING layer surface: full_area=%d,%d %dx%d usable_area=%d,%d %dx%d", - full_area->x, full_area->y, full_area->width, full_area->height, - usable_area->x, usable_area->y, usable_area->width, usable_area->height); wlr_scene_layer_surface_v1_configure(scene_layer_surface, full_area, usable_area); } } @@ -347,8 +341,6 @@ void nedm_arrange_layers(struct nedm_output *output) { return; } - wlr_log(WLR_ERROR, "NEDM ARRANGE LAYERS: Called for output %s (%dx%d)", - output->wlr_output->name, output->wlr_output->width, output->wlr_output->height); struct wlr_box full_area = { .x = 0, @@ -371,4 +363,32 @@ void nedm_arrange_layers(struct nedm_output *output) { arrange_layer(output, 2, &full_area, &usable_area, false); // TOP arrange_layer(output, 1, &full_area, &usable_area, false); // BOTTOM arrange_layer(output, 0, &full_area, &usable_area, false); // BACKGROUND + + // Store the calculated usable area and update workspace tiles if changed + struct wlr_box prev_usable = output->usable_area; + output->usable_area = usable_area; + + // If usable area changed, update workspace tiles + if (prev_usable.width != usable_area.width || + prev_usable.height != usable_area.height || + prev_usable.x != usable_area.x || + prev_usable.y != usable_area.y) { + + if (output->workspaces) { + for (unsigned int i = 0; i < output->server->nws; ++i) { + if (output->workspaces[i] && output->workspaces[i]->focused_tile) { + output->workspaces[i]->focused_tile->tile.x = usable_area.x; + output->workspaces[i]->focused_tile->tile.y = usable_area.y; + output->workspaces[i]->focused_tile->tile.width = usable_area.width; + output->workspaces[i]->focused_tile->tile.height = usable_area.height; + + // Update view if there is one in this tile + if (output->workspaces[i]->focused_tile->view) { + view_maximize(output->workspaces[i]->focused_tile->view, + output->workspaces[i]->focused_tile); + } + } + } + } + } } diff --git a/meson_options.txt b/meson_options.txt index 75c7d9a..433e9d6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,6 @@ # Copyright 2020 - 2025, project-repo and the cagebreak contributors # SPDX-License-Identifier: MIT -option('xwayland', type: 'boolean', value: false, description: 'Enable support for X11 applications') +option('xwayland', type: 'boolean', value: true, description: 'Enable support for X11 applications') option('man-pages', type: 'boolean', value: false, description: 'Build man pages (requires pandoc)') option('fuzz', type: 'boolean', value: false, description: 'Enable building fuzzer targets') option('version_override', type: 'string', description: 'Set the project version to the string specified. Used for creating hashes for reproducible builds.') diff --git a/output.c b/output.c index 874eb85..3547b89 100644 --- a/output.c +++ b/output.c @@ -141,6 +141,11 @@ output_get_layout_box(struct nedm_output *output) { return output->layout_box; } +struct wlr_box +output_get_usable_area(struct nedm_output *output) { + return output->usable_area; +} + static void output_destroy(struct nedm_output *output) { struct nedm_server *server = output->server; @@ -723,6 +728,9 @@ handle_new_output(struct wl_listener *listener, void *data) { wlr_output_layout_get_box(server->output_layout, output->wlr_output, &output->layout_box); + + // Initialize usable_area to layout_box initially + output->usable_area = output->layout_box; output->workspaces = malloc(server->nws * sizeof(struct nedm_workspace *)); diff --git a/output.h b/output.h index da29c7a..ecf5c00 100644 --- a/output.h +++ b/output.h @@ -31,6 +31,7 @@ struct nedm_output { struct nedm_workspace **workspaces; struct wl_list messages; struct wlr_box layout_box; + struct wlr_box usable_area; int curr_workspace; int priority; enum output_role role; @@ -72,6 +73,8 @@ typedef void (*nedm_surface_iterator_func_t)(struct nedm_output *output, void *user_data); struct wlr_box output_get_layout_box(struct nedm_output *output); +struct wlr_box +output_get_usable_area(struct nedm_output *output); void handle_new_output(struct wl_listener *listener, void *data); void diff --git a/workspace.c b/workspace.c index 69ef447..9097cc6 100644 --- a/workspace.c +++ b/workspace.c @@ -42,9 +42,9 @@ full_screen_workspace_tiles(struct nedm_workspace *workspace, workspace->focused_tile->tile.x = 0; workspace->focused_tile->tile.y = 0; workspace->focused_tile->tile.width = - output_get_layout_box(workspace->output).width; + output_get_usable_area(workspace->output).width; workspace->focused_tile->tile.height = - output_get_layout_box(workspace->output).height; + output_get_usable_area(workspace->output).height; workspace_tile_update_view(workspace->focused_tile, NULL); workspace->focused_tile->id = *tiles_curr_id; ++(*tiles_curr_id);