summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandkeyboard.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-15 15:59:13 +0100
committerLars Knoll <lars.knoll@qt.io>2016-11-23 08:42:05 +0000
commit2333c58fff009435503c3b7ef3d86569227056eb (patch)
treec98fd555af28f6324b24a3884bc8f40fa18bde24 /src/compositor/compositor_api/qwaylandkeyboard.cpp
parent1d5b44cbb1e834bc8db94d8ec1ac140b8ca9ed37 (diff)
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>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandkeyboard.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandkeyboard.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp
index 5bbec0a45..55381b450 100644
--- a/src/compositor/compositor_api/qwaylandkeyboard.cpp
+++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp
@@ -35,6 +35,7 @@
**
****************************************************************************/
+#include "qtwaylandcompositorglobal_p.h"
#include "qwaylandkeyboard.h"
#include "qwaylandkeyboard_p.h"
#include <QtWaylandCompositor/QWaylandKeymap>
@@ -47,7 +48,7 @@
#include <fcntl.h>
#include <unistd.h>
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
#include <sys/mman.h>
#include <sys/types.h>
#endif
@@ -65,7 +66,7 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat)
, modsLocked()
, group()
, pendingKeymap(false)
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
, keymap_fd(-1)
, xkb_state(0)
#endif
@@ -76,7 +77,7 @@ QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat)
QWaylandKeyboardPrivate::~QWaylandKeyboardPrivate()
{
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
if (xkb_context) {
if (keymap_area)
munmap(keymap_area, keymap_size);
@@ -146,7 +147,7 @@ void QWaylandKeyboardPrivate::keyboard_bind_resource(wl_keyboard::Resource *reso
if (resource->version() >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION)
send_repeat_info(resource->handle, repeatRate, repeatDelay);
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
if (xkb_context) {
send_keymap(resource->handle, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
keymap_fd, keymap_size);
@@ -201,7 +202,7 @@ void QWaylandKeyboardPrivate::modifiers(uint32_t serial, uint32_t mods_depressed
void QWaylandKeyboardPrivate::updateModifierState(uint code, uint32_t state)
{
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
if (!xkb_context)
return;
@@ -241,7 +242,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap()
return;
pendingKeymap = false;
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
if (!xkb_context)
return;
@@ -261,7 +262,7 @@ void QWaylandKeyboardPrivate::maybeUpdateKeymap()
#endif
}
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
static int createAnonymousFile(size_t size)
{
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
@@ -404,7 +405,7 @@ QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent)
connect(keymap, &QWaylandKeymap::optionsChanged, this, &QWaylandKeyboard::updateKeymap);
connect(keymap, &QWaylandKeymap::rulesChanged, this, &QWaylandKeyboard::updateKeymap);
connect(keymap, &QWaylandKeymap::modelChanged, this, &QWaylandKeyboard::updateKeymap);
-#ifndef QT_NO_WAYLAND_XKB
+#if QT_CONFIG(xkbcommon_evdev)
d->initXKB();
#endif
}