From 46574d479d8f91ca03c6593ef6a3073407fb408d Mon Sep 17 00:00:00 2001 From: M Stoeckl Date: Sun, 17 Nov 2024 14:11:57 -0500 Subject: [PATCH] console.lua,wayland_common: also detect Wayland if WAYLAND_SOCKET set While most Wayland compositors provide a socket path indicated by environment variable WAYLAND_DISPLAY, others may sometimes bequeath a socket file descriptor specified by WAYLAND_SOCKET. --- player/lua/console.lua | 2 +- video/out/wayland_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/player/lua/console.lua b/player/lua/console.lua index 6f1a66c4d8..f6860d38dc 100644 --- a/player/lua/console.lua +++ b/player/lua/console.lua @@ -19,7 +19,7 @@ local function detect_platform() local platform = mp.get_property_native('platform') if platform == 'darwin' or platform == 'windows' then return platform - elseif os.getenv('WAYLAND_DISPLAY') then + elseif os.getenv('WAYLAND_DISPLAY') or os.getenv('WAYLAND_SOCKET') then return 'wayland' end return 'x11' diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 4d67087de9..64e3000573 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -3024,7 +3024,7 @@ bool vo_wayland_valid_format(struct vo_wayland_state *wl, uint32_t drm_format, u bool vo_wayland_init(struct vo *vo) { - if (!getenv("WAYLAND_DISPLAY")) + if (!getenv("WAYLAND_DISPLAY") && !getenv("WAYLAND_SOCKET")) goto err; vo->wl = talloc_zero(NULL, struct vo_wayland_state);