scripting: Make KWin.registerWindow() noop on wayland

On Wayland, windows properly update if they are remapped.
This commit is contained in:
Vlad Zahorodnii 2023-02-17 15:19:10 +02:00
parent 9b14930216
commit 96fdc9d55a

View file

@ -614,14 +614,17 @@ QVariant KWin::JSEngineGlobalMethodsWrapper::readConfig(const QString &key, QVar
void KWin::JSEngineGlobalMethodsWrapper::registerWindow(QQuickWindow *window)
{
QPointer<QQuickWindow> 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<QQuickWindow> 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)