Merge branch 'KDE/4.11'
This commit is contained in:
commit
18932dcace
2 changed files with 8 additions and 36 deletions
21
screens.cpp
21
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<DesktopWidgetScreens*>(this)->updateCount();
|
||||
return m_desktop->screenGeometry(screen);
|
||||
}
|
||||
|
||||
int DesktopWidgetScreens::number(const QPoint &pos) const
|
||||
{
|
||||
finishChangedTimer();
|
||||
if (Screens::self()->isChanging())
|
||||
const_cast<DesktopWidgetScreens*>(this)->updateCount();
|
||||
return m_desktop->screenNumber(pos);
|
||||
}
|
||||
|
||||
|
|
23
screens.h
23
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<ScreenCountTimer*>(m_changedTimer)->finish();
|
||||
}
|
||||
|
||||
inline
|
||||
bool Screens::isCurrentFollowsMouse() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue