Add _GTK_APPLICATION_ID support

This commit is contained in:
Ilya Fedin 2022-11-07 15:29:46 +04:00 committed by John Preston
parent 629314cfa2
commit f542a026ec

View file

@ -111,31 +111,36 @@ void XCBSetDesktopFileName(QWindow *window) {
return; return;
} }
const auto desktopFileAtom = base::Platform::XCB::GetAtom(
connection,
"_KDE_NET_WM_DESKTOP_FILE");
const auto utf8Atom = base::Platform::XCB::GetAtom( const auto utf8Atom = base::Platform::XCB::GetAtom(
connection, connection,
"UTF8_STRING"); "UTF8_STRING");
if (!desktopFileAtom.has_value() || !utf8Atom.has_value()) { if (!utf8Atom.has_value()) {
return; return;
} }
const auto filenameAtoms = {
base::Platform::XCB::GetAtom(connection, "_GTK_APPLICATION_ID"),
base::Platform::XCB::GetAtom(connection, "_KDE_NET_WM_DESKTOP_FILE"),
};
const auto filename = QGuiApplication::desktopFileName() const auto filename = QGuiApplication::desktopFileName()
.chopped(8) .chopped(8)
.toUtf8(); .toUtf8();
xcb_change_property( for (const auto atom : filenameAtoms) {
connection, if (atom.has_value()) {
XCB_PROP_MODE_REPLACE, xcb_change_property(
window->winId(), connection,
*desktopFileAtom, XCB_PROP_MODE_REPLACE,
*utf8Atom, window->winId(),
8, *atom,
filename.size(), *utf8Atom,
filename.data()); 8,
filename.size(),
filename.data());
}
}
} }
#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION #endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION