diff --git a/effects.cpp b/effects.cpp index 8cb6d43726..39e7019387 100644 --- a/effects.cpp +++ b/effects.cpp @@ -229,6 +229,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) connect(Cursor::self(), SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long))); + connect(screens(), &Screens::countChanged, this, &EffectsHandler::numberScreensChanged); #ifdef KWIN_BUILD_ACTIVITIES Activities *activities = Activities::self(); connect(activities, SIGNAL(added(QString)), SIGNAL(activityAdded(QString))); diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 7da72cc9f6..5a740ab2b4 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -40,7 +40,6 @@ along with this program. If not, see . #include #include #include -#include #include #include #include @@ -101,8 +100,7 @@ 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 (qApp->desktop(), SIGNAL(screenCountChanged(int)), SLOT(screenCountChanged())); + connect(effects, &EffectsHandler::numberScreensChanged, this, &PresentWindowsEffect::screenCountChanged); } PresentWindowsEffect::~PresentWindowsEffect() diff --git a/libkwineffects/kwineffects.h b/libkwineffects/kwineffects.h index c4463342fb..4cfd955838 100644 --- a/libkwineffects/kwineffects.h +++ b/libkwineffects/kwineffects.h @@ -668,7 +668,7 @@ class KWINEFFECTS_EXPORT EffectsHandler : public QObject Q_PROPERTY(int desktops READ numberOfDesktops WRITE setNumberOfDesktops NOTIFY numberDesktopsChanged) Q_PROPERTY(bool optionRollOverDesktops READ optionRollOverDesktops) Q_PROPERTY(int activeScreen READ activeScreen) - Q_PROPERTY(int numScreens READ numScreens) + Q_PROPERTY(int numScreens READ numScreens NOTIFY numberScreensChanged) /** * Factor by which animation speed in the effect should be modified (multiplied). * If configurable in the effect itself, the option should have also 'default' @@ -1028,6 +1028,11 @@ Q_SIGNALS: * @since 4.7 */ void numberDesktopsChanged(uint old); + /** + * Signal emitted when the number of screens changed. + * @since 5.0 + **/ + void numberScreensChanged(); /** * Signal emitted when a new window has been added to the Workspace. * @param w The added window