fix: 修复Dock模块窗口属性异常的问题
修复Dock模块窗口属性WindowInfo异常的问题 log: Task: https://pms.uniontech.com/task-view-136759.html Influence: 无 Change-Id: I9bf9e532ec003d4ba7d35d6a5ed0af4e3b5d299d
This commit is contained in:
parent
2675e262e7
commit
e817c291bc
@ -12,7 +12,7 @@ DockRect::DockRect()
|
|||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DockRect &rect)
|
QDebug operator<<(QDebug debug, const DockRect &rect)
|
||||||
{
|
{
|
||||||
debug << QString("Rect(%1, %2, %3, %4)").arg(rect.X)
|
debug << QString("DockRect(%1, %2, %3, %4)").arg(rect.X)
|
||||||
.arg(rect.Y)
|
.arg(rect.Y)
|
||||||
.arg(rect.Width)
|
.arg(rect.Width)
|
||||||
.arg(rect.Height);
|
.arg(rect.Height);
|
||||||
|
51
src/frameworkdbus/types/exportwindowinfo.cpp
Normal file
51
src/frameworkdbus/types/exportwindowinfo.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include "exportwindowinfo.h"
|
||||||
|
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
|
ExportWindowInfo::ExportWindowInfo()
|
||||||
|
: m_xid(0)
|
||||||
|
, m_flash(false)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ExportWindowInfo::ExportWindowInfo(uint32_t xid, const QString &title, bool flash)
|
||||||
|
: m_xid(xid)
|
||||||
|
, m_title(title)
|
||||||
|
, m_flash(flash)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const ExportWindowInfo &info)
|
||||||
|
{
|
||||||
|
debug << QString("ExportWindowInfo(%1, %2, %3)").arg(info.m_xid)
|
||||||
|
.arg(info.m_title)
|
||||||
|
.arg(info.m_flash);
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &info)
|
||||||
|
{
|
||||||
|
arg.beginStructure();
|
||||||
|
arg << info.m_xid << info.m_title << info.m_flash;
|
||||||
|
arg.endStructure();
|
||||||
|
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &info)
|
||||||
|
{
|
||||||
|
arg.beginStructure();
|
||||||
|
arg >> info.m_xid >> info.m_title >> info.m_flash;
|
||||||
|
arg.endStructure();
|
||||||
|
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerExportWindowInfoMetaType()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<ExportWindowInfo>("ExportWindowInfo");
|
||||||
|
qDBusRegisterMetaType<ExportWindowInfo>();
|
||||||
|
}
|
31
src/frameworkdbus/types/exportwindowinfo.h
Normal file
31
src/frameworkdbus/types/exportwindowinfo.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef EXPORTWINDOWINFO_H
|
||||||
|
#define EXPORTWINDOWINFO_H
|
||||||
|
|
||||||
|
#include <QRect>
|
||||||
|
#include <QDBusMetaType>
|
||||||
|
|
||||||
|
struct ExportWindowInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExportWindowInfo();
|
||||||
|
ExportWindowInfo(uint32_t xid, const QString &title, bool flash);
|
||||||
|
|
||||||
|
friend QDebug operator<<(QDebug debug, const ExportWindowInfo &rect);
|
||||||
|
friend const QDBusArgument &operator>>(const QDBusArgument &arg, ExportWindowInfo &rect);
|
||||||
|
friend QDBusArgument &operator<<(QDBusArgument &arg, const ExportWindowInfo &rect);
|
||||||
|
|
||||||
|
uint32_t getXid() {return m_xid;}
|
||||||
|
QString getTitle() {return m_title;}
|
||||||
|
bool getFlash() {return m_flash;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t m_xid;
|
||||||
|
QString m_title;
|
||||||
|
bool m_flash;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(ExportWindowInfo)
|
||||||
|
|
||||||
|
void registerExportWindowInfoMetaType();
|
||||||
|
|
||||||
|
#endif // EXPORTWINDOWINFO_H
|
18
src/frameworkdbus/types/exportwindowinfolist.cpp
Normal file
18
src/frameworkdbus/types/exportwindowinfolist.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "exportwindowinfolist.h"
|
||||||
|
|
||||||
|
void sortExprotWindowInfoList(ExportWindowInfoList &list)
|
||||||
|
{
|
||||||
|
qSort(list.begin(), list.end(), compareWindowXid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerExportWindowInfoListMetaType()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<ExportWindowInfoList>("ExportWindowInfoList");
|
||||||
|
qDBusRegisterMetaType<ExportWindowInfoList>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按xid进行排序
|
||||||
|
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2)
|
||||||
|
{
|
||||||
|
return info1.getXid() < info2.getXid();
|
||||||
|
}
|
18
src/frameworkdbus/types/exportwindowinfolist.h
Normal file
18
src/frameworkdbus/types/exportwindowinfolist.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef EXPORTWINDOWINFOLIST_H
|
||||||
|
#define EXPORTWINDOWINFOLIST_H
|
||||||
|
#include "exportwindowinfo.h"
|
||||||
|
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QDBusMetaType>
|
||||||
|
|
||||||
|
typedef QList<ExportWindowInfo> ExportWindowInfoList;
|
||||||
|
|
||||||
|
bool compareWindowXid(ExportWindowInfo &info1, ExportWindowInfo &info2);
|
||||||
|
|
||||||
|
void sortExprotWindowInfoList(ExportWindowInfoList &list);
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(ExportWindowInfoList)
|
||||||
|
|
||||||
|
void registerExportWindowInfoListMetaType();
|
||||||
|
|
||||||
|
#endif // EXPORTWINDOWINFOLIST_H
|
@ -27,7 +27,11 @@ DBusAdaptorEntry::DBusAdaptorEntry(QObject *parent)
|
|||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
setAutoRelaySignals(true);
|
setAutoRelaySignals(true);
|
||||||
//qDBusRegisterMetaType<ExportWindowInfo>();
|
if (QMetaType::type("ExportWindowInfo") == QMetaType::UnknownType)
|
||||||
|
registerExportWindowInfoMetaType();
|
||||||
|
|
||||||
|
if (QMetaType::type("ExportWindowInfoList") == QMetaType::UnknownType)
|
||||||
|
registerExportWindowInfoListMetaType();
|
||||||
|
|
||||||
Entry *entry = static_cast<Entry *>(QObject::parent());
|
Entry *entry = static_cast<Entry *>(QObject::parent());
|
||||||
if (entry) {
|
if (entry) {
|
||||||
@ -38,12 +42,12 @@ DBusAdaptorEntry::DBusAdaptorEntry(QObject *parent)
|
|||||||
connect(entry, &Entry::nameChanged, this, &DBusAdaptorEntry::NameChanged);
|
connect(entry, &Entry::nameChanged, this, &DBusAdaptorEntry::NameChanged);
|
||||||
connect(entry, &Entry::desktopFileChanged, this, &DBusAdaptorEntry::DesktopFileChanged);
|
connect(entry, &Entry::desktopFileChanged, this, &DBusAdaptorEntry::DesktopFileChanged);
|
||||||
connect(entry, &Entry::currentWindowChanged, this, &DBusAdaptorEntry::CurrentWindowChanged);
|
connect(entry, &Entry::currentWindowChanged, this, &DBusAdaptorEntry::CurrentWindowChanged);
|
||||||
|
connect(entry, &Entry::windowInfosChanged, this, &DBusAdaptorEntry::WindowInfosChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBusAdaptorEntry::~DBusAdaptorEntry()
|
DBusAdaptorEntry::~DBusAdaptorEntry()
|
||||||
{
|
{
|
||||||
// destructor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint DBusAdaptorEntry::currentWindow() const
|
uint DBusAdaptorEntry::currentWindow() const
|
||||||
@ -86,12 +90,11 @@ QString DBusAdaptorEntry::name() const
|
|||||||
return parent()->getName();
|
return parent()->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
ExportWindowInfoList DBusAdaptorEntry::windowInfos()
|
||||||
QList<ExportWindowInfo> DBusAdaptorEntry::windowInfos()
|
|
||||||
{
|
{
|
||||||
return parent()->getExportWindowInfos();
|
return parent()->getExportWindowInfos();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
Entry *DBusAdaptorEntry::parent() const
|
Entry *DBusAdaptorEntry::parent() const
|
||||||
{
|
{
|
||||||
return static_cast<Entry *>(QObject::parent());
|
return static_cast<Entry *>(QObject::parent());
|
||||||
@ -152,26 +155,3 @@ void DBusAdaptorEntry::RequestUndock()
|
|||||||
parent()->requestUndock();
|
parent()->requestUndock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QDBusArgument &operator <<(QDBusArgument &argument, const ExportWindowInfo &info)
|
|
||||||
{
|
|
||||||
argument.beginStructure();
|
|
||||||
argument << info.xid << info.title << info.flash;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDBusArgument &operator >>(const QDBusArgument &argument, ExportWindowInfo &info)
|
|
||||||
{
|
|
||||||
argument.beginStructure();
|
|
||||||
argument >> info.xid >> info.title >> info.flash;
|
|
||||||
argument.endStructure();
|
|
||||||
return argument;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug deg, const ExportWindowInfo &info)
|
|
||||||
{
|
|
||||||
qDebug() << "xid: " << info.xid << " title:" << info.title << " flash:" << info.flash;
|
|
||||||
|
|
||||||
return deg;
|
|
||||||
}
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#define DBUSADAPTORENTRY_H
|
#define DBUSADAPTORENTRY_H
|
||||||
|
|
||||||
#include "entry.h"
|
#include "entry.h"
|
||||||
|
#include "exportwindowinfolist.h"
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QMetaObject>
|
#include <QtCore/QMetaObject>
|
||||||
@ -37,12 +38,6 @@
|
|||||||
|
|
||||||
#include <DBusExtendedAbstractInterface>
|
#include <DBusExtendedAbstractInterface>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ExportWindowInfo)
|
|
||||||
|
|
||||||
QDBusArgument &operator <<(QDBusArgument &argument, const ExportWindowInfo &info);
|
|
||||||
const QDBusArgument &operator >>(const QDBusArgument &argument, ExportWindowInfo &info);
|
|
||||||
QDebug operator<<(QDebug deg, const ExportWindowInfo &info);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adaptor class for interface org.deepin.dde.daemon.Dock1.Entry
|
* Adaptor class for interface org.deepin.dde.daemon.Dock1.Entry
|
||||||
*/
|
*/
|
||||||
@ -51,39 +46,40 @@ class DBusAdaptorEntry: public QDBusAbstractAdaptor
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.deepin.dde.daemon.Dock1.Entry")
|
Q_CLASSINFO("D-Bus Interface", "org.deepin.dde.daemon.Dock1.Entry")
|
||||||
Q_CLASSINFO("D-Bus Introspection", ""
|
Q_CLASSINFO("D-Bus Introspection", ""
|
||||||
" <interface name=\"org.deepin.dde.daemon.Dock1.Entry\">\n"
|
" <interface name=\"org.deepin.dde.daemon.Dock1.Entry\">\n"
|
||||||
" <method name=\"Activate\">\n"
|
" <method name=\"Activate\">\n"
|
||||||
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
" <method name=\"Check\"/>\n"
|
" <method name=\"Check\"/>\n"
|
||||||
" <method name=\"ForceQuit\"/>\n"
|
" <method name=\"ForceQuit\"/>\n"
|
||||||
" <method name=\"GetAllowedCloseWindows\">\n"
|
" <method name=\"GetAllowedCloseWindows\">\n"
|
||||||
" <arg direction=\"out\" type=\"au\" name=\"windows\"/>\n"
|
" <arg direction=\"out\" type=\"au\" name=\"windows\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
" <method name=\"HandleDragDrop\">\n"
|
" <method name=\"HandleDragDrop\">\n"
|
||||||
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
||||||
" <arg direction=\"in\" type=\"as\" name=\"files\"/>\n"
|
" <arg direction=\"in\" type=\"as\" name=\"files\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
" <method name=\"HandleMenuItem\">\n"
|
" <method name=\"HandleMenuItem\">\n"
|
||||||
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
||||||
" <arg direction=\"in\" type=\"s\" name=\"id\"/>\n"
|
" <arg direction=\"in\" type=\"s\" name=\"id\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
" <method name=\"NewInstance\">\n"
|
" <method name=\"NewInstance\">\n"
|
||||||
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
" <arg direction=\"in\" type=\"u\" name=\"timestamp\"/>\n"
|
||||||
" </method>\n"
|
" </method>\n"
|
||||||
" <method name=\"PresentWindows\"/>\n"
|
" <method name=\"PresentWindows\"/>\n"
|
||||||
" <method name=\"RequestDock\"/>\n"
|
" <method name=\"RequestDock\"/>\n"
|
||||||
" <method name=\"RequestUndock\"/>\n"
|
" <method name=\"RequestUndock\"/>\n"
|
||||||
" <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
|
" <property access=\"read\" type=\"s\" name=\"Name\"/>\n"
|
||||||
" <property access=\"read\" type=\"s\" name=\"Icon\"/>\n"
|
" <property access=\"read\" type=\"s\" name=\"Icon\"/>\n"
|
||||||
" <property access=\"read\" type=\"s\" name=\"Id\"/>\n"
|
" <property access=\"read\" type=\"s\" name=\"Id\"/>\n"
|
||||||
" <property access=\"read\" type=\"b\" name=\"IsActive\"/>\n"
|
" <property access=\"read\" type=\"b\" name=\"IsActive\"/>\n"
|
||||||
" <property access=\"read\" type=\"u\" name=\"CurrentWindow\"/>\n"
|
" <property access=\"read\" type=\"u\" name=\"CurrentWindow\"/>\n"
|
||||||
" <property access=\"read\" type=\"b\" name=\"IsDocked\"/>\n"
|
" <property access=\"read\" type=\"b\" name=\"IsDocked\"/>\n"
|
||||||
" <property access=\"read\" type=\"s\" name=\"Menu\"/>\n"
|
" <property access=\"read\" type=\"s\" name=\"Menu\"/>\n"
|
||||||
" <property access=\"read\" type=\"s\" name=\"DesktopFile\"/>\n"
|
" <property access=\"read\" type=\"s\" name=\"DesktopFile\"/>\n"
|
||||||
" <property access=\"read\" type=\"a(usb)\" name=\"WindowInfos\"/>\n"
|
" <property access=\"read\" type=\"a(usb)\" name=\"WindowInfos\"/>\n"
|
||||||
" </interface>\n"
|
" <annotation value=\"ExportWindowInfoList\" name=\"org.qtproject.QtDBus.QtTypeName\"/>\n"
|
||||||
|
" </interface>\n"
|
||||||
"")
|
"")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -115,8 +111,8 @@ public: // PROPERTIES
|
|||||||
Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
|
Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
|
||||||
//Q_PROPERTY(QString WindowInfos READ windowInfos)
|
Q_PROPERTY(ExportWindowInfoList WindowInfos READ windowInfos NOTIFY WindowInfosChanged)
|
||||||
//QList<ExportWindowInfo> windowInfos();
|
ExportWindowInfoList windowInfos();
|
||||||
|
|
||||||
Entry *parent() const;
|
Entry *parent() const;
|
||||||
|
|
||||||
@ -140,6 +136,7 @@ Q_SIGNALS: // SIGNALS
|
|||||||
void NameChanged(QString value);
|
void NameChanged(QString value);
|
||||||
void DesktopFileChanged(QString value);
|
void DesktopFileChanged(QString value);
|
||||||
void CurrentWindowChanged(uint32_t value);
|
void CurrentWindowChanged(uint32_t value);
|
||||||
|
void WindowInfosChanged(ExportWindowInfoList value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -149,7 +149,7 @@ void DBusHandler::listenKWindowSignals(WindowInfoK *windowInfo)
|
|||||||
if (entry->getCurrentWindowInfo() == windowInfo)
|
if (entry->getCurrentWindowInfo() == windowInfo)
|
||||||
entry->updateName();
|
entry->updateName();
|
||||||
|
|
||||||
entry->updateWindowInfos();
|
entry->updateExportWindowInfos();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Icon changed
|
// Icon changed
|
||||||
@ -169,7 +169,7 @@ void DBusHandler::listenKWindowSignals(WindowInfoK *windowInfo)
|
|||||||
if (!entry)
|
if (!entry)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry->updateWindowInfos();
|
entry->updateExportWindowInfos();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Geometry changed
|
// Geometry changed
|
||||||
|
@ -1008,11 +1008,12 @@ void Dock::attachOrDetachWindow(WindowInfoBase *info)
|
|||||||
} else {
|
} else {
|
||||||
// attach
|
// attach
|
||||||
if (info->getEntryInnerId().isEmpty()) {
|
if (info->getEntryInnerId().isEmpty()) {
|
||||||
// 识别窗口并创建entryInnerId
|
// 窗口entryInnerId为空表示未识别,需要识别窗口并创建entryInnerId
|
||||||
qInfo() << "attach operate: window " << winId << " entryInnerId is empty, now call IdentifyWindow";
|
qInfo() << "attach operate: window " << winId << " entryInnerId is empty, now call IdentifyWindow";
|
||||||
QString innerId;
|
QString innerId;
|
||||||
AppInfo *appInfo = windowIdentify->identifyWindow(info, innerId);
|
AppInfo *appInfo = windowIdentify->identifyWindow(info, innerId);
|
||||||
info->setEntryInnerId(innerId); // windowBaseInfo entryInnerId is AppInfo innerId, for binding window and appInfo
|
// 窗口entryInnerId即AppInfo的innerId, 用来将窗口和应用绑定关系
|
||||||
|
info->setEntryInnerId(innerId);
|
||||||
info->setAppInfo(appInfo);
|
info->setAppInfo(appInfo);
|
||||||
markAppLaunched(appInfo);
|
markAppLaunched(appInfo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -413,26 +413,40 @@ bool Entry::hasWindow()
|
|||||||
return windowInfos.size() > 0;
|
return windowInfos.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::updateWindowInfos()
|
/**
|
||||||
|
* @brief Entry::updateExportWindowInfos 同步更新导出窗口信息
|
||||||
|
*/
|
||||||
|
void Entry::updateExportWindowInfos()
|
||||||
{
|
{
|
||||||
QList<ExportWindowInfo> infos;
|
ExportWindowInfoList infos;
|
||||||
bool changed = false;
|
|
||||||
for (auto info : windowInfos) {
|
for (auto info : windowInfos) {
|
||||||
XWindow xid = info->getXid();
|
XWindow xid = info->getXid();
|
||||||
QString title = info->getTitle();
|
QString title = info->getTitle();
|
||||||
bool flash = info->isDemandingAttention();
|
bool flash = info->isDemandingAttention();
|
||||||
infos.push_back({xid, title, flash});
|
infos.push_back({xid, title, flash});
|
||||||
if (!changed) {
|
}
|
||||||
for (auto info : exportWindowInfos) {
|
|
||||||
if (info.title != title || info.flash != flash)
|
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()) {
|
||||||
changed = true;
|
changed = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
exportWindowInfos = infos;
|
Q_EMIT windowInfosChanged(infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportWindowInfos = infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分离窗口, 返回是否需要从任务栏remove
|
// 分离窗口, 返回是否需要从任务栏remove
|
||||||
@ -456,7 +470,7 @@ bool Entry::detachWindow(WindowInfoBase *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWindowInfos();
|
updateExportWindowInfos();
|
||||||
updateIcon();
|
updateIcon();
|
||||||
updateIsActive();
|
updateIsActive();
|
||||||
updateMenu();
|
updateMenu();
|
||||||
@ -476,7 +490,7 @@ bool Entry::attachWindow(WindowInfoBase *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
windowInfos[winId] = info;
|
windowInfos[winId] = info;
|
||||||
updateWindowInfos();
|
updateExportWindowInfos();
|
||||||
updateIsActive();
|
updateIsActive();
|
||||||
|
|
||||||
if (!current) {
|
if (!current) {
|
||||||
@ -504,7 +518,7 @@ void Entry::deleteWindow(XWindow xid)
|
|||||||
WindowInfoBase *info = windowInfos[xid];
|
WindowInfoBase *info = windowInfos[xid];
|
||||||
windowInfos.remove(xid);
|
windowInfos.remove(xid);
|
||||||
for (int i = 0; i < exportWindowInfos.size(); i++) {
|
for (int i = 0; i < exportWindowInfos.size(); i++) {
|
||||||
if (exportWindowInfos[i].xid == xid) {
|
if (exportWindowInfos[i].getXid() == xid) {
|
||||||
exportWindowInfos.removeAt(i);
|
exportWindowInfos.removeAt(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -693,7 +707,7 @@ QVector<XWindow> Entry::getAllowedClosedWindowIds()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ExportWindowInfo> Entry::getExportWindowInfos()
|
ExportWindowInfoList Entry::getExportWindowInfos()
|
||||||
{
|
{
|
||||||
return exportWindowInfos;
|
return exportWindowInfos;
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,12 @@
|
|||||||
#include "appinfo.h"
|
#include "appinfo.h"
|
||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#include "windowinfobase.h"
|
#include "windowinfobase.h"
|
||||||
|
#include "exportwindowinfolist.h"
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
struct ExportWindowInfo {
|
|
||||||
XWindow xid;
|
|
||||||
QString title;
|
|
||||||
bool flash;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 单个应用类
|
// 单个应用类
|
||||||
class Dock;
|
class Dock;
|
||||||
class Entry: public QObject
|
class Entry: public QObject
|
||||||
@ -76,7 +71,7 @@ public:
|
|||||||
WindowInfoBase *findNextLeader();
|
WindowInfoBase *findNextLeader();
|
||||||
QString getExec(bool oneLine);
|
QString getExec(bool oneLine);
|
||||||
bool hasWindow();
|
bool hasWindow();
|
||||||
void updateWindowInfos();
|
void updateExportWindowInfos();
|
||||||
bool detachWindow(WindowInfoBase *info);
|
bool detachWindow(WindowInfoBase *info);
|
||||||
bool attachWindow(WindowInfoBase *info);
|
bool attachWindow(WindowInfoBase *info);
|
||||||
void launchApp(uint32_t timestamp);
|
void launchApp(uint32_t timestamp);
|
||||||
@ -98,7 +93,7 @@ public:
|
|||||||
bool getIsActive();
|
bool getIsActive();
|
||||||
QString getMenu();
|
QString getMenu();
|
||||||
QVector<XWindow> getAllowedClosedWindowIds();
|
QVector<XWindow> getAllowedClosedWindowIds();
|
||||||
QList<ExportWindowInfo> getExportWindowInfos();
|
ExportWindowInfoList getExportWindowInfos();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
QVector<WindowInfoBase *> getAllowedCloseWindows();
|
QVector<WindowInfoBase *> getAllowedCloseWindows();
|
||||||
@ -111,6 +106,7 @@ Q_SIGNALS:
|
|||||||
void nameChanged(QString value);
|
void nameChanged(QString value);
|
||||||
void desktopFileChanged(QString value);
|
void desktopFileChanged(QString value);
|
||||||
void currentWindowChanged(uint32_t value);
|
void currentWindowChanged(uint32_t value);
|
||||||
|
void windowInfosChanged(const ExportWindowInfoList &value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// 右键菜单项
|
// 右键菜单项
|
||||||
@ -140,7 +136,7 @@ private:
|
|||||||
|
|
||||||
// Dbus属性直接放到interface上
|
// Dbus属性直接放到interface上
|
||||||
QMap<XWindow, WindowInfoBase *> windowInfos; // 该应用所有窗口
|
QMap<XWindow, WindowInfoBase *> windowInfos; // 该应用所有窗口
|
||||||
QList<ExportWindowInfo> exportWindowInfos;
|
ExportWindowInfoList exportWindowInfos;
|
||||||
WindowInfoBase *current; // 当前窗口
|
WindowInfoBase *current; // 当前窗口
|
||||||
XWindow currentWindow; //当前窗口Id
|
XWindow currentWindow; //当前窗口Id
|
||||||
bool winIconPreferred;
|
bool winIconPreferred;
|
||||||
|
@ -118,6 +118,10 @@ AppInfo *WindowIdentify::identifyWindow(WindowInfoBase *winInfo, QString &innerI
|
|||||||
AppInfo *WindowIdentify::identifyWindowX11(WindowInfoX *winInfo, QString &innerId)
|
AppInfo *WindowIdentify::identifyWindowX11(WindowInfoX *winInfo, QString &innerId)
|
||||||
{
|
{
|
||||||
AppInfo *appInfo = nullptr;
|
AppInfo *appInfo = nullptr;
|
||||||
|
if (winInfo->getInnerId().isEmpty()) {
|
||||||
|
qInfo() << "identifyWindowX11: window innerId is empty";
|
||||||
|
return appInfo;
|
||||||
|
}
|
||||||
|
|
||||||
for (auto iter = identifyWindowFuns.begin(); iter != identifyWindowFuns.end(); iter++) {
|
for (auto iter = identifyWindowFuns.begin(); iter != identifyWindowFuns.end(); iter++) {
|
||||||
QString name = iter.key();
|
QString name = iter.key();
|
||||||
|
@ -245,6 +245,11 @@ void WindowInfoX::updateHasXEmbedInfo()
|
|||||||
hasXEmbedInfo = XCB->hasXEmbedInfo(xid);
|
hasXEmbedInfo = XCB->hasXEmbedInfo(xid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief WindowInfoX::genInnerId 生成innerId
|
||||||
|
* @param winInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
QString WindowInfoX::genInnerId(WindowInfoX *winInfo)
|
QString WindowInfoX::genInnerId(WindowInfoX *winInfo)
|
||||||
{
|
{
|
||||||
XWindow winId = winInfo->getXid();
|
XWindow winId = winInfo->getXid();
|
||||||
|
@ -93,9 +93,16 @@ WindowPatterns::WindowPatterns()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief WindowPatterns::match 匹配窗口
|
||||||
|
* @param winInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
QString WindowPatterns::match(WindowInfoX *winInfo)
|
QString WindowPatterns::match(WindowInfoX *winInfo)
|
||||||
{
|
{
|
||||||
|
for (auto pattern : patterns) {
|
||||||
|
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class WindowPatterns
|
|||||||
struct WindowPattern {
|
struct WindowPattern {
|
||||||
QVector<QVector<QString>> rules; // rules
|
QVector<QVector<QString>> rules; // rules
|
||||||
QString result; // ret
|
QString result; // ret
|
||||||
QVector< RuleValueParse> parseRules;
|
QVector<RuleValueParse> parseRules;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -369,7 +369,7 @@ void X11Manager::handlePropertyNotifyEvent(XWindow xid, XCBAtom atom)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (atom == XCB->getAtom("_NET_WM_STATE")) {
|
if (atom == XCB->getAtom("_NET_WM_STATE")) {
|
||||||
entry->updateWindowInfos();
|
entry->updateExportWindowInfos();
|
||||||
} else if (atom == XCB->getAtom("_NET_WM_ICON")) {
|
} else if (atom == XCB->getAtom("_NET_WM_ICON")) {
|
||||||
if (entry->getCurrentWindowInfo() == winInfo) {
|
if (entry->getCurrentWindowInfo() == winInfo) {
|
||||||
entry->updateIcon();
|
entry->updateIcon();
|
||||||
@ -378,7 +378,7 @@ void X11Manager::handlePropertyNotifyEvent(XWindow xid, XCBAtom atom)
|
|||||||
if (entry->getCurrentWindowInfo() == winInfo) {
|
if (entry->getCurrentWindowInfo() == winInfo) {
|
||||||
entry->updateName();
|
entry->updateName();
|
||||||
}
|
}
|
||||||
entry->updateWindowInfos();
|
entry->updateExportWindowInfos();
|
||||||
} else if (atom == XCB->getAtom("_NET_WM_ALLOWED_ACTIONS")) {
|
} else if (atom == XCB->getAtom("_NET_WM_ALLOWED_ACTIONS")) {
|
||||||
entry->updateMenu();
|
entry->updateMenu();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user