config: support <margin top="" bottom="" left="" right="" output="" />

This commit is contained in:
Johan Malm 2023-06-06 19:52:57 +01:00 committed by Johan Malm
parent 3a9dcd54a7
commit 4a531daef8
5 changed files with 97 additions and 0 deletions

View file

@ -10,15 +10,32 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <wayland-server.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/util/log.h>
#include "common/list.h"
#include "common/mem.h"
#include "config/rcxml.h"
#include "layers.h"
#include "labwc.h"
#include "node.h"
static void
apply_override(struct output *output, struct wlr_box *usable_area)
{
struct usable_area_override *override;
wl_list_for_each(override, &rc.usable_area_overrides, link) {
if (override->output && strcasecmp(override->output, output->wlr_output->name)) {
continue;
}
usable_area->x += override->margin.left;
usable_area->y += override->margin.top;
usable_area->width -= override->margin.left + override->margin.right;
usable_area->height -= override->margin.top + override->margin.bottom;
}
}
static void
arrange_one_layer(struct output *output, const struct wlr_box *full_area,
struct wlr_box *usable_area, struct wlr_scene_tree *tree,
@ -49,6 +66,8 @@ layers_arrange(struct output *output)
&full_area.width, &full_area.height);
struct wlr_box usable_area = full_area;
apply_override(output, &usable_area);
struct server *server = output->server;
struct wlr_scene_output *scene_output =
wlr_scene_get_scene_output(server->scene, output->wlr_output);