diff options
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_qpa.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_qpa_p.h | 11 |
5 files changed, 37 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 400d1ef..1955c5b 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -499,6 +499,7 @@ public: static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e); static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e); + static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e); // static void reportScreenCount(int count); static void reportScreenCount(QWindowSystemInterfacePrivate::ScreenCountEvent *e); diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 0010ee2..e065a8a 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -118,6 +118,9 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate case QWindowSystemInterfacePrivate::ActivatedWindow: QApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e)); break; + case QWindowSystemInterfacePrivate::WindowStateChanged: + QApplicationPrivate::processWindowStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowStateChangedEvent *>(e)); + break; case QWindowSystemInterfacePrivate::Close: QApplicationPrivate::processCloseEvent( static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e)); @@ -147,6 +150,20 @@ void QApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate } } +void QApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse) +{ + if (wse->tlw.isNull()) + return; + + QWidget *tlw = wse->tlw.data(); + if (!tlw->isWindow()) + return; + + QWindowStateChangeEvent e(tlw->windowState()); + tlw->setWindowState(wse->newState); + QApplication::sendSpontaneousEvent(tlw, &e); +} + QString QApplicationPrivate::appName() const { return QT_PREPEND_NAMESPACE(appName); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index 0a3a3f6..53f0a59 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -89,6 +89,13 @@ void QWindowSystemInterface::handleWindowActivated(QWidget *tlw) QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleWindowStateChanged(QWidget *tlw, Qt::WindowState newState) +{ + QWindowSystemInterfacePrivate::WindowStateChangedEvent *e = + new QWindowSystemInterfacePrivate::WindowStateChangedEvent(tlw, newState); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleGeometryChange(QWidget *tlw, const QRect &newRect) { if (tlw) { diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 64439a4..c211c46 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -95,6 +95,7 @@ public: static void handleEnterEvent(QWidget *w); static void handleLeaveEvent(QWidget *w); static void handleWindowActivated(QWidget *w); + static void handleWindowStateChanged(QWidget *w, Qt::WindowState newState); // Changes to the screen static void handleScreenGeometryChange(int screenIndex); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 32aa9b0..9cc82ff 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -55,6 +55,7 @@ public: Enter, Leave, ActivatedWindow, + WindowStateChanged, Mouse, Wheel, Key, @@ -114,6 +115,16 @@ public: QWeakPointer<QWidget> activated; }; + class WindowStateChangedEvent : public WindowSystemEvent { + public: + WindowStateChangedEvent(QWidget *_tlw, Qt::WindowState _newState) + : WindowSystemEvent(WindowStateChanged), tlw(_tlw), newState(_newState) + { } + + QWeakPointer<QWidget> tlw; + Qt::WindowState newState; + }; + class UserEvent : public WindowSystemEvent { public: UserEvent(QWidget * w, ulong time, EventType t) |