fix for certain window names not being detected

This commit is contained in:
WarmUpTill
2018-03-05 02:26:34 +01:00
committed by GitHub
parent c934b5c7ff
commit 42dcd9dec4

View File

@@ -150,7 +150,9 @@ static std::string GetWindowTitle(size_t i)
std::string windowTitle; std::string windowTitle;
char* name; char* name;
int status = XFetchName(disp(), w, &name); XTextProperty text;
int status = XGetWMName(disp(), w, &text);
name = reinterpret_cast<char*>(text.value);
if (status >= Success && name != nullptr) if (status >= Success && name != nullptr)
{ {
std::string str(name); std::string str(name);
@@ -201,7 +203,9 @@ void GetCurrentWindowTitle(string &title)
&bytes, &bytes,
(uint8_t**)&data); (uint8_t**)&data);
int status = XFetchName(disp(), data[0], &name); XTextProperty text;
int status = XGetWMName(disp(), data[0], &text);
name = reinterpret_cast<char*>(text.value);
if (status >= Success && name != nullptr) { if (status >= Success && name != nullptr) {
std::string str(name); std::string str(name);
@@ -319,5 +323,3 @@ int secondsSinceLastInput()
return idle_time; return idle_time;
} }