panel positioning fix in relation to frames/windows

This commit is contained in:
rozodru 2025-07-20 07:14:02 -04:00
parent 8868b1fee0
commit 85c33c00bd
5 changed files with 44 additions and 13 deletions

View File

@ -5,6 +5,8 @@
#include "output.h"
#include "server.h"
#include "util.h"
#include "view.h"
#include "workspace.h"
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_output.h>
@ -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);
}
}
}
}
}
}

View File

@ -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.')

View File

@ -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 *));

View File

@ -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

View File

@ -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);