drm_lease: withdraw output on output remove and rebase

This commit is contained in:
Alex Denes 2026-04-21 16:43:48 +00:00
parent dbb6a3aa22
commit f584a2dead
No known key found for this signature in database
GPG Key ID: F92BA85F61F4C173

View File

@ -1,15 +1,15 @@
From be620ef43f6a37bc70331d6db69a3d0f60d2bb0d Mon Sep 17 00:00:00 2001
From b2adc829556dc2fd357e7aaa630a7a42d150f87b Mon Sep 17 00:00:00 2001
From: Micah Gorrell <micah.gorrell@venafi.com>
Date: Fri, 26 May 2023 08:17:20 -0600
Subject: [PATCH] Implemented support for the DRM lease protocol, as needed to
use devices such as VR headsets
---
dwl.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
dwl.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/dwl.c b/dwl.c
index 12f441e..6864f18 100644
index 101a45f..535d532 100644
--- a/dwl.c
+++ b/dwl.c
@@ -23,6 +23,7 @@
@ -18,9 +18,9 @@ index 12f441e..6864f18 100644
#include <wlr/types/wlr_drm.h>
+#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_ext_data_control_v1.h>
#include <wlr/types/wlr_fractional_scale_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
@@ -315,6 +316,7 @@ static void powermgrsetmode(struct wl_listener *listener, void *data);
@@ -316,6 +317,7 @@ static void powermgrsetmode(struct wl_listener *listener, void *data);
static void quit(const Arg *arg);
static void rendermon(struct wl_listener *listener, void *data);
static void requestdecorationmode(struct wl_listener *listener, void *data);
@ -28,7 +28,7 @@ index 12f441e..6864f18 100644
static void requeststartdrag(struct wl_listener *listener, void *data);
static void requestmonstate(struct wl_listener *listener, void *data);
static void resize(Client *c, struct wlr_box geo, int interact);
@@ -376,6 +378,7 @@ static struct wl_list clients; /* tiling order */
@@ -377,6 +379,7 @@ static struct wl_list clients; /* tiling order */
static struct wl_list fstack; /* focus order */
static struct wlr_idle_notifier_v1 *idle_notifier;
static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
@ -36,7 +36,7 @@ index 12f441e..6864f18 100644
static struct wlr_layer_shell_v1 *layer_shell;
static struct wlr_output_manager_v1 *output_mgr;
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
@@ -435,6 +438,7 @@ static struct wl_listener request_set_cursor_shape = {.notify = setcursorshape};
@@ -436,6 +439,7 @@ static struct wl_listener request_set_cursor_shape = {.notify = setcursorshape};
static struct wl_listener request_start_drag = {.notify = requeststartdrag};
static struct wl_listener start_drag = {.notify = startdrag};
static struct wl_listener new_session_lock = {.notify = locksession};
@ -44,7 +44,18 @@ index 12f441e..6864f18 100644
#ifdef XWAYLAND
static void activatex11(struct wl_listener *listener, void *data);
@@ -782,6 +786,9 @@ cleanuplisteners(void)
@@ -747,6 +751,10 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output);
+ if (drm_lease_manager) {
+ wlr_drm_lease_v1_manager_withdraw_output (drm_lease_manager, m->wlr_output);
+ }
+
closemon(m);
wlr_scene_node_destroy(&m->fullscreen_bg->node);
free(m);
@@ -783,6 +791,9 @@ cleanuplisteners(void)
wl_list_remove(&request_start_drag.link);
wl_list_remove(&start_drag.link);
wl_list_remove(&new_session_lock.link);
@ -54,7 +65,7 @@ index 12f441e..6864f18 100644
#ifdef XWAYLAND
wl_list_remove(&new_xwayland_surface.link);
wl_list_remove(&xwayland_ready.link);
@@ -1049,6 +1056,14 @@ createmon(struct wl_listener *listener, void *data)
@@ -1050,6 +1061,14 @@ createmon(struct wl_listener *listener, void *data)
if (!wlr_output_init_render(wlr_output, alloc, drw))
return;
@ -69,7 +80,7 @@ index 12f441e..6864f18 100644
m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
@@ -2181,6 +2196,16 @@ requestdecorationmode(struct wl_listener *listener, void *data)
@@ -2183,6 +2202,16 @@ requestdecorationmode(struct wl_listener *listener, void *data)
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
@ -86,7 +97,7 @@ index 12f441e..6864f18 100644
void
requeststartdrag(struct wl_listener *listener, void *data)
{
@@ -2645,10 +2670,18 @@ setup(void)
@@ -2648,10 +2677,18 @@ setup(void)
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
@ -106,5 +117,5 @@ index 12f441e..6864f18 100644
/*
* Initialise the XWayland X server.
--
2.51.1
2.53.0