diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 3951dbced768..49d68a1cd2f9 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -27,6 +27,7 @@ #include <Qt5MainWindow.hxx> #include <Qt5Menu.hxx> #include <Qt5SvpGraphics.hxx> +#include <Qt5System.hxx> #include <Qt5Tools.hxx> #include <Qt5Transferable.hxx> #include <Qt5Widget.hxx> @@ -47,6 +48,7 @@ #if QT5_USING_X11 #include <QtX11Extras/QX11Info> +#include <xcb/xproto.h> #endif #include <saldatabasic.hxx> @@ -1126,9 +1128,29 @@ void Qt5Frame::SetScreenNumber(unsigned int nScreen) } } -void Qt5Frame::SetApplicationID(const OUString&) +void Qt5Frame::SetApplicationID(const OUString& rWMClass) { - // So the hope is that QGuiApplication deals with this properly.. +#if QT5_USING_X11 + if (QGuiApplication::platformName() != "xcb" || !m_pTopLevel) + return; + + OString aResClass = OUStringToOString(rWMClass, RTL_TEXTENCODING_ASCII_US); + const char* pResClass + = !aResClass.isEmpty() ? aResClass.getStr() : SalGenericSystem::getFrameClassName(); + OString aResName = SalGenericSystem::getFrameResName(); + + // the WM_CLASS data consists of two concated cstrings, including the terminating '\0' chars + const uint32_t data_len = aResName.getLength() + 1 + strlen(pResClass) + 1; + char* data = new char[data_len]; + memcpy(data, aResName.getStr(), aResName.getLength() + 1); + memcpy(data + aResName.getLength() + 1, pResClass, strlen(pResClass) + 1); + + xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, m_pTopLevel->winId(), + XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, data_len, data); + delete[] data; +#else + (void)rWMClass; +#endif } // Drag'n'drop foo |