From d76484ae50efb8ede95e6b0921bdb1fad26dccd9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 3 Mar 2020 18:26:15 +0100 Subject: wayland: set window geometry to exclude the invisible CSD borders But it *does* include the title bar. This simplifies the 'adjustment' needed to be done to the configured window size. It also fixes a number of issues: * the compositor will now properly snap the window to screen edges (before, there was an empty space between the edge and the window - the CSD border). * This also removes the need for the mutter 'commit' workaround. We must be doing something right now. --- render.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index a492fb28..82abac4d 100644 --- a/render.c +++ b/render.c @@ -1416,16 +1416,9 @@ maybe_resize(struct terminal *term, int width, int height, bool force) height = term->conf->height; if (term->window->use_csd == CSD_YES) { + /* Take CSD title bar into account */ assert(!term->window->is_fullscreen); - - /* Account for CSDs, to make actual window size match - * the configured size */ - if (!term->window->is_maximized) { - width -= 2 * term->conf->csd.border_width; - height -= 2 * term->conf->csd.border_width + term->conf->csd.title_height; - } else { - height -= term->conf->csd.title_height; - } + height -= term->conf->csd.title_height; } width *= scale; @@ -1556,10 +1549,27 @@ damage_view: term->unmaximized_height = term->height; } + render_csd(term); + +#if 0 + /* TODO: doesn't include CSD title bar */ xdg_toplevel_set_min_size( term->window->xdg_toplevel, min_width / scale, min_height / scale); +#endif + + { + bool title_shown = !term->window->is_fullscreen && + term->window->use_csd == CSD_YES; + + int title_height = title_shown ? term->conf->csd.title_height : 0; + xdg_surface_set_window_geometry( + term->window->xdg_surface, + 0, + -title_height, + term->width / term->scale, + term->height / term->scale + title_height); + - render_csd(term); if (term->is_searching) render_search_box(term); -- cgit v1.3