handle closebutton arm state inside effect only
the enabled/disabled change is a useless distraction implicitly fixes BUG: 321810 FIXED-IN: 4.11 REVIEW: 111538
This commit is contained in:
parent
0f57c9407a
commit
287acae1db
3 changed files with 2 additions and 14 deletions
|
@ -24,7 +24,6 @@ Item {
|
||||||
Plasma.Button {
|
Plasma.Button {
|
||||||
id: closeButton
|
id: closeButton
|
||||||
objectName: "closeButton"
|
objectName: "closeButton"
|
||||||
enabled: armed
|
|
||||||
width: 32
|
width: 32
|
||||||
height: 32
|
height: 32
|
||||||
iconSource: "window-close"
|
iconSource: "window-close"
|
||||||
|
|
|
@ -1968,8 +1968,6 @@ CloseWindowView::CloseWindowView(QWidget *parent)
|
||||||
kdeclarative.initialize();
|
kdeclarative.initialize();
|
||||||
kdeclarative.setupBindings();
|
kdeclarative.setupBindings();
|
||||||
|
|
||||||
rootContext()->setContextProperty("armed", QVariant(false));
|
|
||||||
|
|
||||||
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml"))));
|
setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml"))));
|
||||||
if (QObject *item = rootObject()->findChild<QObject*>("closeButton")) {
|
if (QObject *item = rootObject()->findChild<QObject*>("closeButton")) {
|
||||||
connect(item, SIGNAL(clicked()), SIGNAL(close()));
|
connect(item, SIGNAL(clicked()), SIGNAL(close()));
|
||||||
|
@ -1978,15 +1976,14 @@ CloseWindowView::CloseWindowView(QWidget *parent)
|
||||||
// setup the timer - attempt to prevent accidental clicks
|
// setup the timer - attempt to prevent accidental clicks
|
||||||
m_armTimer->setSingleShot(true);
|
m_armTimer->setSingleShot(true);
|
||||||
m_armTimer->setInterval(350); // 50ms until the window is elevated (seen!) and 300ms more to be "realized" by the user.
|
m_armTimer->setInterval(350); // 50ms until the window is elevated (seen!) and 300ms more to be "realized" by the user.
|
||||||
connect(m_armTimer, SIGNAL(timeout()), SLOT(arm()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
|
void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
if (m_armTimer->isActive())
|
|
||||||
return;
|
|
||||||
if (e->type() == QEvent::MouseMove) {
|
if (e->type() == QEvent::MouseMove) {
|
||||||
mouseMoveEvent(e);
|
mouseMoveEvent(e);
|
||||||
|
} else if (m_armTimer->isActive()) {
|
||||||
|
return;
|
||||||
} else if (e->type() == QEvent::MouseButtonPress) {
|
} else if (e->type() == QEvent::MouseButtonPress) {
|
||||||
mousePressEvent(e);
|
mousePressEvent(e);
|
||||||
} else if (e->type() == QEvent::MouseButtonDblClick) {
|
} else if (e->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
@ -1996,14 +1993,8 @@ void CloseWindowView::windowInputMouseEvent(QMouseEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseWindowView::arm()
|
|
||||||
{
|
|
||||||
rootContext()->setContextProperty("armed", QVariant(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CloseWindowView::disarm()
|
void CloseWindowView::disarm()
|
||||||
{
|
{
|
||||||
rootContext()->setContextProperty("armed", QVariant(false));
|
|
||||||
m_armTimer->start();
|
m_armTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ public:
|
||||||
explicit CloseWindowView(QWidget *parent = 0);
|
explicit CloseWindowView(QWidget *parent = 0);
|
||||||
void windowInputMouseEvent(QMouseEvent* e);
|
void windowInputMouseEvent(QMouseEvent* e);
|
||||||
void disarm();
|
void disarm();
|
||||||
public slots:
|
|
||||||
void arm();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void close();
|
void close();
|
||||||
|
|
Loading…
Reference in a new issue