Compare commits

..

2 Commits

Author SHA1 Message Date
dac784828f Update version number for 5.27.2
GIT_SILENT
2023-02-28 12:01:30 +00:00
ddc4aead87 Use the QScreen of the QWindow as default output
If the Window::setDesiredOutput API was not called for the QWindow, use
QWindow::screen(). This allows assigning QWindows to specific screens using
the plain Qt API.

Passing nullptr to Window::setDesiredOutput explicitly results in nil as
desired output for the layer, which lets the compositor select a screen.

(cherry picked from commit 3c85e2e889)
2023-02-23 09:38:55 +01:00
2 changed files with 9 additions and 3 deletions

View File

@ -4,7 +4,7 @@
cmake_minimum_required(VERSION 3.16)
project(layershellqt)
set(PROJECT_VERSION "5.27.1")
set(PROJECT_VERSION "5.27.2")
set(PROJECT_VERSION_MAJOR 5)
set(CMAKE_C_STANDARD 99)

View File

@ -8,6 +8,7 @@
#include <layershellqt_logging.h>
#include <QPointer>
#include <optional>
using namespace LayerShellQt;
@ -26,7 +27,7 @@ public:
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityExclusive;
Window::Layer layer = Window::LayerTop;
QMargins margins;
QPointer<QScreen> desiredOutput;
std::optional<QPointer<QScreen>> desiredOutput;
};
static QMap<QWindow *, Window *> s_map;
@ -103,7 +104,12 @@ Window::Layer Window::layer() const
QScreen *Window::desiredOutput() const
{
return d->desiredOutput;
// Don't use .value_or here to avoid a temporary QPointer
if (d->desiredOutput.has_value()) {
return d->desiredOutput.value();
}
return d->parentWindow->screen();
}
void Window::setDesiredOutput(QScreen *output)