规范任务栏代码,增加代码整洁度和安全性
Log: 规范任务栏模块代码 Task: https://pms.uniontech.com/task-view-150885.html Influence: 无 Change-Id: I385fbb71cf4c1408ffd4c6684128b412a187ab28
This commit is contained in:
parent
e9e79e3ac9
commit
e557f374c5
@ -496,7 +496,9 @@ WMClass XCBUtils::getWMClass(XWindow xid)
|
|||||||
if (reply.instance_name)
|
if (reply.instance_name)
|
||||||
ret.instanceName.assign(reply.instance_name);
|
ret.instanceName.assign(reply.instance_name);
|
||||||
|
|
||||||
xcb_icccm_get_wm_class_reply_wipe(&reply);
|
if (reply.class_name || reply.instance_name) {
|
||||||
|
xcb_icccm_get_wm_class_reply_wipe(&reply);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ QString AppMenu::getMenuJsonStr()
|
|||||||
objItem["itemIconInactive"] = item.iconInactive;
|
objItem["itemIconInactive"] = item.iconInactive;
|
||||||
objItem["showCheckMark"] = item.showCheckMark;
|
objItem["showCheckMark"] = item.showCheckMark;
|
||||||
objItem["itemSubMenu"] = item.subMenu ? item.subMenu->getMenuJsonStr() : "";
|
objItem["itemSubMenu"] = item.subMenu ? item.subMenu->getMenuJsonStr() : "";
|
||||||
array.push_back(QJsonValue(objItem));
|
array.push_back(objItem);
|
||||||
}
|
}
|
||||||
obj["items"] = QJsonValue(array);
|
obj["items"] = QJsonValue(array);
|
||||||
obj["checkableMenu"] = checkableMenu;
|
obj["checkableMenu"] = checkableMenu;
|
||||||
|
@ -203,13 +203,14 @@ void Dock::undockEntry(Entry *entry)
|
|||||||
QString desktopFile = entry->getFileName();
|
QString desktopFile = entry->getFileName();
|
||||||
QString filebase(desktopFile.data(), desktopFile.size() - 9);
|
QString filebase(desktopFile.data(), desktopFile.size() - 9);
|
||||||
if (desktopFile.contains(scratchDir)) {
|
if (desktopFile.contains(scratchDir)) {
|
||||||
for (auto &ext : QStringList() << ".desktop" << ".sh" << ".png") {
|
QStringList suffixs {".desktop", ".sh", ".png"};
|
||||||
|
for (auto &ext : suffixs) {
|
||||||
QString fileName = filebase + ext;
|
QString fileName = filebase + ext;
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
if (file.exists())
|
if (file.exists()) {
|
||||||
file.remove();
|
file.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry->hasWindow()) {
|
if (entry->hasWindow()) {
|
||||||
|
@ -579,7 +579,6 @@ void Entry::forceQuit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::presentWindows()
|
void Entry::presentWindows()
|
||||||
|
@ -221,9 +221,9 @@ void X11Manager::handleClientListChanged()
|
|||||||
QString wmName(XCB->getWMName(xid).c_str());
|
QString wmName(XCB->getWMName(xid).c_str());
|
||||||
if (pid != 0 || (wmClass.className.size() > 0 && wmClass.instanceName.size() > 0)
|
if (pid != 0 || (wmClass.className.size() > 0 && wmClass.instanceName.size() > 0)
|
||||||
|| wmName.size() > 0 || XCB->getWMCommand(xid).size() > 0) {
|
|| wmName.size() > 0 || XCB->getWMCommand(xid).size() > 0) {
|
||||||
WindowInfoBase *base = static_cast<WindowInfoBase *>(info);
|
|
||||||
if (base) {
|
if (info) {
|
||||||
Q_EMIT requestAttachOrDetachWindow(base);
|
Q_EMIT requestAttachOrDetachWindow(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,9 +248,8 @@ void X11Manager::handleActiveWindowChangedX()
|
|||||||
{
|
{
|
||||||
XWindow active = XCB->getActiveWindow();
|
XWindow active = XCB->getActiveWindow();
|
||||||
WindowInfoX *info = findWindowByXid(active);
|
WindowInfoX *info = findWindowByXid(active);
|
||||||
WindowInfoBase *base = static_cast<WindowInfoBase *>(info);
|
if (info) {
|
||||||
if (base) {
|
Q_EMIT requestHandleActiveWindowChange(info);
|
||||||
Q_EMIT requestHandleActiveWindowChange(base);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,8 +381,9 @@ void X11Manager::handlePropertyNotifyEvent(XWindow xid, XCBAtom atom)
|
|||||||
needAttachOrDetach = true;
|
needAttachOrDetach = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needAttachOrDetach)
|
if (needAttachOrDetach && winInfo) {
|
||||||
dock->attachOrDetachWindow(winInfo);
|
Q_EMIT requestAttachOrDetachWindow(winInfo);
|
||||||
|
}
|
||||||
|
|
||||||
Entry *entry = dock->getEntryByWindowId(xid);
|
Entry *entry = dock->getEntryByWindowId(xid);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
Loading…
Reference in New Issue
Block a user