Commit ed1d3228 authored by Thomas Lübking's avatar Thomas Lübking

move doubleclick logic into press event

alignes w/ systemwide behavior and allows elegant fix of
BUG: 357450
FIXED-IN: 5.6
REVIEW: 126631
parent 95cbd7c1
......@@ -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
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment