diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-01-31 13:29:14 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-02-09 14:10:17 +0000 |
commit | a57f2128b15d363b88c063325eac1d36c2ff1578 (patch) | |
tree | 8cfd5c6ded2a9e4adc1766905114342addb94751 /src/plugins/platforms/windows/qwindowswindow.h | |
parent | ee8b61bcf56e03aae0f8e346e70330276e221843 (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.h | 17 |
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) |