Use QPlatformWindow::startSystemMove() with Qt 5.11
AbandonedPublic

Authored by volkov on Mar 22 2018, 10:43 AM.

Details

Reviewers
None
Group Reviewers
Breeze
Summary

... instead of X11 API to initiate window movement by a window
manager. It works correctly when mouse events are synthesized from
touch events (requires releasing of touch sequences that relies on
Qt's internals and can be done only inside the xcb plugin).
Besides it should work on Wayland.

Note that now globalPos is used when creating QMouseEvent that
triggers window movement. Otherwise QMouseEvent will take it
from QCursor::pos() with integer coordinates received from the
X server, which may differ from coordinates rounded by Qt for
touch events.

Diff Detail

Repository
R31 Breeze
Branch
Plasma/5.12
Lint
No Linters Available
Unit
No Unit Test Coverage
volkov created this revision.Mar 22 2018, 10:43 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 22 2018, 10:43 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
volkov requested review of this revision.Mar 22 2018, 10:43 AM
broulik added inline comments.
kstyle/breezewindowmanager.cpp
100

Using private API will lock Breeze to that specific Qt version it was compiled with, requiring a rebuild. This has imho shown to be quite painful in plasma-integration and Kwin already.

+++ to using this.

However, I think we should at least try to get this as public API in Qt, rather than using internals.
Breeze is far from the only case where someone would want to do this and QWindow has other system calls it seems to make sense to me.

Note that now globalPos is used when creating QMouseEvent that
triggers window movement. Otherwise QMouseEvent will take it
from QCursor::pos() with integer coordinates received from the
X server, which may differ from coordinates rounded by Qt for
touch events.

Can you expand on this, I don't understand why Qt would have different positions for synthesised touch events

volkov added a comment.EditedMar 22 2018, 1:49 PM

IIRC, the X server floors coordinates, while Qt rounds them.
I.e. for a touch begin event with coordinates (0.6, 0.9) Qt will syntesize a mouse button press event (1, 1), but QCursor::pos() will return (0, 0).

In general I like the idea and that should be extended to Wayland as well, but private API is a no-no for breeze. That has huge runtime breakage potential.