From 56ee007b3f44eb3276b244a630f55482c2b02228 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 18 Aug 2016 22:25:08 +0200 Subject: Rework privateFeature privateFeature would add QT_NO_FEATURE to the DEFINES in the private .pri file, which was somewhat inelegant. Additionally, it would add the feature to the _public_ QT_CONFIG variable, which was plain wrong. Replace the implementation with the one just introduced for publicFeature, with the difference that the features are written to the private files instead. As this entirely disposes of the old system, all usages in the project files need to be replaced atomically as well. Change-Id: I506b5d41054410659ea503bc6901736cd5edec6e Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/3rdparty/xkbcommon.pri | 2 +- src/platformsupport/fbconvenience/qfbvthandler.cpp | 3 ++- .../input/evdevtouch/qevdevtouchhandler.cpp | 14 +++++++------- .../input/evdevtouch/qevdevtouchhandler_p.h | 4 ++-- src/plugins/platforms/bsdfb/qbsdfbintegration.cpp | 4 ++-- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 18 +++++++++--------- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 14 +++++++------- src/plugins/platforms/vnc/qvncintegration.cpp | 2 +- .../gl_integrations/gl_integrations_plugin_base.pri | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++---- src/plugins/platforms/xcb/qxcbconnection.h | 3 ++- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbkeyboard.h | 6 +++--- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 2 +- 14 files changed, 48 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/3rdparty/xkbcommon.pri b/src/3rdparty/xkbcommon.pri index eaef4749db..cfffa97369 100644 --- a/src/3rdparty/xkbcommon.pri +++ b/src/3rdparty/xkbcommon.pri @@ -47,7 +47,7 @@ SOURCES += \ $$PWD/xkbcommon/src/xkbcomp/xkbcomp.c \ $$PWD/xkbcommon/src/xkbcomp/parser.c -!contains(DEFINES, QT_NO_XKB):contains(QT_CONFIG, use-xkbcommon-x11support): { +qtConfig(xkb):contains(QT_CONFIG, use-xkbcommon-x11support): { # Build xkbcommon-x11 support library, it depends on -lxcb and -lxcb-xkb, linking is done # in xcb-plugin.pro (linked to system libraries or if Qt was configured with -qt-xcb then # linked to -lxcb-static). diff --git a/src/platformsupport/fbconvenience/qfbvthandler.cpp b/src/platformsupport/fbconvenience/qfbvthandler.cpp index 4c4a01a82e..ba432db1eb 100644 --- a/src/platformsupport/fbconvenience/qfbvthandler.cpp +++ b/src/platformsupport/fbconvenience/qfbvthandler.cpp @@ -39,8 +39,9 @@ #include "qfbvthandler_p.h" #include +#include -#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (!defined(QT_NO_EVDEV) || !defined(QT_NO_LIBINPUT)) +#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (QT_CONFIG(evdev) || QT_CONFIG(libinput)) #define VTH_ENABLED diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index f9e81e840f..32ec9d5452 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -50,7 +50,7 @@ #include #include -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) extern "C" { #include } @@ -150,7 +150,7 @@ QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, co #define LONG_BITS (sizeof(long) << 3) #define NUM_LONGS(bits) (((bits) + LONG_BITS - 1) / LONG_BITS) -#if defined(QT_NO_MTDEV) +#if !QT_CONFIG(mtdev) static inline bool testBit(long bit, const long *array) { return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1; @@ -159,7 +159,7 @@ static inline bool testBit(long bit, const long *array) QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QString &spec, QObject *parent) : QObject(parent), m_notify(Q_NULLPTR), m_fd(-1), d(Q_NULLPTR), m_device(Q_NULLPTR) -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) , m_mtdev(Q_NULLPTR) #endif { @@ -203,7 +203,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const return; } -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) m_mtdev = static_cast(calloc(1, sizeof(mtdev))); int mtdeverr = mtdev_open(m_mtdev, m_fd); if (mtdeverr) { @@ -215,7 +215,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const d = new QEvdevTouchScreenData(this, args); -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) const char *mtdevStr = "(mtdev)"; d->m_typeB = true; #else @@ -312,7 +312,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler() { -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) if (m_mtdev) { mtdev_close(m_mtdev); free(m_mtdev); @@ -337,7 +337,7 @@ void QEvdevTouchScreenHandler::readData() ::input_event buffer[32]; int events = 0; -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) forever { do { events = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event)); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h index a423bbd2ef..b29aa3a793 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h @@ -58,7 +58,7 @@ #include #include -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) struct mtdev; #endif @@ -88,7 +88,7 @@ private: int m_fd; QEvdevTouchScreenData *d; QTouchDevice *m_device; -#if !defined(QT_NO_MTDEV) +#if QT_CONFIG(mtdev) mtdev *m_mtdev; #endif }; diff --git a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp index edb4f4e660..e935d89c9f 100644 --- a/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp +++ b/src/plugins/platforms/bsdfb/qbsdfbintegration.cpp @@ -48,7 +48,7 @@ #include #include -#if !defined(QT_NO_TSLIB) +#if QT_CONFIG(tslib) #include #endif @@ -127,7 +127,7 @@ QPlatformServices *QBsdFbIntegration::services() const void QBsdFbIntegration::createInputHandlers() { -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 8c8ef99bc2..418ff6119b 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -70,17 +70,17 @@ #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) #include #include #include #endif -#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(tslib) #include #endif @@ -386,7 +386,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const { -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) if (function == QEglFSFunctions::loadKeymapTypeIdentifier()) return QFunctionPointer(loadKeymapStatic); #else @@ -398,7 +398,7 @@ QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) void QEglFSIntegration::loadKeymapStatic(const QString &filename) { -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) QEglFSIntegration *self = static_cast(QGuiApplicationPrivate::platformIntegration()); if (self->m_kbdMgr) self->m_kbdMgr->loadKeymap(filename); @@ -411,22 +411,22 @@ void QEglFSIntegration::loadKeymapStatic(const QString &filename) void QEglFSIntegration::createInputHandlers() { -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { new QLibInputHandler(QLatin1String("libinput"), QString()); return; } #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); else -#endif // QT_NO_TSLIB +#endif new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 685f231756..707301487d 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -52,17 +52,17 @@ #include #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) #include #include #include #endif -#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID) #include #endif @@ -140,22 +140,22 @@ QPlatformServices *QLinuxFbIntegration::services() const void QLinuxFbIntegration::createInputHandlers() { -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_FB_NO_LIBINPUT")) { new QLibInputHandler(QLatin1String("libinput"), QString()); return; } #endif -#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID) +#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID) new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString(), this); new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString(), this); -#ifndef QT_NO_TSLIB +#if QT_CONFIG(tslib) const bool useTslib = qEnvironmentVariableIntValue("QT_QPA_FB_TSLIB"); if (useTslib) new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); else -#endif // QT_NO_TSLIB +#endif new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif } diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 810c5d2a90..3227478ebe 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -49,7 +49,7 @@ #include #include #include -#ifndef QT_NO_LIBINPUT +#if QT_CONFIG(libinput) #include #endif diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index b60de79fa0..8d34e98940 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -30,6 +30,6 @@ contains(QT_CONFIG, xcb-qt) { LIBS += -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() QMAKE_USE += xcb } else { - !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb + qtConfig(xkb): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7065bb0ffb..2d959688b3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -599,7 +599,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra xcb_extension_t *extensions[] = { &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) &xcb_xkb_id, #endif #ifdef XCB_USE_RENDER @@ -1069,7 +1069,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s) } } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) namespace { typedef union { /* All XKB events share these fields. */ @@ -1252,7 +1252,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) s->handleScreenChange(change_event); } handled = true; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } else if (response_type == xkb_first_event) { // https://bugs.freedesktop.org/show_bug.cgi?id=51295 _xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event); if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) { @@ -2174,7 +2174,7 @@ void QXcbConnection::initializeXShape() void QXcbConnection::initializeXKB() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id); if (!reply || !reply->present) { qWarning("Qt: XKEYBOARD extension not present on the X server."); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1336b3f5d3..59054fae2d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -53,10 +53,11 @@ #include #include #include +#include // This is needed to make Qt compile together with XKB. xkb.h is using a variable // which is called 'explicit', this is a reserved keyword in c++ -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include #undef explicit diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 811ef4251a..07932ceeb8 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -711,7 +711,7 @@ void QXcbKeyboard::updateKeymap() xkb_keymap = 0; struct xkb_state *new_state = 0; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) if (connection()->hasXKB()) { xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0); if (xkb_keymap) { @@ -754,7 +754,7 @@ void QXcbKeyboard::updateKeymap() checkForLatinLayout(); } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) { if (m_config && connection()->hasXKB()) { @@ -1140,7 +1140,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) , m_hasLatinLayout(false) { memset(&xkb_names, 0, sizeof(xkb_names)); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) core_device_id = 0; if (connection->hasXKB()) { updateVModMapping(); @@ -1154,7 +1154,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) #endif m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); updateModifiers(); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } #endif updateKeymap(); @@ -1173,7 +1173,7 @@ QXcbKeyboard::~QXcbKeyboard() void QXcbKeyboard::updateVModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_names_cookie_t names_cookie; xcb_xkb_get_names_reply_t *name_reply; xcb_xkb_get_names_value_list_t names_list; @@ -1242,7 +1242,7 @@ void QXcbKeyboard::updateVModMapping() void QXcbKeyboard::updateVModToRModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_map_cookie_t map_cookie; xcb_xkb_get_map_reply_t *map_reply; xcb_xkb_get_map_map_t map; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 75e6d2ec82..817b57ff5b 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -45,7 +45,7 @@ #include #include -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #include #endif @@ -77,7 +77,7 @@ public: #ifdef XCB_USE_XINPUT22 void updateXKBStateFromXI(void *modInfo, void *groupInfo); #endif -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server int coreDeviceId() const { return core_device_id; } void updateXKBState(xcb_xkb_state_notify_event_t *state); @@ -136,7 +136,7 @@ private: xkb_mod_index_t mod5; }; _xkb_mods xkb_mods; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server _mod_masks vmod_masks; int core_device_id; diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index d2584ca291..326aa356df 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -81,7 +81,7 @@ contains(QT_CONFIG, xcb-qt) { QMAKE_USE += xcb } else { LIBS += -lxcb-xinerama ### there is no configure test for this! - !contains(DEFINES, QT_NO_XKB): QMAKE_USE += xcb_xkb + qtConfig(xkb): QMAKE_USE += xcb_xkb QMAKE_USE += xcb_syslibs } -- cgit v1.2.3