From dd4ae1865b6358a7ff523615ddea97f29e10ae81 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 16 Feb 2019 13:16:17 +0200 Subject: [PATCH] improvements for color schemes under wayland --- app/lattecorona.cpp | 12 +++++++++++- app/wm/abstractwindowinterface.cpp | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index aac4d1981..2caceb794 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -933,7 +933,17 @@ void Corona::windowColorScheme(QString windowIdAndScheme) QString windowIdStr = windowIdAndScheme.mid(0, firstSlash); QString schemeStr = windowIdAndScheme.mid(firstSlash + 1); - m_wm->setColorSchemeForWindow(windowIdStr, schemeStr); + if (KWindowSystem::isPlatformWayland()) { + QTimer::singleShot(200, [this, schemeStr]() { + //! [Wayland Case] - give the time to be informed correctly for the active window id + //! otherwise the active window id may not be the same with the one trigerred + //! the color scheme dbus signal + QString windowIdStr = m_wm->activeWindow().toString(); + m_wm->setColorSchemeForWindow(windowIdStr.toUInt(), schemeStr); + }); + } else { + m_wm->setColorSchemeForWindow(windowIdStr.toUInt(), schemeStr); + } } //! update badge for specific view item diff --git a/app/wm/abstractwindowinterface.cpp b/app/wm/abstractwindowinterface.cpp index d19b23d72..49820b6a4 100644 --- a/app/wm/abstractwindowinterface.cpp +++ b/app/wm/abstractwindowinterface.cpp @@ -133,10 +133,10 @@ void AbstractWindowInterface::setColorSchemeForWindow(WindowId wid, QString sche } m_windowScheme[wid] = schemeFile; + } - if (wid == activeWindow()) { - emit activeWindowChanged(wid); - } + if (wid == activeWindow()) { + emit activeWindowChanged(wid); } }