mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
Get rid of QPA_XCB define
Since the platform is selected at run time (e.g. xcb vs. Wayland), it is not a good idea to decide at compile time what code is run. Another example is on macOS, where having xcb libraries available will lead to lauching the Xquartz whenever LyX is running. With this patch, things are separated: - the code is run when run-time platform is "xcb". - the support code is compiled in when xcb header and libraries are available. Fixes ticket #13086.
This commit is contained in:
parent
ce9de28f06
commit
18c310a8cf
22
config/qt.m4
22
config/qt.m4
@ -217,31 +217,15 @@ AC_DEFUN([QT_DO_IT_ALL],
|
|||||||
fi;;
|
fi;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
dnl Specific support for X11 will be built if these are available
|
||||||
|
AC_CHECK_HEADERS([xcb/xcb.h])
|
||||||
|
AC_CHECK_LIB([xcb], [xcb_send_event])
|
||||||
|
|
||||||
save_CPPFLAGS=$CPPFLAGS
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES"
|
CPPFLAGS="$save_CPPFLAGS $QT_CORE_INCLUDES"
|
||||||
AC_CHECK_HEADER(QtGui/qtgui-config.h,
|
AC_CHECK_HEADER(QtGui/qtgui-config.h,
|
||||||
[lyx_qt_config=QtGui/qtgui-config.h],
|
[lyx_qt_config=QtGui/qtgui-config.h],
|
||||||
[lyx_qt_config=qconfig.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_qt_config>]
|
|
||||||
[#if !defined(QT_FEATURE_xcb) || QT_FEATURE_xcb < 0]
|
|
||||||
[#error Fail]
|
|
||||||
[#endif]])],
|
|
||||||
[AC_MSG_RESULT(yes)
|
|
||||||
AC_DEFINE(QPA_XCB, 1, [Define if Qt uses the X Window System])],
|
|
||||||
[AC_MSG_RESULT(no)])
|
|
||||||
else
|
|
||||||
AC_EGREP_CPP(xcb,
|
|
||||||
[#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])],
|
|
||||||
[AC_MSG_RESULT(no)])
|
|
||||||
fi
|
|
||||||
CPPFLAGS=$save_CPPFLAGS
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
|
||||||
QT_FIND_TOOL([QT_MOC], [moc])
|
QT_FIND_TOOL([QT_MOC], [moc])
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#if defined(QPA_XCB)
|
#ifdef HAVE_XCB_XCB_H
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#ifdef HAVE_QT5_X11_EXTRAS
|
#ifdef HAVE_QT5_X11_EXTRAS
|
||||||
#include <QtX11Extras/QX11Info>
|
#include <QtX11Extras/QX11Info>
|
||||||
@ -1157,10 +1157,14 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
// Install Qt native translator for GUI elements.
|
// Install Qt native translator for GUI elements.
|
||||||
installTranslator(&d->qt_trans_);
|
installTranslator(&d->qt_trans_);
|
||||||
|
|
||||||
#ifdef QPA_XCB
|
if (platformName() == "xcb") {
|
||||||
// Enable reception of XCB events.
|
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||||
installNativeEventFilter(this);
|
// Enable reception of XCB events.
|
||||||
|
installNativeEventFilter(this);
|
||||||
|
#else
|
||||||
|
LYXERR0("Warning: X11 support is incomplete in this LyX binary.");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: quitOnLastWindowClosed is true by default. We should have a
|
// FIXME: quitOnLastWindowClosed is true by default. We should have a
|
||||||
// lyxrc setting for this in order to let the application stay resident.
|
// lyxrc setting for this in order to let the application stay resident.
|
||||||
@ -1181,13 +1185,13 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
|
|||||||
this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
this, SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(QPA_XCB)
|
if (platformName() == "xcb") {
|
||||||
// doubleClickInterval() is 400 ms on X11 which is just too long.
|
// doubleClickInterval() is 400 ms on X11 which is just too long.
|
||||||
// On Windows and Mac OS X, the operating system's value is used.
|
// On Windows and Mac OS X, the operating system's value is used.
|
||||||
// On Microsoft Windows, calling this function sets the double
|
// On Microsoft Windows, calling this function sets the double
|
||||||
// click interval for all applications. So we don't!
|
// click interval for all applications. So we don't!
|
||||||
QApplication::setDoubleClickInterval(300);
|
QApplication::setDoubleClickInterval(300);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(onLastWindowClosed()));
|
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(onLastWindowClosed()));
|
||||||
|
|
||||||
@ -3498,7 +3502,7 @@ bool GuiApplication::longOperationStarted() {
|
|||||||
//
|
//
|
||||||
// X11 specific stuff goes here...
|
// X11 specific stuff goes here...
|
||||||
|
|
||||||
#if defined(QPA_XCB)
|
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||||
bool GuiApplication::nativeEventFilter(const QByteArray & eventType,
|
bool GuiApplication::nativeEventFilter(const QByteArray & eventType,
|
||||||
void * message, QINTPTR *)
|
void * message, QINTPTR *)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#ifdef QPA_XCB
|
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||||
#include <QAbstractNativeEventFilter>
|
#include <QAbstractNativeEventFilter>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ There should be only one instance of this class. No Qt object
|
|||||||
initialisation should be done before the instantiation of this class.
|
initialisation should be done before the instantiation of this class.
|
||||||
*/
|
*/
|
||||||
class GuiApplication : public QApplication, public Application
|
class GuiApplication : public QApplication, public Application
|
||||||
#ifdef QPA_XCB
|
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||||
, public QAbstractNativeEventFilter
|
, public QAbstractNativeEventFilter
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -121,7 +121,7 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
bool notify(QObject * receiver, QEvent * event) override;
|
bool notify(QObject * receiver, QEvent * event) override;
|
||||||
void commitData(QSessionManager & sm);
|
void commitData(QSessionManager & sm);
|
||||||
#if defined(QPA_XCB)
|
#if defined(HAVE_XCB_XCB_H) && defined(HAVE_LIBXCB)
|
||||||
#if (QT_VERSION < 0x060000)
|
#if (QT_VERSION < 0x060000)
|
||||||
#define QINTPTR long
|
#define QINTPTR long
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user