fix(wayland): fix ext screens resetting and causing protocol error

Could not reproduce this personally but I am told this fixes it.
This commit is contained in:
outfoxxed 2024-02-28 21:11:28 -08:00
parent 48bdcf4db2
commit 4eac0b40c3
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 6 additions and 0 deletions

View file

@ -68,7 +68,10 @@ bool LockWindowExtension::attach(QWindow* window, SessionLockManager* manager) {
if (current != nullptr) { if (current != nullptr) {
current->surface->setExtension(this); current->surface->setExtension(this);
} else { } else {
// Qt appears to be resetting the window's screen on creation on some systems. This works around it.
auto* screen = window->screen();
window->create(); window->create();
window->setScreen(screen);
waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(window->handle()); waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(window->handle());
if (waylandWindow == nullptr) { if (waylandWindow == nullptr) {

View file

@ -54,7 +54,10 @@ bool LayershellWindowExtension::attach(QWindow* window) {
} }
if (!hasSurface) { if (!hasSurface) {
// Qt appears to be resetting the window's screen on creation on some systems. This works around it.
auto* screen = window->screen();
window->create(); window->create();
window->setScreen(screen);
auto* waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(window->handle()); auto* waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow*>(window->handle());
if (waylandWindow == nullptr) { if (waylandWindow == nullptr) {