wayland: don't resize when we're not mapped anywhere

Normally, we resize and update the font's DPI whenever our window
enters or leaves an output.

This is since a change in the outputs we're mapped on means the scale
factor to use, or the DPI to use for the fonts may have changed.

However, a special case is when we're removed from the last
output. This should only happen at shutdown, when we're un-mapping
ourselves.

In this case, we typically don't have a access to e.g. the PTMX
fd (often, the reason we're shutting down is because the client
exited). This resulted in (harmless) error messages when emitting the
TIOCSWINSZ event.

Since we're shutting down anyway, we can simply skip the resize and
everything. This gets rid of the error message, and also means we're
shutting down faster.
This commit is contained in:
Daniel Eklöf 2020-02-29 15:46:40 +01:00
parent ea2d7f8b8c
commit 32a3f56710
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -133,6 +133,9 @@ static const struct wl_seat_listener seat_listener = {
static void
update_term_for_output_change(struct terminal *term)
{
if (tll_length(term->window->on_outputs) == 0)
return;
render_resize(term, term->width / term->scale, term->height / term->scale);
term_font_dpi_changed(term);
wayl_reload_cursor_theme(term->wl, term);