From 8de885ad544f009d4b9bfb8bc25e471904293f3f Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Tue, 21 Feb 2023 16:03:51 +0100 Subject: [PATCH] Use the QScreen of the QWindow as default output If no screen was explicitly assigned through the Window::setDesiredOutput API, use the QWindow's screen property. This allows assigning QWindows to specific screens using the plain Qt API. --- src/qwaylandlayersurface.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index dd17aa0..e172b52 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -25,6 +25,10 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShell *shell, QtWaylandC wl_output *output = nullptr; QScreen *screen = interface->desiredOutput(); + if (!screen) { + screen = window->window()->screen(); + } + if (screen) { auto waylandScreen = dynamic_cast(screen->handle()); // Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created