[Libreoffice-commits] core.git: configure.ac vcl/qt5
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 15 00:38:32 UTC 2019
configure.ac | 4 +++-
vcl/qt5/Qt5Frame.cxx | 26 ++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)
New commits:
commit 77a3c443d35c7d966217f02ea9189cb1819c7828
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 14 00:46:32 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Sat Jun 15 02:37:28 2019 +0200
tdf#125921 Qt5 set WM_CLASS for top level windows
Uses the same naming then the gtk3 backend, i.e. "libreoffice"
for the instance name and different class names for the module
windows, like "libreoffice-writer".
These names are referenced in the desktop files a StartupWMClass
and for example used to pin an app to the task bar.
Change-Id: Ic9b8890536f6413ab59d2e0da866e2280ab3181a
Reviewed-on: https://gerrit.libreoffice.org/74014
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/configure.ac b/configure.ac
index 42d4b8f5f7ea..dbced920a118 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11145,7 +11145,9 @@ then
QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
if test "$USING_X11" = TRUE; then
- QT5_LIBS="$QT5_LIBS -lQt5X11Extras"
+ PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
+ QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
+ QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
QT5_USING_X11=1
AC_DEFINE(QT5_USING_X11)
fi
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
More information about the Libreoffice-commits
mailing list