// SPDX-License-Identifier: GPL-3.0-or-later // The one part of the power chooser's Wayland desktop that needs Plasma's // LayerShellQt: a window made a full-screen overlay layer surface. Built per // Plasma series against its layer-shell-qt (cmake/forks.cmake), or natively // against the host's, and loaded at run time (editor/powerdesktop_wayland.cpp), // so XPlasma itself links no Plasma library. A C function, so loading it // needs no C++ ABI to match: only the Qt in the process, which is the // system's either way. #include #include #include #include extern "C" Q_DECL_EXPORT bool xplasma_layer_window(QWindow *window, QScreen *screen, bool keyboard) { auto *layer = LayerShellQt::Window::get(window); if (!layer) return false; // Since 6.6 the layer has its own output property; older releases use QWindow. if (layer->metaObject()->indexOfProperty("screen") >= 0) layer->setProperty("screen", QVariant::fromValue(screen)); layer->setLayer(LayerShellQt::Window::LayerOverlay); layer->setAnchors(LayerShellQt::Window::Anchors(LayerShellQt::Window::AnchorTop) | LayerShellQt::Window::AnchorBottom | LayerShellQt::Window::AnchorLeft | LayerShellQt::Window::AnchorRight); layer->setExclusiveZone(-1); layer->setKeyboardInteractivity(keyboard ? LayerShellQt::Window::KeyboardInteractivityExclusive : LayerShellQt::Window::KeyboardInteractivityNone); // KWin derives the window type from the layer-shell scope. Unknown scopes // become Normal and animate the whole captured desktop on opening/closing. // Utility surfaces are excluded by its scale, fade and fading-popup effects; // the shared chooser still controls the intentional grayscale transition. layer->setScope(QStringLiteral("utility")); return true; }