diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-10-10 15:19:43 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-10-10 15:19:43 +0000 |
| commit | 3949e3427169f20f050d5df8ae824fa5a8d75fd6 (patch) | |
| tree | 7830b31070c56144007bed74d8014aa6cf6bde7e /terminal.c | |
| parent | pgo: run xtgettcap without any arguments (diff) | |
| parent | render: rename term->render.resizing -> term->interactive_resizing (diff) | |
Merge branch 'delayed-reflow'
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -7,6 +7,7 @@ #include <string.h> #include <unistd.h> #include <errno.h> +#include <limits.h> #include <sys/stat.h> #include <sys/wait.h> @@ -255,8 +256,18 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data) cursor_blink_rearm_timer(term); } + if (unlikely(term->interactive_resizing.grid != NULL)) { + /* + * Don’t consume PTMX while we’re doing an interactive resize, + * since the ‘normal’ grid we’re currently using is a + * temporary one - all changes done to it will be lost when + * the interactive resize ends. + */ + return 0; + } + uint8_t buf[24 * 1024]; - const size_t max_iterations = !hup ? 10 : (size_t)-1ll; + const size_t max_iterations = !hup ? 10 : SIZE_MAX; for (size_t i = 0; i < max_iterations && pollin; i++) { xassert(pollin); @@ -278,6 +289,7 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data) break; } + xassert(term->interactive_resizing.grid == NULL); vt_from_slave(term, buf, count); } @@ -358,6 +370,18 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data) return true; } +bool +term_ptmx_pause(struct terminal *term) +{ + return fdm_event_del(term->fdm, term->ptmx, EPOLLIN); +} + +bool +term_ptmx_resume(struct terminal *term) +{ + return fdm_event_add(term->fdm, term->ptmx, EPOLLIN); +} + static bool fdm_flash(struct fdm *fdm, int fd, int events, void *data) { |
