From a611c632bb906cf77dd3af29ddd7b166f79ad1b0 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 6 Feb 2018 17:21:13 +0100 Subject: Add QWindow::startSystemMove and startSystemResize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This can be used to create custom client side window decorations. Refactors the xcb implementation to use edges instead of corners and we now use the last mouse position for `root_x` and `root_y` in the `_NET_WM_MOVERESIZE` event. Touch has also been changed, so just pick a point that's currently being pressed. The workaround for QTBUG-69716 has now been moved to QSizeGrip, as the comment in the bug report says that it should ideally be fixed at the widget level. On Windows, we no longer abort when GetSystemMenu returns false. I assume this code was added to check whether the window didn't have any decorations and not resize in that case. However, since the point of this patch is to let windows without native decorations resize/move, it makes most sense to remove the check. Adds a manual test, which calls QWindow::startSystemMove and startSystemResize on touch and mouse events. [ChangeLog][QtGui] Added API for starting interactive window resize and move operations handled by the system. Fixes: QTBUG-73011 Change-Id: I7e47a0b2cff182af71d3d479d6e3746f08ea30aa Reviewed-by: Friedemann Kleint Reviewed-by: Qt CI Bot Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/xcb/qxcbwindow.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbwindow.h') diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 976a442b11..d6f370eebe 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -107,8 +107,8 @@ public: bool windowEvent(QEvent *event) override; - bool startSystemResize(const QPoint &pos, Qt::Corner corner) override; - bool startSystemMove(const QPoint &pos) override; + bool startSystemResize(Qt::Edges edges) override; + bool startSystemMove() override; void setOpacity(qreal level) override; void setMask(const QRegion ®ion) override; @@ -168,8 +168,8 @@ public: QXcbScreen *xcbScreen() const; - bool startSystemMoveResize(const QPoint &pos, int corner); - void doStartSystemMoveResize(const QPoint &globalPos, int corner); + bool startSystemMoveResize(const QPoint &pos, int edges); + void doStartSystemMoveResize(const QPoint &globalPos, int edges); static bool isTrayIconWindow(QWindow *window) { @@ -264,6 +264,7 @@ protected: QRegion m_exposeRegion; QSize m_oldWindowSize; + QPoint m_lastPointerPosition; xcb_visualid_t m_visualId = 0; // Last sent state. Initialized to an invalid state, on purpose. -- cgit v1.2.3