fix: 增加设置是否显示最近打开区域的接口

1.增加本地配置,并增加bool类型变量来表示是否显示最近打开应用
2.在应用打开或者退出的时候,根据是否显示最近打开应用的配置来决定是否显示当前应用图标

Log: 增加是否显示最近打开应用接口
Influence: 时尚模式下,调用setShowRecent接口,观察任务栏是否显示最近打开应用
Bug: https://pms.uniontech.com/bug-view-147717.html
Change-Id: I9e2f8a8ea74bf4deb2f1db9af8b87ff1827c2297
This commit is contained in:
donghualin 2022-08-04 13:22:22 +00:00
parent 2a226a1016
commit d7d2f252b7
14 changed files with 356 additions and 163 deletions

View File

@ -151,6 +151,16 @@
"description": "The apps which has been opened recently when dock is started",
"permissions": "readwrite",
"visibility": "private"
},
"Show_Recent": {
"value": false,
"serial": 0,
"flags": [],
"name": "Show_Recent",
"name[zh_CN]": "*****",
"description": "show or hide recent app in dock",
"permissions": "readwrite",
"visibility": "private"
}
}
}

View File

@ -42,6 +42,7 @@ const QString keyOpacity = "Opacity";
const QString keyPluginSettings = "Plugin_Settings";
const QString keyForceQuitApp = "Force_Quit_App";
const QString keyRecentApp = "Recent_App";
const QString keyShowRecent = "Show_Recent";
const QString scratchDir = QDir::homePath() + "/.local/dock/scratch/";

View File

@ -34,6 +34,7 @@ DBusAdaptorDock::DBusAdaptorDock(QObject *parent)
connect(dock, &Dock::entryRemoved, this, &DBusAdaptorDock::EntryRemoved);
connect(dock, &Dock::hideStateChanged, this, &DBusAdaptorDock::HideStateChanged);
connect(dock, &Dock::frontendWindowRectChanged, this, &DBusAdaptorDock::FrontendWindowRectChanged);
connect(dock, &Dock::showRecentChanged, this, &DBusAdaptorDock::showRecentChanged);
}
}
@ -174,6 +175,11 @@ void DBusAdaptorDock::setShowTimeout(uint value)
}
}
bool DBusAdaptorDock::showRecent() const
{
return parent()->showRecent();
}
Dock *DBusAdaptorDock::parent() const
{
return static_cast<Dock *>(QObject::parent());
@ -245,6 +251,11 @@ bool DBusAdaptorDock::RequestUndock(const QString &desktopFile)
return parent()->requestUndock(desktopFile);
}
void DBusAdaptorDock::SetShowRecent(bool visible)
{
parent()->setShowRecent(visible);
}
void DBusAdaptorDock::SetFrontendWindowRect(int x, int y, uint width, uint height)
{
parent()->setFrontendWindowRect(x, y, width, height);

View File

@ -93,6 +93,9 @@ class DBusAdaptorDock: public QDBusAbstractAdaptor
" <arg direction=\"in\" type=\"s\" name=\"desktopFile\"/>\n"
" <arg direction=\"out\" type=\"b\" name=\"ok\"/>\n"
" </method>\n"
" <method name=\"SetShowRecent\">\n"
" <arg direction=\"in\" type=\"b\" name=\"visible\"/>\n"
" </method>\n"
" <method name=\"SetFrontendWindowRect\">\n"
" <arg direction=\"in\" type=\"i\" name=\"x\"/>\n"
" <arg direction=\"in\" type=\"i\" name=\"y\"/>\n"
@ -120,6 +123,7 @@ class DBusAdaptorDock: public QDBusAbstractAdaptor
" <property access=\"readwrite\" type=\"i\" name=\"Position\"/>\n"
" <property access=\"readwrite\" type=\"u\" name=\"IconSize\"/>\n"
" <property access=\"read\" type=\"as\" name=\"DockedApps\"/>\n"
" <property access=\"read\" type=\"b\" name=\"ShowRecent\"/>\n"
" </interface>\n"
"")
public:
@ -174,6 +178,9 @@ public: // PROPERTIES
uint showTimeout() const;
void setShowTimeout(uint value);
Q_PROPERTY(bool ShowRecent READ showRecent NOTIFY showRecentChanged)
bool showRecent() const;
Dock *parent() const;
public Q_SLOTS: // METHODS
@ -190,6 +197,7 @@ public Q_SLOTS: // METHODS
void RemovePluginSettings(QString key1, QStringList key2List);
bool RequestDock(const QString &desktopFile, int index);
bool RequestUndock(const QString &desktopFile);
void SetShowRecent(bool visible);
void SetFrontendWindowRect(int x, int y, uint width, uint height);
Q_SIGNALS: // SIGNALS
@ -210,6 +218,7 @@ Q_SIGNALS: // SIGNALS
void ShowTimeoutChanged(uint value) const;
void WindowSizeEfficientChanged(uint value) const;
void WindowSizeFashionChanged(uint value) const;
void showRecentChanged(bool) const;
};
#endif

View File

@ -44,6 +44,7 @@ DBusAdaptorEntry::DBusAdaptorEntry(QObject *parent)
connect(entry, &Entry::desktopFileChanged, this, &DBusAdaptorEntry::DesktopFileChanged);
connect(entry, &Entry::currentWindowChanged, this, &DBusAdaptorEntry::CurrentWindowChanged);
connect(entry, &Entry::windowInfosChanged, this, &DBusAdaptorEntry::WindowInfosChanged);
connect(entry, &Entry::modeChanged, this, &DBusAdaptorEntry::ModeChanged);
}
}
@ -81,6 +82,11 @@ bool DBusAdaptorEntry::isDocked() const
return parent()->getIsDocked();
}
int DBusAdaptorEntry::mode() const
{
return parent()->mode();
}
QString DBusAdaptorEntry::menu() const
{
return parent()->getMenu();

View File

@ -78,6 +78,7 @@ class DBusAdaptorEntry: public QDBusAbstractAdaptor
" <property access=\"read\" type=\"s\" name=\"Menu\"/>\n"
" <property access=\"read\" type=\"s\" name=\"DesktopFile\"/>\n"
" <property access=\"read\" type=\"a{u(sb)}\" name=\"WindowInfos\"/>\n"
" <property access=\"read\" type=\"i\" name=\"Mode\"/>\n"
" <annotation value=\"WindowInfoMap\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
" </interface>\n"
"")
@ -114,6 +115,9 @@ public: // PROPERTIES
Q_PROPERTY(WindowInfoMap WindowInfos READ windowInfos NOTIFY WindowInfosChanged)
WindowInfoMap windowInfos();
Q_PROPERTY(int Mode READ mode NOTIFY ModeChanged)
int mode() const;
Entry *parent() const;
public Q_SLOTS: // METHODS
@ -137,6 +141,7 @@ Q_SIGNALS: // SIGNALS
void DesktopFileChanged(const QString &value) const;
void CurrentWindowChanged(uint32_t value) const;
void WindowInfosChanged(WindowInfoMap value) const;
void ModeChanged(int value) const;
};
#endif

View File

@ -41,15 +41,15 @@
Dock::Dock(QObject *parent)
: SynModule(parent)
, entriesSum(0)
, windowIdentify(new WindowIdentify(this))
, entries(new Entries(this))
, ddeLauncherVisible(false)
, hideState(HideState::Unknown)
, activeWindow(nullptr)
, activeWindowOld(nullptr)
, dbusHandler(new DBusHandler(this))
, windowOperateMutex(QMutex(QMutex::NonRecursive))
, m_entriesSum(0)
, m_windowIdentify(new WindowIdentify(this))
, m_entries(new Entries(this))
, m_ddeLauncherVisible(false)
, m_hideState(HideState::Unknown)
, m_activeWindow(nullptr)
, m_activeWindowOld(nullptr)
, m_dbusHandler(new DBusHandler(this))
, m_windowOperateMutex(QMutex(QMutex::NonRecursive))
{
registeModule("dock");
@ -57,35 +57,35 @@ Dock::Dock(QObject *parent)
qInfo() << "sessionType=" << sessionType;
if (sessionType.contains("wayland")) {
// wayland env
isWayland = true;
waylandManager = new WaylandManager(this);
dbusHandler->listenWaylandWMSignals();
m_isWayland = true;
m_waylandManager = new WaylandManager(this);
m_dbusHandler->listenWaylandWMSignals();
} else if (sessionType.contains("x11")) {
// x11 env
isWayland = false;
x11Manager = new X11Manager(this);
m_isWayland = false;
m_x11Manager = new X11Manager(this);
}
initSettings();
initEntries();
// 初始化智能隐藏定时器
smartHideTimer = new QTimer(this);
smartHideTimer->setSingleShot(true);
connect(smartHideTimer, &QTimer::timeout, this, &Dock::smartHideModeTimerExpired);
m_smartHideTimer = new QTimer(this);
m_smartHideTimer->setSingleShot(true);
connect(m_smartHideTimer, &QTimer::timeout, this, &Dock::smartHideModeTimerExpired);
if (!isWayland) {
if (!m_isWayland) {
std::thread thread([&] {
// Xlib方式
x11Manager->listenXEventUseXlib();
m_x11Manager->listenXEventUseXlib();
// XCB方式
//listenXEventUseXCB();
});
thread.detach();
x11Manager->listenRootWindowXEvent();
connect(x11Manager, &X11Manager::requestUpdateHideState, this, &Dock::updateHideState);
connect(x11Manager, &X11Manager::requestHandleActiveWindowChange, this, &Dock::handleActiveWindowChanged);
connect(x11Manager, &X11Manager::requestAttachOrDetachWindow, this, &Dock::attachOrDetachWindow);
m_x11Manager->listenRootWindowXEvent();
connect(m_x11Manager, &X11Manager::requestUpdateHideState, this, &Dock::updateHideState);
connect(m_x11Manager, &X11Manager::requestHandleActiveWindowChange, this, &Dock::handleActiveWindowChanged);
connect(m_x11Manager, &X11Manager::requestAttachOrDetachWindow, this, &Dock::attachOrDetachWindow);
}
}
@ -180,10 +180,11 @@ bool Dock::dockEntry(Entry *entry, bool moveToEnd)
// 如果是最近打开应用通过右键菜单的方式驻留且当前是时尚模式那么就让entry驻留到末尾
if (moveToEnd && SETTING->getDisplayMode() == DisplayMode::Fashion)
entries->moveEntryToLast(entry);
m_entries->moveEntryToLast(entry);
entry->setPropIsDocked(true);
entry->updateMenu();
entry->updateMode();
return true;
}
@ -218,6 +219,8 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
}
if (entry->hasWindow()) {
// 移除驻留后,如果当前应用存在子窗口,那么会将移除最近使用应用中最后一个没有子窗口的窗口
m_entries->removeLastRecent();
if (desktopFile.contains(scratchDir) && entry->getCurrentWindowInfo()) {
QFileInfo info(desktopFile);
QString baseName = info.baseName();
@ -229,7 +232,7 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
} else {
// desktop base starts with d:
QString innerId;
AppInfo *app = windowIdentify->identifyWindow(entry->getCurrentWindowInfo(), innerId);
AppInfo *app = m_windowIdentify->identifyWindow(entry->getCurrentWindowInfo(), innerId);
// TODO update entry's innerId
entry->setApp(app);
entry->setInnerId(innerId);
@ -237,7 +240,7 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
}
// 如果存在窗口,在时尚模式下,就会移动到最近打开区域,此时让它移动到最后
if (moveToEnd && SETTING->getDisplayMode() == DisplayMode::Fashion)
entries->moveEntryToLast(entry);
m_entries->moveEntryToLast(entry);
entry->updateIcon();
entry->setPropIsDocked(false);
@ -248,6 +251,8 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
removeAppEntry(entry);
}
// 更新模式, 是在应用区域还是在最近打开区域
entry->updateMode();
saveDockedApps();
}
@ -257,7 +262,7 @@ void Dock::undockEntry(Entry *entry, bool moveToEnd)
*/
QString Dock::allocEntryId()
{
return QString("e%1T%2").arg(++entriesSum).arg(QString::number(QDateTime::currentSecsSinceEpoch(), 16));
return QString("e%1T%2").arg(++m_entriesSum).arg(QString::number(QDateTime::currentSecsSinceEpoch(), 16));
}
/**
@ -269,8 +274,8 @@ bool Dock::shouldShowOnDock(WindowInfoBase *info)
{
if (info->getWindowType() == "X11") {
XWindow winId = info->getXid();
bool isReg = !!x11Manager->findWindowByXid(winId);
bool isContainedInClientList = clientList.indexOf(winId) != -1;
bool isReg = m_x11Manager->findWindowByXid(winId);
bool isContainedInClientList = m_clientList.indexOf(winId) != -1;
bool shouldSkip = info->shouldSkip();
bool isGood = XCB->isGoodWindow(winId);
qInfo() << "shouldShowOnDock X11: isReg:" << isReg << " isContainedInClientList:" << isContainedInClientList << " shouldSkip:" << shouldSkip << " isGood:" << isGood;
@ -289,7 +294,7 @@ bool Dock::shouldShowOnDock(WindowInfoBase *info)
*/
void Dock::setDdeLauncherVisible(bool visible)
{
ddeLauncherVisible = visible;
m_ddeLauncherVisible = visible;
}
/**
@ -298,7 +303,7 @@ void Dock::setDdeLauncherVisible(bool visible)
*/
QString Dock::getWMName()
{
return wmName;
return m_wmName;
}
/**
@ -307,7 +312,7 @@ QString Dock::getWMName()
*/
void Dock::setWMName(QString name)
{
wmName = name;
m_wmName = name;
}
/**
@ -335,7 +340,7 @@ QByteArray Dock::getSyncConfig()
*/
PlasmaWindow *Dock::createPlasmaWindow(QString objPath)
{
return dbusHandler->createPlasmaWindow(objPath);
return m_dbusHandler->createPlasmaWindow(objPath);
}
/**
@ -344,7 +349,7 @@ PlasmaWindow *Dock::createPlasmaWindow(QString objPath)
*/
void Dock::listenKWindowSignals(WindowInfoK *windowInfo)
{
dbusHandler->listenKWindowSignals(windowInfo);
m_dbusHandler->listenKWindowSignals(windowInfo);
}
/**
@ -353,7 +358,7 @@ void Dock::listenKWindowSignals(WindowInfoK *windowInfo)
*/
void Dock::removePlasmaWindowHandler(PlasmaWindow *window)
{
dbusHandler->removePlasmaWindowHandler(window);
m_dbusHandler->removePlasmaWindowHandler(window);
}
/**
@ -362,7 +367,7 @@ void Dock::removePlasmaWindowHandler(PlasmaWindow *window)
*/
void Dock::presentWindows(QList<uint> windows)
{
dbusHandler->presentWindows(windows);
m_dbusHandler->presentWindows(windows);
}
/**
@ -393,13 +398,11 @@ bool Dock::isActiveWindow(const WindowInfoBase *win)
*/
WindowInfoBase *Dock::getActiveWindow()
{
WindowInfoBase *ret = nullptr;
if (!activeWindow)
ret = activeWindowOld;
else
ret = activeWindow;
if (!m_activeWindow)
return m_activeWindowOld;
return m_activeWindow;
return ret;
}
void Dock::doActiveWindow(XWindow xid)
@ -428,7 +431,7 @@ void Dock::doActiveWindow(XWindow xid)
*/
QList<XWindow> Dock::getClientList()
{
return QList<XWindow>(clientList);
return QList<XWindow>(m_clientList);
}
/**
@ -436,7 +439,7 @@ QList<XWindow> Dock::getClientList()
*/
void Dock::setClientList(QList<XWindow> value)
{
clientList = value;
m_clientList = value;
}
/**
@ -446,8 +449,8 @@ void Dock::setClientList(QList<XWindow> value)
void Dock::closeWindow(uint32_t windowId)
{
qInfo() << "Close Window " << windowId;
if (isWayland) {
WindowInfoK *info = waylandManager->findWindowByXid(windowId);
if (m_isWayland) {
WindowInfoK *info = m_waylandManager->findWindowByXid(windowId);
if (info)
info->close(0);
} else {
@ -461,7 +464,7 @@ void Dock::closeWindow(uint32_t windowId)
*/
QStringList Dock::getEntryIDs()
{
return entries->getEntryIDs();
return m_entries->getEntryIDs();
}
/**
@ -473,15 +476,15 @@ QStringList Dock::getEntryIDs()
*/
void Dock::setFrontendWindowRect(int32_t x, int32_t y, uint width, uint height)
{
if (frontendWindowRect == QRect(x, y, width, height)) {
if (m_frontendWindowRect == QRect(x, y, width, height)) {
qInfo() << "SetFrontendWindowRect: no changed";
return;
}
frontendWindowRect.setX(x);
frontendWindowRect.setY(y);
frontendWindowRect.setWidth(width);
frontendWindowRect.setHeight(height);
m_frontendWindowRect.setX(x);
m_frontendWindowRect.setY(y);
m_frontendWindowRect.setWidth(width);
m_frontendWindowRect.setHeight(height);
updateHideState(false);
Q_EMIT frontendWindowRectChanged();
@ -514,7 +517,7 @@ bool Dock::requestDock(QString desktopFile, int index)
}
bool newCreated = false;
Entry *entry = entries->getByInnerId(app->getInnerId());
Entry *entry = m_entries->getByInnerId(app->getInnerId());
if (!entry) {
newCreated = true;
entry = new Entry(this, app, app->getInnerId());
@ -525,7 +528,7 @@ bool Dock::requestDock(QString desktopFile, int index)
if (newCreated) {
entry->startExport();
entries->append(entry);
m_entries->append(entry);
}
saveDockedApps();
@ -547,6 +550,20 @@ bool Dock::requestUndock(QString desktopFile)
return true;
}
void Dock::setShowRecent(bool visible)
{
if (visible == m_showRecent)
return;
SETTING->setShowRecent(visible);
onShowRecentChanged(visible);
}
bool Dock::showRecent() const
{
return m_showRecent;
}
/**
* @brief Dock::moveEntry
* @param oldIndex
@ -554,7 +571,7 @@ bool Dock::requestUndock(QString desktopFile)
*/
void Dock::moveEntry(int oldIndex, int newIndex)
{
entries->move(oldIndex, newIndex);
m_entries->move(oldIndex, newIndex);
saveDockedApps();
}
@ -565,7 +582,7 @@ void Dock::moveEntry(int oldIndex, int newIndex)
*/
bool Dock::isOnDock(QString desktopFile)
{
return !!entries->getByDesktopFilePath(desktopFile);
return m_entries->getByDesktopFilePath(desktopFile);
}
/**
@ -575,7 +592,7 @@ bool Dock::isOnDock(QString desktopFile)
*/
QString Dock::queryWindowIdentifyMethod(XWindow windowId)
{
return entries->queryWindowIdentifyMethod(windowId);
return m_entries->queryWindowIdentifyMethod(windowId);
}
/**
@ -585,7 +602,7 @@ QString Dock::queryWindowIdentifyMethod(XWindow windowId)
QStringList Dock::getDockedAppsDesktopFiles()
{
QStringList ret;
for (auto entry: entries->filterDockedEntries()) {
for (auto entry: m_entries->filterDockedEntries()) {
ret << entry->getFileName();
}
@ -645,8 +662,8 @@ void Dock::smartHideModeTimerExpired()
void Dock::initSettings()
{
qInfo() << "init dock settings";
forceQuitAppStatus = SETTING->getForceQuitAppMode();
connect(SETTING, &DockSettings::hideModeChanged, this, [&](HideMode mode) {
m_forceQuitAppStatus = SETTING->getForceQuitAppMode();
connect(SETTING, &DockSettings::hideModeChanged, this, [ this ](HideMode mode) {
this->updateHideState(false);
});
connect(SETTING, &DockSettings::displayModeChanged, this, [](DisplayMode mode) {
@ -655,19 +672,12 @@ void Dock::initSettings()
connect(SETTING, &DockSettings::positionModeChanged, this, [](PositionMode mode) {
qInfo() << "position mode change to " << static_cast<int>(mode);
});
connect(SETTING, &DockSettings::forceQuitAppChanged, this, [&](ForceQuitAppMode mode) {
connect(SETTING, &DockSettings::forceQuitAppChanged, this, [ this ](ForceQuitAppMode mode) {
qInfo() << "forceQuitApp change to " << int(mode);
forceQuitAppStatus = mode;
entries->updateEntriesMenu();
m_forceQuitAppStatus = mode;
m_entries->updateEntriesMenu();
});
}
/**
* @brief Dock::updateMenu TODO
*/
void Dock::updateMenu()
{
connect(SETTING, &DockSettings::showRecentChanged, this, &Dock::onShowRecentChanged);
}
/**
@ -684,6 +694,8 @@ void Dock::initEntries()
*/
void Dock::loadAppInfos()
{
// 读取是否显示最近打开应用
m_showRecent = SETTING->showRecent();
// 初始化驻留应用信息和最近使用的应用的信息
auto loadApps = [ this ](const QStringList &apps, bool isDocked) {
for (const QString &app : apps) {
@ -697,7 +709,7 @@ void Dock::loadAppInfos()
entryObj->setIsDocked(isDocked);
entryObj->updateMenu();
entryObj->startExport();
entries->append(entryObj);
m_entries->append(entryObj);
}
};
@ -718,8 +730,8 @@ void Dock::loadAppInfos()
*/
void Dock::initClientList()
{
if (isWayland) {
dbusHandler->loadClientList();
if (m_isWayland) {
m_dbusHandler->loadClientList();
} else {
QList<XWindow> clients;
for (auto c : XCB->instance()->getClientList())
@ -727,9 +739,9 @@ void Dock::initClientList()
// 依次注册窗口
qSort(clients.begin(), clients.end());
clientList = clients;
for (auto winId : clientList) {
WindowInfoX *winInfo = x11Manager->registerWindow(winId);
m_clientList = clients;
for (auto winId : m_clientList) {
WindowInfoX *winInfo = m_x11Manager->registerWindow(winId);
attachOrDetachWindow(static_cast<WindowInfoBase *>(winInfo));
}
}
@ -742,7 +754,7 @@ void Dock::initClientList()
*/
WindowInfoX *Dock::findWindowByXidX(XWindow xid)
{
return x11Manager->findWindowByXid(xid);
return m_x11Manager->findWindowByXid(xid);
}
/**
@ -752,7 +764,7 @@ WindowInfoX *Dock::findWindowByXidX(XWindow xid)
*/
WindowInfoK *Dock::findWindowByXidK(XWindow xid)
{
return waylandManager->findWindowByXid(xid);
return m_waylandManager->findWindowByXid(xid);
}
/**
@ -796,7 +808,7 @@ bool Dock::isWindowDockOverlapX(XWindow xid)
// 检查窗口和任务栏窗口是否存在重叠
auto winRect = XCB->getWindowGeometry(xid);
return hasInterSectionX(winRect, frontendWindowRect);
return hasInterSectionX(winRect, m_frontendWindowRect);
}
/**
@ -842,7 +854,7 @@ bool Dock::isWindowDockOverlapK(WindowInfoBase *info)
return false;
}
return hasInterSectionK(rect, frontendWindowRect);
return hasInterSectionK(rect, m_frontendWindowRect);
}
/**
@ -875,7 +887,7 @@ bool Dock::hasInterSectionK(const DockRect &windowRect, QRect dockRect)
*/
Entry *Dock::getDockedEntryByDesktopFile(const QString &desktopFile)
{
return entries->getDockedEntryByDesktopFile(desktopFile);
return m_entries->getDockedEntryByDesktopFile(desktopFile);
}
/**
@ -884,11 +896,11 @@ Entry *Dock::getDockedEntryByDesktopFile(const QString &desktopFile)
*/
bool Dock::shouldHideOnSmartHideMode()
{
if (!activeWindow || ddeLauncherVisible)
if (!m_activeWindow || m_ddeLauncherVisible)
return false;
if (!isWayland) {
XWindow activeWinId = activeWindow->getXid();
if (!m_isWayland) {
XWindow activeWinId = m_activeWindow->getXid();
// dde launcher is invisible, but it is still active window
WMClass winClass = XCB->getWMClass(activeWinId);
@ -906,7 +918,7 @@ bool Dock::shouldHideOnSmartHideMode()
}
return false;
} else {
return isWindowDockOverlapK(activeWindow);
return isWindowDockOverlapK(m_activeWindow);
}
}
@ -984,7 +996,7 @@ QVector<XWindow> Dock::getActiveWinGroup(XWindow xid)
*/
void Dock::updateHideState(bool delay)
{
if (ddeLauncherVisible) {
if (m_ddeLauncherVisible) {
qInfo() << "updateHideState: dde launcher is visible, show dock";
setPropHideState(HideState::Show);
}
@ -999,7 +1011,7 @@ void Dock::updateHideState(bool delay)
break;
case HideMode::SmartHide:
qInfo() << "reset smart hide mode timer " << delay;
smartHideTimer->start(delay ? smartHideTimerDelay : 0);
m_smartHideTimer->start(delay ? smartHideTimerDelay : 0);
break;
}
}
@ -1015,9 +1027,9 @@ void Dock::setPropHideState(HideState state)
return;
}
if (state != hideState) {
hideState = state;
Q_EMIT hideStateChanged(static_cast<int>(hideState));
if (state != m_hideState) {
m_hideState = state;
Q_EMIT hideStateChanged(static_cast<int>(m_hideState));
}
}
@ -1035,7 +1047,7 @@ void Dock::attachOrDetachWindow(WindowInfoBase *info)
qInfo() << "attachOrDetachWindow: shouldDock " << shouldDock;
// 顺序解析窗口合并或分离操作
QMutexLocker locker(&windowOperateMutex);
QMutexLocker locker(&m_windowOperateMutex);
Entry *entry = info->getEntry();
if (entry) {
// detach
@ -1049,7 +1061,7 @@ void Dock::attachOrDetachWindow(WindowInfoBase *info)
// 窗口entryInnerId为空表示未识别需要识别窗口并创建entryInnerId
qInfo() << "attach operate: window " << winId << " entryInnerId is empty, now call IdentifyWindow";
QString innerId;
AppInfo *appInfo = windowIdentify->identifyWindow(info, innerId);
AppInfo *appInfo = m_windowIdentify->identifyWindow(info, innerId);
// 窗口entryInnerId即AppInfo的innerId 用来将窗口和应用绑定关系
info->setEntryInnerId(innerId);
info->setAppInfo(appInfo);
@ -1074,16 +1086,16 @@ void Dock::attachOrDetachWindow(WindowInfoBase *info)
void Dock::attachWindow(WindowInfoBase *info)
{
// TODO: entries中存在innerid为空的entry 导致后续新应用通过innerid获取应用一直能获取到
Entry *entry = entries->getByInnerId(info->getEntryInnerId());
Entry *entry = m_entries->getByInnerId(info->getEntryInnerId());
if (entry) {
// entry existed
entry->attachWindow(info);
} else {
entries->removeLastRecent();
m_entries->removeLastRecent();
entry = new Entry(this, info->getAppInfo(), info->getEntryInnerId());
if (entry->attachWindow(info)) {
entry->startExport();
entries->append(entry);
m_entries->append(entry);
}
}
}
@ -1094,14 +1106,14 @@ void Dock::attachWindow(WindowInfoBase *info)
*/
void Dock::detachWindow(WindowInfoBase *info)
{
Entry *entry = entries->getByWindowId(info->getXid());
Entry *entry = m_entries->getByWindowId(info->getXid());
if (!entry)
return;
bool needRemove = entry->detachWindow(info);
if (needRemove) {
// 如果是最近打开应用
if (entries->shouldInRecent()) {
if (m_entries->shouldInRecent()) {
// 更新entry的导出窗口信息
entry->updateExportWindowInfos();
// 更新entry的右键菜单的信息
@ -1110,8 +1122,9 @@ void Dock::detachWindow(WindowInfoBase *info)
entry->setCurrentWindowInfo(nullptr);
// 移除应用后,同时更新最近打开的应用
updateRecentApps();
// 如果是高效模式,则发送消息
if (SETTING->getDisplayMode() == DisplayMode::Efficient) {
// 如果是高效模式,则发送消息或者关闭了显示最近应用的功能,则从任务栏移除
if (SETTING->getDisplayMode() == DisplayMode::Efficient
|| !m_showRecent) {
Q_EMIT entryRemoved(entry->getId());
}
} else {
@ -1129,7 +1142,7 @@ void Dock::detachWindow(WindowInfoBase *info)
*/
void Dock::launchApp(const QString desktopFile, uint32_t timestamp, QStringList files)
{
dbusHandler->launchApp(desktopFile, timestamp, files);
m_dbusHandler->launchApp(desktopFile, timestamp, files);
}
/**
@ -1140,7 +1153,7 @@ void Dock::launchApp(const QString desktopFile, uint32_t timestamp, QStringList
*/
void Dock::launchAppAction(const QString desktopFile, QString action, uint32_t timestamp)
{
dbusHandler->launchAppAction(desktopFile, action, timestamp);
m_dbusHandler->launchAppAction(desktopFile, action, timestamp);
}
/**
@ -1150,10 +1163,10 @@ void Dock::launchAppAction(const QString desktopFile, QString action, uint32_t t
bool Dock::is3DWM()
{
bool ret = false;
if (wmName.isEmpty())
wmName = dbusHandler->getCurrentWM();
if (m_wmName.isEmpty())
m_wmName = m_dbusHandler->getCurrentWM();
if (wmName == "deepin wm")
if (m_wmName == "deepin wm")
ret = true;
return ret;
@ -1165,7 +1178,7 @@ bool Dock::is3DWM()
*/
bool Dock::isWaylandEnv()
{
return isWayland;
return m_isWayland;
}
/**
@ -1175,7 +1188,7 @@ bool Dock::isWaylandEnv()
*/
WindowInfoK *Dock::handleActiveWindowChangedK(uint activeWin)
{
return waylandManager->handleActiveWindowChangedK(activeWin);
return m_waylandManager->handleActiveWindowChangedK(activeWin);
}
/**
@ -1186,14 +1199,14 @@ void Dock::handleActiveWindowChanged(WindowInfoBase *info)
{
qInfo() << "handleActiveWindowChanged";
if (!info) {
activeWindowOld = info;
activeWindow = nullptr;
m_activeWindowOld = info;
m_activeWindow = nullptr;
return;
}
activeWindow = info;
XWindow winId = activeWindow->getXid();
entries->handleActiveWindowChanged(winId);
m_activeWindow = info;
XWindow winId = m_activeWindow->getXid();
m_entries->handleActiveWindowChanged(winId);
updateHideState(true);
}
@ -1203,7 +1216,7 @@ void Dock::handleActiveWindowChanged(WindowInfoBase *info)
void Dock::saveDockedApps()
{
QStringList dockedApps;
for (auto entry : entries->filterDockedEntries()) {
for (auto entry : m_entries->filterDockedEntries()) {
QString path = entry->getApp()->getFileName();
dockedApps << path;
}
@ -1217,7 +1230,7 @@ void Dock::saveDockedApps()
void Dock::updateRecentApps()
{
QStringList unDockedApps;
QList<Entry *> recentEntrys = entries->unDockedEntries();
QList<Entry *> recentEntrys = m_entries->unDockedEntries();
for (Entry *entry : recentEntrys) {
QString path = entry->getApp()->getFileName();
unDockedApps << path;
@ -1227,6 +1240,16 @@ void Dock::updateRecentApps()
SETTING->setRecentApps(unDockedApps);
}
void Dock::onShowRecentChanged(bool visible)
{
if (m_showRecent == visible)
return;
m_showRecent = visible;
m_entries->updateShowRecent();
Q_EMIT showRecentChanged(visible);
}
/** 移除应用实例
* @brief Dock::removeAppEntry
* @param entry
@ -1234,7 +1257,7 @@ void Dock::updateRecentApps()
void Dock::removeAppEntry(Entry *entry)
{
if (entry) {
entries->remove(entry);
m_entries->remove(entry);
}
}
@ -1256,7 +1279,7 @@ void Dock::handleWindowGeometryChanged()
*/
Entry *Dock::getEntryByWindowId(XWindow windowId)
{
return entries->getByWindowId(windowId);
return m_entries->getByWindowId(windowId);
}
/**
@ -1266,7 +1289,7 @@ Entry *Dock::getEntryByWindowId(XWindow windowId)
*/
QString Dock::getDesktopFromWindowByBamf(XWindow windowId)
{
return dbusHandler->getDesktopFromWindowByBamf(windowId);
return m_dbusHandler->getDesktopFromWindowByBamf(windowId);
}
/**
@ -1275,7 +1298,7 @@ QString Dock::getDesktopFromWindowByBamf(XWindow windowId)
*/
void Dock::registerWindowWayland(const QString &objPath)
{
return waylandManager->registerWindow(objPath);
return m_waylandManager->registerWindow(objPath);
}
/**
@ -1284,7 +1307,7 @@ void Dock::registerWindowWayland(const QString &objPath)
*/
void Dock::unRegisterWindowWayland(const QString &objPath)
{
return waylandManager->unRegisterWindow(objPath);
return m_waylandManager->unRegisterWindow(objPath);
}
/**
@ -1293,7 +1316,7 @@ void Dock::unRegisterWindowWayland(const QString &objPath)
*/
bool Dock::isShowingDesktop()
{
return dbusHandler->wlShowingDesktop();
return m_dbusHandler->wlShowingDesktop();
}
/**
@ -1304,7 +1327,7 @@ bool Dock::isShowingDesktop()
*/
AppInfo *Dock::identifyWindow(WindowInfoBase *winInfo, QString &innerId)
{
return windowIdentify->identifyWindow(winInfo, innerId);
return m_windowIdentify->identifyWindow(winInfo, innerId);
}
/**
@ -1318,7 +1341,7 @@ void Dock::markAppLaunched(AppInfo *appInfo)
QString desktopFile = appInfo->getFileName();
qInfo() << "markAppLaunched: desktopFile is " << desktopFile;
dbusHandler->markAppLaunched(desktopFile);
m_dbusHandler->markAppLaunched(desktopFile);
}
/**
@ -1327,7 +1350,7 @@ void Dock::markAppLaunched(AppInfo *appInfo)
*/
ForceQuitAppMode Dock::getForceQuitAppStatus()
{
return forceQuitAppStatus;
return m_forceQuitAppStatus;
}
/**
@ -1345,7 +1368,7 @@ QVector<QString> Dock::getWinIconPreferredApps()
*/
void Dock::handleLauncherItemDeleted(QString itemPath)
{
for (auto entry : entries->filterDockedEntries()) {
for (auto entry : m_entries->filterDockedEntries()) {
if (entry->getFileName() == itemPath) {
undockEntry(entry);
break;
@ -1359,7 +1382,7 @@ void Dock::handleLauncherItemDeleted(QString itemPath)
*/
void Dock::handleLauncherItemUpdated(QString itemPath)
{
Entry * entry = entries->getByDesktopFilePath(itemPath);
Entry *entry = m_entries->getByDesktopFilePath(itemPath);
if (!entry)
return;
@ -1386,7 +1409,7 @@ double Dock::getOpacity()
*/
QRect Dock::getFrontendWindowRect()
{
return frontendWindowRect;
return m_frontendWindowRect;
}
/**
@ -1406,7 +1429,7 @@ void Dock::setDisplayMode(int mode)
{
DisplayMode displayMode = static_cast<DisplayMode>(mode);
SETTING->setDisplayMode(displayMode);
entries->setDisplayMode(displayMode);
m_entries->setDisplayMode(displayMode);
}
/**
@ -1425,7 +1448,7 @@ QStringList Dock::getDockedApps()
QStringList Dock::getEntryPaths()
{
QStringList ret;
for (auto id : entries->getEntryIDs()) {
for (auto id : m_entries->getEntryIDs()) {
ret.push_back(entryDBusObjPathPrefix + id);
}
@ -1456,7 +1479,7 @@ void Dock::setHideMode(HideMode mode)
*/
HideState Dock::getHideState()
{
return hideState;
return m_hideState;
}
/**
@ -1465,7 +1488,7 @@ HideState Dock::getHideState()
*/
void Dock::setHideState(HideState state)
{
hideState = state;
m_hideState = state;
}
/**

View File

@ -133,6 +133,8 @@ public:
bool isDocked(const QString desktopFile);
bool requestDock(QString desktopFile, int index);
bool requestUndock(QString desktopFile);
void setShowRecent(bool visible);
bool showRecent() const;
void moveEntry(int oldIndex, int newIndex);
bool isOnDock(QString desktopFile);
QString queryWindowIdentifyMethod(XWindow windowId);
@ -148,6 +150,7 @@ Q_SIGNALS:
void entryRemoved(QString id);
void hideStateChanged(int);
void frontendWindowRectChanged();
void showRecentChanged(bool);
public Q_SLOTS:
void updateHideState(bool delay);
@ -157,7 +160,6 @@ public Q_SLOTS:
private:
void initSettings();
void updateMenu();
void initEntries();
void loadAppInfos();
void initClientList();
@ -173,23 +175,27 @@ private:
void updateRecentApps();
private:
WindowIdentify *windowIdentify; // 窗口识别
Entries *entries; // 所有应用实例
int entriesSum; // 累计打开的应用数量
bool ddeLauncherVisible; // 前端启动器是否可见
QString wmName; // 窗管名称
WaylandManager *waylandManager; // wayland窗口管理
X11Manager *x11Manager; // X11窗口管理
QList<XWindow> clientList; // 所有窗口
QRect frontendWindowRect; // 前端任务栏大小, 用于智能隐藏时判断窗口是否重合
HideState hideState; // 记录任务栏隐藏状态
QTimer *smartHideTimer; // 任务栏智能隐藏定时器
WindowInfoBase *activeWindow;// 记录当前活跃窗口信息
WindowInfoBase *activeWindowOld;// 记录前一个活跃窗口信息
bool isWayland; // 判断是否为wayland环境
ForceQuitAppMode forceQuitAppStatus; // 强制退出应用状态
DBusHandler *dbusHandler; // 处理dbus交互
QMutex windowOperateMutex; // 窗口合并或拆分锁
void onShowRecentChanged(bool visible);
private:
WindowIdentify *m_windowIdentify; // 窗口识别
Entries *m_entries; // 所有应用实例
int m_entriesSum; // 累计打开的应用数量
bool m_ddeLauncherVisible; // 前端启动器是否可见
QString m_wmName; // 窗管名称
WaylandManager *m_waylandManager; // wayland窗口管理
X11Manager *m_x11Manager; // X11窗口管理
QList<XWindow> m_clientList; // 所有窗口
QRect m_frontendWindowRect; // 前端任务栏大小, 用于智能隐藏时判断窗口是否重合
HideState m_hideState; // 记录任务栏隐藏状态
QTimer *m_smartHideTimer; // 任务栏智能隐藏定时器
WindowInfoBase *m_activeWindow;// 记录当前活跃窗口信息
WindowInfoBase *m_activeWindowOld;// 记录前一个活跃窗口信息
bool m_isWayland; // 判断是否为wayland环境
ForceQuitAppMode m_forceQuitAppStatus; // 强制退出应用状态
DBusHandler *m_dbusHandler; // 处理dbus交互
QMutex m_windowOperateMutex; // 窗口合并或拆分锁
bool m_showRecent;
};
#endif // DOCK_H

View File

@ -52,6 +52,8 @@ void DockSettings::init()
} else if (key == keyForceQuitApp){
QString mode = m_dockSettings->value(key).toString();
Q_EMIT forceQuitAppChanged(ForceQuitAppModeHandler(mode).toEnum());
} else if (key == keyShowRecent) {
Q_EMIT showRecentChanged(m_dockSettings->value(key).toBool());
}
});
}
@ -273,6 +275,22 @@ QVector<QString> DockSettings::getWinIconPreferredApps()
return ret;
}
void DockSettings::setShowRecent(bool visible)
{
if (!m_dockSettings)
return;
m_dockSettings->setValue(keyShowRecent, visible);
}
bool DockSettings::showRecent() const
{
if (!m_dockSettings)
return false;
return m_dockSettings->value(keyShowRecent).toBool();
}
QString DockSettings::getPluginSettings()
{
QString ret;

View File

@ -54,6 +54,8 @@ public:
case HideMode::SmartHide:
return "smart-hide";
}
// 默认保持始终显示
return "keep-showing";
}
HideMode toEnum() {
@ -233,6 +235,8 @@ public:
void setRecentApps(const QStringList &apps);
double getOpacity();
QVector<QString> getWinIconPreferredApps();
void setShowRecent(bool visible);
bool showRecent() const;
// plugin settings
QString getPluginSettings();
@ -250,6 +254,8 @@ Q_SIGNALS:
void positionModeChanged(PositionMode mode);
// 强制退出应用开关改变
void forceQuitAppChanged(ForceQuitAppMode mode);
// 是否显示最近打开应用改变
void showRecentChanged(bool);
private:
DockSettings(QObject *paret = nullptr);

View File

@ -23,7 +23,7 @@
#include "dock.h"
Entries::Entries(Dock *_dock)
: dock(_dock)
: m_dock(_dock)
{
}
@ -132,8 +132,19 @@ Entry *Entries::getByDesktopFilePath(QString filePath)
QStringList Entries::getEntryIDs()
{
QStringList list;
for (auto item : m_items)
list.push_back(item->getId());
if (static_cast<DisplayMode>(m_dock->getDisplayMode()) == DisplayMode::Fashion
&& m_dock->showRecent()) {
for (Entry *item : m_items)
list.push_back(item->getId());
} else {
// 如果是高效模式或者没有开启显示最近应用的功能,那么未驻留并且没有子窗口的就不显示
// 换句话说,只显示已经驻留或者有子窗口的应用
for (Entry *item : m_items) {
if (!item->getIsDocked() && !item->hasWindow())
continue;
list << item->getId();
}
}
return list;
}
@ -218,12 +229,14 @@ void Entries::moveEntryToLast(Entry *entry)
void Entries::insertCb(Entry *entry, int index)
{
Q_EMIT dock->entryAdded(QDBusObjectPath(entry->path()), index);
if (entry->getIsDocked() || entry->hasWindow() ||
(static_cast<DisplayMode>(m_dock->getDisplayMode()) == DisplayMode::Fashion) && m_dock->showRecent())
Q_EMIT m_dock->entryAdded(QDBusObjectPath(entry->path()), index);
}
void Entries::removeCb(Entry *entry)
{
Q_EMIT dock->entryRemoved(entry->getId());
Q_EMIT m_dock->entryRemoved(entry->getId());
entry->stopExport();
}
@ -274,20 +287,57 @@ void Entries::removeLastRecent()
void Entries::setDisplayMode(DisplayMode displayMode)
{
if (!m_dock->showRecent())
return;
// 如果从时尚模式变成高效模式,对列表中所有的没有打开窗口的应用发送移除信号
if (displayMode == DisplayMode::Efficient) {
for (Entry *entry : m_items) {
entry->updateMode();
if (!entry->getIsDocked() && !entry->hasWindow())
Q_EMIT dock->entryRemoved(entry->getId());
Q_EMIT m_dock->entryRemoved(entry->getId());
}
} else {
// 如果从高效模式变成时尚模式,列表中所有的未驻留且不存在打开窗口的应用认为是最近打开应用,发送新增信号
for (Entry *entry : m_items) {
entry->updateMode();
if (!entry->getIsDocked() && !entry->hasWindow()) {
QString objPath = entry->path();
int index = m_items.indexOf(entry);
Q_EMIT dock->entryAdded(QDBusObjectPath(objPath), index);
Q_EMIT m_dock->entryAdded(QDBusObjectPath(objPath), index);
}
}
}
}
void Entries::updateShowRecent()
{
// 高效模式无需做任何操作
if (static_cast<DisplayMode>(m_dock->getDisplayMode()) != DisplayMode::Fashion)
return;
bool showRecent = m_dock->showRecent();
if (showRecent) {
// 如果显示最近打开应用,则发送新增信号
for (Entry *entry : m_items) {
// 已经驻留的或者有子窗口的本来就在任务栏上面,无需发送信号
entry->updateMode();
if (entry->getIsDocked() || entry->hasWindow())
continue;
QString objPath = entry->path();
int index = m_items.indexOf(entry);
Q_EMIT m_dock->entryAdded(QDBusObjectPath(objPath), index);
}
} else {
// 如果是隐藏最近打开的应用,则发送移除的信号
for (Entry *entry : m_items) {
// 已经驻留的或者有子窗口的本来就在任务栏上面,无需发送信号
entry->updateMode();
if (entry->getIsDocked() || entry->hasWindow())
continue;
Q_EMIT m_dock->entryRemoved(entry->getId());
}
}
}

View File

@ -41,7 +41,6 @@ public:
QVector<Entry *> filterDockedEntries();
Entry *getByInnerId(QString innerId);
void append(Entry *entry);
void insert(Entry *entry, int index);
void remove(Entry *entry);
void move(int oldIndex, int newIndex);
Entry *getByWindowPid(int pid);
@ -57,14 +56,16 @@ public:
bool shouldInRecent();
void removeLastRecent();
void setDisplayMode(DisplayMode displayMode);
void updateShowRecent();
private:
void insertCb(Entry *entry, int index);
void removeCb(Entry *entry);
void insert(Entry *entry, int index);
private:
QList<Entry *> m_items;
Dock *dock;
Dock *m_dock;
};
#endif // ENTRIES_H

View File

@ -43,6 +43,7 @@ Entry::Entry(Dock *_dock, AppInfo *_app, QString _innerId, QObject *parent)
, m_current(nullptr)
, m_currentWindow(0)
, m_winIconPreferred(false)
, m_mode(getCurrentMode())
{
setApp(_app);
id = dock->allocEntryId();
@ -188,7 +189,7 @@ void Entry::setApp(AppInfo *appinfo)
}
}
bool Entry::getIsDocked()
bool Entry::getIsDocked() const
{
return isDocked;
}
@ -282,6 +283,35 @@ void Entry::updateIcon()
setPropIcon(getIcon());
}
int Entry::getCurrentMode()
{
// 只要当前应用是已经驻留的应用则让其显示为Normal
if (getIsDocked())
return ENTRY_NORMAL;
// 对于未驻留的应用则做如下处理
if (static_cast<DisplayMode>(dock->getDisplayMode()) == DisplayMode::Efficient) {
// 高效模式下只有存在子窗口的则让其为nornal没有子窗口的一般不让其显示
return hasWindow() ? ENTRY_NORMAL : ENTRY_NONE;
}
// 时尚模式下对未驻留应用做如下处理
// 如果开启了最近打开应用的功能则显示到最近打开区域ENTRY_RECENT
if (dock->showRecent())
return ENTRY_RECENT;
// 未开启最近使用应用的功能,如果有子窗口,则显示成通用的(ENTRY_NORMAL),如果没有子窗口,则不显示(ENTRY_NONE)
return hasWindow() ? ENTRY_NORMAL : ENTRY_NONE;
}
void Entry::updateMode()
{
int currentMode = getCurrentMode();
if (m_mode != currentMode) {
m_mode = currentMode;
Q_EMIT modeChanged(m_mode);
}
}
void Entry::forceUpdateIcon()
{
icon = getIcon();
@ -487,10 +517,13 @@ bool Entry::detachWindow(WindowInfoBase *info)
bool Entry::isShowOnDock() const
{
// 当前应用显示图标的条件是
// 1.时尚模式下,该应用如果有打开窗口,则正常显示,如果没有打开窗口,则显示为最近打开应用
// 1.时尚模式下,如果开启了显示最近使用,则不管是否有子窗口,都在任务栏上显示
// 如果没有开启显示最近使用,则只显示有子窗口的
if (static_cast<DisplayMode>(dock->getDisplayMode()) == DisplayMode::Fashion)
return (dock->showRecent() || m_exportWindowInfos.size() > 0);
// 2.高效模式下,只有该应用有打开窗口才显示
return (static_cast<DisplayMode>(dock->getDisplayMode()) == DisplayMode::Fashion
|| m_exportWindowInfos.size() > 0);
return (getIsDocked() || m_exportWindowInfos.size() > 0);
}
bool Entry::attachWindow(WindowInfoBase *info)
@ -557,7 +590,7 @@ void Entry::requestDock(bool dockToEnd)
// 取消驻留
void Entry::requestUndock(bool dockToEnd)
{
dock->undockEntry(this);
dock->undockEntry(this, dockToEnd);
}
void Entry::newInstance(uint32_t timestamp)
@ -678,6 +711,11 @@ void Entry::active(uint32_t timestamp)
}
}
int Entry::mode()
{
return m_mode;
}
XWindow Entry::getCurrentWindow()
{
return m_currentWindow;

View File

@ -31,6 +31,10 @@
#include <QVector>
#include <QObject>
#define ENTRY_NONE 0
#define ENTRY_NORMAL 1
#define ENTRY_RECENT 2
// 单个应用类
class Dock;
class Entry: public QObject
@ -51,13 +55,14 @@ public:
QString getFileName();
AppInfo *getApp();
void setApp(AppInfo *appinfo);
bool getIsDocked();
bool getIsDocked() const;
void setIsDocked(bool value);
void startExport();
void stopExport();
void setMenu(AppMenu *_menu);
void updateMenu();
void updateIcon();
void updateMode();
void forceUpdateIcon();
void updateIsActive();
WindowInfoBase *getWindowInfoByPid(int pid);
@ -87,6 +92,7 @@ public:
void forceQuit();
void presentWindows();
void active(uint32_t timestamp);
int mode();
XWindow getCurrentWindow();
QString getDesktopFile();
@ -107,6 +113,7 @@ Q_SIGNALS:
void desktopFileChanged(QString value);
void currentWindowChanged(uint32_t value);
void windowInfosChanged(const WindowInfoMap &value);
void modeChanged(int);
private:
// 右键菜单项
@ -121,6 +128,7 @@ private:
bool killProcess(int pid);
bool setPropDesktopFile(QString value);
bool isShowOnDock() const;
int getCurrentMode();
private:
Dock *dock;
@ -142,6 +150,7 @@ private:
WindowInfoBase *m_current; // 当前窗口
XWindow m_currentWindow; //当前窗口Id
bool m_winIconPreferred;
int m_mode;
};
#endif // ENTRY_H