mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Change window title property on Linux to align with freedesktop spec
Freedesktop recommends using _NET_WM_NAME instead of WM_NAME, and on KDE, for example, the difference between them is including the application name for some windows (e.g. "freedesktop - Google Search - Vivaldi" compared to "freedesktop - Google Search")
This commit is contained in:
parent
f00c244bfa
commit
e61905d02f
|
|
@ -184,9 +184,11 @@ static std::string GetWindowTitle(size_t i)
|
|||
char* name;
|
||||
|
||||
XTextProperty text;
|
||||
int status = XGetWMName(disp(), w, &text);
|
||||
Atom titleProperty = XInternAtom(disp(), "_NET_WM_NAME", true);
|
||||
int status = XGetTextProperty(disp(), w, &text, titleProperty);
|
||||
name = reinterpret_cast<char*>(text.value);
|
||||
if (status >= Success && name != nullptr)
|
||||
|
||||
if (status != 0 && name != nullptr)
|
||||
{
|
||||
std::string str(name);
|
||||
windowTitle = str;
|
||||
|
|
@ -248,10 +250,11 @@ void GetCurrentWindowTitle(string &title)
|
|||
(uint8_t**)&data);
|
||||
|
||||
XTextProperty text;
|
||||
int status = XGetWMName(disp(), data[0], &text);
|
||||
Atom titleProperty = XInternAtom(disp(), "_NET_WM_NAME", true);
|
||||
int status = XGetTextProperty(disp(), data[0], &text, titleProperty);
|
||||
name = reinterpret_cast<char*>(text.value);
|
||||
|
||||
if (status >= Success && name != nullptr) {
|
||||
if (status != 0 && name != nullptr) {
|
||||
std::string str(name);
|
||||
title = str;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user