From ec97be5585fd7721db6ba2bb9ea0591fa5ca30b7 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Thu, 14 Dec 2017 16:55:00 +0100 Subject: 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 --- src/plugins/platforms/windows/qwindowswindow.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowswindow.h') 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; -- cgit v1.2.3