From 27bb9ccc06b715ea8f76c269e8bc2fab03110155 Mon Sep 17 00:00:00 2001 From: Malfurious Date: Tue, 7 May 2024 04:42:24 -0400 Subject: Only update ncurses display on activity or keypress Previously, the test UI logic would constantly regenerate and print the screen's contents every iteration of the main processing loop to naively ensure that changes to the underlying system were reflected immediately. Sometimes, this would result in a screen flicker due to the rapid clearing and printing. This makes the UI a bit smarter about when refreshes occur, by monitoring activity results from the debugger and console modules in addition to user input. This should improve the screen flicker performance. This also addresses an issue selecting text on the screen, which was previously not possible due to the rapid refreshing as well. Signed-off-by: Malfurious --- debugger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'debugger.c') diff --git a/debugger.c b/debugger.c index 401f6dd..3902819 100644 --- a/debugger.c +++ b/debugger.c @@ -546,7 +546,7 @@ int dbg_free(struct thread *th) { return -1; } -void dbg_sync(struct process *proc) { +int dbg_sync(struct process *proc) { struct thread *acted = NULL; struct list *threads = &proc->threads; @@ -566,6 +566,8 @@ void dbg_sync(struct process *proc) { capture_state(proc); resume_threads(proc); } + + return acted != NULL; } int dbg_intr(struct thread *th) { -- cgit v1.2.3