From 3e1d5c555107b229c7d893a47688def000bbdd3a Mon Sep 17 00:00:00 2001 From: donghualin Date: Sat, 14 Jan 2023 22:09:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=AB=98=E6=95=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:高效模式和时尚模式分别创建了各自的XEmbedTrayItemWidget对象,时尚模式后创建这个对象,在创建这个对象的构造函数中会把QX11Info::connection与容器的id进行配对组合,导致后创建的对象替换了先创建对象的容器id与QX11Info::connection的映射,在点击先创建对象的时候,无法找到对应的匹配关系,导致无法打开XEmbedTrayItemWidget协议对应的窗口 修改:在构造函数不再创建映射,在当前窗口showEvent事件中再对容器id和QX11Info::connection进行映射,这样在点击窗口图标的时候可以打开正确的窗口 Log: 修复高效模式下无法打开企业微信的问题 Influence: 进入高效模式,打开企业微信和微信等应用,观察是否正常打开窗口 Bug: https://pms.uniontech.com/bug-view-182065.html Change-Id: I41be68e5ac798f1f7dc34f71652e757247595e06 --- .../tray/widgets/xembedtrayitemwidget.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frame/window/tray/widgets/xembedtrayitemwidget.cpp b/frame/window/tray/widgets/xembedtrayitemwidget.cpp index 3a8c7ad74..a5ea550ba 100644 --- a/frame/window/tray/widgets/xembedtrayitemwidget.cpp +++ b/frame/window/tray/widgets/xembedtrayitemwidget.cpp @@ -124,6 +124,13 @@ void XEmbedTrayItemWidget::showEvent(QShowEvent *e) { QWidget::showEvent(e); + xcb_connection_t *connection = IS_WAYLAND_DISPLAY ? m_xcbCnn : QX11Info::connection(); + if (connection) { + xcb_map_window(connection, m_containerWid); + + xcb_reparent_window(connection, m_windowId, m_containerWid, 0, 0); + } + m_updateTimer->start(); } @@ -260,11 +267,13 @@ void XEmbedTrayItemWidget::wrapWindow() xcb_flush(c); - xcb_map_window(c, m_containerWid); + if (isVisible()) { + xcb_map_window(c, m_containerWid); - xcb_reparent_window(c, m_windowId, - m_containerWid, - 0, 0); + xcb_reparent_window(c, m_windowId, + m_containerWid, + 0, 0); + } /* * Render the embedded window offscreen