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 <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Lars Knoll 2016-08-18 22:25:08 +02:00
parent 606924132f
commit 56ee007b3f
15 changed files with 53 additions and 49 deletions

View File

@ -1419,12 +1419,14 @@ defineTest(qtConfOutput_privateFeature) {
name = "$$eval($${1}.name)"
isEmpty(name): \
name = $$eval($${1}.feature)
feature = $$replace(name, [-+.], _)
$${2} {
qtConfOutputVar(append, "publicPro", "QT_CONFIG", $$name)
qtConfOutputVar(append, "privatePro", "QT.global.enabled_features", $$name)
qtConfOutputSetDefine("privateHeader", "QT_FEATURE_$$feature", 1)
} else {
f = $$upper($$replace(name, -, _))
qtConfOutputVar(append, "privatePro", "DEFINES", "QT_NO_$$f")
qtConfOutputVar(append, "privatePro", "QT.global.disabled_features", $$name)
qtConfOutputSetDefine("privateHeader", "QT_FEATURE_$$feature", -1)
}
}

View File

@ -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).

View File

@ -39,8 +39,9 @@
#include "qfbvthandler_p.h"
#include <QtCore/QSocketNotifier>
#include <QtCore/private/qglobal_p.h>
#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

View File

@ -50,7 +50,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <linux/input.h>
#if !defined(QT_NO_MTDEV)
#if QT_CONFIG(mtdev)
extern "C" {
#include <mtdev.h>
}
@ -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<mtdev *>(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));

View File

@ -58,7 +58,7 @@
#include <QtCore/private/qthread_p.h>
#include <qpa/qwindowsysteminterface.h>
#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
};

View File

@ -48,7 +48,7 @@
#include <qpa/qplatforminputcontext.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#if !defined(QT_NO_TSLIB)
#if QT_CONFIG(tslib)
#include <QtPlatformSupport/private/qtslib_p.h>
#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());

View File

@ -70,17 +70,17 @@
#include <QtPlatformHeaders/QEGLNativeContext>
#ifndef QT_NO_LIBINPUT
#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(evdev)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(tslib)
#include <QtPlatformSupport/private/qtslib_p.h>
#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<QEglFSIntegration *>(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
}

View File

@ -52,17 +52,17 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#ifndef QT_NO_LIBINPUT
#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
#if !defined(QT_NO_EVDEV) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(evdev) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qevdevmousemanager_p.h>
#include <QtPlatformSupport/private/qevdevkeyboardmanager_p.h>
#include <QtPlatformSupport/private/qevdevtouchmanager_p.h>
#endif
#if !defined(QT_NO_TSLIB) && !defined(Q_OS_ANDROID)
#if QT_CONFIG(tslib) && !defined(Q_OS_ANDROID)
#include <QtPlatformSupport/private/qtslib_p.h>
#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
}

View File

@ -49,7 +49,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatforminputcontextfactory_p.h>
#include <private/qinputdevicemanager_p_p.h>
#ifndef QT_NO_LIBINPUT
#if QT_CONFIG(libinput)
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif

View File

@ -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
}

View File

@ -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.");

View File

@ -53,10 +53,11 @@
#include <QVarLengthArray>
#include <qpa/qwindowsysteminterface.h>
#include <QtCore/QLoggingCategory>
#include <QtCore/private/qglobal_p.h>
// 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 <xcb/xkb.h>
#undef explicit

View File

@ -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;

View File

@ -45,7 +45,7 @@
#include <xcb/xcb_keysyms.h>
#include <xkbcommon/xkbcommon.h>
#ifndef QT_NO_XKB
#if QT_CONFIG(xkb)
#include <xkbcommon/xkbcommon-x11.h>
#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;

View File

@ -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
}