xcb: Replace XCB_USE_XINPUT define by QT_CONFIG macro
.. and remove it from qxcbconnection_xi2.cpp as this file is build _only_ when xinput2 is available. Change-Id: I66d6a299c120fc034f8519cd188e1b845d5bd1bc Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>bb10
parent
5cc5c97554
commit
6dd61b4e62
|
|
@ -799,7 +799,7 @@
|
|||
"xinput2": {
|
||||
"label": "Xinput2",
|
||||
"emitIf": "features.xcb",
|
||||
"condition": "libs.xinput2",
|
||||
"condition": "features.xcb-xlib && libs.xinput2",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"xkbcommon-evdev": {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,6 @@ INCLUDEPATH += $$PWD/../
|
|||
|
||||
load(qt_build_paths)
|
||||
|
||||
# needed by Xcursor ...
|
||||
qtConfig(xcb-xlib) {
|
||||
qtConfig(xinput2) {
|
||||
DEFINES += XCB_USE_XINPUT2
|
||||
}
|
||||
}
|
||||
|
||||
# build with session management support
|
||||
qtConfig(xcb-sm) {
|
||||
DEFINES += XCB_USE_SM
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen")
|
|||
#define XCB_GE_GENERIC 35
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
// Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed:
|
||||
// - "pad0" became "extension"
|
||||
// - "pad1" and "pad" became "pad0"
|
||||
|
|
@ -134,7 +134,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode)
|
|||
qt_xcb_ge_event_t *e = reinterpret_cast<qt_xcb_ge_event_t *>(event);
|
||||
return e->extension == opCode;
|
||||
}
|
||||
#endif // XCB_USE_XINPUT2
|
||||
#endif // QT_CONFIG(xinput2)
|
||||
|
||||
#if QT_CONFIG(xcb_xlib)
|
||||
static const char * const xcbConnectionErrors[] = {
|
||||
|
|
@ -604,7 +604,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
|||
initializeScreens();
|
||||
|
||||
initializeXRender();
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2"))
|
||||
initializeXInput2();
|
||||
#endif
|
||||
|
|
@ -664,7 +664,7 @@ QXcbConnection::~QXcbConnection()
|
|||
delete m_drag;
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
finalizeXInput2();
|
||||
#endif
|
||||
|
||||
|
|
@ -1201,7 +1201,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
case XCB_GE_GENERIC:
|
||||
// Here the windowEventListener is invoked from xi2HandleEvent()
|
||||
if (m_xi2Enabled && isXIEvent(event, m_xiOpCode))
|
||||
|
|
@ -1573,7 +1573,7 @@ void *QXcbConnection::createVisualInfoForDefaultVisualId() const
|
|||
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
// it is safe to cast XI_* events here as long as we are only touching the first 32 bytes,
|
||||
// after that position event needs memmove, see xi2PrepareXIGenericDeviceEvent
|
||||
static inline bool isXIType(xcb_generic_event_t *event, int opCode, uint16_t type)
|
||||
|
|
@ -1618,7 +1618,7 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
// compress XI_* events
|
||||
if (responseType == XCB_GE_GENERIC) {
|
||||
if (!m_xi2Enabled)
|
||||
|
|
@ -2232,7 +2232,7 @@ bool QXcbConnection::xi2MouseEvents() const
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
static int xi2ValuatorOffset(const unsigned char *maskPtr, int maskLen, int number)
|
||||
{
|
||||
int offset = 0;
|
||||
|
|
@ -2276,7 +2276,7 @@ void QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event)
|
|||
// and allow casting, overwriting the full_sequence field.
|
||||
memmove((char*) event + 32, (char*) event + 36, event->length * 4);
|
||||
}
|
||||
#endif // defined(XCB_USE_XINPUT2)
|
||||
#endif // QT_CONFIG(xinput2)
|
||||
|
||||
QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
#include <QTabletEvent>
|
||||
#endif
|
||||
|
||||
#if XCB_USE_XINPUT2
|
||||
#if QT_CONFIG(xinput2)
|
||||
#include <X11/extensions/XI2.h>
|
||||
#ifdef XIScrollClass
|
||||
#define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support
|
||||
|
|
@ -77,7 +77,7 @@
|
|||
#endif
|
||||
#endif
|
||||
struct XInput2TouchDeviceData;
|
||||
#endif // XCB_USE_XINPUT2
|
||||
#endif // QT_CONFIG(xinput2)
|
||||
|
||||
struct xcb_randr_get_output_info_reply_t;
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ public:
|
|||
void *createVisualInfoForDefaultVisualId() const;
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
void xi2Select(xcb_window_t window);
|
||||
#endif
|
||||
#ifdef XCB_USE_XINPUT21
|
||||
|
|
@ -551,7 +551,7 @@ private:
|
|||
void destroyScreen(QXcbScreen *screen);
|
||||
void initializeScreens();
|
||||
bool compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const;
|
||||
#ifdef XCB_USE_XINPUT2
|
||||
#if QT_CONFIG(xinput2)
|
||||
bool m_xi2Enabled = false;
|
||||
int m_xi2Minor = 2;
|
||||
void initializeXInput2();
|
||||
|
|
@ -636,7 +636,7 @@ private:
|
|||
void *m_xlib_display = nullptr;
|
||||
#endif
|
||||
QXcbEventReader *m_reader = nullptr;
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
QHash<int, XInput2TouchDeviceData*> m_touchDevices;
|
||||
#ifdef XCB_USE_XINPUT22
|
||||
struct StartSystemResizeInfo {
|
||||
|
|
@ -694,7 +694,7 @@ private:
|
|||
|
||||
friend class QXcbEventReader;
|
||||
};
|
||||
#ifdef XCB_USE_XINPUT2
|
||||
#if QT_CONFIG(xinput2)
|
||||
#if QT_CONFIG(tabletevent)
|
||||
Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE);
|
||||
Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,6 @@
|
|||
#include <QDebug>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef XCB_USE_XINPUT2
|
||||
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
|
||||
|
|
@ -698,10 +696,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
|
|||
if (m_xiGrab) {
|
||||
// XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2)
|
||||
// http://lists.x.org/archives/xorg-devel/2014-July/043059.html
|
||||
#ifdef XCB_USE_XINPUT2
|
||||
XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid,
|
||||
xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case XI_TouchUpdate:
|
||||
|
|
@ -1241,5 +1237,3 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
|
|||
}
|
||||
|
||||
#endif // QT_CONFIG(tabletevent)
|
||||
|
||||
#endif // XCB_USE_XINPUT2
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@
|
|||
#include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
#include <X11/extensions/XInput2.h>
|
||||
#include <X11/extensions/XI2proto.h>
|
||||
#endif
|
||||
|
|
@ -558,7 +558,7 @@ void QXcbWindow::create()
|
|||
32, 2, (void *)data));
|
||||
|
||||
|
||||
#if defined(XCB_USE_XINPUT2)
|
||||
#if QT_CONFIG(xinput2)
|
||||
connection()->xi2Select(m_window);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,11 @@ HEADERS = \
|
|||
load(qt_build_paths)
|
||||
|
||||
DEFINES += QT_BUILD_XCB_PLUGIN
|
||||
# needed by Xcursor ...
|
||||
|
||||
qtConfig(xcb-xlib) {
|
||||
QMAKE_USE += xcb_xlib
|
||||
|
||||
qtConfig(xinput2) {
|
||||
DEFINES += XCB_USE_XINPUT2
|
||||
SOURCES += qxcbconnection_xi2.cpp
|
||||
QMAKE_USE += xinput2
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue