Window placement is wrong when using _GTK_FRAME_EXTENTS for client-side decorations
Chromium sets the _GTK_FRAME_EXTENTS
property to specify areas for the drop shadow around the window. It sets a non-zero extent to every edge of the window. However, when the window gets maximised, things go wrong: the window edges get beyond the edges of the screen.
Before explaining the issue further, it should be mentioned that two scenarios of maximising the window exist. The first one is when the user clicks the Maximise button in the window; in that case, the window asks the WM to maximise, below this will be referred to as 'internal' maximise. The other scenario is when the WM maximises the window (for example, when the user drags the window to the upper edge of the screen); in that case, it's the WM that triggers all changes, and the window only gets the new size and the property change where it receives the new state. This is the 'external' way.
Initially the issue happened in both internal and external scenarios. It was found that the issue could be partially mitigated by setting zero extents when maximising the window in the internal way: if zero extents are sent together with the request to maximise the window horizontally and vertically, the window gets correct measurements. However, the issue still persists for the external scenario: setting the zero extents at the moment when the WM notifies the window about the new state does not help.
Here are the values of _NET_WM_STATE
and _GTK_FRAME_EXTENTS
in the test sequence.
- The browser is just started, the window has normal state.
- _NET_WM_STATE(ATOM) =
- _GTK_FRAME_EXTENTS(CARDINAL) = 16, 16, 10, 32
- The window is maximised via the internal scenario.
- _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
- _GTK_FRAME_EXTENTS is absent because Chromium explicitly resets it when maximising the window via the internal scenario.
- The window is restored to normal state.
- _NET_WM_STATE(ATOM) =
- _GTK_FRAME_EXTENTS(CARDINAL) = 16, 16, 10, 32
- The window is maximised the external way.
- _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT
- _GTK_FRAME_EXTENTS is absent because Chromium explicitly resets it when receiving the notification about the maximised state; however, this time it does not work.
- The window is restored to normal state.
- _NET_WM_STATE(ATOM) =
- _GTK_FRAME_EXTENTS(CARDINAL) = 16, 16, 10, 32
From the above it seems that what makes a difference for Xfwm is when _GTK_FRAME_EXTENTS
is changed. If it is reset before the actual change of the state, the window will get correct measurements, otherwise the new property seems to be ignored.
References:
- The issue in the Chromium bug tracker: https://crbug.com/1260821.
- The same issue posted earlier in Xfwm bug tracker (and closed): xfce4-panel#532 (closed)