From cccb68b9417d863ff9977f1d1f89ea92999ad25f Mon Sep 17 00:00:00 2001 From: tanjingdong Date: Fri, 28 Jun 2024 16:57:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E5=90=91=E6=97=A5=E8=91=B5=E4=B8=AD?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=96=87=E7=AE=A1=E7=AA=97=E5=8F=A3=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E6=97=B6=E7=9B=B4=E6=8E=A5=E8=BF=9B=E5=85=A5=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AA=97=E5=8F=A3=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文管标题栏本身是可以击点拖动来移动窗口的,然后通过向日葵来点击(且没有move)时, 文管窗口会额外收到一个mouse move事件,于是就触发了移动窗口逻辑。 修改方法: 判断真实的mouse move距离,如果距离小于有效值就认为是无效的mouse move事件,不移动窗口。 Log: 修触发窗口移动条件 Bug: https://pms.uniontech.com/bug-view-261679.html Influence: 窗口移动 --- xcb/dnotitlebarwindowhelper.cpp | 6 ++++++ xcb/dnotitlebarwindowhelper.h | 1 + 2 files changed, 7 insertions(+) diff --git a/xcb/dnotitlebarwindowhelper.cpp b/xcb/dnotitlebarwindowhelper.cpp index 4007ef95..81c942d9 100644 --- a/xcb/dnotitlebarwindowhelper.cpp +++ b/xcb/dnotitlebarwindowhelper.cpp @@ -551,6 +551,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) // keeping the moving state, we can just reset ti back to normal. if (event->type() == QEvent::MouseButtonPress) { self->m_windowMoving = false; + m_pressPoint = dynamic_cast(event)->globalPos(); } if (is_mouse_move && !event->isAccepted()) { @@ -560,6 +561,11 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) return ret; } + QPointF delta = me->globalPos() - m_pressPoint; + if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) { + return ret; + } + if (!self->m_windowMoving && self->isEnableSystemMove(winId)) { self->m_windowMoving = true; diff --git a/xcb/dnotitlebarwindowhelper.h b/xcb/dnotitlebarwindowhelper.h index 88d78e8f..3ec4c8d1 100644 --- a/xcb/dnotitlebarwindowhelper.h +++ b/xcb/dnotitlebarwindowhelper.h @@ -124,6 +124,7 @@ private slots: bool m_enableBlurWindow = false; bool m_autoInputMaskByClipPath = false; DNativeSettings *m_settings; + QPointF m_pressPoint{0, 0}; static QHash mapped; From 61918568da9489121e1e2cc20eae09d4a6af8e9e Mon Sep 17 00:00:00 2001 From: tanjingdong Date: Thu, 4 Jul 2024 14:02:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E5=85=B1=E4=BA=AB=E5=BA=93=E4=BA=8C?= =?UTF-8?q?=E8=BF=9B=E5=88=B6=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 共享库二进制兼容 Log: 共享库二进制兼容 Bug: https://pms.uniontech.com/bug-view-261679.html --- xcb/dnotitlebarwindowhelper.cpp | 8 ++++++-- xcb/dnotitlebarwindowhelper.h | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xcb/dnotitlebarwindowhelper.cpp b/xcb/dnotitlebarwindowhelper.cpp index 81c942d9..e7b8486f 100644 --- a/xcb/dnotitlebarwindowhelper.cpp +++ b/xcb/dnotitlebarwindowhelper.cpp @@ -29,6 +29,8 @@ DPP_BEGIN_NAMESPACE QHash DNoTitlebarWindowHelper::mapped; +static QHash g_pressPoint; + DNoTitlebarWindowHelper::DNoTitlebarWindowHelper(QWindow *window, quint32 windowID) : QObject(window) , m_window(window) @@ -77,6 +79,8 @@ DNoTitlebarWindowHelper::DNoTitlebarWindowHelper(QWindow *window, quint32 window DNoTitlebarWindowHelper::~DNoTitlebarWindowHelper() { + g_pressPoint.remove(this); + if (VtableHook::hasVtable(m_window)) { VtableHook::resetVtable(m_window); } @@ -551,7 +555,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) // keeping the moving state, we can just reset ti back to normal. if (event->type() == QEvent::MouseButtonPress) { self->m_windowMoving = false; - m_pressPoint = dynamic_cast(event)->globalPos(); + g_pressPoint[this] = dynamic_cast(event)->globalPos(); } if (is_mouse_move && !event->isAccepted()) { @@ -561,7 +565,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) return ret; } - QPointF delta = me->globalPos() - m_pressPoint; + QPointF delta = me->globalPos() - g_pressPoint[this]; if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) { return ret; } diff --git a/xcb/dnotitlebarwindowhelper.h b/xcb/dnotitlebarwindowhelper.h index 3ec4c8d1..88d78e8f 100644 --- a/xcb/dnotitlebarwindowhelper.h +++ b/xcb/dnotitlebarwindowhelper.h @@ -124,7 +124,6 @@ private slots: bool m_enableBlurWindow = false; bool m_autoInputMaskByClipPath = false; DNativeSettings *m_settings; - QPointF m_pressPoint{0, 0}; static QHash mapped; From a2818d0c8678514f2b10c385dfc2199d6447da21 Mon Sep 17 00:00:00 2001 From: Ye ShanShan Date: Tue, 27 Aug 2024 13:57:45 +0800 Subject: [PATCH 3/3] fix: incorect window movement when selecting files missing reset pressPoint's state. Issue: https://github.com/linuxdeepin/developer-center/issues/10165 --- xcb/dnotitlebarwindowhelper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xcb/dnotitlebarwindowhelper.cpp b/xcb/dnotitlebarwindowhelper.cpp index e7b8486f..1a6b898d 100644 --- a/xcb/dnotitlebarwindowhelper.cpp +++ b/xcb/dnotitlebarwindowhelper.cpp @@ -542,6 +542,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) if (event->type() == QEvent::MouseButtonRelease) { self->m_windowMoving = false; Utility::updateMousePointForWindowMove(winId, true); + g_pressPoint.remove(this); } if (is_mouse_move && self->m_windowMoving) { @@ -558,7 +559,7 @@ bool DNoTitlebarWindowHelper::windowEvent(QEvent *event) g_pressPoint[this] = dynamic_cast(event)->globalPos(); } - if (is_mouse_move && !event->isAccepted()) { + if (is_mouse_move && !event->isAccepted() && g_pressPoint.contains(this)) { QMouseEvent *me = static_cast(event); QRect windowRect = QRect(QPoint(0, 0), w->size()); if (!windowRect.contains(me->windowPos().toPoint())) {