diff --git a/panel-daemon/convert-desktop-windowid/convertdesktoptowinid.cpp b/panel-daemon/convert-desktop-windowid/convertdesktoptowinid.cpp index 1488a7b..330f825 100644 --- a/panel-daemon/convert-desktop-windowid/convertdesktoptowinid.cpp +++ b/panel-daemon/convert-desktop-windowid/convertdesktoptowinid.cpp @@ -68,7 +68,8 @@ QString ConvertDesktopToWinId::confirmDesktopFile(int id) //第一种方法:比较名字一致性 if (m_desktopfilePath.isEmpty()) { - m_className = kdk::WindowManager::getWindowGroup(id); + // getWindowGroup 这个方法的实现有异常,如果单例没有初始化会直接返回空,加上 self 保证初始化。 + m_className = kdk::WindowManager::self()->getWindowGroup(id); //匹配安卓兼容 if (m_className == "kylin-kmre-window") { @@ -203,7 +204,10 @@ void ConvertDesktopToWinId::compareClassName() } path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1); path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf(".")); - if (path_desktop_name == m_className || path_desktop_name == m_statusName) { + + // Chrome 浏览器的 ClassName 是 Google-chrome,destkop 名是 google-crhome,忽略大小写以适配这种情况。 + if (QString::compare(path_desktop_name, m_className, Qt::CaseInsensitive) == 0 + || QString::compare(path_desktop_name, m_statusName, Qt::CaseInsensitive) == 0) { m_desktopfilePath = fileInfo.filePath(); break; }