From f700440f9ca9be7dd6e5615b3a84c1c9e1ca18c2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 28 Feb 2026 09:35:10 +0200 Subject: dfm: also wake on winch This adds responsive resize whilst still allowing dfm to do nothing at idle. Nifty. --- dfm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dfm.c') diff --git a/dfm.c b/dfm.c index f6a30dc..695b0aa 100644 --- a/dfm.c +++ b/dfm.c @@ -3342,9 +3342,6 @@ static inline void fm_update(struct fm *p) { term_reap(); - if (unlikely(term_resize(&p->t))) - if (fm_term_resize(p) < 0) - fm_draw_err(p, S("resize failed"), errno); fm_watch_handle(p); if (!(p->f & FM_DIRTY)) return; p->f &= ~FM_DIRTY; @@ -3403,7 +3400,12 @@ fm_run(struct fm *p) for (; likely(!term_dead(&p->t)); ) { fm_update(p); fm_draw(p); - fm_input(p); + int e = term_wait(&p->t); + if (e & TERM_WAIT_WCH) + if (fm_term_resize(p) < 0) + fm_draw_err(p, S("resize failed"), errno); + if (e & TERM_WAIT_KEY) + fm_input(p); } fm_term_free(p); if (!(p->f & FM_PRINT_PWD)) p->pwd.l = 0; -- cgit v1.2.3