fix: 解决SNI应用左键弹出菜单后卡死的问题

将显示菜单的操作移动到主线程中实现

Log:
Influence: 安装新版QQ,左键点击托盘区的QQ,弹出菜单,观察菜单是否可用
Bug: https://pms.uniontech.com/task-view-233111.html
This commit is contained in:
donghualin 2022-12-30 15:50:31 +08:00 committed by deepin-bot[bot]
parent 0bfd5f5543
commit 92bb6933eb
2 changed files with 4 additions and 1 deletions

View File

@ -108,6 +108,8 @@ SNITrayWidget::SNITrayWidget(const QString &sniServicePath, QWidget *parent)
connect(m_sniInter, &StatusNotifierItem::OverlayIconPixmapChanged, this, &SNITrayWidget::onSNIOverlayIconPixmapChanged);
connect(m_sniInter, &StatusNotifierItem::StatusChanged, this, &SNITrayWidget::onSNIStatusChanged);
connect(this, &SNITrayWidget::requestShowMenu, this, &SNITrayWidget::showContextMenu);
// the following signals can be emit automatically
// need refresh cached properties in these slots
connect(m_sniInter, &StatusNotifierItem::NewIcon, [ = ] {
@ -160,7 +162,7 @@ void SNITrayWidget::sendClick(uint8_t mouseButton, int x, int y)
// primarily work for apps using libappindicator.
reply.waitForFinished();
if (reply.isError()) {
showContextMenu(x,y);
Q_EMIT requestShowMenu(x, y);
}
});
}

View File

@ -60,6 +60,7 @@ public:
Q_SIGNALS:
void statusChanged(SNITrayWidget::ItemStatus status);
void requestShowMenu(int x, int y);
private Q_SLOTS:
void initSNIPropertys();