fix: 修复重启AM后浏览器没有显示在任务栏的问题
修复重启AM后浏览器没有显示在任务栏的问题 Log: Task: https://pms.uniontech.com/task-view-137667.html Influence: 无 Change-Id: I147ff7d2329f0d568496fdb6970925392e485d77
This commit is contained in:
@ -271,7 +271,7 @@ std::string DesktopInfo::getId()
|
||||
idStr = m_fileName.substr(0, m_fileName.size() - 8); // trim suffix
|
||||
size_t dirPos = idStr.find("/applications/");
|
||||
if (dirPos == std::string::npos)
|
||||
return "";
|
||||
return idStr;
|
||||
|
||||
std::string baseDir(idStr.substr(0, dirPos + 14)); // length of "/applications/" is 14
|
||||
std::vector<std::string> appDirs = BaseDir::appDirs();
|
||||
|
@ -145,3 +145,16 @@ void DString::delQuote(std::string &str)
|
||||
str.assign(str.substr(1, str.size() - 2));
|
||||
}
|
||||
|
||||
std::string DString::join(std::vector<std::string> strs, std::string joinStr)
|
||||
{
|
||||
std::string ret;
|
||||
for (uint i = 0; i < strs.size(); i++) {
|
||||
if (i < strs.size() - 1) {
|
||||
ret += strs[i] + joinStr;
|
||||
} else {
|
||||
ret += strs[i];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
// 去除首尾引用
|
||||
static char *delQuote(const char *chars);
|
||||
static void delQuote(std::string &str);
|
||||
// 连接字符串
|
||||
static std::string join(std::vector<std::string> strs, std::string joinStr);
|
||||
};
|
||||
|
||||
#endif // DSTRING_H
|
||||
|
@ -155,12 +155,12 @@ Geometry XCBUtils::getWindowGeometry(XWindow xid)
|
||||
|
||||
XWindow XCBUtils::getActiveWindow()
|
||||
{
|
||||
XWindow ret;
|
||||
xcb_get_property_cookie_t cookie = xcb_ewmh_get_active_window(&m_ewmh, m_screenNum);
|
||||
if (!xcb_ewmh_get_active_window_reply(&m_ewmh, cookie, &ret, nullptr))
|
||||
std::cout << "getActiveWindow error" << std::endl;
|
||||
XWindow ret;
|
||||
xcb_get_property_cookie_t cookie = xcb_ewmh_get_active_window(&m_ewmh, m_screenNum);
|
||||
if (!xcb_ewmh_get_active_window_reply(&m_ewmh, cookie, &ret, nullptr))
|
||||
std::cout << "getActiveWindow error" << std::endl;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void XCBUtils::setActiveWindow(XWindow xid)
|
||||
@ -441,17 +441,12 @@ WMClass XCBUtils::getWMClass(XWindow xid)
|
||||
xcb_icccm_get_wm_class_reply_t reply;
|
||||
reply.instance_name = nullptr;
|
||||
reply.class_name = nullptr;
|
||||
if (!xcb_icccm_get_wm_class_reply(m_connect, cookie, &reply, nullptr)) {
|
||||
if (reply.class_name)
|
||||
ret.className.assign(reply.class_name);
|
||||
xcb_icccm_get_wm_class_reply(m_connect, cookie, &reply, nullptr); // 返回值为0不一定表示失败, 故不做返回值判断
|
||||
if (reply.class_name)
|
||||
ret.className.assign(reply.class_name);
|
||||
|
||||
if (reply.instance_name)
|
||||
ret.instanceName.assign(reply.instance_name);
|
||||
|
||||
//xcb_icccm_get_wm_class_reply_wipe(&reply);
|
||||
} else {
|
||||
std::cout << xid << " getWMClass error" << std::endl;
|
||||
}
|
||||
if (reply.instance_name)
|
||||
ret.instanceName.assign(reply.instance_name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user