From 9c9382a85f53756c3c702ef7a999720ae40be5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Mon, 19 Jun 2017 22:28:37 +0200 Subject: xcb: Increment iterator inside bgr888 region loop Amends 9c1d3bc253abd4418f3050d19ec5f05bef3ada97. Change-Id: I912096794d274617e5b290dfb42685088cd49b23 Reviewed-by: Marc Mutz --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index f095288221..a419caf0fc 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -561,7 +561,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()); } } -- cgit v1.2.3 From 8612b0ed938bfbf7cfd2e5db405aa6a0109f41d2 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 27 Jun 2017 15:36:26 +0200 Subject: xcb: rename arg in QXcbBackingStore ctor ... as it is a window, not widget. This matches the name from cpp file: QXcbBackingStore::QXcbBackingStore(QWindow *window). Change-Id: Ib9f69cbe80ea645bbce0e4f5ef24a8df8808b823 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/xcb') 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; -- cgit v1.2.3 From b1381ea9ebb3dd4019081f4412f82a3280b4eb52 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 13:55:28 +0300 Subject: xcb: Use QT_CONFIG macro to check for xcb-xlib ... and remove the XCB_USE_XLIB define. This patch also removes the unnecessary checks for xcb-xlib in: - qxcbglxintegration.cpp as this files is build _only_ when xcb-xlib is present. From gl_integrations.pro: qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) { SUBDIRS += xcb_glx } This also would have been the right place where to define XCB_USE_XLIB, instead of unconditional line in xcb_glx.pro: DEFINES += XCB_USE_GLX XCB_USE_XLIB - qxcbnativeinterface.cpp as this cpp file does not use any Xlib APIs directly, there is no need to include Xlib.h. Change-Id: I531b5f1e79606fcfd1c63810cf51b7d5e9dc58a7 Reviewed-by: Gatis Paeglis --- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 1 - .../xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro | 2 -- .../xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp | 8 +++----- .../platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbconnection.h | 4 ++-- src/plugins/platforms/xcb/qxcbcursor.cpp | 10 +++++----- src/plugins/platforms/xcb/qxcbcursor.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 12 ++++-------- src/plugins/platforms/xcb/qxcbwindow.cpp | 10 +++++----- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 1 - 15 files changed, 32 insertions(+), 42 deletions(-) (limited to 'src/plugins/platforms/xcb') 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..063a74c395 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 @@ -7,7 +7,6 @@ load(qt_build_paths) # needed by Xcursor ... qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 } 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 4852d38f7e..9c52733120 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -116,7 +116,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 77cbdd5fba..a283d451f8 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 */ @@ -202,10 +202,9 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "ATI") || !strcmp(glxvendor, "Chromium")) @@ -231,10 +230,9 @@ bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(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/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5c15a9cbcb..e29dd645cb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -69,7 +69,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #include @@ -136,7 +136,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) } #endif // XCB_USE_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 */ @@ -557,7 +557,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) , m_nativeInterface(nativeInterface) { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) Display *dpy = XOpenDisplay(m_displayName.constData()); if (dpy) { m_primaryScreenNumber = DefaultScreen(dpy); @@ -569,7 +569,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()); @@ -685,7 +685,7 @@ QXcbConnection::~QXcbConnection() delete m_glIntegration; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XCloseDisplay(static_cast(m_xlib_display)); #else xcb_disconnect(xcb_connection()); @@ -1551,7 +1551,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; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6089265304..5b9a3887f5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -421,7 +421,7 @@ 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 @@ -632,7 +632,7 @@ private: QScopedPointer 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; diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index d257ab1242..7c62c2e2b3 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 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 8e3ee20329..e742e91f7d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -63,7 +63,7 @@ #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #endif @@ -123,7 +123,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true); qRegisterMetaType(); -#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 725288633a..97dcb8f328 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,11 +57,7 @@ #include #include -#ifdef XCB_USE_XLIB -# include -#else -# include -#endif +#include #include @@ -210,7 +206,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr const QXcbScreen *xcbScreen = static_cast(screen->handle()); switch (resourceType(lowerCaseResource)) { case Display: -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) result = xcbScreen->connection()->xlib_display(); #endif break; @@ -436,7 +432,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) @@ -514,7 +510,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 d6c69d52ef..31757ca6f6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -99,7 +99,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #endif @@ -251,7 +251,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 @@ -297,7 +297,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) @@ -569,7 +569,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(DISPLAY_FROM_XCB(platformScreen), false); #endif @@ -1535,7 +1535,7 @@ void QXcbWindow::setWindowTitle(const QString &title) ba.length(), ba.constData())); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XTextProperty *text = qstringToXTP(DISPLAY_FROM_XCB(this), title); if (text) XSetWMName(DISPLAY_FROM_XCB(this), m_window, text); diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6db0c76dea..6c9a3259b6 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -50,7 +50,6 @@ 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) { -- cgit v1.2.3 From 7f62c5fedc4a677fd9d9b002c4dfb9fd52a8a1a3 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 23:04:21 +0200 Subject: Convert features.tabletevent to QT_CONFIG Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/xcb/qxcbconnection.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbconnection.h | 8 ++++---- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 26 ++++++++++++------------ 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/plugins/platforms/xcb') 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(event); if (const_cast(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 #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 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(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 tabletDevices; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&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::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 -- cgit v1.2.3 From 6dd61b4e62d9b67a721bbf671b7ffd62c0a50809 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 14:06:51 +0300 Subject: 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 --- .../gl_integrations/gl_integrations_plugin_base.pri | 7 ------- src/plugins/platforms/xcb/qxcbconnection.cpp | 20 ++++++++++---------- src/plugins/platforms/xcb/qxcbconnection.h | 12 ++++++------ src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ------ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 3 +-- 6 files changed, 19 insertions(+), 33 deletions(-) (limited to 'src/plugins/platforms/xcb') 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 063a74c395..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,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 diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 514ad6775d..cd170e3dbc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -76,7 +76,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #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(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 { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 40a54e0f1f..bba987983e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -68,7 +68,7 @@ #include #endif -#if XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #include #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 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); diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 52873f0910..4d2a83b3cf 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -47,8 +47,6 @@ #include #include -#ifdef XCB_USE_XINPUT2 - #include #include @@ -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(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 diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 31757ca6f6..4acc827bf6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -104,7 +104,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #include #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 diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6c9a3259b6..d0dc8f3075 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -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 } -- cgit v1.2.3