From 0e477e2c5e55fd391aa5adef32789a9b7c3f3024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 16 Apr 2022 10:47:55 +0200 Subject: [PATCH] render: take visible border width into account when setting window geometry This fixes e.g. window snapping in GNOME. --- CHANGELOG.md | 2 ++ render.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 573b409b..724bd636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,8 @@ (https://codeberg.org/dnkl/foot/issues/1008). * Improved compatibility with XTerm when `modifyOtherKeys=2` (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. ### Security diff --git a/render.c b/render.c index e408a9dd..ba470fa2 100644 --- a/render.c +++ b/render.c @@ -3760,16 +3760,23 @@ damage_view: #endif { - bool title_shown = !term->window->is_fullscreen && + bool title_shown = + !term->window->is_fullscreen && + term->window->csd_mode == CSD_YES; + + bool border_shown = + !term->window->is_fullscreen && + !term->window->is_maximized && term->window->csd_mode == CSD_YES; int title_height = title_shown ? term->conf->csd.title_height : 0; + int border_width = border_shown ? term->conf->csd.border_width_visible : 0; xdg_surface_set_window_geometry( term->window->xdg_surface, - 0, - -title_height, - term->width / term->scale, - term->height / term->scale + title_height); + -border_width, + -title_height - border_width, + term->width / term->scale + 2 * border_width, + term->height / term->scale + title_height + 2 * border_width); } tll_free(term->normal.scroll_damage);