NumberDesktopsChanged becomes a signal

TODO: connect DesktopChangeOSD also to the signal
icc-effect-5.14.5
Martin Gräßlin 2011-03-06 20:10:11 +01:00
parent 15757e953a
commit 747afb4225
8 changed files with 13 additions and 23 deletions

View File

@ -102,6 +102,7 @@ EffectsHandlerImpl::EffectsHandlerImpl(CompositingType type)
connect(ws, SIGNAL(unmanagedAdded(KWin::Unmanaged*)), this, SLOT(slotUnmanagedAdded(KWin::Unmanaged*)));
connect(ws, SIGNAL(clientActivated(KWin::Client*)), this, SLOT(slotClientActivated(KWin::Client*)));
connect(ws, SIGNAL(deletedRemoved(KWin::Deleted*)), this, SLOT(slotDeletedRemoved(KWin::Deleted*)));
connect(ws, SIGNAL(numberDesktopsChanged(int)), SIGNAL(numberDesktopsChanged(int)));
connect(ws->tabBox(), SIGNAL(tabBoxAdded(int)), SIGNAL(tabBoxAdded(int)));
connect(ws->tabBox(), SIGNAL(tabBoxUpdated()), SIGNAL(tabBoxUpdated()));
connect(ws->tabBox(), SIGNAL(tabBoxClosed()), SIGNAL(tabBoxClosed()));
@ -497,12 +498,6 @@ void EffectsHandlerImpl::propertyNotify(EffectWindow* c, long atom)
ep.second->propertyNotify(c, atom);
}
void EffectsHandlerImpl::numberDesktopsChanged(int old)
{
foreach (const EffectPair & ep, loaded_effects)
ep.second->numberDesktopsChanged(old);
}
void EffectsHandlerImpl::registerPropertyType(long atom, bool reg)
{
if (reg)

View File

@ -171,7 +171,6 @@ public:
void grabbedKeyboardEvent(QKeyEvent* e);
bool hasKeyboardGrab() const;
void propertyNotify(EffectWindow* c, long atom);
void numberDesktopsChanged(int old);
bool loadEffect(const QString& name);
void toggleEffect(const QString& name);

View File

@ -76,6 +76,7 @@ DesktopGridEffect::DesktopGridEffect()
connect(effects, SIGNAL(windowAdded(EffectWindow*)), this, SLOT(slotWindowAdded(EffectWindow*)));
connect(effects, SIGNAL(windowClosed(EffectWindow*)), this, SLOT(slotWindowClosed(EffectWindow*)));
connect(effects, SIGNAL(windowDeleted(EffectWindow*)), this, SLOT(slotWindowDeleted(EffectWindow*)));
connect(effects, SIGNAL(numberDesktopsChanged(int)), this, SLOT(slotNumberDesktopsChanged(int)));
// Load all other configuration details
reconfigure(ReconfigureAll);
@ -1259,7 +1260,7 @@ void DesktopGridEffect::slotRemoveDesktop()
effects->setNumberOfDesktops(effects->numberOfDesktops() - 1);
}
void DesktopGridEffect::numberDesktopsChanged(int old)
void DesktopGridEffect::slotNumberDesktopsChanged(int old)
{
if (!activated)
return;

View File

@ -75,7 +75,6 @@ public:
virtual void windowInputMouseEvent(Window w, QEvent* e);
virtual void grabbedKeyboardEvent(QKeyEvent* e);
virtual bool borderActivated(ElectricBorder border);
virtual void numberDesktopsChanged(int old);
enum { LayoutPager, LayoutAutomatic, LayoutCustom }; // Layout modes
@ -89,6 +88,7 @@ private slots:
void slotWindowAdded(EffectWindow* w);
void slotWindowClosed(EffectWindow *w);
void slotWindowDeleted(EffectWindow *w);
void slotNumberDesktopsChanged(int old);
private:
QPointF scalePos(const QPoint& pos, int desktop, int screen = -1) const;

View File

@ -263,10 +263,6 @@ double Effect::animationTime(int defaultTime)
return qMax(defaultTime * effects->animationTimeFactor(), 1.);
}
void Effect::numberDesktopsChanged(int)
{
}
//****************************************
// EffectsHandler
//****************************************

View File

@ -463,13 +463,6 @@ public:
virtual bool borderActivated(ElectricBorder border);
/**
* called when the number of currently existing desktops is changed.
* @param old The previous number of desktops in used.
* @see EffectsHandler::numberOfDesktops.
*/
virtual void numberDesktopsChanged(int old);
static int displayWidth();
static int displayHeight();
static QPoint cursorPos();
@ -826,6 +819,13 @@ Q_SIGNALS:
* @since 4.7
**/
void desktopChanged(int oldDesktop, int newDesktop);
/**
* Signal emitted when the number of currently existing desktops is changed.
* @param old The previous number of desktops in used.
* @see EffectsHandler::numberOfDesktops.
* @since 4.7
*/
void numberDesktopsChanged(int old);
/**
* Signal emitted when a new window has been added to the Workspace.
* @param w The added window

View File

@ -1686,9 +1686,7 @@ void Workspace::setNumberOfDesktops(int n)
// reset the desktop change osd
desktop_change_osd->numberDesktopsChanged();
// inform effects
if (effects)
static_cast< EffectsHandlerImpl* >(effects)->numberDesktopsChanged(old_number_of_desktops);
emit numberDesktopsChanged(old_number_of_desktops);
}
/**

View File

@ -922,6 +922,7 @@ Q_SIGNALS:
signals:
void desktopPresenceChanged(KWin::Client*, int);
void currentDesktopChanged(int);
void numberDesktopsChanged(int oldNumberOfDesktops);
void clientAdded(KWin::Client*);
void clientRemoved(KWin::Client*);
void clientActivated(KWin::Client*);