From 3851a8ff20c6aed0807bfdc4588ae108a2b108ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 23 Jun 2017 13:32:25 +0200 Subject: macOS: Work around buildup of NSDisplayCycle objects during rapid painting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-60012 Change-Id: Id5291f768a4b9d8d9c77804cb697e0c9fb151012 Reviewed-by: Timur Pocheptsov Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/cocoa/qnsview.mm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 66c3b6fad4..80c8bfc48b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -381,6 +381,14 @@ static bool _q_dontOverrideCtrlLMB = false; 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())]; } -- cgit v1.2.3 From 198b67d14bf3ca76d6bdf8901348da0838cf3b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Jun 2017 17:58:41 +0200 Subject: macOS: Send text input and key events to focus object of window, not app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The key events and input method callbacks coming from Cocoa are targeted at our specific NSView, so we should deliver them to the focus object of the corresponding QWindow, not the global application focus object. This means that we'll deliver key events to windows also when they are not key (active), but this is intentional, as we would otherwise fail to deliver input method events coming from e.g. the emoji/symbol picker, which steals the key window when active. Task-number: QTBUG-61359 Change-Id: I61326c08ad8bbd0c535b3cc8a67d0ceeec7ee910 Reviewed-by: Gabriel de Dietrich Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 80c8bfc48b..2c9157c4ec 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1544,7 +1544,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)) { @@ -1694,8 +1694,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) commitString = QString::fromCFString(reinterpret_cast(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()) { @@ -1762,8 +1761,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()) { @@ -1779,8 +1777,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()) { @@ -1802,7 +1799,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); @@ -1837,7 +1834,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); @@ -1859,7 +1856,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; @@ -1899,7 +1896,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; -- cgit v1.2.3 From 9c9382a85f53756c3c702ef7a999720ae40be5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Mon, 19 Jun 2017 22:28:37 +0200 Subject: xcb: Increment iterator inside bgr888 region loop Amends 9c1d3bc253abd4418f3050d19ec5f05bef3ada97. Change-Id: I912096794d274617e5b290dfb42685088cd49b23 Reviewed-by: Marc Mutz --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index f095288221..a419caf0fc 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -561,7 +561,7 @@ void QXcbBackingStore::endPaint() return; QPainter p(m_image->image()); while (it != end) { - const QRect rect = *it; + const QRect rect = *(it++); p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } -- cgit v1.2.3 From 8612b0ed938bfbf7cfd2e5db405aa6a0109f41d2 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 27 Jun 2017 15:36:26 +0200 Subject: xcb: rename arg in QXcbBackingStore ctor ... as it is a window, not widget. This matches the name from cpp file: QXcbBackingStore::QXcbBackingStore(QWindow *window). Change-Id: Ib9f69cbe80ea645bbce0e4f5ef24a8df8808b823 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbbackingstore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 2985432b7f..94b5994004 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -54,7 +54,7 @@ class QXcbShmImage; class QXcbBackingStore : public QXcbObject, public QPlatformBackingStore { public: - QXcbBackingStore(QWindow *widget); + QXcbBackingStore(QWindow *window); ~QXcbBackingStore(); QPaintDevice *paintDevice() override; -- cgit v1.2.3 From b1381ea9ebb3dd4019081f4412f82a3280b4eb52 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 13:55:28 +0300 Subject: xcb: Use QT_CONFIG macro to check for xcb-xlib ... and remove the XCB_USE_XLIB define. This patch also removes the unnecessary checks for xcb-xlib in: - qxcbglxintegration.cpp as this files is build _only_ when xcb-xlib is present. From gl_integrations.pro: qtConfig(xcb-xlib):qtConfig(opengl):!qtConfig(opengles2) { SUBDIRS += xcb_glx } This also would have been the right place where to define XCB_USE_XLIB, instead of unconditional line in xcb_glx.pro: DEFINES += XCB_USE_GLX XCB_USE_XLIB - qxcbnativeinterface.cpp as this cpp file does not use any Xlib APIs directly, there is no need to include Xlib.h. Change-Id: I531b5f1e79606fcfd1c63810cf51b7d5e9dc58a7 Reviewed-by: Gatis Paeglis --- .../xcb/gl_integrations/gl_integrations_plugin_base.pri | 1 - .../xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h | 2 +- .../platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro | 2 -- .../xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp | 8 +++----- .../platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 12 ++++++------ src/plugins/platforms/xcb/qxcbconnection.h | 4 ++-- src/plugins/platforms/xcb/qxcbcursor.cpp | 10 +++++----- src/plugins/platforms/xcb/qxcbcursor.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 12 ++++-------- src/plugins/platforms/xcb/qxcbwindow.cpp | 10 +++++----- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 1 - 15 files changed, 32 insertions(+), 42 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 4ab406acb9..063a74c395 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -7,7 +7,6 @@ load(qt_build_paths) # needed by Xcursor ... qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB qtConfig(xinput2) { DEFINES += XCB_USE_XINPUT2 } diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp index 4852d38f7e..9c52733120 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp @@ -116,7 +116,7 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO void *QXcbEglIntegration::xlib_display() const { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) return m_connection->xlib_display(); #else return EGL_DEFAULT_DISPLAY; diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp index 3f7ef94238..9c3fd26d49 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp @@ -65,7 +65,7 @@ void QXcbEglWindow::resolveFormat(const QSurfaceFormat &format) m_format = q_glFormatFromConfig(m_glIntegration->eglDisplay(), m_config, format); } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *QXcbEglWindow::createVisual() { QXcbScreen *scr = xcbScreen(); diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h index 3090cef735..e49a3fe2ac 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.h @@ -62,7 +62,7 @@ protected: void create() override; void resolveFormat(const QSurfaceFormat &format) override; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) const xcb_visualtype_t *createVisual() override; #endif diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro index 1c193849ca..a39e00ec59 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro @@ -5,8 +5,6 @@ QT += egl_support-private CONFIG += egl -qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB - DEFINES += QT_NO_FOREACH HEADERS += \ diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp index 77cbdd5fba..a283d451f8 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp @@ -75,7 +75,7 @@ typedef struct xcb_glx_buffer_swap_complete_event_t { } xcb_glx_buffer_swap_complete_event_t; #endif -#if defined(XCB_USE_XLIB) && defined(XCB_USE_GLX) +#if defined(XCB_USE_GLX) typedef struct { int type; unsigned long serial; /* # of last request processed by server */ @@ -202,10 +202,9 @@ QPlatformOffscreenSurface *QXcbGlxIntegration::createPlatformOffscreenSurface(QO if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "ATI") || !strcmp(glxvendor, "Chromium")) @@ -231,10 +230,9 @@ bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const if (!vendorChecked) { vendorChecked = true; Display *display = glXGetCurrentDisplay(); -#ifdef XCB_USE_XLIB if (!display) display = static_cast(m_connection->xlib_display()); -#endif + const char *glxvendor = glXGetClientString(display, GLX_VENDOR); if (glxvendor) { if (!strcmp(glxvendor, "Parallels Inc")) diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro index 215f5a3fe1..5af6172301 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro @@ -4,7 +4,7 @@ include(../gl_integrations_plugin_base.pri) QT += glx_support-private #should be removed from the sources -DEFINES += XCB_USE_GLX XCB_USE_XLIB +DEFINES += XCB_USE_GLX DEFINES += QT_NO_FOREACH qtConfig(xcb-glx) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5c15a9cbcb..e29dd645cb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -69,7 +69,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #include @@ -136,7 +136,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) } #endif // XCB_USE_XINPUT2 -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static const char * const xcbConnectionErrors[] = { "No error", /* Error 0 */ "I/O error", /* XCB_CONN_ERROR */ @@ -557,7 +557,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) , m_nativeInterface(nativeInterface) { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) Display *dpy = XOpenDisplay(m_displayName.constData()); if (dpy) { m_primaryScreenNumber = DefaultScreen(dpy); @@ -569,7 +569,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra } #else m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreenNumber); -#endif //XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) if (Q_UNLIKELY(!m_connection || xcb_connection_has_error(m_connection))) qFatal("QXcbConnection: Could not connect to display %s", m_displayName.constData()); @@ -685,7 +685,7 @@ QXcbConnection::~QXcbConnection() delete m_glIntegration; -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XCloseDisplay(static_cast(m_xlib_display)); #else xcb_disconnect(xcb_connection()); @@ -1551,7 +1551,7 @@ xcb_window_t QXcbConnection::clientLeader() return m_clientLeader; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *QXcbConnection::xlib_display() const { return m_xlib_display; diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6089265304..5b9a3887f5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -421,7 +421,7 @@ public: bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; } xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) void *xlib_display() const; void *createVisualInfoForDefaultVisualId() const; #endif @@ -632,7 +632,7 @@ private: QScopedPointer m_wmSupport; QXcbNativeInterface *m_nativeInterface = nullptr; -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) void *m_xlib_display = nullptr; #endif QXcbEventReader *m_reader = nullptr; diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index d257ab1242..7c62c2e2b3 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -60,7 +60,7 @@ typedef char *(*PtrXcursorLibraryGetTheme)(void *); typedef int (*PtrXcursorLibrarySetTheme)(void *, const char *); typedef int (*PtrXcursorLibraryGetDefaultSize)(void *); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) #include enum { XCursorShape = CursorShape @@ -308,7 +308,7 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen) const char *cursorStr = "cursor"; xcb_open_font(xcb_connection(), cursorFont, strlen(cursorStr), cursorStr); -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static bool function_ptrs_not_initialized = true; if (function_ptrs_not_initialized) { QLibrary xcursorLib(QLatin1String("Xcursor"), 1); @@ -509,7 +509,7 @@ xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) return cursor; } -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) bool updateCursorTheme(void *dpy, const QByteArray &theme) { if (!ptrXcursorLibraryGetTheme || !ptrXcursorLibrarySetTheme) @@ -553,7 +553,7 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) } return cursor; } -#endif // XCB_USE_XLIB / QT_CONFIG(library) +#endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library) xcb_cursor_t QXcbCursor::createFontCursor(int cshape) { @@ -562,7 +562,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) xcb_cursor_t cursor = XCB_NONE; // Try Xcursor first -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) if (cshape >= 0 && cshape <= Qt::LastCursor) { void *dpy = connection()->xlib_display(); // special case for non-standard dnd-* cursors diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 41ec4dbbf8..e3f88518fe 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -101,7 +101,7 @@ private: #ifndef QT_NO_CURSOR CursorHash m_cursorHash; #endif -#if defined(XCB_USE_XLIB) && QT_CONFIG(library) +#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 8e3ee20329..e742e91f7d 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -63,7 +63,7 @@ #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #endif @@ -123,7 +123,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char qApp->setAttribute(Qt::AA_CompressHighFrequencyEvents, true); qRegisterMetaType(); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XInitThreads(); #endif m_nativeInterface.reset(new QXcbNativeInterface); diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 725288633a..97dcb8f328 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -57,11 +57,7 @@ #include #include -#ifdef XCB_USE_XLIB -# include -#else -# include -#endif +#include #include @@ -210,7 +206,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr const QXcbScreen *xcbScreen = static_cast(screen->handle()); switch (resourceType(lowerCaseResource)) { case Display: -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) result = xcbScreen->connection()->xlib_display(); #endif break; @@ -436,7 +432,7 @@ void *QXcbNativeInterface::rootWindow() void *QXcbNativeInterface::display() { -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) QXcbIntegration *integration = QXcbIntegration::instance(); QXcbConnection *defaultConnection = integration->defaultConnection(); if (defaultConnection) @@ -514,7 +510,7 @@ QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window) void *QXcbNativeInterface::displayForWindow(QWindow *window) { -#if defined(XCB_USE_XLIB) +#if QT_CONFIG(xcb_xlib) QXcbScreen *screen = qPlatformScreenForWindow(window); return screen ? screen->connection()->xlib_display() : Q_NULLPTR; #else diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index d6c69d52ef..31757ca6f6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -99,7 +99,7 @@ #include #include -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) #include #include #endif @@ -251,7 +251,7 @@ static inline bool positionIncludesFrame(QWindow *w) return qt_window_private(w)->positionPolicy == QWindowPrivate::WindowFrameInclusive; } -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) { #include @@ -297,7 +297,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s) #endif return &tp; } -#endif // XCB_USE_XLIB +#endif // QT_CONFIG(xcb_xlib) // TODO move this into a utility function in QWindow or QGuiApplication static QWindow *childWindowAt(QWindow *win, const QPoint &p) @@ -569,7 +569,7 @@ void QXcbWindow::create() if (window()->flags() & Qt::WindowTransparentForInput) setTransparentForMouseEvents(true); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) // force sync to read outstanding requests - see QTBUG-29106 XSync(DISPLAY_FROM_XCB(platformScreen), false); #endif @@ -1535,7 +1535,7 @@ void QXcbWindow::setWindowTitle(const QString &title) ba.length(), ba.constData())); -#ifdef XCB_USE_XLIB +#if QT_CONFIG(xcb_xlib) XTextProperty *text = qstringToXTP(DISPLAY_FROM_XCB(this), title); if (text) XSetWMName(DISPLAY_FROM_XCB(this), m_window, text); diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6db0c76dea..6c9a3259b6 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -50,7 +50,6 @@ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN # needed by Xcursor ... qtConfig(xcb-xlib) { - DEFINES += XCB_USE_XLIB QMAKE_USE += xcb_xlib qtConfig(xinput2) { -- cgit v1.2.3 From 5ede5706a8b8052280981aa1d9c42999a24b74b5 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 22:22:22 +0200 Subject: Convert features.wheelevent to QT_CONFIG Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/qnsview.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 2c9157c4ec..e6d513bb89 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -37,7 +37,7 @@ ** ****************************************************************************/ -#include +#include #include "qnsview.h" #include "qcocoawindow.h" @@ -1388,7 +1388,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) @@ -1469,7 +1469,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 { -- cgit v1.2.3 From 7f62c5fedc4a677fd9d9b002c4dfb9fd52a8a1a3 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 23:04:21 +0200 Subject: Convert features.tabletevent to QT_CONFIG Change-Id: Ibd7ed7f269a64afddadee70979b20f1c58398378 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/android/androidjniinput.cpp | 14 +++++++----- src/plugins/platforms/windows/qwindowscontext.cpp | 5 +++-- .../platforms/windows/qwindowstabletsupport.cpp | 4 ---- .../platforms/windows/qwindowstabletsupport.h | 6 ++--- src/plugins/platforms/xcb/qxcbconnection.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbconnection.h | 8 +++---- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 26 +++++++++++----------- 7 files changed, 33 insertions(+), 34 deletions(-) (limited to 'src/plugins/platforms') 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 + #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/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 5eb58dc5a1..42cdc86fb7 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -59,6 +59,7 @@ #include "qwindowsscreen.h" #include "qwindowstheme.h" +#include #include #include #include @@ -1077,10 +1078,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/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 #include #include #include +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/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e29dd645cb..514ad6775d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1626,11 +1626,11 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, // compress XI_Motion, but not from tablet devices if (isXIType(event, m_xiOpCode, XI_Motion)) { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) xXIDeviceEvent *xdev = reinterpret_cast(event); if (const_cast(this)->tabletDataForDevice(xdev->sourceid)) return false; -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) for (int j = nextIndex; j < eventqueue->size(); ++j) { xcb_generic_event_t *next = eventqueue->at(j); if (!isValid(next)) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 5b9a3887f5..40a54e0f1f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -64,7 +64,7 @@ #undef explicit #endif -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) #include #endif @@ -565,7 +565,7 @@ private: #ifdef XCB_USE_XINPUT22 void xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindow); #endif // XCB_USE_XINPUT22 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) struct TabletData { int deviceId = 0; QTabletEvent::PointerType pointerType = QTabletEvent::UnknownPointer; @@ -587,7 +587,7 @@ private: void xi2ReportTabletEvent(const void *event, TabletData *tabletData); QVector m_tabletData; TabletData *tabletDataForDevice(int id); -#endif // !QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) struct ScrollingDevice { int deviceId = 0; int verticalIndex = 0; @@ -695,7 +695,7 @@ private: friend class QXcbEventReader; }; #ifdef XCB_USE_XINPUT2 -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); #endif diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 730473b983..52873f0910 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -100,7 +100,7 @@ void QXcbConnection::initializeXInput2() void QXcbConnection::xi2SetupDevices() { -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) m_tabletData.clear(); #endif m_scrollingDevices.clear(); @@ -116,7 +116,7 @@ void QXcbConnection::xi2SetupDevices() if (devices[i].use != XISlavePointer) continue; qCDebug(lcQpaXInputDevices) << "input device " << devices[i].name << "ID" << devices[i].deviceid; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) TabletData tabletData; #endif ScrollingDevice scrollingDevice; @@ -126,7 +126,7 @@ void QXcbConnection::xi2SetupDevices() XIValuatorClassInfo *vci = reinterpret_cast(devices[i].classes[c]); const int valuatorAtom = qatom(vci->label); qCDebug(lcQpaXInputDevices) << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms); -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (valuatorAtom < QXcbAtom::NAtoms) { TabletData::ValuatorClassInfo info; info.minVal = vci->min; @@ -134,7 +134,7 @@ void QXcbConnection::xi2SetupDevices() info.number = vci->number; tabletData.valuatorInfo[valuatorAtom] = info; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) scrollingDevice.lastScrollPosition.setX(vci->value); else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) @@ -191,7 +191,7 @@ void QXcbConnection::xi2SetupDevices() } } bool isTablet = false; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) // If we have found the valuators which we expect a tablet to have, it might be a tablet. if (tabletData.valuatorInfo.contains(QXcbAtom::AbsX) && tabletData.valuatorInfo.contains(QXcbAtom::AbsY) && @@ -241,7 +241,7 @@ void QXcbConnection::xi2SetupDevices() m_tabletData.append(tabletData); qCDebug(lcQpaXInputDevices) << " it's a tablet with pointer type" << dbgType; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 if (scrollingDevice.orientations || scrollingDevice.legacyOrientations) { @@ -330,7 +330,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) #endif // XCB_USE_XINPUT22 QSet tabletDevices; -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!m_tabletData.isEmpty()) { unsigned int tabletBitMask; unsigned char *xiTabletBitMask = reinterpret_cast(&tabletBitMask); @@ -347,7 +347,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) } XISelectEvents(xDisplay, window, xiEventMask.data(), m_tabletData.count()); } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 // Enable each scroll device @@ -482,12 +482,12 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) return dev; } -#if defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#if defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) static inline qreal fixed1616ToReal(FP1616 val) { return qreal(val) / 0x10000; } -#endif // defined(XCB_USE_XINPUT21) || !defined(QT_NO_TABLETEVENT) +#endif // defined(XCB_USE_XINPUT21) || QT_CONFIG(tabletevent) void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) { @@ -536,13 +536,13 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) return; } -#ifndef QT_NO_TABLETEVENT +#if QT_CONFIG(tabletevent) if (!xiEnterEvent) { QXcbConnection::TabletData *tablet = tabletDataForDevice(sourceDeviceId); if (tablet && xi2HandleTabletEvent(xiEvent, tablet)) return; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #ifdef XCB_USE_XINPUT21 QHash::iterator device = m_scrollingDevices.find(sourceDeviceId); @@ -1240,6 +1240,6 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) return Q_NULLPTR; } -#endif // QT_NO_TABLETEVENT +#endif // QT_CONFIG(tabletevent) #endif // XCB_USE_XINPUT2 -- cgit v1.2.3 From 4f7be34a42458db87ce2f11ed34ea2d2aa020009 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jun 2017 13:45:53 +0200 Subject: Windows code: Add Q_FALLTHROUGH or break to unmarked fallthroughs seen by GCC 7 Rearrange code handling QtWindows::DisplayChangedEvent. Change-Id: If9f32516108fb64c4a252c84392f2fd7f1872bf1 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 +- src/plugins/platforms/windows/qwindowskeymapper.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 42cdc86fb7..38f2be7a73 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -925,9 +925,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: diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index ab806fd3ea..3987d8ca29 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1008,6 +1008,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; -- cgit v1.2.3 From 1ebe68b01f6ab7e32f4f383d979588842b050dfb Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Tue, 30 May 2017 20:25:50 +0200 Subject: Convert features.filedialog to QT_[REQUIRE_]CONFIG Change-Id: I9bc229b0d1430b81eeb2cfca2b24474736d5d561 Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 9 +++++++-- src/plugins/platforms/cocoa/qcocoafiledialoghelper.h | 3 +++ src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 4 ---- src/plugins/platforms/cocoa/qcocoaintegration.mm | 8 +++++++- src/plugins/platforms/cocoa/qcocoatheme.mm | 10 ++++++++-- 5 files changed, 25 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 62935210be..0f478a79f3 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -21,7 +21,6 @@ OBJECTIVE_SOURCES += main.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ qcocoacolordialoghelper.mm \ - qcocoafiledialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -56,7 +55,6 @@ HEADERS += qcocoaintegration.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ qcocoacolordialoghelper.h \ - qcocoafiledialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -89,6 +87,8 @@ QT += \ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { + QT_FOR_CONFIG += widgets + OBJECTIVE_SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ @@ -101,6 +101,11 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(filedialog) { + SOURCES += qcocoafiledialoghelper.mm + HEADERS += qcocoafiledialoghelper.h + } + QT += widgets-private printsupport-private } 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 +#include #include +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 4ba3dcb9a6..74148b7cbf 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 +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include static void initResources() diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index d2345f9abc..53ccf68c0c 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -45,7 +45,6 @@ #include #include "qcocoacolordialoghelper.h" -#include "qcocoafiledialoghelper.h" #include "qcocoafontdialoghelper.h" #include "qcocoasystemsettings.h" #include "qcocoasystemtrayicon.h" @@ -63,6 +62,13 @@ #include #include +#ifdef QT_WIDGETS_LIB +#include +#if QT_CONFIG(filedialog) +#include "qcocoafiledialoghelper.h" +#endif +#endif + #include @interface QT_MANGLE_NAMESPACE(QCocoaThemeNotificationReceiver) : NSObject { @@ -138,7 +144,7 @@ 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 -- cgit v1.2.3 From 6dd61b4e62d9b67a721bbf671b7ffd62c0a50809 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 22 Feb 2017 14:06:51 +0300 Subject: xcb: Replace XCB_USE_XINPUT define by QT_CONFIG macro .. and remove it from qxcbconnection_xi2.cpp as this file is build _only_ when xinput2 is available. Change-Id: I66d6a299c120fc034f8519cd188e1b845d5bd1bc Reviewed-by: Gatis Paeglis --- .../gl_integrations/gl_integrations_plugin_base.pri | 7 ------- src/plugins/platforms/xcb/qxcbconnection.cpp | 20 ++++++++++---------- src/plugins/platforms/xcb/qxcbconnection.h | 12 ++++++------ src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ------ src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ++-- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 3 +-- 6 files changed, 19 insertions(+), 33 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 063a74c395..e6e352a21d 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -5,13 +5,6 @@ INCLUDEPATH += $$PWD/../ load(qt_build_paths) -# needed by Xcursor ... -qtConfig(xcb-xlib) { - qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 - } -} - # build with session management support qtConfig(xcb-sm) { DEFINES += XCB_USE_SM diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 514ad6775d..cd170e3dbc 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -76,7 +76,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #endif @@ -116,7 +116,7 @@ Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") #define XCB_GE_GENERIC 35 #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // Starting from the xcb version 1.9.3 struct xcb_ge_event_t has changed: // - "pad0" became "extension" // - "pad1" and "pad" became "pad0" @@ -134,7 +134,7 @@ static inline bool isXIEvent(xcb_generic_event_t *event, int opCode) qt_xcb_ge_event_t *e = reinterpret_cast(event); return e->extension == opCode; } -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) #if QT_CONFIG(xcb_xlib) static const char * const xcbConnectionErrors[] = { @@ -604,7 +604,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra initializeScreens(); initializeXRender(); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) if (!qEnvironmentVariableIsSet("QT_XCB_NO_XI2")) initializeXInput2(); #endif @@ -664,7 +664,7 @@ QXcbConnection::~QXcbConnection() delete m_drag; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) finalizeXInput2(); #endif @@ -1201,7 +1201,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) } break; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) case XCB_GE_GENERIC: // Here the windowEventListener is invoked from xi2HandleEvent() if (m_xi2Enabled && isXIEvent(event, m_xiOpCode)) @@ -1573,7 +1573,7 @@ void *QXcbConnection::createVisualInfoForDefaultVisualId() const #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // it is safe to cast XI_* events here as long as we are only touching the first 32 bytes, // after that position event needs memmove, see xi2PrepareXIGenericDeviceEvent static inline bool isXIType(xcb_generic_event_t *event, int opCode, uint16_t type) @@ -1618,7 +1618,7 @@ bool QXcbConnection::compressEvent(xcb_generic_event_t *event, int currentIndex, } return false; } -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) // compress XI_* events if (responseType == XCB_GE_GENERIC) { if (!m_xi2Enabled) @@ -2232,7 +2232,7 @@ bool QXcbConnection::xi2MouseEvents() const } #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) static int xi2ValuatorOffset(const unsigned char *maskPtr, int maskLen, int number) { int offset = 0; @@ -2276,7 +2276,7 @@ void QXcbConnection::xi2PrepareXIGenericDeviceEvent(xcb_ge_event_t *event) // and allow casting, overwriting the full_sequence field. memmove((char*) event + 32, (char*) event + 36, event->length * 4); } -#endif // defined(XCB_USE_XINPUT2) +#endif // QT_CONFIG(xinput2) QXcbSystemTrayTracker *QXcbConnection::systemTrayTracker() const { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 40a54e0f1f..bba987983e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -68,7 +68,7 @@ #include #endif -#if XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #include #ifdef XIScrollClass #define XCB_USE_XINPUT21 // XI 2.1 adds smooth scrolling support @@ -77,7 +77,7 @@ #endif #endif struct XInput2TouchDeviceData; -#endif // XCB_USE_XINPUT2 +#endif // QT_CONFIG(xinput2) struct xcb_randr_get_output_info_reply_t; @@ -426,7 +426,7 @@ public: void *createVisualInfoForDefaultVisualId() const; #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) void xi2Select(xcb_window_t window); #endif #ifdef XCB_USE_XINPUT21 @@ -551,7 +551,7 @@ private: void destroyScreen(QXcbScreen *screen); void initializeScreens(); bool compressEvent(xcb_generic_event_t *event, int currentIndex, QXcbEventArray *eventqueue) const; -#ifdef XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) bool m_xi2Enabled = false; int m_xi2Minor = 2; void initializeXInput2(); @@ -636,7 +636,7 @@ private: void *m_xlib_display = nullptr; #endif QXcbEventReader *m_reader = nullptr; -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) QHash m_touchDevices; #ifdef XCB_USE_XINPUT22 struct StartSystemResizeInfo { @@ -694,7 +694,7 @@ private: friend class QXcbEventReader; }; -#ifdef XCB_USE_XINPUT2 +#if QT_CONFIG(xinput2) #if QT_CONFIG(tabletevent) Q_DECLARE_TYPEINFO(QXcbConnection::TabletData::ValuatorClassInfo, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QXcbConnection::TabletData, Q_MOVABLE_TYPE); diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 52873f0910..4d2a83b3cf 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -47,8 +47,6 @@ #include #include -#ifdef XCB_USE_XINPUT2 - #include #include @@ -698,10 +696,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo if (m_xiGrab) { // XIAllowTouchEvents deadlocks with libXi < 1.7.4 (this has nothing to do with the XI2 versions like 2.2) // http://lists.x.org/archives/xorg-devel/2014-July/043059.html -#ifdef XCB_USE_XINPUT2 XIAllowTouchEvents(static_cast(m_xlib_display), xiDeviceEvent->deviceid, xiDeviceEvent->detail, xiDeviceEvent->event, XIAcceptTouch); -#endif } break; case XI_TouchUpdate: @@ -1241,5 +1237,3 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id) } #endif // QT_CONFIG(tabletevent) - -#endif // XCB_USE_XINPUT2 diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 31757ca6f6..4acc827bf6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -104,7 +104,7 @@ #include #endif -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) #include #include #endif @@ -558,7 +558,7 @@ void QXcbWindow::create() 32, 2, (void *)data)); -#if defined(XCB_USE_XINPUT2) +#if QT_CONFIG(xinput2) connection()->xi2Select(m_window); #endif diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 6c9a3259b6..d0dc8f3075 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -48,12 +48,11 @@ HEADERS = \ load(qt_build_paths) DEFINES += QT_BUILD_XCB_PLUGIN -# needed by Xcursor ... + qtConfig(xcb-xlib) { QMAKE_USE += xcb_xlib qtConfig(xinput2) { - DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp QMAKE_USE += xinput2 } -- cgit v1.2.3 From 3ab0ba7bf2b27f73b38a6f60181426c05f1d3af0 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Wed, 31 May 2017 21:00:22 +0200 Subject: Convert features.colordialog to QT_[REQUIRE_]CONFIG Change-Id: If2ac57a10f38002db5a49be3882dfc507a84a3df Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/cocoa/cocoa.pro | 7 +++++-- src/plugins/platforms/cocoa/qcocoacolordialoghelper.h | 4 ++++ src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm | 4 ---- src/plugins/platforms/cocoa/qcocoatheme.mm | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 0f478a79f3..23a049bebc 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -20,7 +20,6 @@ OBJECTIVE_SOURCES += main.mm \ qmultitouch_mac.mm \ qcocoaaccessibilityelement.mm \ qcocoaaccessibility.mm \ - qcocoacolordialoghelper.mm \ qcocoafontdialoghelper.mm \ qcocoacursor.mm \ qcocoaclipboard.mm \ @@ -54,7 +53,6 @@ HEADERS += qcocoaintegration.h \ qmultitouch_mac_p.h \ qcocoaaccessibilityelement.h \ qcocoaaccessibility.h \ - qcocoacolordialoghelper.h \ qcocoafontdialoghelper.h \ qcocoacursor.h \ qcocoaclipboard.h \ @@ -101,6 +99,11 @@ qtHaveModule(widgets) { qcocoaprintersupport.h \ qcocoaprintdevice.h \ + qtConfig(colordialog) { + SOURCES += qcocoacolordialoghelper.mm + HEADERS += qcocoacolordialoghelper.h + } + qtConfig(filedialog) { SOURCES += qcocoafiledialoghelper.mm HEADERS += qcocoafiledialoghelper.h 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 + #include #include +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 #include #include @@ -424,5 +422,3 @@ QColor QCocoaColorDialogHelper::currentColor() const } QT_END_NAMESPACE - -#endif // QT_NO_COLORDIALOG diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index 53ccf68c0c..faa3df39a0 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -130,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 @@ -148,7 +148,7 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo case QPlatformTheme::FileDialog: return new QCocoaFileDialogHelper(); #endif -#ifndef QT_NO_COLORDIALOG +#if QT_CONFIG(colordialog) case QPlatformTheme::ColorDialog: return new QCocoaColorDialogHelper(); #endif -- cgit v1.2.3