diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp index 7d18d07e1a..b3a6b24a0e 100644 --- a/autotests/integration/decoration_input_test.cpp +++ b/autotests/integration/decoration_input_test.cpp @@ -52,10 +52,8 @@ private Q_SLOTS: void cleanup(); void testAxis_data(); void testAxis(); - void testDoubleClickOnAllDesktops_data(); void testDoubleClickOnAllDesktops(); void testDoubleClickClose(); - void testDoubleTap_data(); void testDoubleTap(); void testHover(); void testPressToMove_data(); @@ -211,16 +209,6 @@ void DecorationInputTest::testAxis() QVERIFY(!window->keepAbove()); } -void DecorationInputTest::testDoubleClickOnAllDesktops_data() -{ - QTest::addColumn("decoPoint"); - QTest::addColumn("expectedSection"); - - QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection; - QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection; - QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection; -} - void KWin::DecorationInputTest::testDoubleClickOnAllDesktops() { KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows")); @@ -249,21 +237,6 @@ void KWin::DecorationInputTest::testDoubleClickOnAllDesktops() PRESS; RELEASE; QVERIFY(!window->isOnAllDesktops()); - - // test top most deco pixel, BUG: 362860 - window->move(QPoint(0, 0)); - QFETCH(QPoint, decoPoint); - MOTION(decoPoint); - QVERIFY(input()->pointer()->decoration()); - QCOMPARE(input()->pointer()->decoration()->window(), window); - QTEST(input()->pointer()->decoration()->decoration()->sectionUnderMouse(), "expectedSection"); - // double click - PRESS; - RELEASE; - QVERIFY(!window->isOnAllDesktops()); - PRESS; - RELEASE; - QVERIFY(window->isOnAllDesktops()); } void DecorationInputTest::testDoubleClickClose() @@ -297,16 +270,6 @@ void DecorationInputTest::testDoubleClickClose() window->unref(); } -void DecorationInputTest::testDoubleTap_data() -{ - QTest::addColumn("decoPoint"); - QTest::addColumn("expectedSection"); - - QTest::newRow("topLeft") << QPoint(10, 10) << Qt::TopLeftSection; - QTest::newRow("top") << QPoint(260, 10) << Qt::TopSection; - QTest::newRow("topRight") << QPoint(509, 10) << Qt::TopRightSection; -} - void KWin::DecorationInputTest::testDoubleTap() { KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows")); @@ -335,23 +298,6 @@ void KWin::DecorationInputTest::testDoubleTap() Test::touchDown(0, tapPoint, timestamp++); Test::touchUp(0, timestamp++); QVERIFY(!window->isOnAllDesktops()); - - // test top most deco pixel, BUG: 362860 - // - // Not directly at (0, 0), otherwise ScreenEdgeInputFilter catches - // event before DecorationEventFilter. - window->move(QPoint(10, 10)); - QFETCH(QPoint, decoPoint); - // double click - Test::touchDown(0, decoPoint, timestamp++); - QVERIFY(input()->touch()->decoration()); - QCOMPARE(input()->touch()->decoration()->window(), window); - QTEST(input()->touch()->decoration()->decoration()->sectionUnderMouse(), "expectedSection"); - Test::touchUp(0, timestamp++); - QVERIFY(!window->isOnAllDesktops()); - Test::touchDown(0, decoPoint, timestamp++); - Test::touchUp(0, timestamp++); - QVERIFY(window->isOnAllDesktops()); } void DecorationInputTest::testHover() diff --git a/src/window.cpp b/src/window.cpp index bf86ffcdcc..bf8aee2c2b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2759,14 +2759,37 @@ bool Window::processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu) } // check whether it is a double click - if (event->button() == Qt::LeftButton && titlebarPositionUnderMouse()) { + if (event->button() == Qt::LeftButton) { if (m_decoration.doubleClickTimer.isValid()) { const qint64 interval = m_decoration.doubleClickTimer.elapsed(); m_decoration.doubleClickTimer.invalidate(); if (interval > QGuiApplication::styleHints()->mouseDoubleClickInterval()) { m_decoration.doubleClickTimer.start(); // expired -> new first click and pot. init } else { - Workspace::self()->performWindowOperation(this, options->operationTitlebarDblClick()); + Options::WindowOperation operation; + switch (decoration()->sectionUnderMouse()) { + case Qt::TitleBarArea: + operation = options->operationTitlebarDblClick(); + break; + case Qt::LeftSection: + case Qt::RightSection: + operation = Options::HMaximizeOp; + break; + case Qt::TopSection: + case Qt::BottomSection: + operation = Options::VMaximizeOp; + break; + case Qt::TopLeftSection: + case Qt::TopRightSection: + case Qt::BottomLeftSection: + case Qt::BottomRightSection: + operation = Options::MaximizeOp; + break; + default: + operation = Options::NoOp; + break; + } + workspace()->performWindowOperation(this, operation); dontInteractiveMoveResize(); return false; } @@ -2805,10 +2828,8 @@ bool Window::processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu) void Window::processDecorationButtonRelease(QMouseEvent *event) { - if (isDecorated()) { - if (event->isAccepted() || !titlebarPositionUnderMouse()) { - invalidateDecorationDoubleClickTimer(); // click was for the deco and shall not init a doubleclick - } + if (event->isAccepted()) { + invalidateDecorationDoubleClickTimer(); // click was for the deco and shall not init a doubleclick } if (event->buttons() == Qt::NoButton) {