diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp index 50b2cce7a1..396ce64857 100644 --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -1098,6 +1098,7 @@ void DesktopGridEffect::setup() if (m_usePresentWindows) m_proxy = static_cast(effects->getProxy(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows))); if (isUsingPresentWindows()) { + m_proxy->reCreateGrids(); // revalidation on multiscreen, bug #351724 for (int i = 1; i <= effects->numberOfDesktops(); i++) { for (int j = 0; j < effects->numScreens(); j++) { WindowMotionManager manager; diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index be62b619f7..6fcc8c6477 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -96,7 +96,12 @@ PresentWindowsEffect::PresentWindowsEffect() connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*))); connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect))); connect(effects, SIGNAL(propertyNotify(KWin::EffectWindow*,long)), this, SLOT(slotPropertyNotify(KWin::EffectWindow*,long))); - connect(effects, &EffectsHandler::numberScreensChanged, this, &PresentWindowsEffect::screenCountChanged); + connect(effects, &EffectsHandler::numberScreensChanged, this, + [this] { + if (isActive()) + reCreateGrids(); + } + ); } PresentWindowsEffect::~PresentWindowsEffect() @@ -1489,7 +1494,7 @@ void PresentWindowsEffect::setActive(bool active) m_hasKeyboardGrab = effects->grabKeyboard(this); effects->setActiveFullScreenEffect(this); - screenCountChanged(); + reCreateGrids(); rearrangeWindows(); setHighlightedWindow(effects->activeWindow()); @@ -1866,10 +1871,8 @@ bool PresentWindowsEffect::isActive() const return m_activated || m_motionManager.managingWindows(); } -void PresentWindowsEffect::screenCountChanged() +void PresentWindowsEffect::reCreateGrids() { - if (!isActive()) - return; m_gridSizes.clear(); for (int i = 0; i < effects->numScreens(); ++i) { m_gridSizes.append(GridSize()); diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index f57c6a77dd..81154b51c4 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -225,11 +225,11 @@ public Q_SLOTS: private Q_SLOTS: void closeWindow(); void elevateCloseWindow(); - void screenCountChanged(); protected: // Window rearranging void rearrangeWindows(); + void reCreateGrids(); void calculateWindowTransformations(EffectWindowList windowlist, int screen, WindowMotionManager& motionManager, bool external = false); void calculateWindowTransformationsClosest(EffectWindowList windowlist, int screen, diff --git a/effects/presentwindows/presentwindows_proxy.cpp b/effects/presentwindows/presentwindows_proxy.cpp index 5c4937e53e..f6aca8737a 100644 --- a/effects/presentwindows/presentwindows_proxy.cpp +++ b/effects/presentwindows/presentwindows_proxy.cpp @@ -39,4 +39,9 @@ void PresentWindowsEffectProxy::calculateWindowTransformations(EffectWindowList return m_effect->calculateWindowTransformations(windows, screen, manager, true); } +void PresentWindowsEffectProxy::reCreateGrids() +{ + m_effect->reCreateGrids(); +} + } // namespace diff --git a/effects/presentwindows/presentwindows_proxy.h b/effects/presentwindows/presentwindows_proxy.h index 1381f30401..8c8bd294f9 100644 --- a/effects/presentwindows/presentwindows_proxy.h +++ b/effects/presentwindows/presentwindows_proxy.h @@ -35,6 +35,8 @@ public: void calculateWindowTransformations(EffectWindowList windows, int screen, WindowMotionManager& manager); + void reCreateGrids(); + private: PresentWindowsEffect* m_effect; };