feat: 任务栏显示桌面窗口优化

根据窗管给的接口,处理鼠标移入显示桌面窗口时,进行窗口显示处理

Log: 增加鼠标移入显示桌面窗口时显示桌面处理
Task: https://pms.uniontech.com/zentao/task-view-30902.html
Change-Id: I27121ada8c041277a9734a3398af2633830ef5ad
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/762
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: wangwei <wangwei@uniontech.com>
Tested-by: <mailman@uniontech.com>
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/914
Reviewed-by: gerrit <gerrit@uniontech.com>
Reviewed-by: niecheng <niecheng@uniontech.com>
This commit is contained in:
liuxing 2020-07-28 14:42:16 +08:00 committed by niecheng
parent 65c0c0f311
commit 1a455503d9
3 changed files with 33 additions and 2 deletions

1
.gerrit_sources_list Normal file
View File

@ -0,0 +1 @@
deb [trusted=yes] http://shuttle.corp.deepin.com/cache/repos/eagle-sp3/release-candidate/RERF5byA5Y-R5rWL6K-VMTE5OQ unstable main contrib

View File

@ -75,6 +75,7 @@ MainPanelControl::MainPanelControl(QWidget *parent)
, m_appSpliter(new QLabel(this))
, m_traySpliter(new QLabel(this))
, m_isHover(false)
, m_needRecoveryWin(false)
, m_isEnableLaunch(true)
{
init();
@ -568,9 +569,17 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
if (watched == m_desktopWidget) {
if (event->type() == QEvent::Enter) {
if (checkNeedShowDesktop()) {
m_needRecoveryWin = true;
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
}
m_isHover = true;
update();
} else if (event->type() == QEvent::Leave) {
// 鼠标移入时隐藏了窗口,移出时恢复
if (m_needRecoveryWin) {
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
}
m_isHover = false;
update();
}
@ -629,8 +638,11 @@ void MainPanelControl::mousePressEvent(QMouseEvent *e)
m_mousePressPos = e->globalPos();
QRect rect(m_desktopWidget->pos(), m_desktopWidget->size());
if (rect.contains(e->pos()))
if (rect.contains(e->pos())) {
// 手动点击 显示桌面窗口 后,鼠标移出时不再调用显/隐窗口进程,以手动点击设置为准
m_needRecoveryWin = false;
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
}
}
QWidget::mousePressEvent(e);
@ -1103,3 +1115,20 @@ void MainPanelControl::updateFixedAreaIcon()
}
}
/**
* @brief MainPanelControl::checkNeedShowDesktop
*
* @return falsetrue
*/
bool MainPanelControl::checkNeedShowDesktop()
{
QDBusInterface wmInter("com.deepin.wm", "/com/deepin/wm", "com.deepin.wm");
QList<QVariant> argumentList;
QDBusMessage reply = wmInter.callWithArgumentList(QDBus::Block, QStringLiteral("GetIsShowDesktop"), argumentList);
if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 1) {
return !reply.arguments().at(0).toBool();
}
qDebug() << "wm call GetIsShowDesktop fail, res:" << reply.type();
return false;
}

View File

@ -103,7 +103,7 @@ private:
void resizeDesktopWidget();
void updateFixedAreaIcon();
bool checkNeedShowDesktop();
public slots:
void insertItem(const int index, DockItem *item);
void removeItem(DockItem *item);
@ -140,6 +140,7 @@ private:
int m_trayIconCount;
TrayPluginItem *m_tray = nullptr;
bool m_isHover;//判断鼠标是否移到desktop区域
bool m_needRecoveryWin; // 判断鼠标移出desktop区域是否恢复之前窗口
bool m_isEnableLaunch;//判断是否使能了com.deepin.dde.dock.module.launcher
};