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
This commit is contained in:
parent
30de988de8
commit
fa199457af
2 changed files with 48 additions and 5 deletions
|
@ -243,14 +243,48 @@ Workspace::Workspace(bool restore)
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
connect(Kephal::Screens::self(), SIGNAL(screenAdded(Kephal::Screen*)), SLOT(desktopResized()));
|
connect(Kephal::Screens::self(), SIGNAL(screenAdded(Kephal::Screen*)), SLOT(screenAdded(Kephal::Screen*)));
|
||||||
connect(Kephal::Screens::self(), SIGNAL(screenRemoved(int)), SLOT(desktopResized()));
|
connect(Kephal::Screens::self(), SIGNAL(screenRemoved(int)), SLOT(screenRemoved(int)));
|
||||||
connect(Kephal::Screens::self(), SIGNAL(screenResized(Kephal::Screen*, QSize, QSize)), SLOT(desktopResized()));
|
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(desktopResized()));
|
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(currentActivityChanged(QString)), SLOT(updateCurrentActivity(QString)));
|
||||||
connect(&activityController_, SIGNAL(activityRemoved(QString)), SLOT(activityRemoved(QString)));
|
connect(&activityController_, SIGNAL(activityRemoved(QString)), SLOT(activityRemoved(QString)));
|
||||||
connect(&activityController_, SIGNAL(activityAdded(QString)), SLOT(activityAdded(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()
|
void Workspace::init()
|
||||||
|
|
11
workspace.h
11
workspace.h
|
@ -58,6 +58,10 @@ class KStartupInfoData;
|
||||||
class QSlider;
|
class QSlider;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
||||||
|
namespace Kephal
|
||||||
|
{
|
||||||
|
class Screen;
|
||||||
|
}
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -675,6 +679,11 @@ private slots:
|
||||||
void clientPopupActivated(QAction*);
|
void clientPopupActivated(QAction*);
|
||||||
void configureWM();
|
void configureWM();
|
||||||
void desktopResized();
|
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 slotUpdateToolWindows();
|
||||||
void delayFocus();
|
void delayFocus();
|
||||||
void gotTemporaryRulesMessage(const QString&);
|
void gotTemporaryRulesMessage(const QString&);
|
||||||
|
@ -769,7 +778,6 @@ private:
|
||||||
|
|
||||||
QMenu* clientPopup();
|
QMenu* clientPopup();
|
||||||
void closeActivePopup();
|
void closeActivePopup();
|
||||||
|
|
||||||
void updateClientArea(bool force);
|
void updateClientArea(bool force);
|
||||||
|
|
||||||
bool windowRepaintsPending() const;
|
bool windowRepaintsPending() const;
|
||||||
|
@ -791,6 +799,7 @@ private:
|
||||||
QList<Rules*> rules;
|
QList<Rules*> rules;
|
||||||
KXMessages temporaryRulesMessages;
|
KXMessages temporaryRulesMessages;
|
||||||
QTimer rulesUpdatedTimer;
|
QTimer rulesUpdatedTimer;
|
||||||
|
QTimer screenChangedTimer;
|
||||||
bool rules_updates_disabled;
|
bool rules_updates_disabled;
|
||||||
static const char* windowTypeToTxt(NET::WindowType type);
|
static const char* windowTypeToTxt(NET::WindowType type);
|
||||||
static NET::WindowType txtToWindowType(const char* txt);
|
static NET::WindowType txtToWindowType(const char* txt);
|
||||||
|
|
Loading…
Reference in a new issue