mirror of
https://github.com/i3/i3.git
synced 2025-10-30 03:42:37 +00:00
Inspired by #5384, but instead of just using the border width, this PR reports the actual frame extents for the window, which may also include the title bar (for floating windows and tiled windows in plain split containers, but not for tiled windows in stacked/tabbed containers). The existing `con_border_style_rect()` function should already handle all configuration options which can affect the decoration sizes (if it does not, that would also show up in other places); its result just needs to be converted into the format used by the `_NET_FRAME_EXTENTS` property. This PR fixes #4292 probably in the best way possible (the reported `_NET_FRAME_EXTENTS` values should always match the actual sizes of window frame elements which are actually drawn into the X11 frame window into which the client window is reparented). The only really problematic case is with the stacked/tabbed containers, for which the title bar is actually drawn into a completely separate window, therefore the title bar size cannot be reported in `_NET_FRAME_EXTENTS` (actually I tried to calculate the size of those decorations and add it to the top decoration size, but that did not change the behavior of `picom`). <details><summary>Large screenshots here (3840×2160)</summary> Example of configuration with `hide_edge_borders smart` — a single window does not have borders, so only the top frame size is non-zero:  but multiple windows have borders:  Changing border width works too (although with `border normal 8` you can see that the top border overlaps the title text, because on the i3 side that border does not really exists, and `picom` just draws it over; also the pixel sizes reported by `xprop` and `xwininfo` are not identical to what is specified in i3, because I use 168 dpi on this system, therefore 4 px in the i3 config = 7 dpx):  Handling of tabbed containers is less perfect though. Here is a single tabbed container with `hide_edge_borders smart`, so it does not really have a border — note that all frame extents are zero, and the titlebar is rounded separately (although it could easily be excluded from rounding, that does not really help much):  Once the border actually appears, you may notice that the top part of the `picom` border actually gets drawn over the top part of the window, partially obscuring the top line in this terminal (`picom` does not mind that the top frame size is reported as 0):  Some examples of floating windows (no major problems there):  Options like `hide_edge_borders both` work too when gaps are removed (although the resulting behavior with `picom` is probably not very useful — the rounded border gets drawn only if all of the left, bottom and right borders are present):  The same with `border pixel 8` (note that windows with only the top border hidden still get the rounded border treatment by `picom`, but the border overlaps the top part of the window):  </details> --------- Signed-off-by: Sergey Vlasov <sigprof@gmail.com> Co-authored-by: Orestis Floros <orestisflo@gmail.com>