mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2026-02-26 23:42:59 -05:00
Allow specifying explicit desired screen
If the window position is not specified, which is a reasonable thing to
do when using the layer shell protocol, setWidth() and setHeight() can
unintentionally change the screen() to the wrong one.
This change adds a setScreen() function so it's harder to shoot
yourself in the foot while using the layer shell protocol.
(cherry picked from commit 430ad3630f)
This commit is contained in:
@ -27,8 +27,13 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
||||
, m_window(window)
|
||||
{
|
||||
wl_output *output = nullptr;
|
||||
if (m_interface->screenConfiguration() == Window::ScreenFromQWindow) {
|
||||
auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(window->window()->screen()->handle());
|
||||
if (!m_interface->wantsToBeOnActiveScreen()) {
|
||||
QScreen *desiredScreen = m_interface->screen();
|
||||
if (!desiredScreen) {
|
||||
desiredScreen = window->window()->screen();
|
||||
}
|
||||
|
||||
auto waylandScreen = dynamic_cast<QtWaylandClient::QWaylandScreen *>(desiredScreen->handle());
|
||||
// Qt will always assign a screen to a window, but if the compositor has no screens available a dummy QScreen object is created
|
||||
// this will not cast to a QWaylandScreen
|
||||
if (!waylandScreen) {
|
||||
|
||||
Reference in New Issue
Block a user