update WM_CLASS instance name from vm_name

This commit is contained in:
Joakim L. Gilje
2023-11-21 23:37:50 +01:00
parent 0186304550
commit aeb44f1c5c
4 changed files with 52 additions and 0 deletions

View File

@@ -117,6 +117,11 @@ extern int qt_nvr_save(void);
# undef KeyRelease
#endif
#if defined Q_OS_UNIX && !defined Q_OS_HAIKU && !defined Q_OS_MACOS
#include <qpa/qplatformwindow.h>
#include "x11_util.h"
#endif
#ifdef Q_OS_MACOS
# include "cocoa_keyboard.hpp"
// The namespace is required to avoid clashing typedefs; we only use this
@@ -712,6 +717,20 @@ MainWindow::MainWindow(QWidget *parent)
# endif
{}
#endif
#if !defined Q_OS_MACOS && !defined Q_OS_HAIKU
if (QApplication::platformName().contains("xcb")) {
QTimer::singleShot(0, this, [this] {
auto whandle = windowHandle();
if (! whandle) {
qWarning() << "No window handle";
} else {
QPlatformWindow *window = whandle->handle();
set_wm_class(window->winId(), vm_name);
}
});
}
#endif
}
void