Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.15, 6.8.2
-
None
-
Debian/unstable with FVWM (version 2 or 3) window manager
Description
Under X11 with the FVWM window manager (version 2 or 3), when the title-bar is shown, a window set up with setGeometry gets incorrectly positioned vertically. https://github.com/nomacs/nomacs/issues/1304#issuecomment-2772895954 contains a testcase (main.cpp source attached), which basically does:
w->setGeometry(initialRect);
w->showNormal();
while (!w->isActiveWindow())
qApp->processEvents();
The window appears as follows, ignoring the border width (but not the title-bar):
┌─────────────────────────┐
│ │
X title-bar │
│ │
├─────────────────────────┤
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────┘
When there is no title-bar (in which case the position is correct), the X above denotes the position of the top-left corner. Note that the X is at the vertical middle of the title-bar. In short, due to the title-bar, the window excluding its frame is shifted downward, and the amount of the shift is half the height of the title-bar.
The above could be measured visually, but the shift is confirmed by values obtained from the program. For instance, if (100,100) were the first two values of initialRect, then the first two values given by w->geometry() after the window is shown are (100,109).
FVWM implements its window decorations (borders and title-bar) as frame extents, which can be shown with the xprop _NET_FRAME_EXTENTS command, e.g.
_NET_FRAME_EXTENTS(CARDINAL) = 4, 4, 32, 4
It seems that the issue occurs because the values are asymmetric due to the title-bar (32 on the top, 4 on the bottom). According to various tests, if B is the border width and T is the height of the title-bar, then xprop _NET_FRAME_EXTENTS gives "B, B, B+T, B", and the shift for the window position is T/2.
The fact that the shift is T/2 could mean that the window is positioned relatively to its center, but there is a confusion between taking the window frame into account or not, which yields a shift. Due to the symmetry concerning the border width, the borders have no influence (explaining that the horizontal position is correct). But this is not the case of the title-bar.
Attachments
Issue Links
- relates to
-
QTBUG-2280 QT should use _NET_FRAME_EXTENTS X property when getting window frame size on X11 whenever possible
-
- Closed
-