summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-06-06 15:54:11 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-06-06 16:03:38 +0200
commit078e4ef6c72bdc759b83b5f430390cdcdf7f4e9e (patch)
treeed480e064dd35fe2f28e786ec066def5aaeb2c4e /src/gui
parent481067453ff5b58552ef06c82d5a65019a648907 (diff)
Made tst_QWidget::updateWhileMinimized() pass.
This requires adding a couple of window system interface events, namely Map, Unmap, and Expose. When a widget is minimized on X11 it is unmapped, and thus update requests should not be delivered. Instead the event will delivered when the widget is mapped, which causes an Expose event to be sent. The Unmap and Expose event thus need to be handled in QWidgetWindow, and Map is also added for the purpose of API symmetry (and for future needs).
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qevent_p.h12
-rw-r--r--src/gui/kernel/qguiapplication.cpp27
-rw-r--r--src/gui/kernel/qguiapplication_p.h5
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp18
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h5
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h30
7 files changed, 104 insertions, 1 deletions
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 731cfc97f2..a53b2c537a 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -167,6 +167,18 @@ public:
QScrollEvent::ScrollState state;
};
+class QExposeEvent : public QEvent
+{
+public:
+ inline QExposeEvent(const QRegion &rgn)
+ : QEvent(Expose)
+ , region(rgn)
+ {
+ }
+
+ QRegion region;
+};
+
QT_END_NAMESPACE
#endif // QEVENT_P_H
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index cce0882a1d..bc4d2e3905 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -455,6 +455,15 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::reportAvailableGeometryChange(
static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::Map:
+ QGuiApplicationPrivate::processMapEvent(static_cast<QWindowSystemInterfacePrivate::MapEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Unmap:
+ QGuiApplicationPrivate::processUnmapEvent(static_cast<QWindowSystemInterfacePrivate::UnmapEvent *>(e));
+ break;
+ case QWindowSystemInterfacePrivate::Expose:
+ QGuiApplicationPrivate::processExposeEvent(static_cast<QWindowSystemInterfacePrivate::ExposeEvent *>(e));
+ break;
default:
qWarning() << "Unknown user input event type:" << e->type;
break;
@@ -659,6 +668,24 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
return;
}
+void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e)
+{
+ QEvent event(QEvent::Map);
+ QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event);
+}
+
+void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e)
+{
+ QEvent event(QEvent::Unmap);
+ QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event);
+}
+
+void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
+{
+ QExposeEvent event(e->region);
+ QCoreApplication::sendSpontaneousEvent(e->exposed.data(), &event);
+}
+
#ifndef QT_NO_CLIPBOARD
QClipboard * QGuiApplication::clipboard()
{
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 2d0f16c2f4..c80212f8f9 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -119,6 +119,11 @@ public:
static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
+ static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e);
+ static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e);
+
+ static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
+
static inline Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
{
if (!(alignment & Qt::AlignHorizontal_Mask))
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index fca8aaca46..3d227f49ca 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -49,6 +49,8 @@
#include "qwindow_p.h"
#include "qguiapplication_p.h"
+#include <private/qevent_p.h>
+
#include <QtCore/QDebug>
QT_BEGIN_NAMESPACE
@@ -486,6 +488,7 @@ void QWindow::hideEvent(QHideEvent *)
bool QWindow::event(QEvent *event)
{
+ Q_D(QWindow);
switch (event->type()) {
case QEvent::MouseMove:
mouseMoveEvent(static_cast<QMouseEvent*>(event));
@@ -525,6 +528,11 @@ bool QWindow::event(QEvent *event)
destroy();
break;
+ case QEvent::Expose:
+ if (d->surface)
+ d->surface->flush(this, static_cast<QExposeEvent *>(event)->region, QPoint());
+ break;
+
default:
return QObject::event(event);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 6b59fb26a7..9df8b1af54 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -252,4 +252,22 @@ void QWindowSystemInterface::handleScreenCountChange(int count)
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+void QWindowSystemInterface::handleMapEvent(QWindow *tlw)
+{
+ QWindowSystemInterfacePrivate::MapEvent *e = new QWindowSystemInterfacePrivate::MapEvent(tlw);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleUnmapEvent(QWindow *tlw)
+{
+ QWindowSystemInterfacePrivate::UnmapEvent *e = new QWindowSystemInterfacePrivate::UnmapEvent(tlw);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
+void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion &region)
+{
+ QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, region);
+ QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 5ad4d7afb7..1188ca3439 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -96,6 +96,11 @@ public:
static void handleLeaveEvent(QWindow *w);
static void handleWindowActivated(QWindow *w);
+ static void handleMapEvent(QWindow *w);
+ static void handleUnmapEvent(QWindow *w);
+
+ static void handleExposeEvent(QWindow *w, const QRegion &region);
+
// Changes to the screen
static void handleScreenGeometryChange(int screenIndex);
static void handleScreenAvailableGeometryChange(int screenIndex);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 017d3b2bff..912ac877fb 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -61,7 +61,10 @@ public:
Touch,
ScreenGeometry,
ScreenAvailableGeometry,
- ScreenCountChange
+ ScreenCountChange,
+ Map,
+ Unmap,
+ Expose
};
class WindowSystemEvent {
@@ -192,6 +195,31 @@ public:
int index;
};
+ class MapEvent : public WindowSystemEvent {
+ public:
+ MapEvent(QWindow *mapped)
+ : WindowSystemEvent(Map), mapped(mapped)
+ { }
+ QWeakPointer<QWindow> mapped;
+ };
+
+ class UnmapEvent : public WindowSystemEvent {
+ public:
+ UnmapEvent(QWindow *unmapped)
+ : WindowSystemEvent(Unmap), unmapped(unmapped)
+ { }
+ QWeakPointer<QWindow> unmapped;
+ };
+
+ class ExposeEvent : public WindowSystemEvent {
+ public:
+ ExposeEvent(QWindow *exposed, const QRegion &region)
+ : WindowSystemEvent(Expose), exposed(exposed), region(region)
+ { }
+ QWeakPointer<QWindow> exposed;
+ QRegion region;
+ };
+
static QList<WindowSystemEvent *> windowSystemEventQueue;
static QMutex queueMutex;