wayland: take (visible) border width into account on configure events

When the compositor is asking us to resize ourselves, take
our (visible) CSD borders into account. This is similar to how we
already take the titlebar size into account.

This fixes an issue where the window size “jumps” when the user starts
an interactive resize, when csd.border-width > 0.

This as been observed in GNOME.
This commit is contained in:
Daniel Eklöf 2022-04-16 11:15:10 +02:00
parent 0e477e2c5e
commit 7a0e7c6c01
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 9 additions and 1 deletions

View file

@ -108,6 +108,8 @@
(https://codeberg.org/dnkl/foot/issues/1009).
* Window geometry when CSDs are enabled and CSD border width set to a
non-zero value. This fixes window snapping in e.g. GNOME.
* Window size “jumping” when starting an interactive resize when CSDs
are enabled, and CSD border width set to a non-zero value.
### Security

View file

@ -746,9 +746,15 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
else if (csd_was_enabled && !enable_csd)
csd_destroy(win);
if (enable_csd && new_width > 0 && new_height > 0)
if (enable_csd && new_width > 0 && new_height > 0) {
new_height -= win->term->conf->csd.title_height;
if (!win->is_maximized) {
new_height -= 2 * win->term->conf->csd.border_width_visible;
new_width -= 2 * win->term->conf->csd.border_width_visible;
}
}
xdg_surface_ack_configure(xdg_surface, serial);
#if 1