diff --git a/client.cpp b/client.cpp index 266116eeb6..ecc0838101 100644 --- a/client.cpp +++ b/client.cpp @@ -519,12 +519,6 @@ void Client::createDecoration(const QRect& oldgeom) if (m_decoration) { m_decoration->update(); connect(m_decoration, &KDecoration2::Decoration::shadowChanged, this, &Toplevel::getShadow); - connect(m_decoration, &KDecoration2::Decoration::titleBarDoubleClicked, this, - [this]() { - Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick()); - dontMoveResize(); - } - ); connect(m_decoration, &KDecoration2::Decoration::resizeOnlyBordersChanged, this, &Client::updateInputWindow); connect(m_decoration, &KDecoration2::Decoration::bordersChanged, this, [this]() { diff --git a/client.h b/client.h index c2b814e5a0..5068da83f7 100644 --- a/client.h +++ b/client.h @@ -29,6 +29,7 @@ along with this program. If not, see . #include "toplevel.h" #include "xcbutils.h" // Qt +#include #include #include // X @@ -868,6 +869,7 @@ private: QScopedPointer m_frameWrapper; KDecoration2::Decoration *m_decoration; QPointer m_decoratedClient; + QElapsedTimer m_decorationDoubleClickTimer; int desk; QStringList activityList; int m_activityUpdatesBlocked; diff --git a/events.cpp b/events.cpp index eac8f73d92..cba9402cb4 100644 --- a/events.cpp +++ b/events.cpp @@ -50,6 +50,7 @@ along with this program. If not, see . #include #include +#include #include #include @@ -1232,6 +1233,19 @@ bool Client::processDecorationButtonPress(int button, int /*state*/, int x, int if (!wantsInput()) // we cannot be active, use it anyway active = true; + // check whether it is a double click + if (button == XCB_BUTTON_INDEX_1) { + if (m_decorationDoubleClickTimer.isValid() && + m_decoration->titleBar().contains(x, y) && + !m_decorationDoubleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval())) { + Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick()); + dontMoveResize(); + m_decorationDoubleClickTimer.invalidate(); + return false; + } + m_decorationDoubleClickTimer.invalidate(); + } + if (button == XCB_BUTTON_INDEX_1) com = active ? options->commandActiveTitlebar1() : options->commandInactiveTitlebar1(); else if (button == XCB_BUTTON_INDEX_2) @@ -1277,7 +1291,11 @@ bool Client::buttonReleaseEvent(xcb_window_t w, int button, int state, int x, in x11ToQtMouseButton(button), x11ToQtMouseButtons(state) & ~x11ToQtMouseButton(button), x11ToQtKeyboardModifiers(state)); + event.setAccepted(false); QCoreApplication::sendEvent(m_decoration, &event); + if (!event.isAccepted() && m_decoration->titleBar().contains(x, y) && button == XCB_BUTTON_INDEX_1) { + m_decorationDoubleClickTimer.start(); + } } } if (w == wrapperId()) { diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp index 8ca0ae4a14..c04b2c0da0 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewclient.cpp @@ -113,16 +113,6 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) emit paletteChanged(m_palette); } ); - connect(decoration, &Decoration::titleBarDoubleClicked, this, - [this]() { - if (!isMaximizeable()) { - return; - } - const bool maximize = !isMaximized(); - setMaximizedHorizontally(maximize); - setMaximizedVertically(maximize); - } - ); auto emitEdgesChanged = [this, c]() { c->adjacentScreenEdgesChanged(adjacentScreenEdges()); };