Not currently considering activation state.
Change-Id: Iea9265d35536947b6cc85639bd9839e9fda69bdf
Reviewed-on: http://codereview.qt.nokia.com/2609
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
case QWindowSystemInterfacePrivate::ActivatedWindow:
QGuiApplicationPrivate::processActivatedEvent(static_cast<QWindowSystemInterfacePrivate::ActivatedWindowEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::WindowStateChanged:
+ QGuiApplicationPrivate::processWindowStateChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowStateChangedEvent *>(e));
+ break;
case QWindowSystemInterfacePrivate::Close:
QGuiApplicationPrivate::processCloseEvent(
static_cast<QWindowSystemInterfacePrivate::CloseEvent *>(e));
self->notifyActiveWindowChange(previous);
}
+void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
+{
+ if (QWindow *window = wse->window.data()) {
+ QWindowStateChangeEvent e(window->windowState());
+ window->d_func()->windowState = wse->newState;
+ QGuiApplication::sendSpontaneousEvent(window, &e);
+ }
+}
+
void QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
{
if (e->tlw.isNull())
static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e);
static void processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e);
+ static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+void QWindowSystemInterface::handleWindowStateChanged(QWindow *tlw, Qt::WindowState newState)
+{
+ QWindowSystemInterfacePrivate::WindowStateChangedEvent *e =
+ new QWindowSystemInterfacePrivate::WindowStateChangedEvent(tlw, newState);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &newRect)
{
QWindowSystemInterfacePrivate::GeometryChangeEvent *e = new QWindowSystemInterfacePrivate::GeometryChangeEvent(tlw,newRect);
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 handleMapEvent(QWindow *w);
static void handleUnmapEvent(QWindow *w);
Enter,
Leave,
ActivatedWindow,
+ WindowStateChanged,
Mouse,
Wheel,
Key,
class WindowSystemEvent {
public:
- WindowSystemEvent(EventType t)
+ explicit WindowSystemEvent(EventType t)
: type(t) { }
EventType type;
};
class CloseEvent : public WindowSystemEvent {
public:
- CloseEvent(QWindow *w)
+ explicit CloseEvent(QWindow *w)
: WindowSystemEvent(Close), window(w) { }
QWeakPointer<QWindow> window;
};
class EnterEvent : public WindowSystemEvent {
public:
- EnterEvent(QWindow *enter)
+ explicit EnterEvent(QWindow *enter)
: WindowSystemEvent(Enter), enter(enter)
{ }
QWeakPointer<QWindow> enter;
class LeaveEvent : public WindowSystemEvent {
public:
- LeaveEvent(QWindow *leave)
+ explicit LeaveEvent(QWindow *leave)
: WindowSystemEvent(Leave), leave(leave)
{ }
QWeakPointer<QWindow> leave;
class ActivatedWindowEvent : public WindowSystemEvent {
public:
- ActivatedWindowEvent(QWindow *activatedWindow)
+ explicit ActivatedWindowEvent(QWindow *activatedWindow)
: WindowSystemEvent(ActivatedWindow), activated(activatedWindow)
{ }
QWeakPointer<QWindow> activated;
};
+ class WindowStateChangedEvent : public WindowSystemEvent {
+ public:
+ WindowStateChangedEvent(QWindow *_window, Qt::WindowState _newState)
+ : WindowSystemEvent(WindowStateChanged), window(_window), newState(_newState)
+ { }
+
+ QWeakPointer<QWindow> window;
+ Qt::WindowState newState;
+ };
+
class UserEvent : public WindowSystemEvent {
public:
UserEvent(QWindow * w, ulong time, EventType t)
handleExposeEvent(static_cast<QExposeEvent *>(event));
return true;
+ case QEvent::WindowStateChange:
+ handleWindowStateChangedEvent(static_cast<QWindowStateChangeEvent *>(event));
+ return true;
+
default:
break;
}
m_widget->d_func()->syncBackingStore(event->region());
}
+void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event)
+{
+ // QWindow does currently not know 'active'.
+ Qt::WindowStates eventState = event->oldState();
+ if (m_widget->windowState() & Qt::WindowActive)
+ eventState |= Qt::WindowActive;
+ QWindowStateChangeEvent widgetEvent(eventState);
+ QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent);
+}
+
QT_END_NAMESPACE
void handleWheelEvent(QWheelEvent *);
void handleDragEvent(QEvent *);
void handleExposeEvent(QExposeEvent *);
+ void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
private:
void updateGeometry();