kwineffects: Drop numScreens property
The screen count can be retrieved by checking the number of items in the EffectHandler.screens property. The replacement for the numberScreensChanged signal are the screenAdded and the screenRemoved signals. The main motivation behind this change is to clean up the screens api and reduce the number of usages of the Screens class.
This commit is contained in:
parent
0c7d97853e
commit
15520888d9
8 changed files with 15 additions and 25 deletions
|
@ -152,9 +152,6 @@ public:
|
|||
int numberOfDesktops() const override {
|
||||
return 0;
|
||||
}
|
||||
int numScreens() const override {
|
||||
return 0;
|
||||
}
|
||||
bool optionRollOverDesktops() const override {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -188,7 +188,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
|||
&KWin::EffectsHandler::sessionStateChanged);
|
||||
connect(vds, &VirtualDesktopManager::countChanged, this, &EffectsHandler::numberDesktopsChanged);
|
||||
connect(Cursors::self()->mouse(), &Cursor::mouseChanged, this, &EffectsHandler::mouseChanged);
|
||||
connect(Screens::self(), &Screens::countChanged, this, &EffectsHandler::numberScreensChanged);
|
||||
connect(Screens::self(), &Screens::sizeChanged, this, &EffectsHandler::virtualScreenSizeChanged);
|
||||
connect(Screens::self(), &Screens::geometryChanged, this, &EffectsHandler::virtualScreenGeometryChanged);
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
|
@ -1195,11 +1194,6 @@ EffectScreen *EffectsHandlerImpl::activeScreen() const
|
|||
return EffectScreenImpl::get(workspace()->activeOutput());
|
||||
}
|
||||
|
||||
int EffectsHandlerImpl::numScreens() const
|
||||
{
|
||||
return Screens::self()->count();
|
||||
}
|
||||
|
||||
QRect EffectsHandlerImpl::clientArea(clientAreaOption opt, const EffectScreen *screen, int desktop) const
|
||||
{
|
||||
const VirtualDesktop *virtualDesktop;
|
||||
|
|
|
@ -141,7 +141,6 @@ public:
|
|||
void addRepaint(const QRegion& r) override;
|
||||
void addRepaint(int x, int y, int w, int h) override;
|
||||
EffectScreen *activeScreen() const override;
|
||||
int numScreens() const override;
|
||||
QRect clientArea(clientAreaOption, const EffectScreen *screen, int desktop) const override;
|
||||
QRect clientArea(clientAreaOption, const EffectWindow* c) const override;
|
||||
QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const override;
|
||||
|
|
|
@ -118,7 +118,8 @@ DesktopGridEffect::DesktopGridEffect()
|
|||
connect(effects, &EffectsHandler::windowDeleted, this, &DesktopGridEffect::slotWindowDeleted);
|
||||
connect(effects, &EffectsHandler::numberDesktopsChanged, this, &DesktopGridEffect::slotNumberDesktopsChanged);
|
||||
connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &DesktopGridEffect::slotWindowFrameGeometryChanged);
|
||||
connect(effects, &EffectsHandler::numberScreensChanged, this, &DesktopGridEffect::setup);
|
||||
connect(effects, &EffectsHandler::screenAdded, this, &DesktopGridEffect::setup);
|
||||
connect(effects, &EffectsHandler::screenRemoved, this, &DesktopGridEffect::setup);
|
||||
|
||||
connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() {
|
||||
deactivate();
|
||||
|
|
|
@ -99,12 +99,8 @@ PresentWindowsEffect::PresentWindowsEffect()
|
|||
connect(effects, &EffectsHandler::windowDeleted, this, &PresentWindowsEffect::slotWindowDeleted);
|
||||
connect(effects, &EffectsHandler::windowFrameGeometryChanged, this, &PresentWindowsEffect::slotWindowFrameGeometryChanged);
|
||||
connect(effects, &EffectsHandler::propertyNotify, this, &PresentWindowsEffect::slotPropertyNotify);
|
||||
connect(effects, &EffectsHandler::numberScreensChanged, this,
|
||||
[this] {
|
||||
if (isActive())
|
||||
reCreateGrids();
|
||||
}
|
||||
);
|
||||
connect(effects, &EffectsHandler::screenAdded, this, &PresentWindowsEffect::maybeRecreateGrids);
|
||||
connect(effects, &EffectsHandler::screenRemoved, this, &PresentWindowsEffect::maybeRecreateGrids);
|
||||
connect(effects, &EffectsHandler::screenAboutToLock, this, [this]() {
|
||||
setActive(false);
|
||||
});
|
||||
|
@ -2027,6 +2023,13 @@ bool PresentWindowsEffect::isActive() const
|
|||
return (m_activated || m_motionManager.managingWindows()) && !effects->isScreenLocked();
|
||||
}
|
||||
|
||||
void PresentWindowsEffect::maybeRecreateGrids()
|
||||
{
|
||||
if (isActive()) {
|
||||
reCreateGrids();
|
||||
}
|
||||
}
|
||||
|
||||
void PresentWindowsEffect::reCreateGrids()
|
||||
{
|
||||
m_gridSizes.clear();
|
||||
|
|
|
@ -214,6 +214,7 @@ protected:
|
|||
// Window rearranging
|
||||
void rearrangeWindows();
|
||||
void reCreateGrids();
|
||||
void maybeRecreateGrids();
|
||||
void calculateWindowTransformations(EffectWindowList windowlist, EffectScreen *screen,
|
||||
WindowMotionManager& motionManager, bool external = false);
|
||||
void calculateWindowTransformationsClosest(EffectWindowList windowlist, EffectScreen *screen,
|
||||
|
|
|
@ -33,7 +33,9 @@ SlideEffect::SlideEffect()
|
|||
this, &SlideEffect::windowDeleted);
|
||||
connect(effects, &EffectsHandler::numberDesktopsChanged,
|
||||
this, &SlideEffect::stop);
|
||||
connect(effects, &EffectsHandler::numberScreensChanged,
|
||||
connect(effects, &EffectsHandler::screenAdded,
|
||||
this, &SlideEffect::stop);
|
||||
connect(effects, &EffectsHandler::screenRemoved,
|
||||
this, &SlideEffect::stop);
|
||||
}
|
||||
|
||||
|
|
|
@ -778,7 +778,6 @@ class KWINEFFECTS_EXPORT EffectsHandler : public QObject
|
|||
Q_PROPERTY(int desktops READ numberOfDesktops WRITE setNumberOfDesktops NOTIFY numberDesktopsChanged)
|
||||
Q_PROPERTY(bool optionRollOverDesktops READ optionRollOverDesktops)
|
||||
Q_PROPERTY(KWin::EffectScreen *activeScreen READ activeScreen)
|
||||
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'
|
||||
|
@ -1025,7 +1024,6 @@ public:
|
|||
virtual bool optionRollOverDesktops() const = 0;
|
||||
|
||||
virtual EffectScreen *activeScreen() const = 0; // Xinerama
|
||||
virtual int numScreens() const = 0; // Xinerama
|
||||
virtual QRect clientArea(clientAreaOption, const EffectScreen *screen, int desktop) const = 0;
|
||||
virtual QRect clientArea(clientAreaOption, const EffectWindow* c) const = 0;
|
||||
virtual QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const = 0;
|
||||
|
@ -1408,11 +1406,6 @@ 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 the desktop showing ("dashboard") state changed
|
||||
* The desktop is risen to the keepAbove layer, you may want to elevate
|
||||
|
|
Loading…
Reference in a new issue