diff options
author | Andre de la Rocha <andre.rocha@qt.io> | 2017-12-14 16:55:00 +0100 |
---|---|---|
committer | Andre de la Rocha <andre.rocha@qt.io> | 2018-05-18 09:31:33 +0000 |
commit | ec97be5585fd7721db6ba2bb9ea0591fa5ca30b7 (patch) | |
tree | 2fee041afef742cf5cb5c3f1eb4ad750a1e5c9a4 /src/plugins/platforms/windows/qwindowswindow.h | |
parent | 7c3ecf85a770cd7fef01ece935f88d8894de09b2 (diff) |
Windows: Add support for invisible window margins
Windows 10 windows contain an invisible area within the NC window frame
on which the mouse cursor is enabled to perform resizing. This change
captures the geometry of the invisible margins and considers it when
moving a window, so that, for instance, a move(0,0) does not generate
gap between the window and the beginning of screen.
[ChangeLog][Windows] The dimensions of invisible margins inside the
frames of Windows 10 windows will now be disregarded in the positioning
of Qt windows to avoid a misplaced look (offset by a few pixels from
the expected position).
Task-number: QTBUG-55762
Change-Id: I1f537756eb1a093f78b919de9d44992528199700
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 68e0617b19..6606f4ee7a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -108,8 +108,8 @@ struct QWindowsWindowData { Qt::WindowFlags flags; QRect geometry; - QMargins frame; // Do not use directly for windows, see FrameDirty. - QMargins customMargins; // User-defined, additional frame for NCCALCSIZE + QMargins fullFrameMargins; // Do not use directly for windows, see FrameDirty. + QMargins customMargins; // User-defined, additional frame for NCCALCSIZE HWND hwnd = 0; bool embedded = false; @@ -125,9 +125,10 @@ public: WId winId() const override { return WId(handle()); } QRect geometry() const override { return geometry_sys(); } - QMargins frameMargins() const override { return frameMargins_sys(); } + QMargins frameMargins() const override { return fullFrameMargins(); } QPoint mapToGlobal(const QPoint &pos) const override; QPoint mapFromGlobal(const QPoint &pos) const override; + virtual QMargins fullFrameMargins() const { return frameMargins_sys(); } using QPlatformWindow::screenForGeometry; @@ -258,7 +259,8 @@ public: static bool handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &marginsDp); bool handleGeometryChanging(MSG *message) const; QMargins frameMargins() const override; - void setFrameMargins(const QMargins &newMargins); + QMargins fullFrameMargins() const override; + void setFullFrameMargins(const QMargins &newMargins); void setOpacity(qreal level) override; void setMask(const QRegion ®ion) override; |