qt5base-lts/tests/auto/widgets/kernel
Gatis Paeglis 4050ee6ac7 xcb: rely on WM_SIZE_HINTS gravity to handle x,y positioning
The original code was added by b316c3ac5e
(in 2012). This patch changes two things:

1) We now rely on WM to position a window based on the set gravity. It
should not be necessary to calculate coordinates manually as was done
in windowToWmGeometry(). We don't even know the decoration size before
the window is mapped.

2) We now update gravity whenever needed instead of hardcoding based
on what Qt APIs (setGeometry vs setFramePosition) where used to set
the initial window position.

The patch from b316c3a says:

"Determine gravity from initial position. Do not change later as
it will cause the window to move uncontrollably"

Since it did not elaborate on the situation, we can only assume
that it was caused by another bug in Qt at the time or perhaps
a broken WM. From [1]:

"Applications are free to change their win_gravity setting at any
time. If an Application changes its win_gravity then the Window Manager
should adjust the reference point, so that the client window will
not move as the result."

Tested on Ubuntu/Unity, KDE/KWin, Gnome-shell/Mutter, Lubuntu/OpenBox.
Works as expected everywhere expect Unity. Unity seems to ignore
XCB_GRAVITY_STATIC and treats it as XCB_GRAVITY_NORTH_WEST, which means
that setGeometry/setFramePosition produce the same placement on this WM
(the behavior was the same also before this patch).

P.S. Also renamed xRect -> rect, which was a leftover from
ae5f2a6672

With this change we can un-blacklist QWidget save/restore geometry
auto tests.

[1] https://specifications.freedesktop.org/wm-spec/latest/ar01s09.html

Task-number: QTBUG-66708
Change-Id: I381eef5d34dddb04de16a897ce5540b9c430b216
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2018-06-26 07:11:34 +00:00
..
qaction Send ShortcutOverride event when receiving a non-spontaneous key press 2018-04-20 10:18:49 +00:00
qactiongroup qtbase: Remove BLACKLIST files which are no longer active 2018-02-12 17:40:12 +00:00
qapplication winrt: make widgets/kernel auto tests pass 2018-06-22 05:02:45 +00:00
qboxlayout Merge remote-tracking branch 'origin/5.11' into dev 2018-04-26 09:55:10 +02:00
qdesktopwidget Updated license headers 2016-01-21 18:55:18 +00:00
qformlayout winrt: make widgets/kernel auto tests pass 2018-06-22 05:02:45 +00:00
qgesturerecognizer tests: un-blacklist tst_QGestureRecognizer::panGesture on xcb 2018-06-25 13:41:40 +00:00
qgridlayout tests/auto/widgets/kernel: Avoid unconditional qWait()s 2018-04-24 05:01:57 +00:00
qlayout winrt: make widgets/kernel auto tests pass 2018-06-22 05:02:45 +00:00
qshortcut tests/auto/widgets/kernel: Avoid unconditional qWait()s 2018-04-24 05:01:57 +00:00
qsizepolicy Replace Q_NULLPTR with nullptr where possible 2017-09-19 11:53:55 +00:00
qstackedlayout tests/auto/widgets/kernel: Avoid unconditional qWait()s 2018-04-24 05:01:57 +00:00
qtooltip ToolTip/Windows: Fix wrong size when font is modified by widget stylesheet 2018-03-01 09:56:14 +00:00
qwidget xcb: rely on WM_SIZE_HINTS gravity to handle x,y positioning 2018-06-26 07:11:34 +00:00
qwidget_window widgetwindow: send DragMove for every DragEnter 2018-06-25 12:45:54 +00:00
qwidgetaction testlib: start sharing common helper functions 2017-11-04 20:11:22 +00:00
qwidgetmetatype Updated license headers 2016-01-21 18:55:18 +00:00
qwidgetsvariant Updated license headers 2016-01-21 18:55:18 +00:00
qwindowcontainer winrt: make widgets/kernel auto tests pass 2018-06-22 05:02:45 +00:00
kernel.pro Move QGestureRecognizer test to widgets/kernel 2017-06-02 18:36:11 +00:00