diff --git a/workspace.cpp b/workspace.cpp index 1a48194baf..98b41f9303 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -243,14 +243,48 @@ Workspace::Workspace(bool restore) init(); - connect(Kephal::Screens::self(), SIGNAL(screenAdded(Kephal::Screen*)), SLOT(desktopResized())); - connect(Kephal::Screens::self(), SIGNAL(screenRemoved(int)), SLOT(desktopResized())); - connect(Kephal::Screens::self(), SIGNAL(screenResized(Kephal::Screen*, QSize, QSize)), SLOT(desktopResized())); - connect(Kephal::Screens::self(), SIGNAL(screenMoved(Kephal::Screen*, QPoint, QPoint)), SLOT(desktopResized())); + connect(Kephal::Screens::self(), SIGNAL(screenAdded(Kephal::Screen*)), SLOT(screenAdded(Kephal::Screen*))); + connect(Kephal::Screens::self(), SIGNAL(screenRemoved(int)), SLOT(screenRemoved(int))); + connect(Kephal::Screens::self(), SIGNAL(screenResized(Kephal::Screen*, QSize, QSize)), SLOT(screenResized(Kephal::Screen*, QSize, QSize))); + connect(Kephal::Screens::self(), SIGNAL(screenMoved(Kephal::Screen*, QPoint, QPoint)), SLOT(screenMoved(Kephal::Screen*, QPoint, QPoint))); connect(&activityController_, SIGNAL(currentActivityChanged(QString)), SLOT(updateCurrentActivity(QString))); connect(&activityController_, SIGNAL(activityRemoved(QString)), SLOT(activityRemoved(QString))); connect(&activityController_, SIGNAL(activityAdded(QString)), SLOT(activityAdded(QString))); + + connect(&screenChangedTimer, SIGNAL(timeout()), SLOT(screenChangeTimeout())); + screenChangedTimer.setSingleShot(true); + screenChangedTimer.setInterval(100); +} + +void Workspace::screenChangeTimeout() +{ + kDebug() << "It is time to call desktopResized"; + desktopResized(); +} + +void Workspace::screenAdded(Kephal::Screen* screen) +{ + kDebug(); + screenChangedTimer.start(); +} + +void Workspace::screenRemoved(int screen) +{ + kDebug(); + screenChangedTimer.start(); +} + +void Workspace::screenResized(Kephal::Screen* screen, QSize old, QSize newSize) +{ + kDebug(); + screenChangedTimer.start(); +} + +void Workspace::screenMoved(Kephal::Screen* screen, QPoint old, QPoint newPos) +{ + kDebug(); + screenChangedTimer.start(); } void Workspace::init() diff --git a/workspace.h b/workspace.h index fa3d7bdaba..79c1e2d691 100644 --- a/workspace.h +++ b/workspace.h @@ -58,6 +58,10 @@ class KStartupInfoData; class QSlider; class QPushButton; +namespace Kephal +{ + class Screen; +} namespace KWin { @@ -675,6 +679,11 @@ private slots: void clientPopupActivated(QAction*); void configureWM(); void desktopResized(); + void screenChangeTimeout(); + void screenAdded(Kephal::Screen*); + void screenRemoved(int); + void screenResized(Kephal::Screen*, QSize, QSize); + void screenMoved(Kephal::Screen*, QPoint, QPoint); void slotUpdateToolWindows(); void delayFocus(); void gotTemporaryRulesMessage(const QString&); @@ -769,7 +778,6 @@ private: QMenu* clientPopup(); void closeActivePopup(); - void updateClientArea(bool force); bool windowRepaintsPending() const; @@ -791,6 +799,7 @@ private: QList rules; KXMessages temporaryRulesMessages; QTimer rulesUpdatedTimer; + QTimer screenChangedTimer; bool rules_updates_disabled; static const char* windowTypeToTxt(NET::WindowType type); static NET::WindowType txtToWindowType(const char* txt);