aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-17 15:12:54 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-26 18:32:06 +0000
commit9a1df7bb036cffbef206a3f2dbe46559b6f15d89 (patch)
tree3b0a25ebae76e86c6247d5946455e8a75b9fdb54 /wayland.c
parentwayland: pending ‘configure’ flags: use ’bool’ in bit-fields (diff)
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
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c17
1 files changed, 17 insertions, 0 deletions
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);
}