add wlroots wayland backend patches

This commit is contained in:
Xtr126 2024-05-04 11:05:11 +05:30
parent 8de5818580
commit b1d3a81667
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,33 @@
From 79f8e916ab684c748858fd0f1a8fea05c5aac963 Mon Sep 17 00:00:00 2001
From: Xtr126 <80520774+Xtr126@users.noreply.github.com>
Date: Sat, 4 May 2024 10:12:04 +0530
Subject: [PATCH 1/1] add environment variable for disabling title bar
---
backend/wayland/backend.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index fd71a124..95ecd0c4 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -31,6 +31,7 @@
#include "relative-pointer-unstable-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "util/env.h"
struct wlr_wl_linux_dmabuf_feedback_v1 {
struct wlr_wl_backend *backend;
@@ -369,7 +370,7 @@ static void registry_global(void *data, struct wl_registry *registry,
&xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(wl->xdg_wm_base, &xdg_wm_base_listener, NULL);
} else if (strcmp(iface, zxdg_decoration_manager_v1_interface.name) == 0) {
- wl->zxdg_decoration_manager_v1 = wl_registry_bind(registry, name,
+ if (!env_parse_bool("WLR_NO_DECORATION")) wl->zxdg_decoration_manager_v1 = wl_registry_bind(registry, name,
&zxdg_decoration_manager_v1_interface, 1);
} else if (strcmp(iface, zwp_pointer_gestures_v1_interface.name) == 0) {
wl->zwp_pointer_gestures_v1 = wl_registry_bind(registry, name,
--
2.44.0

View file

@ -0,0 +1,59 @@
From 84b069a333a49a15bec23c7501d8da230be66866 Mon Sep 17 00:00:00 2001
From: Xtr126 <80520774+Xtr126@users.noreply.github.com>
Date: Sat, 4 May 2024 10:59:34 +0530
Subject: [PATCH 1/1] wlroots wayland backend custom size
---
backend/wayland/output.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index bc150845..80b5cc55 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -1,4 +1,5 @@
#include <assert.h>
+#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -761,6 +762,22 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
.close = xdg_toplevel_handle_close,
};
+static size_t parse_size_env(const char *name) {
+ const char *size_str = getenv(name);
+ if (size_str == NULL) {
+ return 1;
+ }
+
+ char *end;
+ int size = (int)strtol(size_str, &end, 10);
+ if (*end || size < 0) {
+ wlr_log(WLR_ERROR, "%s specified with invalid integer, ignoring", name);
+ return 1;
+ }
+
+ return size;
+}
+
static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend,
struct wl_surface *surface) {
struct wlr_wl_output *output = calloc(1, sizeof(*output));
@@ -772,7 +789,12 @@ static struct wlr_wl_output *output_create(struct wlr_wl_backend *backend,
struct wlr_output_state state;
wlr_output_state_init(&state);
- wlr_output_state_set_custom_mode(&state, 1280, 720, 0);
+
+ size_t width = parse_size_env("XTMAPPER_WIDTH");
+ size_t height = parse_size_env("XTMAPPER_HEIGHT");
+
+ if (width > 1 && height > 1) wlr_output_state_set_custom_mode(&state, width, height, 0);
+ else wlr_output_state_set_custom_mode(&state, 1280, 720, 0);
wlr_output_init(wlr_output, &backend->backend, &output_impl,
backend->local_display, &state);
--
2.44.0