From 4437071c3f7c0b51881b0b1a5d5a68bdd100328b Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Wed, 1 Dec 2021 08:53:25 +0100 Subject: Qt fix non-X11 build and introduce CHECK_* macros Explicitly uses ANY, so it's hopefully easier to read then QT, QT5 and QT6 in the otherwise same macro names. Change-Id: Ie9bbbc858f5f9db5c8b429c7b0d8a897ac6159fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126168 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- vcl/qt5/QtFrame.cxx | 13 ++++++------- vcl/qt5/QtWidget.cxx | 10 ++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'vcl/qt5') diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 5b8a6fad6d96..ea1dee4fe916 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -51,7 +51,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 +#if CHECK_QT5_USING_X11 #include #include #if QT5_HAVE_XCB_ICCCM @@ -68,7 +68,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 && QT5_HAVE_XCB_ICCCM +#if CHECK_QT5_USING_X11 && QT5_HAVE_XCB_ICCCM static bool g_bNeedsWmHintsWindowGroup = true; static xcb_atom_t g_aXcbClientLeaderAtom = 0; #endif @@ -115,8 +115,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) , m_bDefaultPos(true) , m_bFullScreen(false) , m_bFullScreenSpanAll(false) -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11) \ - || (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT6_USING_X11) +#if CHECK_ANY_QT_USING_X11 , m_nKeyModifiers(ModKeyFlags::NONE) #endif , m_nInputLanguage(LANGUAGE_DONTKNOW) @@ -211,7 +210,7 @@ void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, QWidge void QtFrame::fixICCCMwindowGroup() { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 && QT5_HAVE_XCB_ICCCM +#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. @@ -795,7 +794,7 @@ void QtFrame::StartPresentation(bool bStart) { // meh - so there's no Qt platform independent solution // https://forum.qt.io/topic/38504/solved-qdialog-in-fullscreen-disable-os-screensaver -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 +#if CHECK_QT5_USING_X11 std::optional aRootWindow; std::optional aDisplay; @@ -1319,7 +1318,7 @@ void QtFrame::SetScreenNumber(unsigned int nScreen) void QtFrame::SetApplicationID(const OUString& rWMClass) { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11 +#if CHECK_QT5_USING_X11 if (m_aSystemData.platform != SystemEnvData::Platform::Xcb || !m_pTopLevel) return; diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 85bcd814b03a..3078a7133764 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -54,8 +54,7 @@ #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11) \ - || (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT6_USING_X11) +#if CHECK_ANY_QT_USING_X11 #define XK_MISCELLANY #include #endif @@ -462,8 +461,7 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent aModEvt.mbDown = eState == ButtonKeyState::Pressed; aModEvt.mnModKeyCode = ModKeyFlags::NONE; -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11) \ - || (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && QT6_USING_X11) +#if CHECK_ANY_QT_USING_X11 if (QGuiApplication::platformName() == "xcb") { // pressing just the ctrl key leads to a keysym of XK_Control but @@ -534,8 +532,10 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, QKeyEvent return false; } +#if CHECK_ANY_QT_USING_X11 // prevent interference of writing direction switch (Ctrl + L/R-Shift) with "normal" shortcuts rFrame.m_nKeyModifiers = ModKeyFlags::NONE; +#endif SalKeyEvent aEvent; aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : pEvent->text().at(0).unicode()); @@ -610,7 +610,9 @@ void QtWidget::closePopup() void QtWidget::focusOutEvent(QFocusEvent*) { +#if CHECK_ANY_QT_USING_X11 m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE; +#endif endExtTextInput(); m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr); closePopup(); -- cgit