From cb8e67da95344e120c681b0cbf9ade47708c891a Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 13 Jul 2026 20:56:20 -0400 Subject: [PATCH] fix(linux): Fall back to wl_output metadata when xdg_output is unavailable --- src/platform/linux/wayland.cpp | 28 +++++++++++++++++++++------- src/platform/linux/wayland.h | 6 ++++++ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/platform/linux/wayland.cpp b/src/platform/linux/wayland.cpp index 1be18e12de3..ac9fae9b9fe 100644 --- a/src/platform/linux/wayland.cpp +++ b/src/platform/linux/wayland.cpp @@ -167,6 +167,14 @@ namespace wl { viewport.height = height; BOOST_LOG(info) << "[wayland] Resolution: "sv << width << 'x' << height; + + // Assign these only if xdg_output hasn't done so already + if (viewport.logical_width <= 0) { + viewport.logical_width = viewport.width; + } + if (viewport.logical_height <= 0) { + viewport.logical_height = viewport.height; + } } void monitor_t::listen(zxdg_output_manager_v1 *output_manager) { @@ -175,6 +183,10 @@ namespace wl { wl_output_add_listener(output, &wl_listener, this); } + void monitor_t::listen_fallback() { + wl_output_add_listener(output, &wl_listener, this); + } + interface_t::interface_t() noexcept : screencopy_manager {nullptr}, @@ -568,13 +580,15 @@ namespace wl { display.roundtrip(); - if (!interface[interface_t::XDG_OUTPUT]) { - BOOST_LOG(error) << "[wayland] Missing Wayland wire XDG_OUTPUT"sv; - return {}; - } - - for (auto &monitor : interface.monitors) { - monitor->listen(interface.output_manager); + if (interface[interface_t::XDG_OUTPUT]) { + for (auto &monitor : interface.monitors) { + monitor->listen(interface.output_manager); + } + } else { + BOOST_LOG(warning) << "[wayland] Missing Wayland wire XDG_OUTPUT, falling back to wl_output only"sv; + for (auto &monitor : interface.monitors) { + monitor->listen_fallback(); + } } display.roundtrip(); diff --git a/src/platform/linux/wayland.h b/src/platform/linux/wayland.h index 137040021b8..f281bf890c4 100644 --- a/src/platform/linux/wayland.h +++ b/src/platform/linux/wayland.h @@ -217,6 +217,12 @@ namespace wl { * @param output_manager xdg-output manager used to query logical monitor metadata. */ void listen(zxdg_output_manager_v1 *output_manager); + + /** + * @brief Attach wl-output listeners for this monitor, without using xdg-output. + */ + void listen_fallback(); + /** * @brief Store the xdg-output logical monitor name. *