From 165fe9586c817bb31ca833841ad6e77104f09b6e Mon Sep 17 00:00:00 2001 From: xiaoyaobing Date: Sat, 24 Oct 2020 11:03:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=93=E5=BC=80=E5=A4=9A=E4=B8=AA?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=9C=A8=E6=A1=8C=E9=9D=A2=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E9=A2=84=E8=A7=88=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=AA=97=E5=8F=A3=E5=85=B3=E9=97=AD=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E7=AA=97=E5=8F=A3=E8=A2=AB=E5=85=B3=E9=97=AD?= =?UTF-8?q?=EF=BC=8C=E5=85=B6=E5=AE=83=E7=AA=97=E5=8F=A3=E8=A2=AB=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 中间预览窗口较特殊,点击关闭时中间预览和左侧首个预览,鼠标没有离开事件,修改为当点击中间和左侧首个预览窗口关闭按钮,发送关闭信号处理逻辑 Log: 修复任务栏打开多个窗口在桌面,在任务栏预览窗口点击窗口关闭按钮,窗口被关闭,其它窗口被隐藏 Bug: https://pms.uniontech.com/zentao/bug-view-48677.html Change-Id: Ief953f2501e75950374d7b617136641719186fa0 --- frame/item/components/appsnapshot.cpp | 2 ++ frame/item/components/appsnapshot.h | 1 + frame/item/components/previewcontainer.cpp | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index f97a80dcc..e5d235df2 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -108,6 +108,8 @@ void AppSnapshot::closeWindow() const e.xclient.data.l[0] = XInternAtom(display, "WM_DELETE_WINDOW", false); e.xclient.data.l[1] = CurrentTime; + Q_EMIT requestCloseAppSnapshot(); + XSendEvent(display, m_wid, false, NoEventMask, &e); XFlush(display); } diff --git a/frame/item/components/appsnapshot.h b/frame/item/components/appsnapshot.h index 9943cb565..ee1de0da4 100644 --- a/frame/item/components/appsnapshot.h +++ b/frame/item/components/appsnapshot.h @@ -68,6 +68,7 @@ signals: void entered(const WId wid) const; void clicked(const WId wid) const; void requestCheckWindow() const; + void requestCloseAppSnapshot() const; public slots: void fetchSnapshot(); diff --git a/frame/item/components/previewcontainer.cpp b/frame/item/components/previewcontainer.cpp index e4d91dfb4..2cc081586 100644 --- a/frame/item/components/previewcontainer.cpp +++ b/frame/item/components/previewcontainer.cpp @@ -120,6 +120,7 @@ void PreviewContainer::checkMouseLeave() m_needActivate = false; emit requestActivateWindow(m_floatingPreview->trackedWid()); } else { + Q_EMIT requestHidePopup(); emit requestCancelPreviewWindow(); } } @@ -170,6 +171,15 @@ void PreviewContainer::appendSnapWidget(const WId wid) connect(snap, &AppSnapshot::clicked, this, &PreviewContainer::onSnapshotClicked, Qt::QueuedConnection); connect(snap, &AppSnapshot::entered, this, &PreviewContainer::previewEntered, Qt::QueuedConnection); connect(snap, &AppSnapshot::requestCheckWindow, this, &PreviewContainer::requestCheckWindows, Qt::QueuedConnection); + connect(snap, &AppSnapshot::requestCloseAppSnapshot, this, [this](){ + if (!m_wmHelper->hasComposite()) + return ; + + if (m_currentWId != m_snapshots.lastKey()) { + Q_EMIT requestHidePopup(); + Q_EMIT requestCancelPreviewWindow(); + } + }); m_windowListLayout->addWidget(snap);