Discovered while doing the following cleanup in XCB plugin https://codereview.qt-project.org/#/c/225924/
"Window Managers MUST honor the win_gravity field of WM_NORMAL_HINTS"
Unity seems to ignore XCB_GRAVITY_STATIC and treats it as XCB_GRAVITY_NORTH_WEST, which means
that setGeometry() and setFramePosition() produce the same final geomtery() (x, y + frame height), but the expected is (x, y) for setGeometry() and only for setFramePosition() the expected is (x, y + frame height). Tested on Ubuntu/Unity, KDE/KWin, Gnome-shell/Mutter, Lubuntu/OpenBox. Works as expected everywhere expect Unity.
This results in a late ConfigureNotify event, with the "adjusted" x,y. We haven't been able to explain until now what caused this stray ConfigureNotify and have had various hacks both in qtestlib https://codereview.qt-project.org/#/c/27146/ (which caused even more flakiness and failing tests
QTBUG-63542) and in actual tests. The hacks in auto tests are usually based on adding various waiting calls.
There is nothing we can do about this in the XCB plugin. One suggestion was to wait for _NET_FRAME_EXTENTS atom to be set on the window (in other words: wait for window to be decorated). That would help to ensure that the window has received the final geometry before continuing a test function. But this approach has a significant drawback: geometry() returns unexpected results. Auto tests are written in a way where geometry calls are respected as that is how things work on other platforms. Not respecting geometry calls is normal on X11 with e.g. tiling window mangers, but we are not testing those in CI.
Ubuntu 18.04 LTS (https://itsfoss.com/ubuntu-18-04-release-features/):
Unity is on its way out, but we still need to test in our CI as long as we support Ubuntu 16.04 and below. But to keep some sanity, not waste time dealing with these issues for years or continue to add hacks in Qt, we could try to configure Unity machines in CI to not decorate windows. In this case setFramePosition() would produce the same position as setGeometry(), but at least geometry would be stable as we would not get the delayed ConfigureNotify. It might be that some tests that rely on setFramePosition() would need minor refactoring, but that is far less trouble than what we have right now. Redhat/Gnome and OpenSuse/KWin machines in CI will cover testing normal windows (with decorations), so test coverage should not suffer from this change.
Decorations can be removed via Unity theming support: /usr/share/themes/Ambiance/gtk-3.0/apps/unity.css
Change -UnityDecoration-extents: 28px 0 0 0;
to -UnityDecoration-extents: 0 0 0 0;
|For Gerrit Dashboard: QTBUG-67757|
|226536,4||Provisioning: Ubuntu - remove Unity window decorations||5.11||qt/qt5||Status: MERGED||+2||0|
|226701,3||qtestlib: restore qWaitForWindowActive() its original semantics||5.11||qt/qtbase||Status: MERGED||+2||0|