config_host/config_vclplug.h.in | 1 configure.ac | 7 --- vcl/inc/qt5/QtFrame.hxx | 2 - vcl/inc/qt5/QtX11Support.hxx | 8 ---- vcl/qt5/QtFrame.cxx | 23 ----------- vcl/qt5/QtX11Support.cxx | 79 ---------------------------------------- 6 files changed, 120 deletions(-)
New commits: commit 35ea75e9c2be75a70298a3f4e7d703c1d0f9497e Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Oct 18 08:23:35 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Oct 18 11:00:12 2023 +0200 qt: Drop now obsolete workaround for Qt < 5.12 This workaround was only applied for Qt < 5.12 and is no longer needed now that support for Qt < 5.15 has been dropped in commit afb4c96d271958ced3175dfc2cf8bb9e8b0a9d3b Author: Michael Weghorn <m.wegh...@posteo.de> Date: Thu Aug 3 21:30:22 2023 +0200 qt: Drop code for Qt < 5.15 Commit originally adding the workaround: commit fe2baf9e84e0ca9aeaa683e37076f57fa3f38dca Author: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> Date: Tue Dec 3 08:32:58 2019 +0100 Qt5 fix missing XCB_ICCCM_WM_HINT_WINDOW_GROUP This is the application level equivalent of the Qt5 fix for bug QTBUG-46626 / commit 0de4b32 ("xcb: fix issue with dialogs hidden by other windows"), which was broken since Qt 5.4 and is just fixed since Qt 5.12. It is needed for some window managers, which don't know about the WM_CLIENT_LEADER property. Both settings are the same, but just the latter is set by older Qt5 releases. This probably isn't a real problem, as GNOME or XFCE would use the gtk VCL plugin, but since I already wrote the code when debugging tdf#129071, there is also no reason to drop it (except: more code, more bugs...). This fix is optional and needs development headers for xcb-icccm, which can actually be compiled into Qt5. If missing configure will just print a warning, since it's a runtime requirement and we explicitly drop the linked Qt version symbol, so the potential build Qt version won't matter. Change-Id: Ifc5a8f8a40ee13779a911efb53e8b8b868614d0b Reviewed-on: https://gerrit.libreoffice.org/84299 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> Change-Id: I56b708449cf686f787f55256c76673be604d31e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158102 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/config_host/config_vclplug.h.in b/config_host/config_vclplug.h.in index 63dacb1bc10e..2334288cd49d 100644 --- a/config_host/config_vclplug.h.in +++ b/config_host/config_vclplug.h.in @@ -31,7 +31,6 @@ Settings about which desktops have support enabled. #define ENABLE_GSTREAMER_1_0 0 #define QT5_HAVE_GOBJECT 0 #define QT5_USING_X11 0 -#define QT5_HAVE_XCB_ICCCM 0 #define QT6_USING_X11 0 #endif diff --git a/configure.ac b/configure.ac index 39857bb25f6f..999ab64289e8 100644 --- a/configure.ac +++ b/configure.ac @@ -13119,13 +13119,6 @@ then if test "$USING_X11" = TRUE; then PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])]) - PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[ - QT5_HAVE_XCB_ICCCM=1 - AC_DEFINE(QT5_HAVE_XCB_ICCCM) - ],[ - AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)]) - add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)" - ]) QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS" QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras" QT5_USING_X11=1 diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index b5ae7508a506..b80818687c0e 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -132,8 +132,6 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public SalFrame bool isMaximized() const; void SetWindowStateImpl(Qt::WindowStates eState); - void fixICCCMwindowGroup(); - private Q_SLOTS: void screenChanged(QScreen*); diff --git a/vcl/inc/qt5/QtX11Support.hxx b/vcl/inc/qt5/QtX11Support.hxx index 2931e82e4d1a..17696a89529d 100644 --- a/vcl/inc/qt5/QtX11Support.hxx +++ b/vcl/inc/qt5/QtX11Support.hxx @@ -15,15 +15,7 @@ class QtX11Support final { - static constexpr const char* m_sWindowGroupName = "WM_CLIENT_LEADER\0"; - static xcb_atom_t m_nWindowGroupAtom; - static bool m_bDidAtomLookups; - - static xcb_atom_t lookupAtom(xcb_connection_t*, const char* const sAtomName); - static void fetchAtoms(); - public: - static bool fixICCCMwindowGroup(xcb_window_t nWinId); static void setApplicationID(xcb_window_t nWinId, std::u16string_view rWMClass); }; diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 7a9b5f3861f8..cde1a06b3dd8 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -66,10 +66,6 @@ #include <unx/fontmanager.hxx> -#if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM -static bool g_bNeedsWmHintsWindowGroup = true; -#endif - static void SvpDamageHandler(void* handle, sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) { @@ -192,8 +188,6 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) } SetIcon(SV_ICON_ID_OFFICE); - - fixICCCMwindowGroup(); } void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); } @@ -221,23 +215,6 @@ void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, QWidge rData.pWidget = pWidget; } -void QtFrame::fixICCCMwindowGroup() -{ -#if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM - if (!g_bNeedsWmHintsWindowGroup) - return; - g_bNeedsWmHintsWindowGroup = false; - - assert(m_aSystemData.platform != SystemEnvData::Platform::Invalid); - if (m_aSystemData.platform != SystemEnvData::Platform::Xcb) - return; - - g_bNeedsWmHintsWindowGroup = QtX11Support::fixICCCMwindowGroup(asChild()->winId()); -#else - (void)this; // avoid loplugin:staticmethods -#endif -} - QtFrame::~QtFrame() { QtInstance* pInst = GetQtInstance(); diff --git a/vcl/qt5/QtX11Support.cxx b/vcl/qt5/QtX11Support.cxx index d6f372fdadf5..84036fb8a565 100644 --- a/vcl/qt5/QtX11Support.cxx +++ b/vcl/qt5/QtX11Support.cxx @@ -20,40 +20,8 @@ #include <QtX11Extras/QX11Info> #endif -#if QT5_HAVE_XCB_ICCCM -#include <xcb/xcb_icccm.h> -#endif - #include <unx/gensys.h> -xcb_atom_t QtX11Support::m_nWindowGroupAtom = 0; -bool QtX11Support::m_bDidAtomLookups = false; - -xcb_atom_t QtX11Support::lookupAtom(xcb_connection_t* pConn, const char* const sAtomName) -{ - xcb_atom_t nAtom = 0; - xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(pConn, 1, strlen(sAtomName), sAtomName); - xcb_intern_atom_reply_t* atom_reply = xcb_intern_atom_reply(pConn, atom_cookie, nullptr); - if (atom_reply) - { - nAtom = atom_reply->atom; - free(atom_reply); - } - return nAtom; -} - -void QtX11Support::fetchAtoms() -{ -#if CHECK_QT5_USING_X11 - if (m_bDidAtomLookups) - return; - m_bDidAtomLookups = true; - - xcb_connection_t* pXcbConn = QX11Info::connection(); - m_nWindowGroupAtom = lookupAtom(pXcbConn, m_sWindowGroupName); -#endif -} - void QtX11Support::setApplicationID(const xcb_window_t nWinId, std::u16string_view rWMClass) { #if CHECK_QT5_USING_X11 @@ -77,51 +45,4 @@ void QtX11Support::setApplicationID(const xcb_window_t nWinId, std::u16string_vi #endif } -bool QtX11Support::fixICCCMwindowGroup(const xcb_window_t nWinId) -{ -#if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM - // older Qt5 just sets WM_CLIENT_LEADER, but not the XCB_ICCCM_WM_HINT_WINDOW_GROUP - // see Qt commit 0de4b326d8 ("xcb: fix issue with dialogs hidden by other windows") - // or QTBUG-46626. So LO has to set this itself to help some WMs. - if (QVersionNumber::fromString(qVersion()) >= QVersionNumber(5, 12)) - return false; - - xcb_connection_t* pXcbConn = QX11Info::connection(); - xcb_icccm_wm_hints_t hints; - - xcb_get_property_cookie_t prop_cookie = xcb_icccm_get_wm_hints_unchecked(pXcbConn, nWinId); - if (!xcb_icccm_get_wm_hints_reply(pXcbConn, prop_cookie, &hints, nullptr)) - return false; - - if (hints.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) - return false; - - fetchAtoms(); - if (!m_nWindowGroupAtom) - return false; - - prop_cookie = xcb_get_property(pXcbConn, 0, nWinId, m_nWindowGroupAtom, XCB_ATOM_WINDOW, 0, 1); - xcb_get_property_reply_t* prop_reply = xcb_get_property_reply(pXcbConn, prop_cookie, nullptr); - if (!prop_reply) - return true; - - if (xcb_get_property_value_length(prop_reply) != 4) - { - free(prop_reply); - return true; - } - - xcb_window_t leader = *static_cast<xcb_window_t*>(xcb_get_property_value(prop_reply)); - free(prop_reply); - - hints.flags |= XCB_ICCCM_WM_HINT_WINDOW_GROUP; - hints.window_group = leader; - xcb_icccm_set_wm_hints(pXcbConn, nWinId, &hints); - return true; -#else - Q_UNUSED(nWinId); - return false; -#endif -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */