[LyX/master] Fix detection of xcb during configure

Enrico Forestieri forenr at lyx.org
Mon Aug 28 07:37:43 UTC 2023


commit c088cc4413b96fab8fcee2d4f5547d6ddd7fc922
Author: Enrico Forestieri <forenr at lyx.org>
Date:   Mon Aug 28 10:52:08 2023 +0200

    Fix detection of xcb during configure
    
    The QT_FEATURE_xcb macro is not in the private headers anymore.
    They keep changing APIs...
---
 config/qt.m4                        |   11 ++++-------
 src/frontends/qt/GuiApplication.cpp |    2 +-
 src/frontends/qt/GuiApplication.h   |    7 ++++++-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/config/qt.m4 b/config/qt.m4
index e738723..b33be23 100644
--- a/config/qt.m4
+++ b/config/qt.m4
@@ -218,16 +218,13 @@ AC_DEFUN([QT_DO_IT_ALL],
 	save_CPPFLAGS=$CPPFLAGS
 	CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES"
 	AC_CHECK_HEADER(QtGui/qtgui-config.h,
-	  [lyx_qt5_config=QtGui/qtgui-config.h],
-	  [lyx_qt5_config=qconfig.h])
-	AC_CHECK_HEADER(QtGui/private/qtgui-config_p.h,
-	  [lyx_qt6_config=QtGui/private/qtgui-config_p.h],
-	  [lyx_qt6_config=qconfig.h])
+	  [lyx_qt_config=QtGui/qtgui-config.h],
+	  [lyx_qt_config=qconfig.h])
 	AC_MSG_CHECKING([whether Qt uses the X Window system])
 	if test x$USE_QT6 = xyes ; then
 	  dnl FIXME: Check whether defining QPA_XCB makes sense with Qt6
 	  AC_PREPROC_IFELSE([AC_LANG_SOURCE([
-	    [#include <$lyx_qt6_config>]
+	    [#include <$lyx_qt_config>]
 	    [#if !defined(QT_FEATURE_xcb) || QT_FEATURE_xcb < 0]
 	    [#error Fail]
 	    [#endif]])],
@@ -236,7 +233,7 @@ AC_DEFUN([QT_DO_IT_ALL],
 	    [AC_MSG_RESULT(no)])
 	else
 	  AC_EGREP_CPP(xcb,
-	    [#include <$lyx_qt5_config>
+	    [#include <$lyx_qt_config>
 	    QT_QPA_DEFAULT_PLATFORM_NAME],
 	    [AC_MSG_RESULT(yes)
 	     AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])],
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index a237242..57eaaf6 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -3495,7 +3495,7 @@ bool GuiApplication::longOperationStarted() {
 
 #if defined(QPA_XCB)
 bool GuiApplication::nativeEventFilter(const QByteArray & eventType,
-				       void * message, long *)
+				       void * message, QINTPTR *)
 {
 	if (!current_view_ || eventType != "xcb_generic_event_t")
 		return false;
diff --git a/src/frontends/qt/GuiApplication.h b/src/frontends/qt/GuiApplication.h
index a77b0c7..b27964d 100644
--- a/src/frontends/qt/GuiApplication.h
+++ b/src/frontends/qt/GuiApplication.h
@@ -121,8 +121,13 @@ public:
 	bool notify(QObject * receiver, QEvent * event) override;
 	void commitData(QSessionManager & sm);
 #if defined(QPA_XCB)
+#if (QT_VERSION < 0x060000)
+#define QINTPTR long
+#else
+#define QINTPTR qintptr
+#endif
 	virtual bool nativeEventFilter(const QByteArray & eventType, void * message,
-	                               long * result) override;
+	                               QINTPTR * result) override;
 #endif
 	//@}
 


More information about the lyx-cvs mailing list