summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-07-04 15:19:36 +0200
committerLiang Qi <liang.qi@qt.io>2017-07-04 16:05:53 +0200
commitc2b224a758ce7e6dcf3748444fa8e29ab81904be (patch)
tree277cb99bf054190c935579142506caa4ec9861dd /src/plugins/platforms/xcb
parent10de063ff12cdba07b4620182aced8ed05ee3505 (diff)
parenteaee1209f0ead5be786e81db8aee604ccfea85b0 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri8
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp8
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp32
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h24
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp32
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp10
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp12
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp14
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro4
18 files changed, 70 insertions, 94 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index 4ab406acb9..e6e352a21d 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -5,14 +5,6 @@ INCLUDEPATH += $$PWD/../
load(qt_build_paths)
-# needed by Xcursor ...
-qtConfig(xcb-xlib) {
- DEFINES += XCB_USE_XLIB
- qtConfig(xinput2) {
- DEFINES += XCB_USE_XINPUT2
- }
-}
-
# build with session management support
qtConfig(xcb-sm) {
DEFINES += XCB_USE_SM
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
index 40ecd9e58d..7aa1d631df 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
@@ -115,7 +115,7 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO
void *QXcbEglIntegration::xlib_display() const
{
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
return m_connection->xlib_display();
#else
return EGL_DEFAULT_DISPLAY;
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
index 3f7ef94238..9c3fd26d49 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
@@ -65,7 +65,7 @@ void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format)
m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format);
}
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
const xcb_visualtype_t *QXcbEglWindow::createVisual()
{
QXcbScreen *scr = xcbScreen();
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
index 3090cef735..e49a3fe2ac 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h
@@ -62,7 +62,7 @@ protected:
void create() override;
void resolveFormat(const QSurfaceFormat &format) override;
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
const xcb_visualtype_t *createVisual() override;
#endif
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
index 1c193849ca..a39e00ec59 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
@@ -5,8 +5,6 @@ QT += egl_support-private
CONFIG += egl
-qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB
-
DEFINES += QT_NO_FOREACH
HEADERS += \
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
index 0d02062421..40103a42d7 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
@@ -75,7 +75,7 @@ typedef struct xcb_glx_buffer_swap_complete_event_t {
} xcb_glx_buffer_swap_complete_event_t;
#endif
-#if defined(XCB_USE_XLIB) && defined(XCB_USE_GLX)
+#if defined(XCB_USE_GLX)
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
@@ -197,10 +197,9 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO
if (!vendorChecked) {
vendorChecked = true;
Display *display = glXGetCurrentDisplay();
-#ifdef XCB_USE_XLIB
if (!display)
display = static_cast<Display *>(m_connection->xlib_display());
-#endif
+
const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
if (glxvendor) {
if (!strcmp(glxvendor, "ATI") || !strcmp(glxvendor, "Chromium"))
@@ -226,10 +225,9 @@ bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const
if (!vendorChecked) {
vendorChecked = true;
Display *display = glXGetCurrentDisplay();
-#ifdef XCB_USE_XLIB
if (!display)
display = static_cast<Display *>(m_connection->xlib_display());
-#endif
+
const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
if (glxvendor) {
if (!strcmp(glxvendor, "Parallels Inc"))
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index 215f5a3fe1..5af6172301 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri)
QT += glx_support-private
#should be removed from the sources
-DEFINES += XCB_USE_GLX XCB_USE_XLIB
+DEFINES += XCB_USE_GLX
DEFINES += QT_NO_FOREACH
qtConfig(xcb-glx) {
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index e0a12f57c2..17927af3e3 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -553,7 +553,7 @@ void QXcbBackingStore::endPaint()
return;
QPainter p(m_image->image());
while (it != end) {
- const QRect rect = *it;
+ const QRect rect = *(it++);
p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped());
}
}
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index 2985432b7f..94b5994004 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -54,7 +54,7 @@ class QXcbShmImage;
class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore
{
public:
- QXcbBackingStore(QWindow *widget);
+ QXcbBackingStore(QWindow *window);
~QXcbBackingStore();
QPaintDevice *paintDevice() override;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index b4cefd07ed..f0c1659b8e 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -69,14 +69,14 @@
#include <xcb/xfixes.h>
#include <xcb/xinerama.h>
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
#include <X11/Xlib.h>
#include <X11/Xlib-xcb.h>
#include <X11/Xlibint.h>
#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,9 +134,9 @@ 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)
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
static const char * const xcbConnectionErrors[] = {
"No error", /* Error 0 */
"I/O error", /* XCB_CONN_ERROR */
@@ -540,7 +540,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
, m_nativeInterface(nativeInterface)
, has_render_extension(false)
{
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
Display *dpy = XOpenDisplay(m_displayName.constData());
if (dpy) {
m_primaryScreenNumber = DefaultScreen(dpy);
@@ -552,7 +552,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
}
#else
m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber);
-#endif //XCB_USE_XLIB
+#endif // QT_CONFIG(xcb_xlib)
if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection)))
qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData());
@@ -587,7 +587,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
@@ -647,7 +647,7 @@ QXcbConnection::~QXcbConnection()
delete m_drag;
#endif
-#if defined(XCB_USE_XINPUT2)
+#if QT_CONFIG(xinput2)
finalizeXInput2();
#endif
@@ -668,7 +668,7 @@ QXcbConnection::~QXcbConnection()
delete m_glIntegration;
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
XCloseDisplay(static_cast<Display *>(m_xlib_display));
#else
xcb_disconnect(xcb_connection());
@@ -1141,7 +1141,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))
@@ -1485,7 +1485,7 @@ xcb_window_t QXcbConnection::clientLeader()
return m_clientLeader;
}
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
void *QXcbConnection::xlib_display() const
{
return m_xlib_display;
@@ -1508,7 +1508,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)
@@ -1553,7 +1553,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)
@@ -1561,12 +1561,12 @@ 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 (!QCoreApplication::testAttribute(Qt::AA_CompressTabletEvents) &&
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 8e67621e9b..fd77d56588 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -67,11 +67,11 @@
#undef explicit
#endif
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
#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
@@ -80,7 +80,7 @@
#endif
#endif
struct XInput2TouchDeviceData;
-#endif // XCB_USE_XINPUT2
+#endif // QT_CONFIG(xinput2)
struct xcb_randr_get_output_info_reply_t;
@@ -422,12 +422,12 @@ public:
bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; }
xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; }
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
void *xlib_display() const;
void *createVisualInfoForDefaultVisualId() const;
#endif
-#if defined(XCB_USE_XINPUT2)
+#if QT_CONFIG(xinput2)
void xi2Select(xcb_window_t window);
#endif
#ifdef XCB_USE_XINPUT21
@@ -552,7 +552,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();
@@ -566,7 +566,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;
@@ -588,7 +588,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;
@@ -633,11 +633,11 @@ private:
QScopedPointer<QXcbWMSupport> m_wmSupport;
QXcbNativeInterface *m_nativeInterface = nullptr;
-#if defined(XCB_USE_XLIB)
+#if QT_CONFIG(xcb_xlib)
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 {
@@ -679,8 +679,8 @@ private:
friend class QXcbEventReader;
};
-#ifdef XCB_USE_XINPUT2
-#ifndef QT_NO_TABLETEVENT
+#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);
#endif
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 47702741e0..5b80b823de 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -47,8 +47,6 @@
#include <QDebug>
#include <cmath>
-#ifdef XCB_USE_XINPUT2
-
#include <X11/extensions/XInput2.h>
#include <X11/extensions/XI2proto.h>
@@ -100,7 +98,7 @@ void QXcbConnection::initializeXInput2()
void QXcbConnection::xi2SetupDevices()
{
-#ifndef QT_NO_TABLETEVENT
+#if QT_CONFIG(tabletevent)
m_tabletData.clear();
#endif
m_scrollingDevices.clear();
@@ -116,7 +114,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 +124,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 +132,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 +189,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 +239,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 +328,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 +345,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 +480,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 +534,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);
@@ -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:
@@ -1284,6 +1280,4 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
return Q_NULLPTR;
}
-#endif // QT_NO_TABLETEVENT
-
-#endif // XCB_USE_XINPUT2
+#endif // QT_CONFIG(tabletevent)
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index b05a3535b6..da63360333 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -60,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *);
typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *);
typedef int (*PtrXcursorLibraryGetDefaultSize)(void *);
-#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
#include <X11/Xlib.h>
enum {
XCursorShape = CursorShape
@@ -308,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
const char *cursorStr = "cursor";
xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr);
-#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
static bool function_ptrs_not_initialized = true;
if (function_ptrs_not_initialized) {
QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
@@ -509,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape)
return cursor;
}
-#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
bool updateCursorTheme(void *dpy, const QByteArray &theme) {
if (!ptrXcursorLibraryGetTheme
|| !ptrXcursorLibrarySetTheme)
@@ -553,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
}
return cursor;
}
-#endif // XCB_USE_XLIB / QT_CONFIG(library)
+#endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library)
xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
{
@@ -562,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
xcb_cursor_t cursor = XCB_NONE;
// Try Xcursor first
-#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
if (cshape >= 0 && cshape <= Qt::LastCursor) {
void *dpy = connection()->xlib_display();
// special case for non-standard dnd-* cursors
diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h
index 41ec4dbbf8..e3f88518fe 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.h
+++ b/src/plugins/platforms/xcb/qxcbcursor.h
@@ -101,7 +101,7 @@ private:
#ifndef QT_NO_CURSOR
CursorHash m_cursorHash;
#endif
-#if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen,
const QByteArray &name,
const QVariant &property,
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 94111559b4..4f78f806be 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -63,7 +63,7 @@
#include <QtGui/private/qguiapplication_p.h>
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
#include <X11/Xlib.h>
#if QT_CONFIG(xcb_native_painting)
#include "qxcbnativepainting.h"
@@ -133,7 +133,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
qRegisterMetaType<QXcbWindow*>();
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
XInitThreads();
#endif
m_nativeInterface.reset(new QXcbNativeInterface);
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index eff38fc868..76ee8f3fb4 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -57,11 +57,7 @@
#include <QtPlatformHeaders/qxcbintegrationfunctions.h>
#include <QtPlatformHeaders/qxcbscreenfunctions.h>
-#ifdef XCB_USE_XLIB
-# include <X11/Xlib.h>
-#else
-# include <stdio.h>
-#endif
+#include <stdio.h>
#include <algorithm>
@@ -206,7 +202,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
const QXcbScreen *xcbScreen = static_cast<QXcbScreen *>(screen->handle());
switch (resourceType(lowerCaseResource)) {
case Display:
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
result = xcbScreen->connection()->xlib_display();
#endif
break;
@@ -440,7 +436,7 @@ void *QXcbNativeInterface::rootWindow()
void *QXcbNativeInterface::display()
{
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
QXcbIntegration *integration = QXcbIntegration::instance();
QXcbConnection *defaultConnection = integration->defaultConnection();
if (defaultConnection)
@@ -510,7 +506,7 @@ QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window)
void *QXcbNativeInterface::displayForWindow(QWindow *window)
{
-#if defined(XCB_USE_XLIB)
+#if QT_CONFIG(xcb_xlib)
QXcbScreen *screen = qPlatformScreenForWindow(window);
return screen ? screen->connection()->xlib_display() : Q_NULLPTR;
#else
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 947d98db58..f22bc83686 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -99,12 +99,12 @@
#include <QTextCodec>
#include <stdio.h>
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
#include <X11/Xlib.h>
#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
@@ -257,7 +257,7 @@ static inline bool positionIncludesFrame(QWindow *w)
return qt_window_private(w)->positionPolicy == QWindowPrivate::WindowFrameInclusive;
}
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
{
#include <X11/Xatom.h>
@@ -303,7 +303,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
#endif
return &tp;
}
-#endif // XCB_USE_XLIB
+#endif // QT_CONFIG(xcb_xlib)
// TODO move this into a utility function in QWindow or QGuiApplication
static QWindow *childWindowAt(QWindow *win, const QPoint &p)
@@ -577,7 +577,7 @@ void QXcbWindow::create()
32, 2, (void *)data);
-#if defined(XCB_USE_XINPUT2)
+#if QT_CONFIG(xinput2)
connection()->xi2Select(m_window);
#endif
@@ -588,7 +588,7 @@ void QXcbWindow::create()
if (window()->flags() & Qt::WindowTransparentForInput)
setTransparentForMouseEvents(true);
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
// force sync to read outstanding requests - see QTBUG-29106
XSync(static_cast<Display*>(platformScreen->connection()->xlib_display()), false);
#endif
@@ -1504,7 +1504,7 @@ void QXcbWindow::setWindowTitle(const QString &title)
ba.length(),
ba.constData());
-#ifdef XCB_USE_XLIB
+#if QT_CONFIG(xcb_xlib)
Display *dpy = static_cast<Display *>(connection()->xlib_display());
XTextProperty *text = qstringToXTP(dpy, title);
if (text)
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index b5cefa2726..ba748ea14d 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -51,13 +51,11 @@ HEADERS = \
load(qt_build_paths)
DEFINES += QT_BUILD_XCB_PLUGIN
-# needed by Xcursor ...
+
qtConfig(xcb-xlib) {
- DEFINES += XCB_USE_XLIB
QMAKE_USE += xcb_xlib
qtConfig(xinput2) {
- DEFINES += XCB_USE_XINPUT2
SOURCES += qxcbconnection_xi2.cpp
QMAKE_USE += xinput2
}