diff --git a/desktopchangeosd.cpp b/desktopchangeosd.cpp index 77ff155b7c..91ccd41701 100644 --- a/desktopchangeosd.cpp +++ b/desktopchangeosd.cpp @@ -63,6 +63,7 @@ DesktopChangeOSD::DesktopChangeOSD(Workspace* ws) m_delayedHideTimer.setSingleShot(true); connect(&m_delayedHideTimer, SIGNAL(timeout()), this, SLOT(hide())); + connect(ws, SIGNAL(currentDesktopChanged(int)), this, SLOT(desktopChanged(int))); m_scene = new QGraphicsScene(0); setScene(m_scene); @@ -89,6 +90,9 @@ void DesktopChangeOSD::reconfigure() void DesktopChangeOSD::desktopChanged(int old) { + // Not for the very first time, only if something changed and there are more than 1 desktops + if (old == 0 || old == m_wspace->currentDesktop() || m_wspace->numberOfDesktops() <= 1) + return; if (!m_show) return; // we have to stop in case the old desktop does not exist anymore diff --git a/desktopchangeosd.h b/desktopchangeosd.h index 270bb82856..f448851213 100644 --- a/desktopchangeosd.h +++ b/desktopchangeosd.h @@ -65,12 +65,12 @@ private: class DesktopChangeOSD : public QGraphicsView { + Q_OBJECT public: DesktopChangeOSD(Workspace* ws); ~DesktopChangeOSD(); void reconfigure(); - void desktopChanged(int old); void numberDesktopsChanged(); inline Plasma::FrameSvg* itemFrame() { @@ -95,6 +95,9 @@ private: bool m_show; int m_delayTime; bool m_textOnly; + +private Q_SLOTS: + void desktopChanged(int old); }; class DesktopChangeItem : public QObject, public QGraphicsItem diff --git a/workspace.cpp b/workspace.cpp index 8cf5299e5a..636e8017d3 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1330,10 +1330,6 @@ bool Workspace::setCurrentDesktop(int new_desktop) // s += QString::number( desktop_focus_chain[i] ) + ", "; //kDebug( 1212 ) << s << "}\n"; - // Not for the very first time, only if something changed and there are more than 1 desktops - if (old_desktop != 0 && old_desktop != new_desktop && numberOfDesktops() > 1) - desktop_change_osd->desktopChanged(old_desktop); - if (compositing()) addRepaintFull();