fix: 修复任务栏应用图标右键失效问题
修复任务栏应用图标右键失效问题 Log: Task: https://pms.uniontech.com/task-view-140805.html Influence: 保证任务栏应用右键菜单功能正常 Change-Id: Iedb3e0394567c855f7760dc52a06d8ad1073001e
This commit is contained in:
@ -29,10 +29,8 @@ DBusAdaptorDock::DBusAdaptorDock(QObject *parent)
|
||||
|
||||
Dock *dock = static_cast<Dock *>(QObject::parent());
|
||||
if (dock) {
|
||||
connect(dock, &Dock::serviceRestarted, this, [&] {
|
||||
Q_EMIT ServiceRestarted();});
|
||||
connect(dock, &Dock::entryAdded, this, [&](QString entryObjPath, int32_t index){
|
||||
Q_EMIT EntryAdded(QDBusObjectPath(entryObjPath), index);});
|
||||
connect(dock, &Dock::serviceRestarted, this, &DBusAdaptorDock::ServiceRestarted);
|
||||
connect(dock, &Dock::entryAdded, this, &DBusAdaptorDock::EntryAdded);
|
||||
connect(dock, &Dock::entryRemoved, this, &DBusAdaptorDock::EntryRemoved);
|
||||
connect(dock, &Dock::hideStateChanged, this, &DBusAdaptorDock::HideStateChanged);
|
||||
connect(dock, &Dock::frontendWindowRectChanged, this, &DBusAdaptorDock::FrontendWindowRectChanged);
|
||||
|
@ -27,11 +27,12 @@ DBusAdaptorEntry::DBusAdaptorEntry(QObject *parent)
|
||||
|
||||
// constructor
|
||||
setAutoRelaySignals(true);
|
||||
if (QMetaType::type("ExportWindowInfo") == QMetaType::UnknownType)
|
||||
registerExportWindowInfoMetaType();
|
||||
|
||||
if (QMetaType::type("ExportWindowInfoList") == QMetaType::UnknownType)
|
||||
registerExportWindowInfoListMetaType();
|
||||
if (QMetaType::type("WindowInfo") == QMetaType::UnknownType)
|
||||
registerWindowInfoMetaType();
|
||||
|
||||
if (QMetaType::type("WindowInfoMap") == QMetaType::UnknownType)
|
||||
registerWindowInfoMapMetaType();
|
||||
|
||||
Entry *entry = static_cast<Entry *>(QObject::parent());
|
||||
if (entry) {
|
||||
@ -90,7 +91,7 @@ QString DBusAdaptorEntry::name() const
|
||||
return parent()->getName();
|
||||
}
|
||||
|
||||
ExportWindowInfoList DBusAdaptorEntry::windowInfos()
|
||||
WindowInfoMap DBusAdaptorEntry::windowInfos()
|
||||
{
|
||||
return parent()->getExportWindowInfos();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define DBUSADAPTORENTRY_H
|
||||
|
||||
#include "entry.h"
|
||||
#include "exportwindowinfolist.h"
|
||||
#include "windowinfomap.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QMetaObject>
|
||||
@ -77,8 +77,8 @@ class DBusAdaptorEntry: public QDBusAbstractAdaptor
|
||||
" <property access=\"read\" type=\"b\" name=\"IsDocked\"/>\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"Menu\"/>\n"
|
||||
" <property access=\"read\" type=\"s\" name=\"DesktopFile\"/>\n"
|
||||
" <property access=\"read\" type=\"a(usb)\" name=\"WindowInfos\"/>\n"
|
||||
" <annotation value=\"ExportWindowInfoList\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
|
||||
" <property access=\"read\" type=\"a{u(sb)}\" name=\"WindowInfos\"/>\n"
|
||||
" <annotation value=\"WindowInfoMap\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
|
||||
" </interface>\n"
|
||||
"")
|
||||
|
||||
@ -111,8 +111,8 @@ public: // PROPERTIES
|
||||
Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
|
||||
QString name() const;
|
||||
|
||||
Q_PROPERTY(ExportWindowInfoList WindowInfos READ windowInfos NOTIFY WindowInfosChanged)
|
||||
ExportWindowInfoList windowInfos();
|
||||
Q_PROPERTY(WindowInfoMap WindowInfos READ windowInfos NOTIFY WindowInfosChanged)
|
||||
WindowInfoMap windowInfos();
|
||||
|
||||
Entry *parent() const;
|
||||
|
||||
@ -136,7 +136,7 @@ Q_SIGNALS: // SIGNALS
|
||||
void NameChanged(QString value);
|
||||
void DesktopFileChanged(QString value);
|
||||
void CurrentWindowChanged(uint32_t value);
|
||||
void WindowInfosChanged(ExportWindowInfoList value);
|
||||
void WindowInfosChanged(WindowInfoMap value);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -409,6 +409,14 @@ QList<XWindow> Dock::getClientList()
|
||||
return QList<XWindow>(clientList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dock::setClientList 设置窗口client列表
|
||||
*/
|
||||
void Dock::setClientList(QList<XWindow> value)
|
||||
{
|
||||
clientList = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Dock::closeWindow 关闭窗口
|
||||
* @param windowId 窗口id
|
||||
|
@ -128,6 +128,7 @@ public:
|
||||
WindowInfoBase *getActiveWindow();
|
||||
void doActiveWindow(XWindow xid);
|
||||
QList<XWindow> getClientList();
|
||||
void setClientList(QList<XWindow> value);
|
||||
|
||||
void closeWindow(XWindow windowId);
|
||||
QStringList getEntryIDs();
|
||||
@ -148,7 +149,7 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void serviceRestarted();
|
||||
void entryAdded(QString entryObjPath, int32_t index);
|
||||
void entryAdded(QDBusObjectPath entryObjPath, int index);
|
||||
void entryRemoved(QString id);
|
||||
void hideStateChanged(int);
|
||||
void frontendWindowRectChanged();
|
||||
|
@ -59,6 +59,7 @@ void Entries::insert(Entry *entry, int index)
|
||||
{
|
||||
if (index < 0 || index >= items.size()) {
|
||||
// append
|
||||
index = items.size();
|
||||
items.push_back(entry);
|
||||
} else {
|
||||
// insert
|
||||
@ -70,11 +71,13 @@ void Entries::insert(Entry *entry, int index)
|
||||
|
||||
void Entries::remove(Entry *entry)
|
||||
{
|
||||
for (auto iter = items.begin(); iter != items.end(); iter++) {
|
||||
for (auto iter = items.begin(); iter != items.end();) {
|
||||
if ((*iter)->getId() == entry->getId()) {
|
||||
items.erase(iter);
|
||||
iter = items.erase(iter);
|
||||
removeCb(entry);
|
||||
delete entry;
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,7 +208,7 @@ void Entries::updateEntriesMenu()
|
||||
void Entries::insertCb(Entry *entry, int index)
|
||||
{
|
||||
QString objPath = entryDBusObjPathPrefix + entry->getId();
|
||||
Q_EMIT dock->entryAdded(objPath, index);
|
||||
Q_EMIT dock->entryAdded(QDBusObjectPath(objPath), index);
|
||||
}
|
||||
|
||||
void Entries::removeCb(Entry *entry)
|
||||
@ -213,3 +216,4 @@ void Entries::removeCb(Entry *entry)
|
||||
Q_EMIT dock->entryRemoved(entry->getId());
|
||||
entry->stopExport();
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ Entry::Entry(Dock *_dock, AppInfo *_app, QString _innerId, QObject *parent)
|
||||
|
||||
Entry::~Entry()
|
||||
{
|
||||
for (auto winInfo : windowInfos) {
|
||||
for (auto winInfo : windowInfoMap) {
|
||||
if (winInfo)
|
||||
delete winInfo;
|
||||
}
|
||||
windowInfos.clear();
|
||||
windowInfoMap.clear();
|
||||
|
||||
if (app) {
|
||||
delete app;
|
||||
@ -196,7 +196,7 @@ void Entry::setIsDocked(bool value)
|
||||
}
|
||||
}
|
||||
|
||||
// 导出Dbus服务
|
||||
// 导出DBus服务
|
||||
void Entry::startExport()
|
||||
{
|
||||
if (getId().isEmpty()) {
|
||||
@ -219,7 +219,7 @@ void Entry::startExport()
|
||||
}
|
||||
}
|
||||
|
||||
// 停止导出Dbus服务
|
||||
// 停止导出DBus服务
|
||||
void Entry::stopExport()
|
||||
{
|
||||
if (getId().isEmpty()) {
|
||||
@ -291,8 +291,10 @@ void Entry::updateIsActive()
|
||||
{
|
||||
bool isActive = false;
|
||||
auto activeWin = dock->getActiveWindow();
|
||||
if (activeWin)
|
||||
isActive = windowInfos.find(activeWin->getXid()) != windowInfos.end();
|
||||
if (activeWin) {
|
||||
// 判断活跃窗口是否属于当前应用
|
||||
isActive = windowInfoMap.find(activeWin->getXid()) != windowInfoMap.end();
|
||||
}
|
||||
|
||||
setPropIsActive(isActive);
|
||||
}
|
||||
@ -300,7 +302,7 @@ void Entry::updateIsActive()
|
||||
WindowInfoBase *Entry::getWindowInfoByPid(int pid)
|
||||
{
|
||||
WindowInfoBase *ret = nullptr;
|
||||
for (const auto &windowInfo : windowInfos) {
|
||||
for (const auto &windowInfo : windowInfoMap) {
|
||||
if (windowInfo->getPid() == pid) {
|
||||
ret = windowInfo;
|
||||
break;
|
||||
@ -313,8 +315,8 @@ WindowInfoBase *Entry::getWindowInfoByPid(int pid)
|
||||
WindowInfoBase *Entry::getWindowInfoByWinId(XWindow windowId)
|
||||
{
|
||||
WindowInfoBase *ret = nullptr;
|
||||
if (windowInfos.find(windowId) != windowInfos.end()) {
|
||||
ret = windowInfos[windowId];
|
||||
if (windowInfoMap.find(windowId) != windowInfoMap.end()) {
|
||||
ret = windowInfoMap[windowId];
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -377,7 +379,7 @@ WindowInfoBase *Entry::getCurrentWindowInfo()
|
||||
*/
|
||||
WindowInfoBase *Entry::findNextLeader()
|
||||
{
|
||||
auto xids = windowInfos.keys();
|
||||
auto xids = windowInfoMap.keys();
|
||||
qSort(xids);
|
||||
XWindow curWinId = current->getXid();
|
||||
int index = xids.indexOf(curWinId);
|
||||
@ -389,7 +391,7 @@ WindowInfoBase *Entry::findNextLeader()
|
||||
if (index < xids.size() - 1)
|
||||
nextIndex = index + 1;
|
||||
|
||||
return windowInfos[xids[nextIndex]];
|
||||
return windowInfoMap[xids[nextIndex]];
|
||||
}
|
||||
|
||||
QString Entry::getExec(bool oneLine)
|
||||
@ -410,7 +412,7 @@ QString Entry::getExec(bool oneLine)
|
||||
|
||||
bool Entry::hasWindow()
|
||||
{
|
||||
return windowInfos.size() > 0;
|
||||
return windowInfoMap.size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -418,22 +420,21 @@ bool Entry::hasWindow()
|
||||
*/
|
||||
void Entry::updateExportWindowInfos()
|
||||
{
|
||||
ExportWindowInfoList infos;
|
||||
for (auto info : windowInfos) {
|
||||
WindowInfoMap infos;
|
||||
for (auto info : windowInfoMap) {
|
||||
WindowInfo winInfo;
|
||||
XWindow xid = info->getXid();
|
||||
QString title = info->getTitle();
|
||||
bool flash = info->isDemandingAttention();
|
||||
infos.push_back({xid, title, flash});
|
||||
winInfo.title = info->getTitle();
|
||||
winInfo.attention = info->isDemandingAttention();
|
||||
infos[xid] = winInfo;
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
if (infos.size() == exportWindowInfos.size()) {
|
||||
sortExprotWindowInfoList(infos);
|
||||
sortExprotWindowInfoList(exportWindowInfos);
|
||||
for (int i = 0; i < infos.size(); i++) {
|
||||
if (infos[i].getXid() != exportWindowInfos[i].getXid()
|
||||
|| infos[i].getFlash() != exportWindowInfos[i].getFlash()
|
||||
|| infos[i].getTitle() != exportWindowInfos[i].getTitle()) {
|
||||
for (auto iter = infos.begin(); iter != infos.end(); iter++) {
|
||||
XWindow xid = iter.key();
|
||||
if (infos[xid].title != exportWindowInfos[xid].title ||
|
||||
infos[xid].attention != exportWindowInfos[xid].attention) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
@ -456,13 +457,13 @@ bool Entry::detachWindow(WindowInfoBase *info)
|
||||
XWindow winId = info->getXid();
|
||||
deleteWindow(winId);
|
||||
|
||||
if (windowInfos.size() == 0) {
|
||||
if (windowInfoMap.size() == 0) {
|
||||
if (!isDocked) // 既无窗口也非驻留应用,无需在任务栏显示
|
||||
return true;
|
||||
|
||||
setCurrentWindowInfo(nullptr);
|
||||
} else {
|
||||
for (auto window : windowInfos) {
|
||||
for (auto window : windowInfoMap) {
|
||||
if (window) { // 选择第一个窗口作为当前窗口
|
||||
setCurrentWindowInfo(window);
|
||||
break;
|
||||
@ -484,12 +485,12 @@ bool Entry::attachWindow(WindowInfoBase *info)
|
||||
qInfo() << "attatchWindow: window id:" << winId;
|
||||
info->setEntry(this);
|
||||
|
||||
if (windowInfos.find(winId) != windowInfos.end()) {
|
||||
if (windowInfoMap.find(winId) != windowInfoMap.end()) {
|
||||
qInfo() << "attachWindow: window " << winId << " is already attached";
|
||||
return false;
|
||||
}
|
||||
|
||||
windowInfos[winId] = info;
|
||||
windowInfoMap[winId] = info;
|
||||
updateExportWindowInfos();
|
||||
updateIsActive();
|
||||
|
||||
@ -510,19 +511,14 @@ void Entry::launchApp(uint32_t timestamp)
|
||||
|
||||
bool Entry::containsWindow(XWindow xid)
|
||||
{
|
||||
return windowInfos.find(xid) != windowInfos.end();
|
||||
return windowInfoMap.find(xid) != windowInfoMap.end();
|
||||
}
|
||||
|
||||
void Entry::deleteWindow(XWindow xid)
|
||||
{
|
||||
WindowInfoBase *info = windowInfos[xid];
|
||||
windowInfos.remove(xid);
|
||||
for (int i = 0; i < exportWindowInfos.size(); i++) {
|
||||
if (exportWindowInfos[i].getXid() == xid) {
|
||||
exportWindowInfos.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
WindowInfoBase *info = windowInfoMap[xid];
|
||||
windowInfoMap.remove(xid);
|
||||
exportWindowInfos.remove(xid);
|
||||
|
||||
if (info) {
|
||||
delete info;
|
||||
@ -564,7 +560,7 @@ void Entry::newInstance(uint32_t timestamp)
|
||||
// 检查应用窗口分离、合并状态
|
||||
void Entry::check()
|
||||
{
|
||||
for (auto iter = windowInfos.begin(); iter != windowInfos.end(); iter++) {
|
||||
for (auto iter = windowInfoMap.begin(); iter != windowInfoMap.end(); iter++) {
|
||||
dock->attachOrDetachWindow(iter.value());
|
||||
}
|
||||
}
|
||||
@ -573,28 +569,29 @@ void Entry::check()
|
||||
void Entry::forceQuit()
|
||||
{
|
||||
QMap<int, QVector<WindowInfoBase*>> pidWinInfoMap;
|
||||
for (auto iter = windowInfos.begin(); iter != windowInfos.end(); iter++) {
|
||||
for (auto iter = windowInfoMap.begin(); iter != windowInfoMap.end(); iter++) {
|
||||
int pid = iter.value()->getPid();
|
||||
if (pid != 0) {
|
||||
pidWinInfoMap[pid].push_back(iter.value());
|
||||
} else {
|
||||
iter.value()->killClient();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto iter = pidWinInfoMap.begin(); iter != pidWinInfoMap.end(); iter++) {
|
||||
if (!killProcess(iter.key())) { // kill pid
|
||||
for (auto &info : iter.value()) { // kill window
|
||||
info->killClient();
|
||||
}
|
||||
for (auto iter = pidWinInfoMap.begin(); iter != pidWinInfoMap.end(); iter++) {
|
||||
if (!killProcess(iter.key())) { // kill pid
|
||||
for (auto &info : iter.value()) { // kill window
|
||||
info->killClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Entry::presentWindows()
|
||||
{
|
||||
QList<uint> windows;
|
||||
for (auto iter = windowInfos.begin(); iter != windowInfos.end(); iter++)
|
||||
for (auto iter = windowInfoMap.begin(); iter != windowInfoMap.end(); iter++)
|
||||
windows.push_back(iter.key());
|
||||
|
||||
dock->presentWindows(windows);
|
||||
@ -632,7 +629,7 @@ void Entry::active(uint32_t timestamp)
|
||||
if (showing || winInfo->isMinimized()) {
|
||||
winInfo->activate();
|
||||
} else {
|
||||
if (windowInfos.size() == 1) {
|
||||
if (windowInfoMap.size() == 1) {
|
||||
winInfo->minimize();
|
||||
} else {
|
||||
WindowInfoBase *nextWin = findNextLeader();
|
||||
@ -662,7 +659,7 @@ void Entry::active(uint32_t timestamp)
|
||||
// 激活隐藏窗口
|
||||
dock->doActiveWindow(xid);
|
||||
} else {
|
||||
if (windowInfos.size() == 1) {
|
||||
if (windowInfoMap.size() == 1) {
|
||||
XCB->minimizeWindow(xid);
|
||||
} else if (dock->getActiveWindow()->getXid() == xid) {
|
||||
WindowInfoBase *nextWin = findNextLeader();
|
||||
@ -698,7 +695,7 @@ QString Entry::getMenu()
|
||||
QVector<XWindow> Entry::getAllowedClosedWindowIds()
|
||||
{
|
||||
QVector<XWindow> ret;
|
||||
for (auto iter = windowInfos.begin(); iter != windowInfos.end(); iter++) {
|
||||
for (auto iter = windowInfoMap.begin(); iter != windowInfoMap.end(); iter++) {
|
||||
WindowInfoBase *info = iter.value();
|
||||
if (info && info->allowClose())
|
||||
ret.push_back(iter.key());
|
||||
@ -707,7 +704,7 @@ QVector<XWindow> Entry::getAllowedClosedWindowIds()
|
||||
return ret;
|
||||
}
|
||||
|
||||
ExportWindowInfoList Entry::getExportWindowInfos()
|
||||
WindowInfoMap Entry::getExportWindowInfos()
|
||||
{
|
||||
return exportWindowInfos;
|
||||
}
|
||||
@ -715,7 +712,7 @@ ExportWindowInfoList Entry::getExportWindowInfos()
|
||||
QVector<WindowInfoBase *> Entry::getAllowedCloseWindows()
|
||||
{
|
||||
QVector<WindowInfoBase *> ret;
|
||||
for (auto iter = windowInfos.begin(); iter != windowInfos.end(); iter++) {
|
||||
for (auto iter = windowInfoMap.begin(); iter != windowInfoMap.end(); iter++) {
|
||||
WindowInfoBase *info = iter.value();
|
||||
if (info && info->allowClose())
|
||||
ret.push_back(info);
|
||||
@ -772,7 +769,7 @@ AppMenuItem Entry::getMenuItemCloseAll()
|
||||
qInfo() << "do MenuItem: Close All";
|
||||
auto winInfos = getAllowedCloseWindows();
|
||||
|
||||
// 从大到小排序, 方便后面关闭窗口
|
||||
// 根据创建时间从大到小排序, 方便后续关闭窗口
|
||||
for (int i = 0; i < winInfos.size() - 1; i++) {
|
||||
for (int j = i + 1; j < winInfos.size(); j++) {
|
||||
if (winInfos[i]->getCreatedTime() < winInfos[j]->getCreatedTime()) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "appinfo.h"
|
||||
#include "appmenu.h"
|
||||
#include "windowinfobase.h"
|
||||
#include "exportwindowinfolist.h"
|
||||
#include "windowinfomap.h"
|
||||
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
@ -93,7 +93,7 @@ public:
|
||||
bool getIsActive();
|
||||
QString getMenu();
|
||||
QVector<XWindow> getAllowedClosedWindowIds();
|
||||
ExportWindowInfoList getExportWindowInfos();
|
||||
WindowInfoMap getExportWindowInfos();
|
||||
|
||||
public Q_SLOTS:
|
||||
QVector<WindowInfoBase *> getAllowedCloseWindows();
|
||||
@ -106,7 +106,7 @@ Q_SIGNALS:
|
||||
void nameChanged(QString value);
|
||||
void desktopFileChanged(QString value);
|
||||
void currentWindowChanged(uint32_t value);
|
||||
void windowInfosChanged(const ExportWindowInfoList &value);
|
||||
void windowInfosChanged(const WindowInfoMap &value);
|
||||
|
||||
private:
|
||||
// 右键菜单项
|
||||
@ -135,8 +135,8 @@ private:
|
||||
QString desktopFile;
|
||||
|
||||
// Dbus属性直接放到interface上
|
||||
QMap<XWindow, WindowInfoBase *> windowInfos; // 该应用所有窗口
|
||||
ExportWindowInfoList exportWindowInfos;
|
||||
QMap<XWindow, WindowInfoBase *> windowInfoMap; // 该应用所有窗口
|
||||
WindowInfoMap exportWindowInfos; // 该应用导出的窗口属性
|
||||
WindowInfoBase *current; // 当前窗口
|
||||
XWindow currentWindow; //当前窗口Id
|
||||
bool winIconPreferred;
|
||||
|
@ -65,16 +65,16 @@ public:
|
||||
bool containAtom(QVector<XCBAtom> supports, XCBAtom ty) {return supports.indexOf(ty) != -1;}
|
||||
|
||||
protected:
|
||||
XWindow xid;
|
||||
QString title;
|
||||
QString icon;
|
||||
int pid;
|
||||
QString entryInnerId;
|
||||
QString innerId;
|
||||
Entry *entry;
|
||||
AppInfo *app;
|
||||
ProcessInfo *processInfo;
|
||||
int64_t createdTime;
|
||||
XWindow xid; // 窗口id
|
||||
QString title; // 窗口标题
|
||||
QString icon; // 窗口图标
|
||||
int pid; // 窗口所属应用进程
|
||||
QString entryInnerId; // 窗口所属应用对应的innerId
|
||||
QString innerId; // 窗口对应的innerId
|
||||
Entry *entry; // 窗口所属应用
|
||||
AppInfo *app; // 窗口所属应用对应的desktopFile信息
|
||||
ProcessInfo *processInfo; // 窗口所属应用的进程信息
|
||||
int64_t createdTime; // 创建时间
|
||||
};
|
||||
|
||||
#endif // WINDOWINFOBASE_H
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <QDebug>
|
||||
#include <QCryptographicHash>
|
||||
#include <QTimer>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
|
||||
#define XCB XCBUtils::instance()
|
||||
|
||||
@ -367,9 +369,7 @@ void WindowInfoX::update()
|
||||
// TODO 从窗口中获取图标, 并设置best size be used in Entry
|
||||
QString WindowInfoX::getIconFromWindow()
|
||||
{
|
||||
QString ret;
|
||||
|
||||
return ret;
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool WindowInfoX::isActionMinimizeAllowed()
|
||||
|
@ -209,7 +209,9 @@ void X11Manager::handleClientListChanged()
|
||||
|
||||
addClientList = newClientList - oldClientList;
|
||||
rmClientList = oldClientList - newClientList;
|
||||
dock->setClientList(newClientList.toList());
|
||||
|
||||
// 处理新增窗口
|
||||
for (auto xid : addClientList) {
|
||||
WindowInfoX *info = registerWindow(xid);
|
||||
if (!XCB->isGoodWindow(xid))
|
||||
@ -220,9 +222,10 @@ void X11Manager::handleClientListChanged()
|
||||
QString wmName(XCB->getWMName(xid).c_str());
|
||||
if (pid != 0 || (wmClass.className.size() > 0 && wmClass.instanceName.size() > 0)
|
||||
|| wmName.size() > 0 || XCB->getWMCommand(xid).size() > 0)
|
||||
dock->attachWindow(info);
|
||||
dock->attachOrDetachWindow(info);
|
||||
}
|
||||
|
||||
// 处理需要移除的窗口
|
||||
for (auto xid : rmClientList) {
|
||||
WindowInfoX *info = windowInfoMap[xid];
|
||||
if (info) {
|
||||
@ -370,7 +373,7 @@ void X11Manager::handlePropertyNotifyEvent(XWindow xid, XCBAtom atom)
|
||||
}
|
||||
|
||||
if (needAttachOrDetach)
|
||||
dock->attachWindow(winInfo);
|
||||
dock->attachOrDetachWindow(winInfo);
|
||||
|
||||
Entry *entry = dock->getEntryByWindowId(xid);
|
||||
if (!entry)
|
||||
|
Reference in New Issue
Block a user