[libkwineffects] Add a signal for screen count changed

Used in PresentWindows effect instead of QDesktopWidget.
This commit is contained in:
Martin Gräßlin 2013-12-10 12:20:43 +01:00
parent 145f0c096f
commit 73054577df
3 changed files with 8 additions and 4 deletions

View file

@ -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)));

View file

@ -40,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QQmlEngine>
#include <QQuickItem>
#include <QQuickView>
#include <QDesktopWidget>
#include <QGraphicsObject>
#include <QTimer>
#include <QElapsedTimer>
@ -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()

View file

@ -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