Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/platform/linux/wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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},
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions src/platform/linux/wayland.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down