Merge pull request #2148 from eulertour/master

UI: Fall back to XGetWMName if XFetchName fails
master
Jim 2019-11-05 12:54:50 -08:00 committed by GitHub
commit cbfb779876
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -126,10 +126,17 @@ static std::string GetWindowTitle(size_t i)
if (status >= Success && name != nullptr) { if (status >= Success && name != nullptr) {
std::string str(name); std::string str(name);
windowTitle = str; windowTitle = str;
XFree(name);
} else {
XTextProperty xtp_new_name;
if (XGetWMName(disp(), w, &xtp_new_name) != 0 &&
xtp_new_name.value != nullptr) {
std::string str((const char *)xtp_new_name.value);
windowTitle = str;
XFree(xtp_new_name.value);
}
} }
XFree(name);
return windowTitle; return windowTitle;
} }