From 287acae1dbd7c52841c880f69bc2be50bef159e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 16 Jul 2013 20:58:15 +0200 Subject: [PATCH] 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 --- effects/presentwindows/main.qml | 1 - effects/presentwindows/presentwindows.cpp | 13 ++----------- effects/presentwindows/presentwindows.h | 2 -- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/effects/presentwindows/main.qml b/effects/presentwindows/main.qml index e456a48a30..762d804306 100644 --- a/effects/presentwindows/main.qml +++ b/effects/presentwindows/main.qml @@ -24,7 +24,6 @@ Item { Plasma.Button { id: closeButton objectName: "closeButton" - enabled: armed width: 32 height: 32 iconSource: "window-close" diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 413e3ab993..397bd61d38 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -1968,8 +1968,6 @@ CloseWindowView::CloseWindowView(QWidget *parent) kdeclarative.initialize(); kdeclarative.setupBindings(); - rootContext()->setContextProperty("armed", QVariant(false)); - setSource(QUrl(KStandardDirs::locate("data", QLatin1String("kwin/effects/presentwindows/main.qml")))); if (QObject *item = rootObject()->findChild("closeButton")) { connect(item, SIGNAL(clicked()), SIGNAL(close())); @@ -1978,15 +1976,14 @@ CloseWindowView::CloseWindowView(QWidget *parent) // setup the timer - attempt to prevent accidental clicks m_armTimer->setSingleShot(true); 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) { - if (m_armTimer->isActive()) - return; if (e->type() == QEvent::MouseMove) { mouseMoveEvent(e); + } else if (m_armTimer->isActive()) { + return; } else if (e->type() == QEvent::MouseButtonPress) { mousePressEvent(e); } 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() { - rootContext()->setContextProperty("armed", QVariant(false)); m_armTimer->start(); } diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index cdbc958dcd..3b97d195c4 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -39,8 +39,6 @@ public: explicit CloseWindowView(QWidget *parent = 0); void windowInputMouseEvent(QMouseEvent* e); void disarm(); -public slots: - void arm(); Q_SIGNALS: void close();