From ee45592d85d128200120e05c951542497e47944b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 31 Jul 2013 12:55:00 +0200 Subject: [PATCH] validate screens w/o direct update largely reverts b164e9912c9b5f9c9ae619bbd79355d317174115 which prevented the crash but due to early screen updating causes issues with scene/overlay update on at least intel chips BUG: 322970 FIXED-IN: 4.11 CCBUG: 322156 REVIEW: https://git.reviewboard.kde.org/r/111811/ --- screens.cpp | 21 +++++---------------- screens.h | 23 +++-------------------- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/screens.cpp b/screens.cpp index 3dd2584d79..23caf59352 100644 --- a/screens.cpp +++ b/screens.cpp @@ -37,7 +37,7 @@ Screens::Screens(QObject *parent) , m_count(0) , m_current(0) , m_currentFollowsMouse(false) - , m_changedTimer(new ScreenCountTimer(this)) + , m_changedTimer(new QTimer(this)) { m_changedTimer->setSingleShot(true); m_changedTimer->setInterval(100); @@ -117,19 +117,6 @@ int Screens::current() const return m_current; } -ScreenCountTimer::ScreenCountTimer(QObject * parent) : QTimer(parent) -{ -} - -void ScreenCountTimer::finish() -{ - if (isActive()) { - stop(); - Screens::self()->updateCount(); - QMetaObject::invokeMethod(Screens::self(), "changed", Qt::QueuedConnection); - } -} - DesktopWidgetScreens::DesktopWidgetScreens(QObject *parent) : Screens(parent) , m_desktop(QApplication::desktop()) @@ -145,13 +132,15 @@ DesktopWidgetScreens::~DesktopWidgetScreens() QRect DesktopWidgetScreens::geometry(int screen) const { - finishChangedTimer(); + if (Screens::self()->isChanging()) + const_cast(this)->updateCount(); return m_desktop->screenGeometry(screen); } int DesktopWidgetScreens::number(const QPoint &pos) const { - finishChangedTimer(); + if (Screens::self()->isChanging()) + const_cast(this)->updateCount(); return m_desktop->screenNumber(pos); } diff --git a/screens.h b/screens.h index 6bdc9689b3..f05f818519 100644 --- a/screens.h +++ b/screens.h @@ -35,15 +35,6 @@ namespace KWin { class Client; -class ScreenCountTimer : public QTimer { - public: - ScreenCountTimer(QObject * parent = 0); - /** - * if isActive, stop AND emit timeout() - */ - void finish(); -}; - class Screens : public QObject { Q_OBJECT @@ -75,6 +66,8 @@ public: virtual QRect geometry(int screen) const = 0; virtual int number(const QPoint &pos) const = 0; + inline bool isChanging() { return m_changedTimer->isActive(); } + public Q_SLOTS: void reconfigure(); @@ -85,11 +78,7 @@ Q_SIGNALS: **/ void changed(); -protected: - void finishChangedTimer() const; - protected Q_SLOTS: - friend class ScreenCountTimer; void setCount(int count); void startChangedTimer(); virtual void updateCount() = 0; @@ -98,7 +87,7 @@ private: int m_count; int m_current; bool m_currentFollowsMouse; - ScreenCountTimer *m_changedTimer; + QTimer *m_changedTimer; KSharedConfig::Ptr m_config; KWIN_SINGLETON(Screens) @@ -131,12 +120,6 @@ int Screens::count() const return m_count; } -inline -void Screens::finishChangedTimer() const -{ - const_cast(m_changedTimer)->finish(); -} - inline bool Screens::isCurrentFollowsMouse() const {