move doubleclick logic into press event
alignes w/ systemwide behavior and allows elegant fix of BUG: 357450 FIXED-IN: 5.6 REVIEW: 126631icc-effect-5.14.5
parent
95cbd7c1b3
commit
ed1d32288b
|
@ -1392,16 +1392,21 @@ bool AbstractClient::processDecorationButtonPress(QMouseEvent *event, bool ignor
|
|||
active = true;
|
||||
|
||||
// check whether it is a double click
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
if (m_decoration.doubleClickTimer.isValid() &&
|
||||
decoration()->titleBar().contains(event->x(), event->y()) &&
|
||||
!m_decoration.doubleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval())) {
|
||||
Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick());
|
||||
dontMoveResize();
|
||||
if (event->button() == Qt::LeftButton && decoration()->titleBar().contains(event->x(), event->y())) {
|
||||
if (m_decoration.doubleClickTimer.isValid()) {
|
||||
const quint64 interval = m_decoration.doubleClickTimer.elapsed();
|
||||
m_decoration.doubleClickTimer.invalidate();
|
||||
return false;
|
||||
if (interval > QGuiApplication::styleHints()->mouseDoubleClickInterval()) {
|
||||
m_decoration.doubleClickTimer.invalidate(); // expired -> new first click and pot. init
|
||||
} else {
|
||||
Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick());
|
||||
dontMoveResize();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_decoration.doubleClickTimer.start(); // new first click and pot. init, could be invalidated by release - see below
|
||||
}
|
||||
m_decoration.doubleClickTimer.invalidate();
|
||||
}
|
||||
|
||||
if (event->button() == Qt::LeftButton)
|
||||
|
@ -1462,6 +1467,11 @@ void AbstractClient::startDecorationDoubleClickTimer()
|
|||
m_decoration.doubleClickTimer.start();
|
||||
}
|
||||
|
||||
void AbstractClient::invalidateDecorationDoubleClickTimer()
|
||||
{
|
||||
m_decoration.doubleClickTimer.invalidate();
|
||||
}
|
||||
|
||||
bool AbstractClient::providesContextHelp() const
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -865,6 +865,7 @@ protected:
|
|||
}
|
||||
virtual void destroyDecoration();
|
||||
void startDecorationDoubleClickTimer();
|
||||
void invalidateDecorationDoubleClickTimer();
|
||||
|
||||
private:
|
||||
void handlePaletteChange();
|
||||
|
|
|
@ -1224,8 +1224,8 @@ bool Client::buttonReleaseEvent(xcb_window_t w, int button, int state, int x, in
|
|||
x11ToQtKeyboardModifiers(state));
|
||||
event.setAccepted(false);
|
||||
QCoreApplication::sendEvent(decoration(), &event);
|
||||
if (!event.isAccepted() && decoration()->titleBar().contains(x, y) && button == XCB_BUTTON_INDEX_1) {
|
||||
startDecorationDoubleClickTimer();
|
||||
if (event.isAccepted() || !decoration()->titleBar().contains(x, y)) {
|
||||
invalidateDecorationDoubleClickTimer(); // click was for the deco and shall not init a doubleclick
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue