From 96fdc9d55a046fd0b106c467838b7f9ac5db6557 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 17 Feb 2023 15:19:10 +0200 Subject: [PATCH] scripting: Make KWin.registerWindow() noop on wayland On Wayland, windows properly update if they are remapped. --- src/scripting/scripting.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index 9a41df8717..139bb988c1 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -614,14 +614,17 @@ QVariant KWin::JSEngineGlobalMethodsWrapper::readConfig(const QString &key, QVar void KWin::JSEngineGlobalMethodsWrapper::registerWindow(QQuickWindow *window) { - QPointer guard = window; - connect( - window, &QWindow::visibilityChanged, this, [guard](QWindow::Visibility visibility) { - if (guard && visibility == QWindow::Hidden) { - guard->destroy(); - } - }, - Qt::QueuedConnection); + if (kwinApp()->operationMode() == Application::OperationModeX11) { + // Windows stop updating if they are remapped. It seems like a bug in QtXCB. + QPointer guard = window; + connect( + window, &QWindow::visibilityChanged, this, [guard](QWindow::Visibility visibility) { + if (guard && visibility == QWindow::Hidden) { + guard->destroy(); + } + }, + Qt::QueuedConnection); + } } bool KWin::JSEngineGlobalMethodsWrapper::registerShortcut(const QString &name, const QString &text, const QKeySequence &keys, QJSValue function)