summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorStephan Binner <stephan.binner@basyskom.com>2017-05-30 23:04:21 +0200
committerStephan Binner <stephan.binner@basyskom.com>2017-06-28 16:15:14 +0000
commit7f62c5fedc4a677fd9d9b002c4dfb9fd52a8a1a3 (patch)
treec0a138148fa99dee1f8e6a3476d49c71a80788fe /src/plugins/platforms
parent5ede5706a8b8052280981aa1d9c42999a24b74b5 (diff)
Convert features.tabletevent to QT_CONFIG
Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/android/androidjniinput.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp5
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h8
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp26
7 files changed, 33 insertions, 34 deletions
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index 32630003d1..ef95b80dd4 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -38,6 +38,8 @@
**
****************************************************************************/
+#include <QtGui/qtguiglobal.h>
+
#include "androidjniinput.h"
#include "androidjnimain.h"
#include "qandroidplatformintegration.h"
@@ -292,17 +294,17 @@ namespace QtAndroidInput
static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/)
{
-#ifdef QT_NO_TABLETEVENT
- return false;
-#else
+#if QT_CONFIG(tabletevent)
return true;
-#endif // QT_NO_TABLETEVENT
+#else
+ return false;
+#endif // QT_CONFIG(tabletevent)
}
static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action,
jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure)
{
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
QPointF globalPosF(x, y);
QPoint globalPos((int)x, (int)y);
QWindow *tlw = topLevelWindowAt(globalPos);
@@ -344,7 +346,7 @@ namespace QtAndroidInput
QWindowSystemInterface::handleTabletEvent(tlw, ulong(time),
localPos, globalPosF, QTabletEvent::Stylus, pointerType,
buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier);
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
}
static int mapAndroidKey(int key)
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 5eb58dc5a1..42cdc86fb7 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -59,6 +59,7 @@
#include "qwindowsscreen.h"
#include "qwindowstheme.h"
+#include <QtGui/qtguiglobal.h>
#include <QtGui/QWindow>
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformnativeinterface.h>
@@ -1077,10 +1078,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
*result = LRESULT(MA_NOACTIVATE);
return true;
}
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
if (!d->m_tabletSupport.isNull())
d->m_tabletSupport->notifyActivate();
-#endif // !QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
if (platformWindow->testFlag(QWindowsWindow::BlockedByModal))
if (const QWindow *modalWindow = QGuiApplication::modalWindow()) {
QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(modalWindow);
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index 46306d438f..7e1017426f 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -39,8 +39,6 @@
#include "qwindowstabletsupport.h"
-#ifndef QT_NO_TABLETEVENT
-
#include "qwindowscontext.h"
#include "qwindowskeymapper.h"
#include "qwindowswindow.h"
@@ -498,5 +496,3 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_TABLETEVENT
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index 97eceaf2cc..7878e962e1 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -41,14 +41,15 @@
#define QWINDOWSTABLETSUPPORT_H
#include "qtwindowsglobal.h"
-
-#if !defined(QT_NO_TABLETEVENT)
+#include <QtGui/qtguiglobal.h>
#include <QtCore/QVector>
#include <QtCore/QPointF>
#include <wintab.h>
+QT_REQUIRE_CONFIG(tabletevent);
+
QT_BEGIN_NAMESPACE
class QDebug;
@@ -140,5 +141,4 @@ private:
QT_END_NAMESPACE
-#endif // !QT_NO_TABLETEVENT
#endif // QWINDOWSTABLETSUPPORT_H
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index e29dd645cb..514ad6775d 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1626,11 +1626,11 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex,
// compress XI_Motion, but not from tablet devices
if (isXIType(event, m_xiOpCode, XI_Motion)) {
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
xXIDeviceEvent *xdev = reinterpret_cast<xXIDeviceEvent *>(event);
if (const_cast<QXcbConnection *>(this)->tabletDataForDevice(xdev->sourceid))
return false;
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
for (int j = nextIndex; j < eventqueue->size(); ++j) {
xcb_generic_event_t *next = eventqueue->at(j);
if (!isValid(next))
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 5b9a3887f5..40a54e0f1f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -64,7 +64,7 @@
#undef explicit
#endif
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
#include <QTabletEvent>
#endif
@@ -565,7 +565,7 @@ private:
#ifdef XCB_USE_XINPUT22
void xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow);
#endif // XCB_USE_XINPUT22
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
struct TabletData {
int deviceId = 0;
QTabletEvent::PointerType pointerType = QTabletEvent::UnknownPointer;
@@ -587,7 +587,7 @@ private:
void xi2ReportTabletEvent(const void *event, TabletData *tabletData);
QVector<TabletData> m_tabletData;
TabletData *tabletDataForDevice(int id);
-#endif // !QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
struct ScrollingDevice {
int deviceId = 0;
int verticalIndex = 0;
@@ -695,7 +695,7 @@ private:
friend class QXcbEventReader;
};
#ifdef XCB_USE_XINPUT2
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE);
#endif
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 730473b983..52873f0910 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -100,7 +100,7 @@ void QXcbConnection::initializeXInput2()
void QXcbConnection::xi2SetupDevices()
{
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
m_tabletData.clear();
#endif
m_scrollingDevices.clear();
@@ -116,7 +116,7 @@ void QXcbConnection::xi2SetupDevices()
if (devices[i].use != XISlavePointer)
continue;
qCDebug(lcQpaXInputDevices) << "input device " << devices[i].name << "ID" << devices[i].deviceid;
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
TabletData tabletData;
#endif
ScrollingDevice scrollingDevice;
@@ -126,7 +126,7 @@ void QXcbConnection::xi2SetupDevices()
XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(devices[i].classes[c]);
const int valuatorAtom = qatom(vci->label);
qCDebug(lcQpaXInputDevices) << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms);
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
if (valuatorAtom < QXcbAtom::NAtoms) {
TabletData::ValuatorClassInfo info;
info.minVal = vci->min;
@@ -134,7 +134,7 @@ void QXcbConnection::xi2SetupDevices()
info.number = vci->number;
tabletData.valuatorInfo[valuatorAtom] = info;
}
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel)
scrollingDevice.lastScrollPosition.setX(vci->value);
else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel)
@@ -191,7 +191,7 @@ void QXcbConnection::xi2SetupDevices()
}
}
bool isTablet = false;
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
// If we have found the valuators which we expect a tablet to have, it might be a tablet.
if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) &&
tabletData.valuatorInfo.contains(QXcbAtom::AbsY) &&
@@ -241,7 +241,7 @@ void QXcbConnection::xi2SetupDevices()
m_tabletData.append(tabletData);
qCDebug(lcQpaXInputDevices) << " it's a tablet with pointer type" << dbgType;
}
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
#ifdef XCB_USE_XINPUT21
if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) {
@@ -330,7 +330,7 @@ void QXcbConnection::xi2Select(xcb_window_t window)
#endif // XCB_USE_XINPUT22
QSet<int> tabletDevices;
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
if (!m_tabletData.isEmpty()) {
unsigned int tabletBitMask;
unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask);
@@ -347,7 +347,7 @@ void QXcbConnection::xi2Select(xcb_window_t window)
}
XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count());
}
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
#ifdef XCB_USE_XINPUT21
// Enable each scroll device
@@ -482,12 +482,12 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id)
return dev;
}
-#if defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT)
+#if defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent)
static inline qreal fixed1616ToReal(FP1616 val)
{
return qreal(val) / 0x10000;
}
-#endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT)
+#endif // defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent)
void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
{
@@ -536,13 +536,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
return;
}
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
if (!xiEnterEvent) {
QXcbConnection::TabletData *tablet = tabletDataForDevice(sourceDeviceId);
if (tablet && xi2HandleTabletEvent(xiEvent, tablet))
return;
}
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
#ifdef XCB_USE_XINPUT21
QHash<int, ScrollingDevice>::iterator device = m_scrollingDevices.find(sourceDeviceId);
@@ -1240,6 +1240,6 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
return Q_NULLPTR;
}
-#endif // QT_NO_TABLETEVENT
+#endif // QT_CONFIG(tabletevent)
#endif // XCB_USE_XINPUT2