mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
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:
parent
65c0c0f311
commit
1a455503d9
1
.gerrit_sources_list
Normal file
1
.gerrit_sources_list
Normal file
@ -0,0 +1 @@
|
|||||||
|
deb [trusted=yes] http://shuttle.corp.deepin.com/cache/repos/eagle-sp3/release-candidate/RERF5byA5Y-R5rWL6K-VMTE5OQ unstable main contrib
|
@ -75,6 +75,7 @@ MainPanelControl::MainPanelControl(QWidget *parent)
|
|||||||
, m_appSpliter(new QLabel(this))
|
, m_appSpliter(new QLabel(this))
|
||||||
, m_traySpliter(new QLabel(this))
|
, m_traySpliter(new QLabel(this))
|
||||||
, m_isHover(false)
|
, m_isHover(false)
|
||||||
|
, m_needRecoveryWin(false)
|
||||||
, m_isEnableLaunch(true)
|
, m_isEnableLaunch(true)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
@ -568,9 +569,17 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event)
|
|||||||
|
|
||||||
if (watched == m_desktopWidget) {
|
if (watched == m_desktopWidget) {
|
||||||
if (event->type() == QEvent::Enter) {
|
if (event->type() == QEvent::Enter) {
|
||||||
|
if (checkNeedShowDesktop()) {
|
||||||
|
m_needRecoveryWin = true;
|
||||||
|
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||||
|
}
|
||||||
m_isHover = true;
|
m_isHover = true;
|
||||||
update();
|
update();
|
||||||
} else if (event->type() == QEvent::Leave) {
|
} else if (event->type() == QEvent::Leave) {
|
||||||
|
// 鼠标移入时隐藏了窗口,移出时恢复
|
||||||
|
if (m_needRecoveryWin) {
|
||||||
|
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||||
|
}
|
||||||
m_isHover = false;
|
m_isHover = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -629,8 +638,11 @@ void MainPanelControl::mousePressEvent(QMouseEvent *e)
|
|||||||
m_mousePressPos = e->globalPos();
|
m_mousePressPos = e->globalPos();
|
||||||
|
|
||||||
QRect rect(m_desktopWidget->pos(), m_desktopWidget->size());
|
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");
|
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget::mousePressEvent(e);
|
QWidget::mousePressEvent(e);
|
||||||
@ -1103,3 +1115,20 @@ void MainPanelControl::updateFixedAreaIcon()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief MainPanelControl::checkNeedShowDesktop 根据窗管提供接口(当前是否显示的桌面),提供鼠标
|
||||||
|
* 移入 显示桌面窗口 区域时,是否需要显示桌面判断依据
|
||||||
|
* @return 窗管返回 当前是桌面 或 窗管接口查询失败 返回false,否则true
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@ -103,7 +103,7 @@ private:
|
|||||||
void resizeDesktopWidget();
|
void resizeDesktopWidget();
|
||||||
|
|
||||||
void updateFixedAreaIcon();
|
void updateFixedAreaIcon();
|
||||||
|
bool checkNeedShowDesktop();
|
||||||
public slots:
|
public slots:
|
||||||
void insertItem(const int index, DockItem *item);
|
void insertItem(const int index, DockItem *item);
|
||||||
void removeItem(DockItem *item);
|
void removeItem(DockItem *item);
|
||||||
@ -140,6 +140,7 @@ private:
|
|||||||
int m_trayIconCount;
|
int m_trayIconCount;
|
||||||
TrayPluginItem *m_tray = nullptr;
|
TrayPluginItem *m_tray = nullptr;
|
||||||
bool m_isHover;//判断鼠标是否移到desktop区域
|
bool m_isHover;//判断鼠标是否移到desktop区域
|
||||||
|
bool m_needRecoveryWin; // 判断鼠标移出desktop区域是否恢复之前窗口
|
||||||
bool m_isEnableLaunch;//判断是否使能了com.deepin.dde.dock.module.launcher
|
bool m_isEnableLaunch;//判断是否使能了com.deepin.dde.dock.module.launcher
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user