From 3f1e57de1cba13b24b5a6d05187b00d59c622033 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Jan 2024 13:58:04 +0200 Subject: [PATCH] xwayland: Fix primary output identification Output::geometry() returns a logical geometry, while the crtc rect is in the device pixels. --- src/xwayland/xwayland.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xwayland/xwayland.cpp b/src/xwayland/xwayland.cpp index 64b6ec9451..3a6d020d65 100644 --- a/src/xwayland/xwayland.cpp +++ b/src/xwayland/xwayland.cpp @@ -593,10 +593,11 @@ void Xwayland::updatePrimary() } Output *const primaryOutput = workspace()->outputOrder().front(); + const QRect primaryOutputGeometry = Xcb::toXNative(primaryOutput->fractionalGeometry()); for (int i = 0; i < resources->num_crtcs; ++i) { Xcb::RandR::CrtcInfo crtcInfo(crtcs[i], resources->config_timestamp); const QRect geometry = crtcInfo.rect(); - if (geometry.topLeft() == primaryOutput->geometry().topLeft()) { + if (geometry.topLeft() == primaryOutputGeometry.topLeft()) { auto outputs = crtcInfo.outputs(); if (outputs && crtcInfo->num_outputs > 0) { qCDebug(KWIN_XWL) << "Setting primary" << primaryOutput << outputs[0];