From 32a3f567108236b14d811562c1e1f54ce4e29ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 29 Feb 2020 15:46:40 +0100 Subject: [PATCH] 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. --- wayland.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wayland.c b/wayland.c index 7322a32f..b694e23c 100644 --- a/wayland.c +++ b/wayland.c @@ -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);