diff --git a/src/private/FloatingWindow.cpp b/src/private/FloatingWindow.cpp index 24870115..c0079de1 100644 --- a/src/private/FloatingWindow.cpp +++ b/src/private/FloatingWindow.cpp @@ -275,6 +275,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 3fde757a..1e55477d 100644 --- a/src/private/FloatingWindow_p.h +++ b/src/private/FloatingWindow_p.h @@ -53,6 +53,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. * @@ -149,6 +154,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 2dd99776..ab084697 100644 --- a/src/private/WidgetResizeHandler.cpp +++ b/src/private/WidgetResizeHandler.cpp @@ -262,6 +262,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)) {