aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-16 09:15:10 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-16 09:17:19 +0000
commit7a0e7c6c012b6d3697389bf294f2321430e3b63d (patch)
tree595951b677afc35493a31163a7df7eefaaa49299
parentrender: take visible border width into account when setting window geometry (diff)
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.
-rw-r--r--CHANGELOG.md2
-rw-r--r--wayland.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 724bd636..3bd70f4d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/wayland.c b/wayland.c
index 7206d982..d77cd65d 100644
--- a/wayland.c
+++ b/wayland.c
@@ -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