diff options
author | Liang Qi <liang.qi@qt.io> | 2017-07-04 15:19:36 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-07-04 16:05:53 +0200 |
commit | c2b224a758ce7e6dcf3748444fa8e29ab81904be (patch) | |
tree | 277cb99bf054190c935579142506caa4ec9861dd /src/plugins | |
parent | 10de063ff12cdba07b4620182aced8ed05ee3505 (diff) | |
parent | eaee1209f0ead5be786e81db8aee604ccfea85b0 (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')
36 files changed, 163 insertions, 156 deletions
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 1ee81fa9c9..eb9e9c8b8d 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -395,8 +395,8 @@ void QIBusPlatformInputContext::filterEventFinished(QDBusPendingCallWatcher *cal Qt::KeyboardModifiers modifiers = watcher->modifiers(); QVariantList args = watcher->arguments(); - const ulong time = static_cast<const ulong>(args.at(0).toUInt()); - const QEvent::Type type = static_cast<const QEvent::Type>(args.at(1).toUInt()); + const ulong time = static_cast<ulong>(args.at(0).toUInt()); + const QEvent::Type type = static_cast<QEvent::Type>(args.at(1).toUInt()); const int qtcode = args.at(2).toInt(); const quint32 code = args.at(3).toUInt(); const quint32 sym = args.at(4).toUInt(); diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 32630003d1..ef95b80dd4 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -38,6 +38,8 @@ ** ****************************************************************************/ +#include <QtGui/qtguiglobal.h> + #include "androidjniinput.h" #include "androidjnimain.h" #include "qandroidplatformintegration.h" @@ -292,17 +294,17 @@ namespace QtAndroidInput static bool isTabletEventSupported(JNIEnv */*env*/, jobject /*thiz*/) { -#ifdef QT_NO_TABLETEVENT - return false; -#else +#if QT_CONFIG(tabletevent) return true; -#endif // QT_NO_TABLETEVENT +#else + return false; +#endif // QT_CONFIG(tabletevent) } static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action, jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) QPointF globalPosF(x, y); QPoint globalPos((int)x, (int)y); QWindow *tlw = topLevelWindowAt(globalPos); @@ -344,7 +346,7 @@ namespace QtAndroidInput QWindowSystemInterface::handleTabletEvent(tlw, ulong(time), localPos, globalPosF, QTabletEvent::Stylus, pointerType, buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier); -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) } static int mapAndroidKey(int key) diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 4d05fb4a46..f48f9ccf30 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -21,8 +21,6 @@ OBJECTIVE_SOURCES += main.mm \ qmultitouch_mac.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ - qcocoacolordialoghelper.mm \ - qcocoafiledialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -57,8 +55,6 @@ HEADERS += qcocoaintegration.h \ qmultitouch_mac_p.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ - qcocoacolordialoghelper.h \ - qcocoafiledialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -91,6 +87,8 @@ QT += \ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { + QT_FOR_CONFIG += widgets + OBJECTIVE_SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ @@ -103,6 +101,16 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(colordialog) { + SOURCES += qcocoacolordialoghelper.mm + HEADERS += qcocoacolordialoghelper.h + } + + qtConfig(filedialog) { + SOURCES += qcocoafiledialoghelper.mm + HEADERS += qcocoafiledialoghelper.h + } + QT += widgets-private printsupport-private } diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h index 55017668d1..133efd6db8 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h @@ -40,9 +40,13 @@ #ifndef QCOCOACOLORDIALOGHELPER_H #define QCOCOACOLORDIALOGHELPER_H +#include <QtWidgets/qtwidgetsglobal.h> + #include <QObject> #include <qpa/qplatformdialoghelper.h> +QT_REQUIRE_CONFIG(colordialog); + QT_BEGIN_NAMESPACE class QCocoaColorDialogHelper : public QPlatformColorDialogHelper diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index a8974c4de5..5d331c0e96 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -37,8 +37,6 @@ ** ****************************************************************************/ -#ifndef QT_NO_COLORDIALOG - #include <QtCore/qdebug.h> #include <QtCore/qtimer.h> #include <qpa/qplatformtheme.h> @@ -424,5 +422,3 @@ QColor QCocoaColorDialogHelper::currentColor() const } QT_END_NAMESPACE - -#endif // QT_NO_COLORDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h index 1cff6f97ba..f5ba1dc22e 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h @@ -41,8 +41,11 @@ #define QCOCOAFILEDIALOGHELPER_H #include <QObject> +#include <QtWidgets/qtwidgetsglobal.h> #include <qpa/qplatformdialoghelper.h> +QT_REQUIRE_CONFIG(filedialog); + Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate)); QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index b5a5568f3c..9a00eb89b7 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -41,8 +41,6 @@ #include "qcocoafiledialoghelper.h" -#ifndef QT_NO_FILEDIALOG - /***************************************************************************** QFileDialog debug facilities *****************************************************************************/ @@ -775,5 +773,3 @@ bool QCocoaFileDialogHelper::defaultNameFilterDisables() const } QT_END_NAMESPACE - -#endif // QT_NO_FILEDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index d48ec8c6f7..bac49cfad9 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -47,7 +47,6 @@ #include "qcocoahelpers.h" #include "qcocoaapplication.h" #include "qcocoaapplicationdelegate.h" -#include "qcocoafiledialoghelper.h" #include "qcocoatheme.h" #include "qcocoainputcontext.h" #include "qcocoamimetypes.h" @@ -60,6 +59,13 @@ #include <QtGui/private/qcoregraphics_p.h> +#ifdef QT_WIDGETS_LIB +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include <IOKit/graphics/IOGraphicsLib.h> static void initResources() diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index ad2b27999b..a6104d86cc 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -45,7 +45,6 @@ #include <QtCore/QVariant> #include "qcocoacolordialoghelper.h" -#include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" #include "qcocoasystemtrayicon.h" @@ -63,6 +62,13 @@ #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> +#ifdef QT_WIDGETS_LIB +#include <QtWidgets/qtwidgetsglobal.h> +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include <Carbon/Carbon.h> @interface QT_MANGLE_NAMESPACE(QCocoaThemeNotificationReceiver) : NSObject { @@ -124,7 +130,7 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const { if (dialogType == QPlatformTheme::FileDialog) return true; -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) if (dialogType == QPlatformTheme::ColorDialog) return true; #endif @@ -138,11 +144,11 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const { switch (dialogType) { -#ifndef QT_NO_FILEDIALOG +#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) case QPlatformTheme::FileDialog: return new QCocoaFileDialogHelper(); #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) case QPlatformTheme::ColorDialog: return new QCocoaColorDialogHelper(); #endif diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 1fe2a91d57..6e5b749747 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include <QtCore/qglobal.h> +#include <QtGui/qtguiglobal.h> #include "qnsview.h" #include "qcocoawindow.h" @@ -363,6 +363,14 @@ static QTouchDevice *touchDevice = 0; m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->paintDevice()->devicePixelRatio(); + + // Prevent buildup of NSDisplayCycle objects during setNeedsDisplayInRect, which + // would normally be released as part of the root runloop's autorelease pool, but + // can be kept alive during repeated painting which starve the root runloop. + // FIXME: Move this to the event dispatcher, to cover more cases of starvation. + // FIXME: Figure out if there's a way to detect and/or prevent runloop starvation. + QMacAutoReleasePool pool; + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } @@ -1356,7 +1364,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) } #endif // QT_NO_GESTURES -#ifndef QT_NO_WHEELEVENT +#if QT_CONFIG(wheelevent) - (void)scrollWheel:(NSEvent *)theEvent { if (!m_platformWindow) @@ -1437,7 +1445,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) QWindowSystemInterface::handleWheelEvent(m_platformWindow->window(), qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers, ph, source, isInverted); } -#endif //QT_NO_WHEELEVENT +#endif // QT_CONFIG(wheelevent) - (int) convertKeyCode : (QChar)keyChar { @@ -1512,7 +1520,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, [nsevent isARepeat], 1); } - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (m_sendKeyEvent && fo) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImHints); if (QCoreApplication::sendEvent(fo, &queryEvent)) { @@ -1662,8 +1670,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) commitString = QString::fromCFString(reinterpret_cast<CFStringRef>(aString)); }; } - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1730,8 +1737,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) m_composingText = preeditString; - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1747,8 +1753,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (void) unmarkText { if (!m_composingText.isEmpty()) { - QObject *fo = QGuiApplication::focusObject(); - if (fo) { + if (QObject *fo = m_platformWindow->window()->focusObject()) { QInputMethodQueryEvent queryEvent(Qt::ImEnabled); if (QCoreApplication::sendEvent(fo, &queryEvent)) { if (queryEvent.value(Qt::ImEnabled).toBool()) { @@ -1770,7 +1775,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) - (NSAttributedString *) attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1805,7 +1810,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { NSRange selectedRange = {0, 0}; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return selectedRange; QInputMethodQueryEvent queryEvent(Qt::ImEnabled | Qt::ImCurrentSelection); @@ -1827,7 +1832,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) { Q_UNUSED(aRange) Q_UNUSED(actualRange) - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return NSZeroRect; @@ -1867,7 +1872,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (m_platformWindow->window() != QGuiApplication::focusWindow()) return nil; - QObject *fo = QGuiApplication::focusObject(); + QObject *fo = m_platformWindow->window()->focusObject(); if (!fo) return nil; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index ddd779bbac..ef893f8a63 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -60,6 +60,7 @@ #include "qwindowsscreen.h" #include "qwindowstheme.h" +#include <QtGui/qtguiglobal.h> #include <QtGui/QWindow> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformnativeinterface.h> @@ -940,9 +941,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return false; #endif case QtWindows::DisplayChangedEvent: - return d->m_screenManager.handleDisplayChange(wParam, lParam); if (QWindowsTheme *t = QWindowsTheme::instance()) t->displayChanged(); + return d->m_screenManager.handleDisplayChange(wParam, lParam); case QtWindows::SettingChangedEvent: return d->m_screenManager.handleScreenChanges(); default: @@ -1089,10 +1090,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, *result = LRESULT(MA_NOACTIVATE); return true; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->notifyActivate(); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (platformWindow->testFlag(QWindowsWindow::BlockedByModal)) if (const QWindow *modalWindow = QGuiApplication::modalWindow()) { QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(modalWindow); diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index c2d7632e89..af62936a18 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1014,6 +1014,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms state |= ((msg.wParam >= '0' && msg.wParam <= '9') || (msg.wParam >= VK_OEM_PLUS && msg.wParam <= VK_OEM_3)) ? 0 : int(Qt::KeypadModifier); + Q_FALLTHROUGH(); default: if (uint(msg.lParam) == 0x004c0001 || uint(msg.lParam) == 0xc04c0001) state |= Qt::KeypadModifier; diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 46306d438f..7e1017426f 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -39,8 +39,6 @@ #include "qwindowstabletsupport.h" -#ifndef QT_NO_TABLETEVENT - #include "qwindowscontext.h" #include "qwindowskeymapper.h" #include "qwindowswindow.h" @@ -498,5 +496,3 @@ bool QWindowsTabletSupport::translateTabletPacketEvent() } QT_END_NAMESPACE - -#endif // QT_NO_TABLETEVENT diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 97eceaf2cc..7878e962e1 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -41,14 +41,15 @@ #define QWINDOWSTABLETSUPPORT_H #include "qtwindowsglobal.h" - -#if !defined(QT_NO_TABLETEVENT) +#include <QtGui/qtguiglobal.h> #include <QtCore/QVector> #include <QtCore/QPointF> #include <wintab.h> +QT_REQUIRE_CONFIG(tabletevent); + QT_BEGIN_NAMESPACE class QDebug; @@ -140,5 +141,4 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/xcb/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 ¶meters, 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 } diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 1cd1629347..8d991cc721 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -90,7 +90,9 @@ #include <qtreeview.h> #include <qtableview.h> #include <qoperatingsystemversion.h> +#if QT_CONFIG(wizard) #include <qwizard.h> +#endif #include <qdebug.h> #include <qlibrary.h> #include <qdatetimeedit.h> @@ -3090,7 +3092,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w case SH_FocusFrame_AboveWidget: ret = true; break; -#ifndef QT_NO_WIZARD +#if QT_CONFIG(wizard) case SH_WizardStyle: ret = QWizard::MacStyle; break; @@ -4264,6 +4266,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // outside world, unless they read the source, in which case, it's // their own fault). bool nonDefaultFont = p->font() != qt_app_fonts_hash()->value("QComboMenuItem"); + + if (!myTab.documentMode && (myTab.state & State_Selected) && (myTab.state & State_Active)) + if (const auto *tabBar = qobject_cast<const QTabBar *>(w)) + if (!tabBar->tabTextColor(tabBar->currentIndex()).isValid()) + myTab.palette.setColor(QPalette::WindowText, Qt::white); + if (verticalTabs || nonDefaultFont || !tab->icon.isNull() || !myTab.leftButtonSize.isEmpty() || !myTab.rightButtonSize.isEmpty()) { int heightOffset = 0; diff --git a/src/plugins/styles/mac/qmacstyle_mac_p_p.h b/src/plugins/styles/mac/qmacstyle_mac_p_p.h index 03282e1bbc..73166b12f7 100644 --- a/src/plugins/styles/mac/qmacstyle_mac_p_p.h +++ b/src/plugins/styles/mac/qmacstyle_mac_p_p.h @@ -93,7 +93,6 @@ #include <qtoolbutton.h> #include <qtreeview.h> #include <qtableview.h> -#include <qwizard.h> #include <qdebug.h> #include <qdatetimeedit.h> #include <qmath.h> diff --git a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp index 1a1094a934..ebd3934c90 100644 --- a/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsvistastyle.cpp @@ -778,10 +778,10 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt if (qobject_cast<const QMessageBox *> (widget)) buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_msgbox_buttonbox")); -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<const QInputDialog *> (widget)) buttonBox = widget->findChild<const QDialogButtonBox *>(QLatin1String("qt_inputdlg_buttonbox")); -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) if (buttonBox) { //draw white panel part @@ -2151,6 +2151,7 @@ QRect QWindowsVistaStyle::subControlRect(ComplexControl control, const QStyleOpt rect = visualRect(cb->direction, cb->rect, rect); return rect; } + break; #endif // QT_NO_COMBOBOX case CC_TitleBar: if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) { @@ -2321,7 +2322,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground); #if QT_CONFIG(dialogbuttonbox) @@ -2330,7 +2331,7 @@ void QWindowsVistaStyle::polish(QWidget *widget) buttonBox->setContentsMargins(0, 9, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover); } @@ -2365,7 +2366,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#ifndef QT_NO_INPUTDIALOG +#if QT_CONFIG(inputdialog) else if (qobject_cast<QInputDialog *> (widget)) { widget->setAttribute(Qt::WA_StyledBackground, false); #if QT_CONFIG(dialogbuttonbox) @@ -2374,7 +2375,7 @@ void QWindowsVistaStyle::unpolish(QWidget *widget) buttonBox->setContentsMargins(0, 0, 0, 0); #endif } -#endif // QT_NO_INPUTDIALOG +#endif // QT_CONFIG(inputdialog) else if (QTreeView *tree = qobject_cast<QTreeView *> (widget)) { tree->viewport()->setAttribute(Qt::WA_Hover, false); } else if (qobject_cast<QCommandLinkButton*>(widget)) { diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index beb8c60e3a..a21ce4b531 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -1515,10 +1515,9 @@ case PE_Frame: return; } else if (fillType == BT_NONE) { return; - } else { - break; } } + break; } case PE_FrameLineEdit: { // we try to check if this lineedit is a delegate on a QAbstractItemView-derived class. @@ -2434,6 +2433,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op p->restore(); return; } + break; #endif // QT_NO_RUBBERBAND case CE_HeaderEmptyArea: if (option->state & State_Horizontal) @@ -3760,10 +3760,9 @@ int QWindowsXPStyle::styleHint(StyleHint hint, const QStyleOption *option, const break; #ifndef QT_NO_RUBBERBAND case SH_RubberBand_Mask: - if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) { + if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) res = 0; - break; - } + break; #endif // QT_NO_RUBBERBAND case SH_ItemView_DrawDelegateFrame: |