diff options
Diffstat (limited to 'src/plugins/platforms/xcb')
35 files changed, 212 insertions, 191 deletions
diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index 15cf4cf241..5efc9b7f99 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -21,3 +21,13 @@ REDUCING RUNTIME DEPENDENCIES The '-qt-xcb' configure option can be used to get rid of most xcb- dependencies. Only libxcb will still be linked dynamically, since it will be most likely be pulled in via other dependencies anyway. This should allow for binaries that are portable across most modern Linux distributions. + +PACKAGE VERSION REQUIREMENTS + +When using touch input via XInput 2.2 or higher, there is a potential issue on systems that ship with +a libXi older than 1.7.4. This is because XIAllowTouchEvents can deadlock with libXi 1.7.3 and earlier. +When touch events are never received, this is not an issue, so plain mouse/keyboard systems are not affected. +See http://lists.x.org/archives/xorg-devel/2014-July/043059.html for details on the libXi patch. +Qt versions before 5.8 attempted to recognize this scenario based on the pkg-config package version and skip +the call. This has been removed starting from 5.8 since relying on pkg-config package versions is unsafe given +that Qt must also support systems with limited or incomplete pkg-config setups. diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro index 9de0476810..b8f878ffe8 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations.pro @@ -1,9 +1,10 @@ TEMPLATE = subdirs +QT_FOR_CONFIG += gui-private -contains(QT_CONFIG, egl): contains(QT_CONFIG, egl_x11): contains(QT_CONFIG, opengl) { +qtConfig(egl):qtConfig(egl_x11):qtConfig(opengl) { SUBDIRS += xcb_egl } -contains(QT_CONFIG, xcb-xlib): contains(QT_CONFIG, opengl): !contains(QT_CONFIG, opengles2) { +qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) { SUBDIRS += xcb_glx } 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 68cb91ff3d..4ab406acb9 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 @@ -1,4 +1,4 @@ -QT += core-private gui-private platformsupport-private xcb_qpa_lib-private +QT += core-private gui-private xcb_qpa_lib-private INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/../ @@ -6,35 +6,26 @@ INCLUDEPATH += $$PWD/../ load(qt_build_paths) # needed by Xcursor ... -contains(QT_CONFIG, xcb-xlib) { +qtConfig(xcb-xlib) { DEFINES += XCB_USE_XLIB - contains(QT_CONFIG, xinput2) { + qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 } } -# to support custom cursors with depth > 1 -contains(QT_CONFIG, xcb-render) { - DEFINES += XCB_USE_RENDER -} - # build with session management support -contains(QT_CONFIG, xcb-sm) { +qtConfig(xcb-sm) { DEFINES += XCB_USE_SM } -DEFINES += $$QMAKE_DEFINES_XCB -LIBS += $$QMAKE_LIBS_XCB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB - -CONFIG += qpa/genericunixfontdatabase - -contains(QT_CONFIG, xcb-qt) { +!qtConfig(system-xcb) { DEFINES += XCB_USE_RENDER - XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb) - INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude - LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + QMAKE_USE += xcb-static xcb } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms - !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + qtConfig(xkb): QMAKE_USE += xcb_xkb + # to support custom cursors with depth > 1 + qtConfig(xcb-render) { + DEFINES += XCB_USE_RENDER + } + QMAKE_USE += xcb_syslibs } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h index 64e9bec6db..48e774bbb2 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglcontext.h @@ -41,8 +41,8 @@ #define QXCBEGLCONTEXT_H #include "qxcbeglwindow.h" -#include <QtPlatformSupport/private/qeglplatformcontext_p.h> -#include <QtPlatformSupport/private/qeglpbuffer_p.h> +#include <QtEglSupport/private/qeglplatformcontext_p.h> +#include <QtEglSupport/private/qeglpbuffer_p.h> #include <QtPlatformHeaders/QEGLNativeContext> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h index 7c6524c8ee..a5a47dd0bb 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglinclude.h @@ -46,7 +46,7 @@ #include <QtGui/private/qcssparser_p.h> #include <QtGui/private/qtextengine_p.h> -#include <QtPlatformSupport/private/qt_egl_p.h> +#include <QtEglSupport/private/qt_egl_p.h> QT_BEGIN_NAMESPACE 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 079f0466dc..4852d38f7e 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -42,6 +42,7 @@ #include "qxcbeglcontext.h" #include <QtGui/QOffscreenSurface> +#include <QtEglSupport/private/qeglstreamconvenience_p.h> #include "qxcbeglnativeinterfacehandler.h" @@ -63,7 +64,18 @@ QXcbEglIntegration::~QXcbEglIntegration() bool QXcbEglIntegration::initialize(QXcbConnection *connection) { m_connection = connection; - m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display())); + + const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + + if (extensions && strstr(extensions, "EGL_EXT_platform_x11")) { + QEGLStreamConvenience streamFuncs; + m_egl_display = streamFuncs.get_platform_display(EGL_PLATFORM_X11_KHR, + xlib_display(), + nullptr); + } + + if (!m_egl_display) + m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display())); EGLint major, minor; bool success = eglInitialize(m_egl_display, &major, &minor); 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 69b7dfbdbf..3f7ef94238 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -41,8 +41,8 @@ #include "qxcbeglintegration.h" -#include <QtPlatformSupport/private/qeglconvenience_p.h> -#include <QtPlatformSupport/private/qxlibeglintegration_p.h> +#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtEglSupport/private/qxlibeglintegration_p.h> QT_BEGIN_NAMESPACE 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 6d52332bad..1c193849ca 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 @@ -1,10 +1,13 @@ TARGET = qxcb-egl-integration include(../gl_integrations_plugin_base.pri) +QT += egl_support-private CONFIG += egl -contains(QT_CONFIG, xcb-xlib): DEFINES += XCB_USE_XLIB +qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB + +DEFINES += QT_NO_FOREACH HEADERS += \ qxcbeglcontext.h \ diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 4c4176a063..1f36a1ad2a 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -51,7 +51,7 @@ #include <QtGui/QOffscreenSurface> #include "qglxintegration.h" -#include <QtPlatformSupport/private/qglxconvenience_p.h> +#include <QtGlxSupport/private/qglxconvenience_p.h> #include <QtPlatformHeaders/QGLXNativeContext> #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp index a8d51d5e8c..8df8b28f72 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp @@ -40,7 +40,7 @@ #include "qxcbglxwindow.h" #include "qxcbscreen.h" -#include <QtPlatformSupport/private/qglxconvenience_p.h> +#include <QtGlxSupport/private/qglxconvenience_p.h> QT_BEGIN_NAMESPACE 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 67fd68765a..8aa6e1febd 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 @@ -1,15 +1,15 @@ TARGET = qxcb-glx-integration include(../gl_integrations_plugin_base.pri) +QT += glx_support-private #should be removed from the sources DEFINES += XCB_USE_GLX XCB_USE_XLIB +DEFINES += QT_NO_FOREACH -LIBS += -lxcb - -contains(QT_CONFIG, xcb-glx) { +qtConfig(xcb-glx) { DEFINES += XCB_HAS_XCB_GLX - LIBS += -lxcb-glx + QMAKE_USE += xcb_glx } LIBS += $$QMAKE_LIBS_DYNLOAD diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index ce9e5d926e..3d09b1c139 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -225,14 +225,14 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) preparePaint(area); const QPoint delta(dx, dy); - foreach (const QRect &rect, area.rects()) + for (const QRect &rect : area) qt_scrollRectInImage(*image(), rect, delta); if (m_xcb_pixmap) { flushPixmap(area); ensureGC(m_xcb_pixmap); const QRect bounds(QPoint(0, 0), size()); - foreach (const QRect &src, area.rects()) { + for (const QRect &src : area) { const QRect dst = src.translated(delta).intersected(bounds); Q_XCB_CALL(xcb_copy_area(xcb_connection(), m_xcb_pixmap, @@ -533,11 +533,9 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) if (m_image->hasAlpha()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = region.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); - } + for (const QRect &rect : region) + p.fillRect(rect, blank); } } @@ -557,22 +555,21 @@ void QXcbBackingStore::endPaint() // Slow path: the paint device was m_rgbImage. Now copy with swapping red // and blue into m_image. - const QVector<QRect> rects = region.rects(); - if (rects.isEmpty()) + auto it = region.begin(); + const auto end = region.end(); + if (it == end) return; QPainter p(m_image->image()); - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + while (it != end) { const QRect rect = *it; p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } -#ifndef QT_NO_OPENGL QImage QXcbBackingStore::toImage() const { return m_image && m_image->image() ? *m_image->image() : QImage(); } -#endif QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const { diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 5a8f385c1b..6af679d28a 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -63,8 +63,8 @@ public: void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, QOpenGLContext *context, bool translucentBackground) Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; #endif + QImage toImage() const Q_DECL_OVERRIDE; QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 7052e88141..7bd233f387 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -602,7 +602,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra xcb_extension_t *extensions[] = { &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) &xcb_xkb_id, #endif #ifdef XCB_USE_RENDER @@ -1072,7 +1072,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s) } } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) namespace { typedef union { /* All XKB events share these fields. */ @@ -1258,7 +1258,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) s->handleScreenChange(change_event); } handled = true; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } else if (response_type == xkb_first_event) { // https://bugs.freedesktop.org/show_bug.cgi?id=51295 _xkb_event *xkb_event = reinterpret_cast<_xkb_event *>(event); if (xkb_event->any.deviceID == m_keyboard->coreDeviceId()) { @@ -1725,11 +1725,13 @@ void QXcbConnection::processXcbEvents() compressEvent(event, i, eventqueue)) continue; +#ifndef QT_NO_CLIPBOARD bool accepted = false; if (clipboard()->processIncr()) clipboard()->incrTransactionPeeker(event, accepted); if (accepted) continue; +#endif auto isWaitingFor = [=](PeekFunc peekFunc) { // These callbacks return true if the event is what they were @@ -1779,24 +1781,6 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t * window->handleClientMessageEvent(event); } -xcb_generic_event_t *QXcbConnection::checkEvent(int type) -{ - QXcbEventArray *eventqueue = m_reader->lock(); - - for (int i = 0; i < eventqueue->size(); ++i) { - xcb_generic_event_t *event = eventqueue->at(i); - if (event && event->response_type == type) { - (*eventqueue)[i] = 0; - m_reader->unlock(); - return event; - } - } - - m_reader->unlock(); - - return 0; -} - static const char * xcb_atomnames = { // window-manager <-> client protocols "WM_PROTOCOLS\0" @@ -2198,7 +2182,7 @@ void QXcbConnection::initializeXShape() void QXcbConnection::initializeXKB() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xkb_id); if (!reply || !reply->present) { qWarning("Qt: XKEYBOARD extension not present on the X server."); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index ebea8d5460..f6ba828a15 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -43,6 +43,7 @@ #include <xcb/xcb.h> #include <xcb/randr.h> +#include <QtGui/private/qtguiglobal_p.h> #include "qxcbexport.h" #include <QHash> #include <QList> @@ -53,10 +54,11 @@ #include <QVarLengthArray> #include <qpa/qwindowsysteminterface.h> #include <QtCore/QLoggingCategory> +#include <QtCore/private/qglobal_p.h> // This is needed to make Qt compile together with XKB. xkb.h is using a variable // which is called 'explicit', this is a reserved keyword in c++ -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #define explicit dont_use_cxx_explicit #include <xcb/xkb.h> #undef explicit @@ -448,7 +450,6 @@ public: QXcbWindowEventListener *windowEventListenerFromId(xcb_window_t id); QXcbWindow *platformWindowFromId(xcb_window_t id); - xcb_generic_event_t *checkEvent(int type); template<typename T> inline xcb_generic_event_t *checkEvent(T &checker); @@ -582,6 +583,8 @@ private: }; QHash<int, ValuatorClassInfo> valuatorInfo; }; + friend class QTypeInfo<TabletData>; + friend class QTypeInfo<TabletData::ValuatorClassInfo>; bool xi2HandleTabletEvent(const void *event, TabletData *tabletData); void xi2ReportTabletEvent(const void *event, TabletData *tabletData); QVector<TabletData> m_tabletData; @@ -684,6 +687,12 @@ private: friend class QXcbEventReader; }; +#ifdef XCB_USE_XINPUT2 +#ifndef QT_NO_TABLETEVENT +Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); +#endif +#endif #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) #define CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(object) ((XVisualInfo *)(object->connection()->createVisualInfoForDefaultVisualId())) diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index f2824b6d65..93f8db92bf 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -697,23 +697,7 @@ 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 -#ifndef LIBXI_MAJOR - static bool allowTouchWarningShown = false; - if (!allowTouchWarningShown) { - allowTouchWarningShown = true; - qWarning("Skipping XIAllowTouchEvents() because it was not possible to detect libXi version at build time." - " Minimum libXi version required is 1.7.4." - " Expect issues with touch behavior."); - } -#elif LIBXI_MAJOR == 1 && (LIBXI_MINOR < 7 || (LIBXI_MINOR == 7 && LIBXI_PATCH < 4)) - static bool allowTouchWarningShown = false; - if (!allowTouchWarningShown) { - allowTouchWarningShown = true; - qWarning("Skipping XIAllowTouchEvents() due to not having libXi >= 1.7.4." - " libXi version at build time was %d.%d.%d." - " Expect issues with touch behavior.", LIBXI_MAJOR, LIBXI_MINOR, LIBXI_PATCH); - } -#else +#ifdef XCB_USE_XINPUT2 XIAllowTouchEvents(static_cast<Display *>(m_xlib_display), xiDeviceEvent->deviceid, xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch); #endif diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 4de4be43d1..80fe5a2199 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -74,6 +74,8 @@ static PtrXcursorLibraryGetDefaultSize ptrXcursorLibraryGetDefaultSize = 0; static xcb_font_t cursorFont = 0; static int cursorCount = 0; +#ifndef QT_NO_CURSOR + static uint8_t cur_blank_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -276,8 +278,6 @@ static const char * const cursorNames[] = { "link" }; -#ifndef QT_NO_CURSOR - QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c) : shape(c.shape()), bitmapCacheKey(0), maskCacheKey(0) { diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index dd0c557de6..4915bb1b11 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -194,8 +194,10 @@ void QXcbDrag::startDrag() init(); +#ifndef QT_NO_CLIPBOARD xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(), atom(QXcbAtom::XdndSelection), connection()->time()); +#endif QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData()); for (int i = 0; i < fmts.size(); ++i) { @@ -205,10 +207,12 @@ void QXcbDrag::startDrag() drag_types.append(atoms.at(j)); } } +#ifndef QT_NO_CLIPBOARD if (drag_types.size() > 3) xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(), atom(QXcbAtom::XdndTypelist), XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData()); +#endif setUseCompositing(current_virtual_desktop->compositingActive()); setScreen(current_virtual_desktop->screens().constFirst()->screen()); @@ -447,7 +451,11 @@ void QXcbDrag::move(const QPoint &globalPos) enter.window = target; enter.format = 32; enter.type = atom(QXcbAtom::XdndEnter); +#ifndef QT_NO_CLIPBOARD enter.data.data32[0] = connection()->clipboard()->owner(); +#else + enter.data.data32[0] = 0; +#endif enter.data.data32[1] = flags; enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0; enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0; @@ -476,7 +484,11 @@ void QXcbDrag::move(const QPoint &globalPos) move.window = target; move.format = 32; move.type = atom(QXcbAtom::XdndPosition); +#ifndef QT_NO_CLIPBOARD move.data.data32[0] = connection()->clipboard()->owner(); +#else + move.data.data32[0] = 0; +#endif move.data.data32[1] = 0; // flags move.data.data32[2] = (globalPos.x() << 16) + globalPos.y(); move.data.data32[3] = connection()->time(); @@ -505,7 +517,11 @@ void QXcbDrag::drop(const QPoint &globalPos) drop.window = current_target; drop.format = 32; drop.type = atom(QXcbAtom::XdndDrop); +#ifndef QT_NO_CLIPBOARD drop.data.data32[0] = connection()->clipboard()->owner(); +#else + drop.data.data32[0] = 0; +#endif drop.data.data32[1] = 0; // flags drop.data.data32[2] = connection()->time(); @@ -791,9 +807,11 @@ void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message // reset target_time = XCB_CURRENT_TIME; +#ifndef QT_NO_CLIPBOARD if (xdnd_dragsource == connection()->clipboard()->owner()) handle_xdnd_status(&response); else +#endif Q_XCB_CALL(xcb_send_event(xcb_connection(), false, current_proxy_target, XCB_EVENT_MASK_NO_EVENT, (const char *)&response)); } @@ -859,7 +877,11 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event) void QXcbDrag::handleStatus(const xcb_client_message_event_t *event) { - if (event->window != connection()->clipboard()->owner() || !drag()) + if ( +#ifndef QT_NO_CLIPBOARD + event->window != connection()->clipboard()->owner() || +#endif + !drag()) return; xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event); @@ -914,7 +936,11 @@ void QXcbDrag::send_leave() leave.window = current_target; leave.format = 32; leave.type = atom(QXcbAtom::XdndLeave); +#ifndef QT_NO_CLIPBOARD leave.data.data32[0] = connection()->clipboard()->owner(); +#else + leave.data.data32[0] = 0; +#endif leave.data.data32[1] = 0; // flags leave.data.data32[2] = 0; // x, y leave.data.data32[3] = 0; // w, h @@ -1006,8 +1032,10 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) { DEBUG("xdndHandleFinished"); +#ifndef QT_NO_CLIPBOARD if (event->window != connection()->clipboard()->owner()) return; +#endif const unsigned long *l = (const unsigned long *)event->data.data32; @@ -1287,11 +1315,13 @@ QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type r if (a == XCB_NONE) return result; +#ifndef QT_NO_CLIPBOARD if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE) return result; // should never happen? xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection); result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime()); +#endif return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding); } diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index f65dbda05d..cb6e95cc9a 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -159,6 +159,7 @@ private: QPointer<QDrag> drag; QTime time; }; + friend class QTypeInfo<Transaction>; QVector<Transaction> transactions; int transaction_expiry_timer; @@ -167,6 +168,7 @@ private: int findTransactionByTime(xcb_timestamp_t timestamp); xcb_window_t findRealWindow(const QPoint & pos, xcb_window_t w, int md, bool ignoreNonXdndAwareWindows); }; +Q_DECLARE_TYPEINFO(QXcbDrag::Transaction, Q_MOVABLE_TYPE); #endif // QT_NO_DRAGANDDROP diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 802f7b85ce..f4da7ba033 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -55,19 +55,14 @@ #include <xcb/xcb.h> -#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h> -#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h> -#include <QtPlatformSupport/private/qgenericunixservices_p.h> +#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> +#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h> +#include <QtServiceSupport/private/qgenericunixservices_p.h> #include <stdio.h> -//this has to be included before egl, since egl pulls in X headers #include <QtGui/private/qguiapplication_p.h> -#ifdef XCB_USE_EGL -# include <QtPlatformSupport/private/qt_egl_p.h> -#endif - #ifdef XCB_USE_XLIB #include <X11/Xlib.h> #endif @@ -82,7 +77,7 @@ #ifndef QT_NO_ACCESSIBILITY #include <qpa/qplatformaccessibility.h> #ifndef QT_NO_ACCESSIBILITY_ATSPI_BRIDGE -#include "../../../platformsupport/linuxaccessibility/bridge_p.h" +#include <QtLinuxAccessibilitySupport/private/bridge_p.h> #endif #endif diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 4e4bfad1d6..a5aff7f11f 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -711,7 +711,7 @@ void QXcbKeyboard::updateKeymap() xkb_keymap = 0; struct xkb_state *new_state = 0; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) if (connection()->hasXKB()) { xkb_keymap = xkb_x11_keymap_new_from_device(xkb_context, xcb_connection(), core_device_id, (xkb_keymap_compile_flags)0); if (xkb_keymap) { @@ -753,7 +753,7 @@ void QXcbKeyboard::updateKeymap() checkForLatinLayout(); } -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) { if (m_config && connection()->hasXKB()) { @@ -1144,7 +1144,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) , m_hasLatinLayout(false) { memset(&xkb_names, 0, sizeof(xkb_names)); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) core_device_id = 0; if (connection->hasXKB()) { updateVModMapping(); @@ -1158,7 +1158,7 @@ QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) #endif m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); updateModifiers(); -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) } #endif updateKeymap(); @@ -1177,7 +1177,7 @@ QXcbKeyboard::~QXcbKeyboard() void QXcbKeyboard::updateVModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_names_cookie_t names_cookie; xcb_xkb_get_names_reply_t *name_reply; xcb_xkb_get_names_value_list_t names_list; @@ -1246,7 +1246,7 @@ void QXcbKeyboard::updateVModMapping() void QXcbKeyboard::updateVModToRModMapping() { -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) xcb_xkb_get_map_cookie_t map_cookie; xcb_xkb_get_map_reply_t *map_reply; xcb_xkb_get_map_map_t map; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 18f1aa5732..dfd2926435 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -45,7 +45,7 @@ #include <xcb/xcb_keysyms.h> #include <xkbcommon/xkbcommon.h> -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) #include <xkbcommon/xkbcommon-x11.h> #endif @@ -77,7 +77,7 @@ public: #ifdef XCB_USE_XINPUT22 void updateXKBStateFromXI(void *modInfo, void *groupInfo); #endif -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server int coreDeviceId() const { return core_device_id; } void updateXKBState(xcb_xkb_state_notify_event_t *state); @@ -138,7 +138,7 @@ private: xkb_mod_index_t mod5; }; _xkb_mods xkb_mods; -#ifndef QT_NO_XKB +#if QT_CONFIG(xkb) // when XKEYBOARD is present on the X server _mod_masks vmod_masks; int core_device_id; diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp index f7244739a5..7592eb2887 100644 --- a/src/plugins/platforms/xcb/qxcbmime.cpp +++ b/src/plugins/platforms/xcb/qxcbmime.cpp @@ -121,9 +121,7 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa // so QXcbConnection::atomName() has to be used. if (atomName == QLatin1String("text/uri-list") && connection->atomName(a) == "text/x-moz-url") { - const QByteArray uri = data->split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); + const QString mozUri = QLatin1String(data->split('\n').constFirst()) + QLatin1Char('\n'); *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); } else if (atomName == QLatin1String("application/x-color")) @@ -175,7 +173,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, // qDebug() << "mimeConvertDataToFormat" << format << atomName << data; if (!encoding.isEmpty() - && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + && atomName == format + QLatin1String(";charset=") + QLatin1String(encoding)) { #ifndef QT_NO_TEXTCODEC if (requestedType == QVariant::String) { @@ -210,10 +208,11 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, reinterpret_cast<const ushort *>(data.constData()), data.size() / 2); if (!str.isNull()) { if (format == QLatin1String("text/uri-list")) { - const QStringList urls = str.split(QLatin1Char('\n')); + const auto urls = str.splitRef(QLatin1Char('\n')); QList<QVariant> list; - foreach (const QString &s, urls) { - const QUrl url(s.trimmed()); + list.reserve(urls.size()); + for (const QStringRef &s : urls) { + const QUrl url(s.trimmed().toString()); if (url.isValid()) list.append(url); } @@ -221,7 +220,7 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, // The atomName variable is not used because mimeAtomToString() // converts "text/x-moz-url" to "text/uri-list". if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url") - return list.first(); + return list.constFirst(); return list; } else { return str; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index a3e8da7df8..b1575cbee4 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,10 +57,6 @@ #include <QtPlatformHeaders/qxcbintegrationfunctions.h> #include <QtPlatformHeaders/qxcbscreenfunctions.h> -#ifndef QT_NO_DBUS -#include "QtPlatformSupport/private/qdbusmenuconnection_p.h" -#endif - #ifdef XCB_USE_XLIB # include <X11/Xlib.h> #else @@ -85,7 +81,6 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"), QByteArrayLiteral("rootwindow"), QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingenabled"), - QByteArrayLiteral("nofonthinting"), QByteArrayLiteral("atspibus"), QByteArrayLiteral("compositingenabled") }; @@ -242,9 +237,6 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr case GetTimestamp: result = getTimestamp(xcbScreen); break; - case NoFontHinting: - result = xcbScreen->noFontHinting() ? this : 0; //qboolptr... - break; case RootWindow: result = reinterpret_cast<void *>(xcbScreen->root()); break; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index ba19cd869c..acecbf4116 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -53,7 +53,6 @@ class QWidget; class QXcbScreen; class QXcbConnection; class QXcbNativeInterfaceHandler; -class QDBusMenuConnection; class Q_XCB_EXPORT QXcbNativeInterface : public QPlatformNativeInterface { @@ -73,7 +72,6 @@ public: RootWindow, ScreenSubpixelType, ScreenAntialiasingEnabled, - NoFontHinting, AtspiBus, CompositingEnabled }; diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index dc6846b20b..a9675935f4 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -61,8 +61,7 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t , m_number(number) , m_xSettings(Q_NULLPTR) { - QByteArray cmAtomName("_NET_WM_CM_S"); - cmAtomName += QByteArray::number(m_number); + const QByteArray cmAtomName = "_NET_WM_CM_S" + QByteArray::number(m_number); m_net_wm_cm_atom = connection->internAtom(cmAtomName.constData()); m_compositingActive = connection->getSelectionOwner(m_net_wm_cm_atom); @@ -188,7 +187,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe , m_forcedDpi(-1) , m_pixelDensity(1) , m_hintStyle(QFontEngine::HintStyle(-1)) - , m_noFontHinting(false) , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) , m_antialiasingEnabled(-1) { diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 8716af29b5..0d32c3d624 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -172,7 +172,6 @@ public: void readXResources(); QFontEngine::HintStyle hintStyle() const { return m_hintStyle; } - bool noFontHinting() const { return m_noFontHinting; } QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; } int antialiasingEnabled() const { return m_antialiasingEnabled; } @@ -208,7 +207,6 @@ private: int m_forcedDpi; int m_pixelDensity; QFontEngine::HintStyle m_hintStyle; - bool m_noFontHinting; QFontEngine::SubpixelAntialiasingType m_subpixelType; int m_antialiasingEnabled; }; diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp index 802e4cfe08..2303ccf806 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp @@ -40,6 +40,8 @@ #include "qxcbsessionmanager.h" +#ifndef QT_NO_SESSIONMANAGER + #include <qguiapplication.h> #include <qdatetime.h> #include <qfileinfo.h> @@ -144,7 +146,7 @@ static void sm_setProperty(const QString &name, const QStringList &value) for (QStringList::ConstIterator it = value.begin(); it != value.end(); ++it) { prop[count].length = (*it).length(); vl.append((*it).toUtf8()); - prop[count].value = (char*)vl.last().data(); + prop[count].value = (char*)vl.constLast().data(); ++count; } sm_setProperty(name.toLatin1().data(), SmLISTofARRAY8, count, prop); @@ -491,3 +493,5 @@ void QXcbSessionManager::exitEventLoop() } #include "qxcbsessionmanager.moc" + +#endif diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h index cba0ab91ad..a184282034 100644 --- a/src/plugins/platforms/xcb/qxcbsessionmanager.h +++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h @@ -52,6 +52,8 @@ #include <qpa/qplatformsessionmanager.h> +#ifndef QT_NO_SESSIONMANAGER + QT_BEGIN_NAMESPACE class QEventLoop; @@ -89,4 +91,6 @@ private: QT_END_NAMESPACE +#endif //QT_NO_SESSIONMANAGER + #endif //QXCBSESSIONMANAGER_H diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index f744b34901..0c8e78491e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -119,6 +119,8 @@ enum { QT_BEGIN_NAMESPACE +Q_DECLARE_TYPEINFO(xcb_rectangle_t, Q_PRIMITIVE_TYPE); + #undef FocusIn enum QX11EmbedFocusInDetail { @@ -256,6 +258,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) free_prop = true; } +#if QT_CONFIG(textcodec) static const QTextCodec* mapper = QTextCodec::codecForLocale(); int errCode = 0; if (mapper) { @@ -271,6 +274,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) mapper = QTextCodec::codecForName("latin1"); if (!mapper || !mapper->canEncode(s)) return Q_NULLPTR; +#endif static QByteArray qcs; qcs = s.toLatin1(); tp.value = (uchar*)qcs.data(); @@ -278,7 +282,9 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) tp.format = 8; tp.nitems = qcs.length(); free_prop = false; +#if QT_CONFIG(textcodec) } +#endif return &tp; } #endif // XCB_USE_XLIB @@ -2417,6 +2423,17 @@ static inline int fixed1616ToInt(FP1616 val) return int((qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF); } +void QXcbWindow::handleXIMouseButtonState(const xcb_ge_event_t *event) +{ + QXcbConnection *conn = connection(); + const xXIDeviceEvent *ev = reinterpret_cast<const xXIDeviceEvent *>(event); + if (ev->buttons_len > 0) { + unsigned char *buttonMask = (unsigned char *) &ev[1]; + for (int i = 1; i <= 15; ++i) + conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i)); + } +} + // With XI 2.2+ press/release/motion comes here instead of the above handlers. void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source) { @@ -2432,12 +2449,6 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource const Qt::MouseButton button = conn->xiToQtMouseButton(ev->detail); - if (ev->buttons_len > 0) { - unsigned char *buttonMask = (unsigned char *) &ev[1]; - for (int i = 1; i <= 15; ++i) - conn->setButton(conn->translateMouseButton(i), XIMaskIsSet(buttonMask, i)); - } - const char *sourceName = 0; if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) { const QMetaObject *metaObject = qt_getEnumMetaObject(source); @@ -2447,18 +2458,23 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource switch (ev->evtype) { case XI_ButtonPress: + handleXIMouseButtonState(event); if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) qCDebug(lcQpaXInputEvents, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, true); handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_ButtonRelease: + handleXIMouseButtonState(event); if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) qCDebug(lcQpaXInputEvents, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName); conn->setButton(button, false); handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source); break; case XI_Motion: + // Here we do NOT call handleXIMouseButtonState because we don't expect button state change to be bundled with motion. + // When a touchscreen is pressed, an XI_Motion event occurs in which XIMaskIsSet says the left button is pressed, + // but we don't want QGuiApplicationPrivate::processMouseEvent() to react by generating a mouse press event. if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) qCDebug(lcQpaXInputEvents, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName); handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source); @@ -2856,9 +2872,8 @@ void QXcbWindow::setMask(const QRegion ®ion) XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE); } else { QVector<xcb_rectangle_t> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - foreach (const QRect &r, regionRects) + rects.reserve(region.rectCount()); + for (const QRect &r : region) rects.push_back(qRectToXCBRectangle(r)); xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 717c424e11..92f3f7a67c 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -139,6 +139,7 @@ public: void handleFocusOutEvent(const xcb_focus_out_event_t *event) Q_DECL_OVERRIDE; void handlePropertyNotifyEvent(const xcb_property_notify_event_t *event) Q_DECL_OVERRIDE; #ifdef XCB_USE_XINPUT22 + void handleXIMouseButtonState(const xcb_ge_event_t *); void handleXIMouseEvent(xcb_ge_event_t *, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized) Q_DECL_OVERRIDE; void handleXIEnterLeave(xcb_ge_event_t *) Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 75684a769b..01d493156d 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -1,6 +1,8 @@ TARGET = qxcb -QT += core-private gui-private platformsupport-private xcb_qpa_lib-private +QT += core-private gui-private xcb_qpa_lib-private + +DEFINES += QT_NO_FOREACH SOURCES = \ qxcbmain.cpp diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index 20481e4834..20d8b83e7c 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -5,14 +5,13 @@ # libxcb-xinerama # CONFIG += static -load(qt_helper_lib) -XCB_DIR = ../../../../3rdparty/xcb +XCB_DIR = $$QT_SOURCE_TREE/src/3rdparty/xcb -INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude +MODULE_INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude +INCLUDEPATH += $$XCB_DIR/include/xcb -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB -QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB +QMAKE_USE += xcb/nolink # ignore compiler warnings in 3rdparty code QMAKE_CFLAGS_STATIC_LIB+=-w @@ -76,3 +75,5 @@ SOURCES += \ OTHER_FILES = $$XCB_DIR/README TR_EXCLUDE += $$XCB_DIR/* + +load(qt_helper_lib) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 5915a59c0b..0d27645a60 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -1,7 +1,8 @@ TEMPLATE = subdirs CONFIG += ordered +QT_FOR_CONFIG += gui-private -contains(QT_CONFIG, xcb-qt):SUBDIRS+=xcb-static +!qtConfig(system-xcb): SUBDIRS += xcb-static SUBDIRS += xcb_qpa_lib.pro SUBDIRS += xcb-plugin.pro diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 9ca8872cb2..6db0c76dea 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -1,7 +1,14 @@ TARGET = QtXcbQpa CONFIG += no_module_headers internal_module +DEFINES += QT_NO_FOREACH -QT += core-private gui-private platformsupport-private +QT += \ + core-private gui-private \ + service_support-private theme_support-private \ + eventdispatcher_support-private fontdatabase_support-private + +qtHaveModule(linuxaccessibility_support-private): \ + QT += linuxaccessibility_support-private SOURCES = \ qxcbclipboard.cpp \ @@ -42,67 +49,50 @@ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... -contains(QT_CONFIG, xcb-xlib) { +qtConfig(xcb-xlib) { DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb + QMAKE_USE += xcb_xlib - contains(QT_CONFIG, xinput2) { + qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp - LIBS += -lXi - !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) { - DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \ - LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \ - LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH - } + QMAKE_USE += xinput2 } } -# to support custom cursors with depth > 1 -contains(QT_CONFIG, xcb-render) { - DEFINES += XCB_USE_RENDER - LIBS += -lxcb-render -lxcb-render-util -} - # build with session management support -contains(QT_CONFIG, xcb-sm) { +qtConfig(xcb-sm) { DEFINES += XCB_USE_SM - LIBS += -lSM -lICE + QMAKE_USE += x11sm SOURCES += qxcbsessionmanager.cpp HEADERS += qxcbsessionmanager.h } include(gl_integrations/gl_integrations.pri) -DEFINES += $$QMAKE_DEFINES_XCB -LIBS += $$QMAKE_LIBS_XCB -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB -QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB - -CONFIG += qpa/genericunixfontdatabase - -contains(QT_CONFIG, dbus-linked) { - QT += dbus - LIBS += $$QT_LIBS_DBUS -} - -contains(QT_CONFIG, xcb-qt) { +!qtConfig(system-xcb) { DEFINES += XCB_USE_RENDER - XCB_DIR = ../../../3rdparty/xcb - INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude - LIBS += -lxcb -L$$MODULE_BASE_OUTDIR/lib -lxcb-static$$qtPlatformTargetSuffix() + QMAKE_USE += xcb-static xcb } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama - !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb + LIBS += -lxcb-xinerama ### there is no configure test for this! + qtConfig(xkb): QMAKE_USE += xcb_xkb + # to support custom cursors with depth > 1 + qtConfig(xcb-render) { + DEFINES += XCB_USE_RENDER + QMAKE_USE += xcb_render + } + QMAKE_USE += xcb_syslibs } # libxkbcommon -contains(QT_CONFIG, xkbcommon-qt) { - QT_CONFIG += use-xkbcommon-x11support - include(../../../3rdparty/xkbcommon.pri) +!qtConfig(xkbcommon-system) { + qtConfig(xkb) { + include(../../../3rdparty/xkbcommon-x11.pri) + } else { + include(../../../3rdparty/xkbcommon.pri) + } } else { - LIBS += $$QMAKE_LIBS_XKBCOMMON - QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XKBCOMMON + QMAKE_USE += xkbcommon } load(qt_module) |