summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qclipboard.h2
-rw-r--r--src/gui/kernel/qevent.cpp26
-rw-r--r--src/gui/kernel/qevent.h19
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp41
-rw-r--r--src/gui/kernel/qguiapplication_p.h3
-rw-r--r--src/gui/kernel/qguivariant.cpp8
-rw-r--r--src/gui/kernel/qkeysequence.cpp10
-rw-r--r--src/gui/kernel/qkeysequence.h3
-rw-r--r--src/gui/kernel/qopenglcontext.cpp9
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qplatformsharedgraphicscache_qpa.h2
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp6
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qscreen.h2
-rw-r--r--src/gui/kernel/qsurface.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.h2
-rw-r--r--src/gui/kernel/qwindow.cpp36
-rw-r--r--src/gui/kernel/qwindow.h4
-rw-r--r--src/gui/kernel/qwindow_p.h5
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp20
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h24
24 files changed, 117 insertions, 121 deletions
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 5a251dd0ef..5c88764d88 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -59,7 +59,7 @@ class Q_GUI_EXPORT QClipboard : public QObject
{
Q_OBJECT
private:
- QClipboard(QObject *parent);
+ explicit QClipboard(QObject *parent);
~QClipboard();
public:
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 436ed56ea0..fd674225ae 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -3627,7 +3627,7 @@ QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
*/
QTouchEvent::TouchPoint::~TouchPoint()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -3869,10 +3869,11 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
}
/*!
+ \since 5.0
Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
- \note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
+ \note Returns an empty vector if the touch device's capabilities do not include QTouchDevice::RawPositions.
\note Native screen coordinates refer to the native orientation of the screen which, in case of
mobile devices, is typically portrait. This means that on systems capable of screen orientation
@@ -3881,7 +3882,7 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
\sa QTouchDevice::capabilities(), device(), window()
*/
-QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
+QVector<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
{
return d->rawScreenPositions;
}
@@ -4039,7 +4040,7 @@ void QTouchEvent::TouchPoint::setVelocity(const QVector2D &v)
}
/*! \internal */
-void QTouchEvent::TouchPoint::setRawScreenPositions(const QList<QPointF> &positions)
+void QTouchEvent::TouchPoint::setRawScreenPositions(const QVector<QPointF> &positions)
{
if (d->ref.load() != 1)
d = d->detach();
@@ -4054,16 +4055,15 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
d->flags = flags;
}
-/*! \internal */
-QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
-{
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- return *this;
-}
+/*!
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
+ \internal
+ */
+/*!
+ \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
+ \internal
+*/
/*!
\class QScrollPrepareEvent
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index a042922f61..1642cd006b 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -713,9 +713,19 @@ public:
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
explicit TouchPoint(int id = -1);
- TouchPoint(const QTouchEvent::TouchPoint &other);
+ TouchPoint(const TouchPoint &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
+ TouchPoint &operator=(TouchPoint &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
~TouchPoint();
+ TouchPoint &operator=(const TouchPoint &other)
+ { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
+
+ void swap(TouchPoint &other) { qSwap(d, other.d); }
+
int id() const;
Qt::TouchPointState state() const;
@@ -743,7 +753,7 @@ public:
qreal pressure() const;
QVector2D velocity() const;
InfoFlags flags() const;
- QList<QPointF> rawScreenPositions() const;
+ QVector<QPointF> rawScreenPositions() const;
// internal
void setId(int id);
@@ -766,8 +776,7 @@ public:
void setPressure(qreal pressure);
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
- void setRawScreenPositions(const QList<QPointF> &positions);
- QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
+ void setRawScreenPositions(const QVector<QPointF> &positions);
private:
QTouchEventTouchPointPrivate *d;
@@ -819,7 +828,7 @@ protected:
friend class QApplication;
friend class QApplicationPrivate;
};
-
+Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
class QScrollPrepareEventPrivate;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 3f354c14e4..4c639f4eef 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -107,7 +107,7 @@ public:
qreal pressure;
QVector2D velocity;
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawScreenPositions;
+ QVector<QPointF> rawScreenPositions;
};
class QFileOpenEventPrivate
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index e12183869a..9b0973afb2 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -143,7 +143,6 @@ QFont *QGuiApplicationPrivate::app_font = 0;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
extern void qRegisterGuiVariant();
-extern void qUnregisterGuiVariant();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
@@ -358,8 +357,6 @@ QGuiApplication::~QGuiApplication()
clearPalette();
- qUnregisterGuiVariant();
-
#ifndef QT_NO_CURSOR
d->cursor_list.clear();
#endif
@@ -977,12 +974,6 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
QGuiApplicationPrivate::processThemeChanged(
static_cast<QWindowSystemInterfacePrivate::ThemeChangeEvent *>(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;
@@ -1602,30 +1593,28 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
}
-void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e)
+void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
{
- if (!e->mapped)
+ if (!e->exposed)
return;
- QEvent event(QEvent::Map);
- QCoreApplication::sendSpontaneousEvent(e->mapped.data(), &event);
-}
+ QWindow *window = e->exposed.data();
+ QWindowPrivate *p = qt_window_private(window);
-void QGuiApplicationPrivate::processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e)
-{
- if (!e->unmapped)
- return;
+ if (!p->receivedExpose) {
+ if (p->resizeEventPending) {
+ // as a convenience for plugins, send a resize event before the first expose event if they haven't done so
+ QSize size = p->geometry.size();
+ QResizeEvent e(size, size);
+ QGuiApplication::sendSpontaneousEvent(window, &e);
- QEvent event(QEvent::Unmap);
- QCoreApplication::sendSpontaneousEvent(e->unmapped.data(), &event);
-}
+ p->resizeEventPending = false;
+ }
-void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
-{
- if (!e->exposed)
- return;
+ p->receivedExpose = true;
+ }
- QWindow *window = e->exposed.data();
+ p->exposed = e->isExposed;
QExposeEvent exposeEvent(e->region);
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index f30a2bb5a0..6792e9382c 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -118,9 +118,6 @@ public:
static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce);
- static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e);
- static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e);
-
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 50d3f0b7d1..531afeef2d 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -389,12 +389,4 @@ void qRegisterGuiVariant()
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
-void qUnregisterGuiVariant()
-{
- QVariantPrivate::unregisterHandler(QModulesPrivate::Gui);
- qMetaTypeGuiHelper = 0;
-}
-Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
-
-
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 153b2b5c2d..b0200335d7 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -934,16 +934,6 @@ QKeySequence::QKeySequence()
Note the "File|Open" translator comment. It is by no means
necessary, but it provides some context for the human translator.
*/
-QKeySequence::QKeySequence(const QString &key)
-{
- d = new QKeySequencePrivate();
- assign(key);
-}
-
-/*!
- \since 4.7
- Creates a key sequence from the \a key string based on \a format.
-*/
QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
{
d = new QKeySequencePrivate();
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index d1e7d06653..e8dd134bc3 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -146,8 +146,7 @@ public:
};
QKeySequence();
- QKeySequence(const QString &key);
- QKeySequence(const QString &key, SequenceFormat format);
+ QKeySequence(const QString &key, SequenceFormat format = NativeText);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index eaff417f15..29f46aefd6 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -49,6 +49,7 @@
#include <QtCore/QThread>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qwindow_p.h>
#include <QtGui/QScreen>
#include <private/qopenglextensions_p.h>
@@ -502,7 +503,13 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
if (surface->surfaceType() != QSurface::OpenGLSurface) {
qWarning() << "QOpenGLContext::swapBuffers() called with non-opengl surface";
return;
- }
+ }
+
+ if (surface->surfaceClass() == QSurface::Window
+ && !qt_window_private(static_cast<QWindow *>(surface))->receivedExpose)
+ {
+ qWarning() << "QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined";
+ }
QPlatformSurface *surfaceHandle = surface->surfaceHandle();
if (!surfaceHandle)
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 52f94a8a10..5e1cd17635 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -94,7 +94,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QOpenGLContext)
public:
- QOpenGLContext(QObject *parent = 0);
+ explicit QOpenGLContext(QObject *parent = 0);
~QOpenGLContext();
void setFormat(const QSurfaceFormat &format);
diff --git a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
index d59cd7c3c8..f8ee201d85 100644
--- a/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
+++ b/src/gui/kernel/qplatformsharedgraphicscache_qpa.h
@@ -65,7 +65,7 @@ public:
OpenGLTexture
};
- QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
+ explicit QPlatformSharedGraphicsCache(QObject *parent = 0) : QObject(parent) {}
Q_INVOKABLE virtual void ensureCacheInitialized(const QByteArray &cacheId, BufferType bufferType,
PixelFormat pixelFormat) = 0;
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 76d5c5465c..80ee99c899 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -60,7 +60,7 @@ public:
QSurface::SurfaceClass surfaceClass() const;
private:
- QPlatformSurface(QSurface::SurfaceClass type);
+ explicit QPlatformSurface(QSurface::SurfaceClass type);
QSurface::SurfaceClass m_type;
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index e12228d7bd..c8e2776366 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -142,11 +142,13 @@ QMargins QPlatformWindow::frameMargins() const
/*!
Reimplemented in subclasses to show the surface
if \a visible is \c true, and hide it if \a visible is \c false.
+
+ The default implementation sends a synchronous expose event.
*/
void QPlatformWindow::setVisible(bool visible)
{
- Q_UNUSED(visible);
- QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size()));
+ QRect rect(QPoint(), geometry().size());
+ QWindowSystemInterface::handleSynchronousExposeEvent(window(), rect);
}
/*!
Requests setting the window flags of this surface
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index 170f62162f..a72de7b547 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -63,7 +63,7 @@ class Q_GUI_EXPORT QPlatformWindow : public QPlatformSurface
{
Q_DECLARE_PRIVATE(QPlatformWindow)
public:
- QPlatformWindow(QWindow *window);
+ explicit QPlatformWindow(QWindow *window);
virtual ~QPlatformWindow();
QWindow *window() const;
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 111e10d340..3bd24db3ce 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -142,7 +142,7 @@ Q_SIGNALS:
void orientationChanged(Qt::ScreenOrientation orientation);
private:
- QScreen(QPlatformScreen *screen);
+ explicit QScreen(QPlatformScreen *screen);
Q_DISABLE_COPY(QScreen)
friend class QGuiApplicationPrivate;
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index a8900fde33..befb771129 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -80,7 +80,7 @@ public:
virtual QSize size() const = 0;
protected:
- QSurface(SurfaceClass type);
+ explicit QSurface(SurfaceClass type);
SurfaceClass m_type;
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index 6daa08095e..a4224bbedd 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -75,7 +75,7 @@ public:
};
QSurfaceFormat();
- QSurfaceFormat(FormatOptions options);
+ /*implicit*/ QSurfaceFormat(FormatOptions options);
QSurfaceFormat(const QSurfaceFormat &other);
QSurfaceFormat &operator=(const QSurfaceFormat &other);
~QSurfaceFormat();
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 18fd72cfa2..d72cc991d7 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -108,6 +108,18 @@ QT_BEGIN_NAMESPACE
called whenever the windows exposure in the windowing system changes. On
windowing systems that do not make this information visible to the
application, isExposed() will simply return the same value as isVisible().
+
+ \section1 Rendering
+
+ There are two Qt APIs that can be used to render content into a window,
+ QBackingStore for rendering with a QPainter and flushing the contents
+ to a window with type QSurface::RasterSurface, and QOpenGLContext for
+ rendering with OpenGL to a window with type QSurface::OpenGLSurface.
+
+ The application can start rendering as soon as isExposed() returns true,
+ and can keep rendering until it isExposed() returns false. To find out when
+ isExposed() changes, reimplement exposeEvent(). The window will always get
+ a resize event before the first expose event.
*/
/*!
@@ -576,9 +588,7 @@ void QWindow::requestActivateWindow()
bool QWindow::isExposed() const
{
Q_D(const QWindow);
- if (d->platformWindow)
- return d->platformWindow->isExposed();
- return false;
+ return d->exposed;
}
/*!
@@ -1070,6 +1080,9 @@ void QWindow::destroy()
}
setVisible(false);
delete d->platformWindow;
+ d->resizeEventPending = true;
+ d->receivedExpose = false;
+ d->exposed = false;
d->platformWindow = 0;
}
@@ -1329,12 +1342,19 @@ bool QWindow::close()
The expose event is sent by the window system whenever the window's
exposure on screen changes.
+ The application can start rendering into the window with QBackingStore
+ and QOpenGLContext as soon as it gets an exposeEvent() such that
+ isExposed() is true.
+
If the window is moved off screen, is made totally obscured by another
window, iconified or similar, this function might be called and the
value of isExposed() might change to false. When this happens,
an application should stop its rendering as it is no longer visible
to the user.
+ A resize event will always be sent before the expose event the first time
+ a window is shown.
+
\sa isExposed()
*/
void QWindow::exposeEvent(QExposeEvent *ev)
@@ -1365,7 +1385,10 @@ void QWindow::resizeEvent(QResizeEvent *ev)
/*!
Override this to handle show events.
- The show event is called when the window becomes visible in the windowing system.
+ The show event is called when the window has requested becoming visible.
+
+ If the window is successfully shown by the windowing system, this will
+ be followed by a resize and an expose event.
*/
void QWindow::showEvent(QShowEvent *ev)
{
@@ -1373,9 +1396,10 @@ void QWindow::showEvent(QShowEvent *ev)
}
/*!
- Override this to handle show events.
+ Override this to handle hide evens.
- The show event is called when the window becomes hidden in the windowing system.
+ The hide event is called when the window has requested being hidden in the
+ windowing system.
*/
void QWindow::hideEvent(QHideEvent *ev)
{
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 1461f12520..62ddb66a75 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -94,8 +94,8 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
public:
- QWindow(QScreen *screen = 0);
- QWindow(QWindow *parent);
+ explicit QWindow(QScreen *screen = 0);
+ explicit QWindow(QWindow *parent);
virtual ~QWindow();
void setSurfaceType(SurfaceType surfaceType);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 7f3958b3ff..03b3b92a25 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -72,8 +72,10 @@ public:
, parentWindow(0)
, platformWindow(0)
, visible(false)
+ , exposed(false)
, windowState(Qt::WindowNoState)
, resizeEventPending(true)
+ , receivedExpose(false)
, positionPolicy(WindowFrameExclusive)
, contentOrientation(Qt::PrimaryOrientation)
, windowOrientation(Qt::PrimaryOrientation)
@@ -99,17 +101,18 @@ public:
return offset;
}
-
QWindow::SurfaceType surfaceType;
Qt::WindowFlags windowFlags;
QWindow *parentWindow;
QPlatformWindow *platformWindow;
bool visible;
+ bool exposed;
QSurfaceFormat requestedFormat;
QString windowTitle;
QRect geometry;
Qt::WindowState windowState;
bool resizeEventPending;
+ bool receivedExpose;
PositionPolicy positionPolicy;
Qt::ScreenOrientation contentOrientation;
Qt::ScreenOrientation windowOrientation;
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 1953ce47bb..bcbf96b2c0 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
#include "qwindowsysteminterface_qpa.h"
+#include "qplatformwindow_qpa.h"
#include "qwindowsysteminterface_qpa_p.h"
#include "private/qguiapplication_p.h"
#include "private/qevent_p.h"
@@ -274,6 +275,15 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, con
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
+
+QWindowSystemInterfacePrivate::ExposeEvent::ExposeEvent(QWindow *exposed, const QRegion &region)
+ : WindowSystemEvent(Expose)
+ , exposed(exposed)
+ , isExposed(exposed && exposed->handle() ? exposed->handle()->isExposed() : false)
+ , region(region)
+{
+}
+
int QWindowSystemInterfacePrivate::windowSystemEventsQueued()
{
queueMutex.lock();
@@ -426,15 +436,9 @@ void QWindowSystemInterface::handleThemeChange(QWindow *tlw)
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleMapEvent(QWindow *tlw)
-{
- QWindowSystemInterfacePrivate::MapEvent *e = new QWindowSystemInterfacePrivate::MapEvent(tlw);
- QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
-}
-
-void QWindowSystemInterface::handleUnmapEvent(QWindow *tlw)
+void QWindowSystemInterface::handleExposeEvent(QWindow *tlw, const QRegion &region)
{
- QWindowSystemInterfacePrivate::UnmapEvent *e = new QWindowSystemInterfacePrivate::UnmapEvent(tlw);
+ QWindowSystemInterfacePrivate::ExposeEvent *e = new QWindowSystemInterfacePrivate::ExposeEvent(tlw, region);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 4cdd33b49f..1fbf430bf9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -110,7 +110,7 @@ public:
Qt::TouchPointState state; //Qt::TouchPoint{Pressed|Moved|Stationary|Released}
QVector2D velocity; // in screen coordinate system, pixels / seconds
QTouchEvent::TouchPoint::InfoFlags flags;
- QList<QPointF> rawPositions; // in screen coordinates
+ QVector<QPointF> rawPositions; // in screen coordinates
};
static void registerTouchDevice(QTouchDevice *device);
@@ -130,9 +130,7 @@ public:
static void handleWindowActivated(QWindow *w);
static void handleWindowStateChanged(QWindow *w, Qt::WindowState newState);
- static void handleMapEvent(QWindow *w);
- static void handleUnmapEvent(QWindow *w);
-
+ static void handleExposeEvent(QWindow *tlw, const QRegion &region);
static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion &region);
// Drag and drop. These events are sent immediately.
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index fe97b486ad..d7be7699e9 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -42,6 +42,7 @@
#define QWINDOWSYSTEMINTERFACE_QPA_P_H
#include "qwindowsysteminterface_qpa.h"
+
#include <QElapsedTimer>
QT_BEGIN_HEADER
@@ -66,8 +67,6 @@ public:
ScreenAvailableGeometry,
ScreenLogicalDotsPerInch,
ThemeChange,
- Map,
- Unmap,
Expose
};
@@ -241,28 +240,11 @@ public:
QWeakPointer<QWindow> window;
};
- 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)
- { }
+ ExposeEvent(QWindow *exposed, const QRegion &region);
QWeakPointer<QWindow> exposed;
+ bool isExposed;
QRegion region;
};