summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2021-12-01 08:53:25 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2021-12-01 13:30:41 +0100
commit4437071c3f7c0b51881b0b1a5d5a68bdd100328b (patch)
treed7f584de52587070c39a979ce6d6362be21cdd44 /vcl/qt5
parent5b253b2197e957fb5e42e3d0e233c10ac83afc10 (diff)
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 <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtFrame.cxx13
-rw-r--r--vcl/qt5/QtWidget.cxx10
2 files changed, 12 insertions, 11 deletions
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 <QtWidgets/QMenuBar>
#include <QtWidgets/QMainWindow>
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT5_USING_X11
+#if CHECK_QT5_USING_X11
#include <QtX11Extras/QX11Info>
#include <xcb/xproto.h>
#if QT5_HAVE_XCB_ICCCM
@@ -68,7 +68,7 @@
#include <cairo.h>
#include <headless/svpgdi.hxx>
-#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<unsigned int> aRootWindow;
std::optional<Display*> 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 <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
-#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 <X11/keysymdef.h>
#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();