summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-01-31 13:29:14 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-02-09 14:10:17 +0000
commita57f2128b15d363b88c063325eac1d36c2ff1578 (patch)
tree8cfd5c6ded2a9e4adc1766905114342addb94751 /src/plugins/platforms/windows/qwindowswindow.h
parentee8b61bcf56e03aae0f8e346e70330276e221843 (diff)
Add QPlatformWindow::isForeignWindow()
Simplifies code at call sites and allows for refactoring how to decide if a window is foreign or not at a later point. Change-Id: Icc51a83bac187f4975535366b53b4990832b6c82 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.h')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 22ba49b0a5..8179280bb3 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -385,15 +385,14 @@ QPoint QWindowsGeometryHint::mapFromGlobal(const QWindow *w, const QPoint &p)
inline QWindowsWindow *QWindowsWindow::windowsWindowOf(const QWindow *w)
{
- QWindowsWindow *result = Q_NULLPTR;
- if (w) {
- const Qt::WindowType type = w->type();
- if (type != Qt::Desktop && type != Qt::ForeignWindow) {
- if (QPlatformWindow *pw = w->handle())
- result = static_cast<QWindowsWindow *>(pw);
- }
- }
- return result;
+ if (!w || !w->handle())
+ return nullptr;
+
+ const Qt::WindowType type = w->type();
+ if (type == Qt::Desktop || w->handle()->isForeignWindow())
+ return nullptr;
+
+ return static_cast<QWindowsWindow *>(w->handle());
}
void *QWindowsWindow::userDataOf(HWND hwnd)