Use the feature system internally

Get rid of almost all DEFINES += ... in the pro files,
instead use the proper QT_CONFIG() macro to determine
whether a feature is available.

Change-Id: I867769be2085c6ba93b6815e223e2b89edcb245d
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Lars Knoll 2016-11-15 15:59:13 +01:00
parent 629663aa2e
commit 1d51cabc54
48 changed files with 124 additions and 79 deletions

View File

@ -15,15 +15,8 @@ use_gold_linker: CONFIG += no_linker_version_script
CONFIG -= precompile_header
CONFIG += link_pkgconfig wayland-scanner
qtConfig(opengl) {
DEFINES += QT_WAYLAND_GL_SUPPORT
}
qtConfig(xkbcommon-evdev) {
qtConfig(xkbcommon-evdev): \
QMAKE_USE_PRIVATE += xkbcommon_evdev
} else {
DEFINES += QT_NO_WAYLAND_XKB
}
QMAKE_USE += wayland-client wayland-cursor
@ -108,7 +101,8 @@ HEADERS += qwaylandintegration_p.h \
qwaylandinputcontext_p.h \
qwaylanddatadevice_p.h \
qwaylandshm_p.h \
qwaylandclientexport.h \
qtwaylandclientglobal.h \
qtwaylandclientglobal_p.h \
../shared/qwaylandinputmethodeventbuilder_p.h \
../shared/qwaylandmimehelper_p.h \
../shared/qwaylandxkb_p.h \

View File

@ -38,7 +38,7 @@
#define QWAYLANDCLIENTEXTENSION_H
#include <QObject>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
struct wl_registry;

View File

@ -52,7 +52,7 @@
//
#include <QtCore/qglobal.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>

View File

@ -52,7 +52,7 @@
//
#include <QtWaylandClient/private/qwayland-hardware-integration.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -55,7 +55,7 @@
#include <QtGui/qopengl.h>
#include <QtWaylandClient/private/qwayland-server-buffer-extension.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>

View File

@ -52,7 +52,7 @@
//
#include <QtCore/qglobal.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <stdint.h>

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>

View File

@ -37,8 +37,8 @@
**
****************************************************************************/
#ifndef QWAYLANDCLIENTEXPORT_H
#define QWAYLANDCLIENTEXPORT_H
#ifndef QWAYLANDCLIENTGLOBAL_H
#define QWAYLANDCLIENTGLOBAL_H
//
// W A R N I N G
@ -51,7 +51,8 @@
// We mean it.
//
#include <QtCore/qglobal.h>
#include <QtGui/qtguiglobal.h>
#include <QtWaylandClient/qtwaylandclient-config.h>
QT_BEGIN_NAMESPACE
@ -65,5 +66,5 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
#endif //QWAYLANDCLIENTEXPORT_H
#endif //QWAYLANDCLIENTGLOBAL_H

View File

@ -0,0 +1,59 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWAYLANDCLIENTGLOBAL_P_H
#define QWAYLANDCLIENTGLOBAL_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QtWaylandClient/private/qtwaylandclient-config_p.h>
#endif //QWAYLANDCLIENTGLOBAL_P_H

View File

@ -59,7 +59,7 @@
#include <QtGui/QColor>
#include <QtGui/QStaticText>
#include <QtGui/QImage>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <wayland-client.h>

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QSize>
#include <QtCore/QRect>

View File

@ -55,7 +55,7 @@
#include <QtCore/QVariant>
#include <QtCore/QMimeData>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#ifndef QT_NO_DRAGANDDROP
QT_BEGIN_NAMESPACE

View File

@ -53,7 +53,7 @@
#include <qpa/qplatformcursor.h>
#include <QtCore/QMap>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
struct wl_cursor;
struct wl_cursor_image;

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#ifndef QT_NO_DRAGANDDROP

View File

@ -53,7 +53,7 @@
#include <QtGui/private/qdnd_p.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#ifndef QT_NO_DRAGANDDROP

View File

@ -54,7 +54,7 @@
#include <QObject>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#ifndef QT_NO_DRAGANDDROP

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>

View File

@ -61,7 +61,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/private/qwaylandshm_p.h>

View File

@ -57,7 +57,7 @@
#include <QtGui/QDrag>
#include <QtCore/QMimeData>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -54,7 +54,7 @@
#include <QtCore/QString>
#include <QtCore/QVariant>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <wayland-client.h>
#include <QtWaylandClient/private/qwayland-surface-extension.h>

View File

@ -73,7 +73,7 @@ namespace QtWaylandClient {
QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
: mParent(p)
, mFocus(0)
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
, mXkbContext(0)
, mXkbMap(0)
, mXkbState(0)
@ -83,7 +83,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p)
connect(&mRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatKey()));
}
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
bool QWaylandInputDevice::Keyboard::createDefaultKeyMap()
{
if (mXkbContext && mXkbMap && mXkbState) {
@ -125,7 +125,7 @@ void QWaylandInputDevice::Keyboard::releaseKeyMap()
QWaylandInputDevice::Keyboard::~Keyboard()
{
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
releaseKeyMap();
#endif
if (mFocus)
@ -334,7 +334,7 @@ Qt::KeyboardModifiers QWaylandInputDevice::Keyboard::modifiers() const
{
Qt::KeyboardModifiers ret = Qt::NoModifier;
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
if (!mXkbState)
return ret;
@ -602,7 +602,7 @@ void QWaylandInputDevice::Pointer::pointer_axis(uint32_t time, uint32_t axis, in
void QWaylandInputDevice::Keyboard::keyboard_keymap(uint32_t format, int32_t fd, uint32_t size)
{
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
close(fd);
return;
@ -702,7 +702,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
if (isDown)
mParent->mQDisplay->setLastInputDevice(mParent, serial, window);
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
if (!createDefaultKeyMap()) {
return;
}
@ -720,7 +720,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
#endif
if (state == WL_KEYBOARD_KEY_STATE_PRESSED
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
&& xkb_keymap_key_repeats(mXkbMap, code)
#endif
) {
@ -728,7 +728,7 @@ void QWaylandInputDevice::Keyboard::keyboard_key(uint32_t serial, uint32_t time,
mRepeatCode = code;
mRepeatTime = time;
mRepeatText = text;
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
mRepeatSym = sym;
#endif
mRepeatTimer.setInterval(400);
@ -742,7 +742,7 @@ void QWaylandInputDevice::Keyboard::repeatKey()
{
mRepeatTimer.setInterval(25);
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyRelease, mRepeatKey, modifiers(), mRepeatCode,
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
mRepeatSym, mNativeModifiers,
#else
0, 0,
@ -750,7 +750,7 @@ void QWaylandInputDevice::Keyboard::repeatKey()
mRepeatText, true);
sendKey(mFocus->window(), mRepeatTime, QEvent::KeyPress, mRepeatKey, modifiers(), mRepeatCode,
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
mRepeatSym, mNativeModifiers,
#else
0, 0,
@ -765,7 +765,7 @@ void QWaylandInputDevice::Keyboard::keyboard_modifiers(uint32_t serial,
uint32_t group)
{
Q_UNUSED(serial);
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
if (mXkbState)
xkb_state_update_mask(mXkbState,
mods_depressed, mods_latched, mods_locked,

View File

@ -51,6 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/private/qtwaylandclientglobal_p.h>
#include <QtWaylandClient/private/qwaylandwindow_p.h>
#include <QSocketNotifier>
@ -64,7 +65,7 @@
#include <QtWaylandClient/private/qwayland-wayland.h>
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
#include <xkbcommon/xkbcommon.h>
#include <xkbcommon/xkbcommon-keysyms.h>
#endif
@ -194,7 +195,7 @@ public:
QWaylandInputDevice *mParent;
QWaylandWindow *mFocus;
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
xkb_context *mXkbContext;
xkb_keymap *mXkbMap;
xkb_state *mXkbState;
@ -205,7 +206,7 @@ public:
uint32_t mRepeatCode;
uint32_t mRepeatTime;
QString mRepeatText;
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
xkb_keysym_t mRepeatSym;
#endif
QTimer mRepeatTimer;
@ -216,7 +217,7 @@ private slots:
void repeatKey();
private:
#ifndef QT_NO_WAYLAND_XKB
#if QT_CONFIG(xkbcommon_evdev)
bool createDefaultKeyMap();
void releaseKeyMap();
#endif

View File

@ -51,9 +51,8 @@
// We mean it.
//
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <qpa/qplatformintegration.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtCore/QScopedPointer>
QT_BEGIN_NAMESPACE

View File

@ -119,7 +119,7 @@ void *QWaylandNativeInterface::nativeResourceForScreen(const QByteArray &resourc
#ifndef QT_NO_OPENGL
void *QWaylandNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context)
{
#ifdef QT_WAYLAND_GL_SUPPORT
#if QT_CONFIG(opengl)
QByteArray lowerCaseResource = resource.toLower();
if (lowerCaseResource == "eglconfig" && m_integration->clientBufferIntegration())

View File

@ -54,7 +54,7 @@
#include <QVariantMap>
#include <qpa/qplatformnativeinterface.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -53,7 +53,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-qtkey-extension.h>
QT_BEGIN_NAMESPACE

View File

@ -52,7 +52,7 @@
//
#include <qpa/qplatformscreen.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>

View File

@ -57,7 +57,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -54,7 +54,7 @@
#include <QVector>
#include <QImage>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
QT_BEGIN_NAMESPACE

View File

@ -56,7 +56,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qmutex.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
QT_BEGIN_NAMESPACE

View File

@ -54,7 +54,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtWaylandClient/private/qwayland-touch-extension.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -60,7 +60,7 @@
#include <qpa/qplatformwindow.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
struct wl_egl_window;

View File

@ -58,7 +58,7 @@
#include <QtServiceSupport/private/qgenericunixservices_p.h>
#include <QtWaylandClient/private/qwayland-qt-windowmanager.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
QT_BEGIN_NAMESPACE

View File

@ -55,7 +55,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-wayland.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>

View File

@ -47,7 +47,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>

View File

@ -57,7 +57,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>
QT_BEGIN_NAMESPACE

View File

@ -56,7 +56,7 @@
#include <wayland-client.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwayland-xdg-shell.h>
#include <QtWaylandClient/private/qwaylandshellsurface_p.h>

View File

@ -43,8 +43,6 @@
#include <QKeyEvent>
#include <QString>
#ifndef QT_NO_WAYLAND_XKB
#include <xkbcommon/xkbcommon-keysyms.h>
QT_BEGIN_NAMESPACE
@ -377,5 +375,3 @@ QVector<xkb_keysym_t> QWaylandXkb::toKeysym(QKeyEvent *event)
}
QT_END_NAMESPACE
#endif // QT_NO_WAYLAND_XKB

View File

@ -41,8 +41,6 @@
#ifndef QWAYLANDXKB_H
#define QWAYLANDXKB_H
#ifndef QT_NO_WAYLAND_XKB
#include <Qt>
#include <QEvent>
#include <xkbcommon/xkbcommon.h>
@ -65,6 +63,4 @@ public:
QT_END_NAMESPACE
#endif // QT_NO_WAYLAND_XKB
#endif

View File

@ -51,8 +51,7 @@
// We mean it.
//
#include <QtCore/qglobal.h>
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtWaylandClient/private/qwaylanddisplay_p.h>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/QStringList>
QT_BEGIN_NAMESPACE

View File

@ -51,7 +51,7 @@
// We mean it.
//
#include <QtWaylandClient/qwaylandclientexport.h>
#include <QtWaylandClient/qtwaylandclientglobal.h>
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>