diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 107 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 12 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_p.h | 3 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 9 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 11 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfscursor.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/qnx/qqnxwindow.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 16 |
9 files changed, 83 insertions, 84 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index cdf5c6135a..755fd8a652 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -139,7 +139,8 @@ void QPlatformWindow::setVisible(bool visible) { Q_UNUSED(visible); QRect rect(QPoint(), geometry().size()); - QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect); + QWindowSystemInterface::handleExposeEvent(window(), rect); + QWindowSystemInterface::flushWindowSystemEvents(); } /*! Requests setting the window flags of this surface diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 5ae55d6307..d05dc8cbdc 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE QElapsedTimer QWindowSystemInterfacePrivate::eventTime; +bool QWindowSystemInterfacePrivate::synchronousWindowsSystemEvents = false; //------------------------------------------------------------ // @@ -78,39 +79,33 @@ void QWindowSystemInterface::handleEnterEvent(QWindow *tlw) { if (tlw) { QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(tlw); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } } void QWindowSystemInterface::handleLeaveEvent(QWindow *tlw) { QWindowSystemInterfacePrivate::LeaveEvent *e = new QWindowSystemInterfacePrivate::LeaveEvent(tlw); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleWindowActivated(QWindow *tlw) { QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState) { QWindowSystemInterfacePrivate::WindowStateChangedEvent *e = new QWindowSystemInterfacePrivate::WindowStateChangedEvent(tlw, newState); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect) { QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); -} - -void QWindowSystemInterface::handleSynchronousGeometryChange(QWindow *tlw, const QRect &newRect) -{ - handleGeometryChange(tlw, newRect); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleCloseEvent(QWindow *tlw) @@ -118,15 +113,7 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *tlw) if (tlw) { QWindowSystemInterfacePrivate::CloseEvent *e = new QWindowSystemInterfacePrivate::CloseEvent(tlw); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); - } -} - -void QWindowSystemInterface::handleSynchronousCloseEvent(QWindow *tlw) -{ - if (tlw) { - handleCloseEvent(tlw); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } } @@ -145,7 +132,7 @@ void QWindowSystemInterface::handleMouseEvent(QWindow *w, ulong timestamp, const { QWindowSystemInterfacePrivate::MouseEvent * e = new QWindowSystemInterfacePrivate::MouseEvent(w, timestamp, local, global, b, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods) @@ -160,17 +147,17 @@ void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *w, ulong timest new QWindowSystemInterfacePrivate::MouseEvent(w, timestamp, QWindowSystemInterfacePrivate::FrameStrutMouse, local, global, b, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -bool QWindowSystemInterface::tryHandleSynchronousShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, +bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed(); - return tryHandleSynchronousShortcutEvent(w, timestamp, k, mods, text, autorep, count); + return tryHandleShortcutEvent(w, timestamp, k, mods, text, autorep, count); } -bool QWindowSystemInterface::tryHandleSynchronousShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, +bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) { #ifndef QT_NO_SHORTCUT @@ -191,15 +178,15 @@ bool QWindowSystemInterface::tryHandleSynchronousShortcutEvent(QWindow *w, ulong #endif } -bool QWindowSystemInterface::tryHandleSynchronousExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, +bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorep, ushort count) { unsigned long timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed(); - return tryHandleSynchronousExtendedShortcutEvent(w, timestamp, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + return tryHandleExtendedShortcutEvent(w, timestamp, k, mods, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); } -bool QWindowSystemInterface::tryHandleSynchronousExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, +bool QWindowSystemInterface::tryHandleExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorep, ushort count) { @@ -234,7 +221,7 @@ void QWindowSystemInterface::handleKeyEvent(QWindow *tlw, ulong timestamp, QEven { QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, t, k, mods, text, autorep, count); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, @@ -258,7 +245,7 @@ void QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestam QWindowSystemInterfacePrivate::KeyEvent * e = new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods) { @@ -295,14 +282,14 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con // Simple case: vertical deltas only: if (angleDelta.y() != 0 && angleDelta.x() == 0) { e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return; } // Simple case: horizontal deltas only: if (angleDelta.y() == 0 && angleDelta.x() != 0) { e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); return; } @@ -310,12 +297,12 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con // The first event contains the Qt 5 pixel and angle delta as points, // and in addition the Qt 4 compatibility vertical angle delta. e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); // The second event contains null pixel and angle points and the // Qt 4 compatibility horizontal angle delta. e = new QWindowSystemInterfacePrivate::WheelEvent(tlw, timestamp, local, global, QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } @@ -337,13 +324,16 @@ QWindowSystemInterfacePrivate::WindowSystemEvent * QWindowSystemInterfacePrivate return windowSystemEventQueue.takeFirstOrReturnNull(); } -void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev) +void QWindowSystemInterfacePrivate::handleWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *ev) { - windowSystemEventQueue.append(ev); - - QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher(); - if (dispatcher) - dispatcher->wakeUp(); + if (synchronousWindowsSystemEvents) { + QGuiApplicationPrivate::processWindowSystemEvent(ev); + } else { + windowSystemEventQueue.append(ev); + QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher(); + if (dispatcher) + dispatcher->wakeUp(); + } } void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device) @@ -414,7 +404,7 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTo QWindowSystemInterfacePrivate::TouchEvent *e = new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, QTouchDevice *device, @@ -430,60 +420,54 @@ void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, ulong timestamp, QWindowSystemInterfacePrivate::TouchEvent *e = new QWindowSystemInterfacePrivate::TouchEvent(w, timestamp, QEvent::TouchCancel, device, QList<QTouchEvent::TouchPoint>(), mods); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation) { QWindowSystemInterfacePrivate::ScreenOrientationEvent *e = new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry) { QWindowSystemInterfacePrivate::ScreenGeometryEvent *e = new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, geometry); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen, const QRect &availableGeometry) { QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e = new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen, availableGeometry); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY) { QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e = new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, dpiX, dpiY); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate) { QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e = new QWindowSystemInterfacePrivate::ScreenRefreshRateEvent(screen, newRefreshRate); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleThemeChange(QWindow *tlw) { QWindowSystemInterfacePrivate::ThemeChangeEvent *e = new QWindowSystemInterfacePrivate::ThemeChangeEvent(tlw); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion ®ion) { QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, region); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); -} - -void QWindowSystemInterface::handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion) -{ - QWindowSystemInterface::handleExposeEvent(tlw, region); - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::flushWindowSystemEvents() @@ -497,6 +481,11 @@ bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFla return sendWindowSystemEventsImplementation(flags); } +void QWindowSystemInterface::setSynchronousWindowsSystemEvents(bool enable) +{ + QWindowSystemInterfacePrivate::synchronousWindowsSystemEvents = enable; +} + bool QWindowSystemInterface::sendWindowSystemEventsImplementation(QEventLoop::ProcessEventsFlags flags) { int nevents = 0; @@ -565,7 +554,7 @@ void QWindowSystemInterface::handleTabletEvent(QWindow *w, ulong timestamp, bool QWindowSystemInterfacePrivate::TabletEvent *e = new QWindowSystemInterfacePrivate::TabletEvent(w, timestamp, down, local, global, device, pointerType, pressure, xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleTabletEvent(QWindow *w, bool down, const QPointF &local, const QPointF &global, @@ -582,7 +571,7 @@ void QWindowSystemInterface::handleTabletEnterProximityEvent(ulong timestamp, in { QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e = new QWindowSystemInterfacePrivate::TabletEnterProximityEvent(timestamp, device, pointerType, uid); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid) @@ -595,7 +584,7 @@ void QWindowSystemInterface::handleTabletLeaveProximityEvent(ulong timestamp, in { QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e = new QWindowSystemInterfacePrivate::TabletLeaveProximityEvent(timestamp, device, pointerType, uid); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } void QWindowSystemInterface::handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid) @@ -608,7 +597,7 @@ void QWindowSystemInterface::handlePlatformPanelEvent(QWindow *w) { QWindowSystemInterfacePrivate::PlatformPanelEvent *e = new QWindowSystemInterfacePrivate::PlatformPanelEvent(w); - QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier) { diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index fb856004b4..cf5d22edbd 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -80,15 +80,15 @@ public: static void handleFrameStrutMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleFrameStrutMouseEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier); - static bool tryHandleSynchronousShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, + static bool tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - static bool tryHandleSynchronousShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, + static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); - static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, + static bool tryHandleExtendedShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1); - static bool tryHandleSynchronousExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, + static bool tryHandleExtendedShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1); @@ -133,16 +133,13 @@ public: static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); static void handleGeometryChange(QWindow *w, const QRect &newRect); - static void handleSynchronousGeometryChange(QWindow *w, const QRect &newRect); static void handleCloseEvent(QWindow *w); - static void handleSynchronousCloseEvent(QWindow *w); static void handleEnterEvent(QWindow *w); static void handleLeaveEvent(QWindow *w); static void handleWindowActivated(QWindow *w); static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); static void handleExposeEvent(QWindow *tlw, const QRegion ®ion); - static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion ®ion); #ifndef QT_NO_DRAGANDDROP // Drag and drop. These events are sent immediately. @@ -180,6 +177,7 @@ public: // For event dispatcher implementations static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags); + static void setSynchronousWindowsSystemEvents(bool enable); static void flushWindowSystemEvents(); static int windowSystemEventsQueued(); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 87dbeb2a9c..e9d2fadc84 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -357,9 +357,10 @@ public: static int windowSystemEventsQueued(); static WindowSystemEvent * getWindowSystemEvent(); - static void queueWindowSystemEvent(WindowSystemEvent *ev); + static void handleWindowSystemEvent(WindowSystemEvent *ev); static QElapsedTimer eventTime; + static bool synchronousWindowsSystemEvents; static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type); }; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 6e105eea2b..26161b106e 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -270,7 +270,8 @@ void QCocoaWindow::setVisible(bool visible) } // Make sure the QWindow has a frame ready before we show the NSWindow. - QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size())); + QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + QWindowSystemInterface::flushWindowSystemEvents(); if (m_nsWindow) { // setWindowState might have been called while the window was hidden and @@ -536,7 +537,8 @@ void QCocoaWindow::windowWillMove() { // Close any open popups on window move if (m_activePopupWindow) { - QWindowSystemInterface::handleSynchronousCloseEvent(m_activePopupWindow); + QWindowSystemInterface::handleCloseEvent(m_activePopupWindow); + QWindowSystemInterface::flushWindowSystemEvents(); m_activePopupWindow = 0; } } @@ -558,7 +560,8 @@ void QCocoaWindow::windowDidResize() void QCocoaWindow::windowWillClose() { - QWindowSystemInterface::handleSynchronousCloseEvent(window()); + QWindowSystemInterface::handleCloseEvent(window()); + QWindowSystemInterface::flushWindowSystemEvents(); } bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index fe1b26a8c8..f23fd3045f 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -143,8 +143,10 @@ static QTouchDevice *touchDevice = 0; m_platformWindow->QPlatformWindow::setGeometry(geo); // Send a geometry change event to Qt, if it's ready to handle events - if (!m_platformWindow->m_inConstructor) - QWindowSystemInterface::handleSynchronousGeometryChange(m_window, geo); + if (!m_platformWindow->m_inConstructor) { + QWindowSystemInterface::handleGeometryChange(m_window, geo); + QWindowSystemInterface::flushWindowSystemEvents(); + } } - (void)windowNotification : (NSNotification *) windowNotification @@ -355,7 +357,8 @@ static QTouchDevice *touchDevice = 0; - (void)mouseDown:(NSEvent *)theEvent { if (m_platformWindow->m_activePopupWindow) { - QWindowSystemInterface::handleSynchronousCloseEvent(m_platformWindow->m_activePopupWindow); + QWindowSystemInterface::handleCloseEvent(m_platformWindow->m_activePopupWindow); + QWindowSystemInterface::flushWindowSystemEvents(); m_platformWindow->m_activePopupWindow = 0; } if ([self hasMarkedText]) { @@ -691,7 +694,7 @@ static QTouchDevice *touchDevice = 0; text = QCFString::toQString([nsevent characters]); if (m_composingText.isEmpty()) - m_sendKeyEvent = !QWindowSystemInterface::tryHandleSynchronousShortcutEvent(m_window, timestamp, keyCode, modifiers, text); + m_sendKeyEvent = !QWindowSystemInterface::tryHandleShortcutEvent(m_window, timestamp, keyCode, modifiers, text); QObject *fo = QGuiApplication::focusObject(); if (m_sendKeyEvent && fo) { diff --git a/src/plugins/platforms/eglfs/qeglfscursor.cpp b/src/plugins/platforms/eglfs/qeglfscursor.cpp index c07a018bbb..85bc8679f2 100644 --- a/src/plugins/platforms/eglfs/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/qeglfscursor.cpp @@ -224,7 +224,8 @@ bool QEglFSCursor::setCurrentCursor(QCursor *cursor) void QEglFSCursor::update(const QRegion &rgn) { - QWindowSystemInterface::handleSynchronousExposeEvent(m_screen->topLevelAt(m_cursor.pos), rgn); + QWindowSystemInterface::handleExposeEvent(m_screen->topLevelAt(m_cursor.pos), rgn); + QWindowSystemInterface::flushWindowSystemEvents(); } QRect QEglFSCursor::cursorRect() const diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index c7d17875fa..9dd8ad7a71 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -180,7 +180,8 @@ void QQnxWindow::setGeometry(const QRect &rect) } // Send a geometry change event to Qt (triggers resizeEvent() in QWindow/QWidget) - QWindowSystemInterface::handleSynchronousGeometryChange(window(), rect); + QWindowSystemInterface::handleGeometryChange(window(), rect); + QWindowSystemInterface::flushWindowSystemEvents(); // Now move all children. if (!oldGeometry.isEmpty()) { diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index eb9b364cb7..2335870ea7 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1071,10 +1071,9 @@ void QWindowsWindow::handleGeometryChange() return; m_data.geometry = geometry_sys(); QPlatformWindow::setGeometry(m_data.geometry); + QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry); if (testFlag(SynchronousGeometryChangeEvent)) - QWindowSystemInterface::handleSynchronousGeometryChange(window(), m_data.geometry); - else - QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry); + QWindowSystemInterface::flushWindowSystemEvents(); if (QWindowsContext::verboseEvents || QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << this << window() << m_data.geometry; @@ -1153,8 +1152,9 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, if (testFlag(OpenGLDoubleBuffered)) InvalidateRect(hwnd, 0, false); BeginPaint(hwnd, &ps); - QWindowSystemInterface::handleSynchronousExposeEvent(window(), - QRegion(qrectFromRECT(ps.rcPaint))); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(qrectFromRECT(ps.rcPaint))); + QWindowSystemInterface::flushWindowSystemEvents(); + EndPaint(hwnd, &ps); } else { BeginPaint(hwnd, &ps); @@ -1163,7 +1163,8 @@ bool QWindowsWindow::handleWmPaint(HWND hwnd, UINT message, if (QWindowsContext::verboseIntegration) qDebug() << __FUNCTION__ << this << window() << updateRect; - QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRegion(updateRect)); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(updateRect)); + QWindowSystemInterface::flushWindowSystemEvents(); EndPaint(hwnd, &ps); } return true; @@ -1324,7 +1325,8 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) SetWindowPos(m_data.hwnd, HWND_TOP, r.left(), r.top(), r.width(), r.height(), swpf); if (!wasSync) clearFlag(SynchronousGeometryChangeEvent); - QWindowSystemInterface::handleSynchronousGeometryChange(window(), r); + QWindowSystemInterface::handleGeometryChange(window(), r); + QWindowSystemInterface::flushWindowSystemEvents(); } else if (newState != Qt::WindowMinimized) { // Restore saved state. unsigned newStyle = m_savedStyle ? m_savedStyle : style(); |