diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-02-06 17:21:13 +0100 |
---|---|---|
committer | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2020-01-28 16:52:13 +0100 |
commit | a611c632bb906cf77dd3af29ddd7b166f79ad1b0 (patch) | |
tree | 931493fe4d13116efe738623f9e705c6025f1674 /src/gui/kernel/qplatformwindow.cpp | |
parent | 6c3eb39832876a65291546476b92fd94950b1208 (diff) |
Add QWindow::startSystemMove and startSystemResize
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 <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformwindow.cpp')
-rw-r--r-- | src/gui/kernel/qplatformwindow.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index 65accc9f68..03f2e4d79e 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -482,19 +482,17 @@ bool QPlatformWindow::windowEvent(QEvent *event) } /*! - Reimplement this method to start a system size grip drag - operation if the system supports it and return true to indicate - success. - It is called from the mouse press event handler of the size grip. + Reimplement this method to start a system resize operation if + the system supports it and return true to indicate success. + + The default implementation is empty and does nothing with \a edges. - The default implementation is empty and does nothing with \a pos - and \a corner. + \since 5.15 */ -bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) +bool QPlatformWindow::startSystemResize(Qt::Edges edges) { - Q_UNUSED(pos) - Q_UNUSED(corner) + Q_UNUSED(edges) return false; } @@ -502,18 +500,13 @@ bool QPlatformWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) Reimplement this method to start a system move operation if the system supports it and return true to indicate success. - The \a pos is a position of MouseButtonPress event or TouchBegin - event from a sequence of mouse events that triggered the movement. - It must be specified in window coordinates. - - The default implementation is empty and does nothing with \a pos. + The default implementation is empty and does nothing. - \since 5.11 + \since 5.15 */ -bool QPlatformWindow::startSystemMove(const QPoint &pos) +bool QPlatformWindow::startSystemMove() { - Q_UNUSED(pos) return false; } |