#include "workspaces.h"
static bool in_regions;
+static bool in_usable_area_override;
static bool in_keybind;
static bool in_mousebind;
static bool in_libinput_category;
static bool in_window_switcher_field;
static bool in_window_rules;
+static struct usable_area_override *current_usable_area_override;
static struct keybind *current_keybind;
static struct mousebind *current_mousebind;
static struct libinput_category *current_libinput_category;
static void load_default_key_bindings(void);
static void load_default_mouse_bindings(void);
+static void
+fill_usable_area_override(char *nodename, char *content)
+{
+ if (!strcasecmp(nodename, "margin")) {
+ current_usable_area_override = znew(*current_usable_area_override);
+ wl_list_append(&rc.usable_area_overrides, ¤t_usable_area_override->link);
+ return;
+ }
+ string_truncate_at_pattern(nodename, ".margin");
+ if (!content) {
+ /* nop */
+ } else if (!current_usable_area_override) {
+ wlr_log(WLR_ERROR, "no usable-area-override object");
+ } else if (!strcmp(nodename, "output")) {
+ free(current_usable_area_override->output);
+ current_usable_area_override->output = xstrdup(content);
+ } else if (!strcmp(nodename, "left")) {
+ current_usable_area_override->margin.left = atoi(content);
+ } else if (!strcmp(nodename, "right")) {
+ current_usable_area_override->margin.right = atoi(content);
+ } else if (!strcmp(nodename, "top")) {
+ current_usable_area_override->margin.top = atoi(content);
+ } else if (!strcmp(nodename, "bottom")) {
+ current_usable_area_override->margin.bottom = atoi(content);
+ } else {
+ wlr_log(WLR_ERROR, "Unexpected data usable-area-override parser: %s=\"%s\"",
+ nodename, content);
+ }
+}
+
/* Does a boolean-parse but also allows 'default' */
static void
set_property(const char *str, enum property *variable)
printf("%s: %s\n", nodename, content);
}
+ if (in_usable_area_override) {
+ fill_usable_area_override(nodename, content);
+ }
if (in_keybind) {
fill_keybind(nodename, content);
}
} else if (!strcasecmp(nodename, "name.context.mouse")) {
current_mouse_context = content;
current_mousebind = NULL;
+
} else if (!strcasecmp(nodename, "repeatRate.keyboard")) {
rc.repeat_rate = atoi(content);
} else if (!strcasecmp(nodename, "repeatDelay.keyboard")) {
if (!strcasecmp((char *)n->name, "comment")) {
continue;
}
+ if (!strcasecmp((char *)n->name, "margin")) {
+ in_usable_area_override = true;
+ traverse(n);
+ in_usable_area_override = false;
+ continue;
+ }
if (!strcasecmp((char *)n->name, "keybind")) {
in_keybind = true;
traverse(n);
static bool has_run;
if (!has_run) {
+ wl_list_init(&rc.usable_area_overrides);
wl_list_init(&rc.keybinds);
wl_list_init(&rc.mousebinds);
wl_list_init(&rc.libinput_categories);
zfree(rc.font_osd.name);
zfree(rc.theme_name);
+ struct usable_area_override *area, *area_tmp;
+ wl_list_for_each_safe(area, area_tmp, &rc.usable_area_overrides, link) {
+ wl_list_remove(&area->link);
+ zfree(area->output);
+ zfree(area);
+ }
+
struct keybind *k, *k_tmp;
wl_list_for_each_safe(k, k_tmp, &rc.keybinds, link) {
wl_list_remove(&k->link);
}
/* Reset state vars for starting fresh when Reload is triggered */
+ current_usable_area_override = NULL;
current_keybind = NULL;
current_mousebind = NULL;
current_libinput_category = NULL;
#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,
&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);