diff --git a/src/private/FloatingWindow.cpp b/src/private/FloatingWindow.cpp index 2dab0eec..1345cd1d 100644 --- a/src/private/FloatingWindow.cpp +++ b/src/private/FloatingWindow.cpp @@ -297,6 +297,14 @@ MultiSplitter *FloatingWindow::multiSplitter() const bool FloatingWindow::isInDragArea(QPoint globalPoint) const { +#ifdef Q_OS_WIN + // A click near the border will still send a Qt::NonClientMousePressEvent. We shouldn't + // interpret that as a drag, as it's for a native resize. + // Keep track of how we handled the WM_NCHITTEST + if (m_lastHitTest != 0 && m_lastHitTest != HTCAPTION) + return false; +#endif + return dragRect().contains(globalPoint); } diff --git a/src/private/FloatingWindow_p.h b/src/private/FloatingWindow_p.h index c4bbb0c0..2f45fac8 100644 --- a/src/private/FloatingWindow_p.h +++ b/src/private/FloatingWindow_p.h @@ -55,6 +55,11 @@ public: const Frame::List frames() const; DropArea *dropArea() const { return m_dropArea; } +#ifdef Q_OS_WIN + void setLastHitTest(int hitTest) { + m_lastHitTest = hitTest; + } +#endif /** * @brief Returns the title bar. * @@ -153,6 +158,9 @@ private: bool m_updatingTitleBarVisibility = false; QMetaObject::Connection m_layoutDestroyedConnection; QAbstractNativeEventFilter *m_nchittestFilter = nullptr; +#ifdef Q_OS_WIN + int m_lastHitTest = 0; +#endif }; } diff --git a/src/private/WidgetResizeHandler.cpp b/src/private/WidgetResizeHandler.cpp index 26ad7f1f..acf87e1c 100644 --- a/src/private/WidgetResizeHandler.cpp +++ b/src/private/WidgetResizeHandler.cpp @@ -257,6 +257,7 @@ bool WidgetResizeHandler::handleWindowsNativeEvent(FloatingWindow *w, const QByt } } + w->setLastHitTest(*result); return *result != 0; } else if (msg->message == WM_NCLBUTTONDBLCLK) { if ((Config::self().flags() & Config::Flag_DoubleClickMaximizes)) {