summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp15
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qwindow.cpp32
-rw-r--r--src/gui/kernel/qwindow.h2
4 files changed, 51 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index c52a1cf757..f3f0a55862 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -142,6 +142,7 @@ QMargins QPlatformWindow::frameMargins() const
void QPlatformWindow::setVisible(bool visible)
{
Q_UNUSED(visible);
+ QWindowSystemInterface::handleSynchronousExposeEvent(window(), QRect(QPoint(), geometry().size()));
}
/*!
Requests setting the window flags of this surface
@@ -152,6 +153,20 @@ Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags)
return flags;
}
+
+
+/*!
+ Returns if this window is exposed in the windowing system.
+
+ An exposeEvent() is sent every time this value changes.
+ */
+
+bool QPlatformWindow::isExposed() const
+{
+ Q_D(const QPlatformWindow);
+ return d->window->visible();
+}
+
/*!
Requests setting the window state of this surface
to \a type. Returns the actual state set.
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index 88bf633425..170f62162f 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -89,6 +89,8 @@ public:
virtual void raise();
virtual void lower();
+ virtual bool isExposed() const;
+
virtual void propagateSizeHints();
virtual void setOpacity(qreal level);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 96fb394643..5b6ee0e9cb 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -374,6 +374,25 @@ void QWindow::requestActivateWindow()
d->platformWindow->requestActivateWindow();
}
+
+/*!
+ Returns if this window is exposed in the windowing system.
+
+ When the window is not exposed, it is shown by the application
+ but it is still not showing in the windowing system, so the application
+ should minimize rendering and other graphical activities.
+
+ An exposeEvent() is sent every time this value changes.
+ */
+
+bool QWindow::isExposed() const
+{
+ Q_D(const QWindow);
+ if (d->platformWindow)
+ return d->platformWindow->isExposed();
+ return false;
+}
+
/*!
Returns true if the window should appear active from a style perspective.
@@ -888,6 +907,19 @@ bool QWindow::close()
return true;
}
+
+
+/*!
+ The expose event is sent by the window system whenever the window's
+ exposure on screen changes.
+
+ 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.
+ */
+
void QWindow::exposeEvent(QExposeEvent *ev)
{
ev->ignore();
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 061426befb..1461f12520 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -152,6 +152,8 @@ public:
bool isAncestorOf(const QWindow *child, AncestorMode mode = IncludeTransients) const;
+ bool isExposed() const;
+
QSize minimumSize() const;
QSize maximumSize() const;
QSize baseSize() const;