From 9a1df7bb036cffbef206a3f2dbe46559b6f15d89 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 17 Jan 2021 16:12:54 +0100 Subject: render: delay TIOCSWINSZ while doing an interactive resize Instead of disabling content centering, delay the TIOCSWINSZ (a.k.a delay sending the new dimensions to the client) by a small amount while doing an interactive resize. Non-interactive resizes are still immediate. For now, force a resize when the user stops the interactive resize. This ensures the client application receives the new dimensions immediately. It still works without the last, forced, resize, but there typically be a small delay until the client application receives the final dimensions. Closes #301 Closes #283 --- wayland.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'wayland.c') diff --git a/wayland.c b/wayland.c index 4e8a8ca8..ec113552 100644 --- a/wayland.c +++ b/wayland.c @@ -677,9 +677,22 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, term->window->frame_callback = NULL; } +#if 1 + /* + * TODO: decide if we should to the last “forced” call when ending + * an interactive resize. + * + * Without it, the last TIOCSWINSZ sent to the client will be a + * scheduled one. I.e. there will be a small delay after the user + * has *stopped* resizing, and the client application receives the + * final size. + */ bool resized = was_resizing && !win->is_resizing ? render_resize_force(term, win->configure.width, win->configure.height) : render_resize(term, win->configure.width, win->configure.height); +#else + bool resized = render_resize(term, win->configure.width, win->configure.height); +#endif if (win->configure.is_activated) term_visual_focus_in(term); @@ -1278,6 +1291,7 @@ wayl_win_init(struct terminal *term) win->term = term; win->use_csd = CSD_UNKNOWN; win->csd.move_timeout_fd = -1; + win->resize_timeout_fd = -1; win->surface = wl_compositor_create_surface(wayl->compositor); if (win->surface == NULL) { @@ -1430,6 +1444,9 @@ wayl_win_destroy(struct wl_window *win) wl_surface_destroy(win->surface); wayl_roundtrip(win->term->wl); + + if (win->resize_timeout_fd >= 0) + fdm_del(win->term->wl->fdm, win->resize_timeout_fd); free(win); } -- cgit v1.3