diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 47 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 12 |
2 files changed, 32 insertions, 27 deletions
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index b799f75090..5dd525f315 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -165,11 +165,11 @@ void QWindowSystemInterface::handleEnterLeaveEvent(QWindow *enter, QWindow *leav handleEnterEvent(enter, local, global); } -void QWindowSystemInterface::handleWindowActivated(QWindow *tlw, Qt::FocusReason r) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowActivated, QWindow *tlw, Qt::FocusReason r) { QWindowSystemInterfacePrivate::ActivatedWindowEvent *e = new QWindowSystemInterfacePrivate::ActivatedWindowEvent(tlw, r); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState) @@ -197,10 +197,25 @@ void QWindowSystemInterface::handleApplicationStateChanged(Qt::ApplicationState /*! If \a oldRect is null, Qt will use the previously reported geometry instead. */ -void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect, const QRect &oldRect) +QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *tlw, const QRect &newRect, const QRect &oldRect) { QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw, QHighDpi::fromNativePixels(newRect, tlw), QHighDpi::fromNativePixels(oldRect, tlw)); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); +} + +QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion ®ion) + : WindowSystemEvent(Expose) + , window(window) + , isExposed(window && window->handle() ? window->handle()->isExposed() : false) + , region(region) +{ +} + +QT_DEFINE_QPA_EVENT_HANDLER(void, handleExposeEvent, QWindow *tlw, const QRegion ®ion) +{ + QWindowSystemInterfacePrivate::ExposeEvent *e = + new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw)); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } void QWindowSystemInterface::handleCloseEvent(QWindow *tlw, bool *accepted) @@ -405,15 +420,6 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } - -QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *window, const QRegion ®ion) - : WindowSystemEvent(Expose) - , window(window) - , isExposed(window && window->handle() ? window->handle()->isExposed() : false) - , region(region) -{ -} - int QWindowSystemInterfacePrivate::windowSystemEventsQueued() { return windowSystemEventQueue.count(); @@ -596,20 +602,20 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchEvent, QWindow *tlw, ulong timestam QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } -void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, QTouchDevice *device, +QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); - handleTouchCancelEvent(w, time, device, mods); + handleTouchCancelEvent<Delivery>(w, time, device, mods); } -void QWindowSystemInterface::handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, +QT_DEFINE_QPA_EVENT_HANDLER(void, handleTouchCancelEvent, QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods) { QWindowSystemInterfacePrivate::TouchEvent *e = new QWindowSystemInterfacePrivate::TouchEvent(w, timestamp, QEvent::TouchCancel, device, QList<QTouchEvent::TouchPoint>(), mods); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); + QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e); } void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation) @@ -646,13 +652,6 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw) QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); } -void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion ®ion) -{ - QWindowSystemInterfacePrivate::ExposeEvent *e = - new QWindowSystemInterfacePrivate::ExposeEvent(tlw, QHighDpi::fromNativeLocalExposedRegion(region, tlw)); - QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); -} - void QWindowSystemInterface::deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags) { Q_ASSERT(QThread::currentThread() == QGuiApplication::instance()->thread()); diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 6fade3cc4c..3be3c3188c 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -150,11 +150,19 @@ public: template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device, const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier); + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleTouchCancelEvent(QWindow *w, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier); // rect is relative to parent + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleGeometryChange(QWindow *w, const QRect &newRect, const QRect &oldRect = QRect()); + + // region is in local coordinates, do not confuse with geometry which is parent-relative + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> + static void handleExposeEvent(QWindow *tlw, const QRegion ®ion); + static void handleCloseEvent(QWindow *w, bool *accepted = Q_NULLPTR); template<typename Delivery = QWindowSystemInterface::DefaultDelivery> @@ -162,6 +170,7 @@ public: template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleLeaveEvent(QWindow *w); static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local = QPointF(), const QPointF& global = QPointF()); + template<typename Delivery = QWindowSystemInterface::DefaultDelivery> static void handleWindowActivated(QWindow *w, Qt::FocusReason r = Qt::OtherFocusReason); static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState); @@ -169,9 +178,6 @@ public: static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false); - // region is in local coordinates, do not confuse with geometry which is parent-relative - static void handleExposeEvent(QWindow *tlw, const QRegion ®ion); - #ifndef QT_NO_DRAGANDDROP // Drag and drop. These events are sent immediately. static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); |