mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2026-02-26 07:22:58 -05:00
Add Window::screenConfiguration() shim
This shim is for 6.6 to maintain compatibility with previous versions.
(cherry picked from commit dd76feea81)
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
|
||||
#include <QPlatformSurfaceEvent>
|
||||
#include <QPointer>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
|
||||
#include <QtWaylandClient/private/qwaylandwindow_p.h>
|
||||
@ -153,6 +154,33 @@ Window::Layer Window::layer() const
|
||||
return d->layer;
|
||||
}
|
||||
|
||||
#if LAYERSHELLQTINTERFACE_BUILD_DEPRECATED_SINCE(6, 6)
|
||||
Window::ScreenConfiguration Window::screenConfiguration() const
|
||||
{
|
||||
if (wantsToBeOnActiveScreen()) {
|
||||
return ScreenFromCompositor;
|
||||
} else {
|
||||
// If an explicit screen is set, it's quite inaccurate but it should be fine.
|
||||
return ScreenFromQWindow;
|
||||
}
|
||||
}
|
||||
|
||||
void Window::setScreenConfiguration(ScreenConfiguration screenConfiguration)
|
||||
{
|
||||
static std::once_flag deprecationFlag;
|
||||
std::call_once(deprecationFlag, []() {
|
||||
qWarning() << "LayerShellQt.Window.screenConfiguration is deprecated use screen and wantsToBeOnActiveScreen instead";
|
||||
});
|
||||
|
||||
if (screenConfiguration == ScreenFromCompositor) {
|
||||
setWantsToBeOnActiveScreen(true);
|
||||
} else {
|
||||
setWantsToBeOnActiveScreen(false);
|
||||
setScreen(nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void Window::setWantsToBeOnActiveScreen(bool set)
|
||||
{
|
||||
if (d->wantsToBeOnActiveScreen == set) {
|
||||
|
||||
Reference in New Issue
Block a user