handle closebutton arm state inside effect only
the enabled/disabled change is a useless distraction implicitly fixes BUG: 321810 FIXED-IN: 4.11 REVIEW: 111538icc-effect-5.14.5
parent
0f57c9407a
commit
287acae1db
|
@ -24,7 +24,6 @@ Item {
|
|||
Plasma.Button {
|
||||
id: closeButton
|
||||
objectName: "closeButton"
|
||||
enabled: armed
|
||||
width: 32
|
||||
height: 32
|
||||
iconSource: "window-close"
|
||||
|
|
|
@ -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<QObject*>("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();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,6 @@ public:
|
|||
explicit CloseWindowView(QWidget *parent = 0);
|
||||
void windowInputMouseEvent(QMouseEvent* e);
|
||||
void disarm();
|
||||
public slots:
|
||||
void arm();
|
||||
|
||||
Q_SIGNALS:
|
||||
void close();
|
||||
|
|
Loading…
Reference in New Issue