summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Fiestas <afiestas@kde.org>2011-07-24 20:56:55 (GMT)
committerAlex Fiestas <afiestas@kde.org>2011-08-25 23:10:49 (GMT)
commit6a07efdd744b47d102c5093613ee1349284fa8ef (patch)
tree778abc4916f7bf4bf0bd933974c56eca661eec78
parentbc3d6c65c16f570ea84c2eee16a347fe556d6a71 (diff)
Try to call desktopRezie once intead of doing it in all XRandR events.
When a screen is disconnected XRandR emits 3 events instead of just one: 1-Disconnected screen resized 2-Disconnected screen moved 3-Disconnected screen removed Before this commit we were calling desktopResize on each event which between other things restart the composite (not necessarily the faster thing to do...). So, in order to be able to call desktopResize only once, now we're handling individually each event, when one of them happens a QTimer is started/restarted on each event and desktopResized is called owhen QTimer.timeout The current interval is 100msec (cherry picked from commit 6f891693405d695f73231d8d04864389aa47c0b2)
-rw-r--r--kwin/workspace.cpp42
-rw-r--r--kwin/workspace.h11
2 files changed, 48 insertions, 5 deletions
diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp
index a773700..24acf98 100644
--- a/kwin/workspace.cpp
+++ b/kwin/workspace.cpp
@@ -245,14 +245,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/kwin/workspace.h b/kwin/workspace.h
index 837e557..83e1591 100644
--- a/kwin/workspace.h
+++ b/kwin/workspace.h
@@ -55,6 +55,10 @@ class KStartupInfoData;
class QSlider;
class QPushButton;
+namespace Kephal
+{
+ class Screen;
+}
namespace KWin
{
@@ -704,6 +708,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 lostTopMenuSelection();
void lostTopMenuOwner();
@@ -833,7 +842,6 @@ private:
QMenu* clientPopup();
void closeActivePopup();
-
void updateClientArea(bool force);
bool windowRepaintsPending() const;
@@ -856,6 +864,7 @@ private:
QList<Rules*> 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);