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.
This commit is contained in:
Daniel Eklöf 2020-03-03 18:26:15 +01:00
parent 044556ef3e
commit d76484ae50
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 28 additions and 63 deletions

View file

@ -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);