From a750f38d7c1f971ed470f652635e01f799c059b9 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 5 Aug 2024 09:40:09 +1000 Subject: [PATCH] Resolve a problem in F2/Setup update interval adjustments The halfdelay(3X) curses function ultimately drives the update interval that htop samples values and refreshes at. This is a bit complicated by interrupts generated from other places (key or mouse events), however if halfdelay is not explicitly called at some point soon after changing the interval it does not get correctly updated during that session. Since the delay setting is persisted, on restart htop actually does honour the change from the previous invocation, confusing the situation even further. With this commit the update is reflected immediately in the UI as well now. Fixes: #1510 --- CRT.h | 4 ++++ DisplayOptionsPanel.c | 1 + 2 files changed, 5 insertions(+) diff --git a/CRT.h b/CRT.h index eb3df1d7f..1b2b5742d 100644 --- a/CRT.h +++ b/CRT.h @@ -214,6 +214,10 @@ void CRT_disableDelay(void); void CRT_enableDelay(void); +static inline void CRT_updateDelay(void) { + CRT_enableDelay(); // pushes new delay setting into halfdelay(3X) +} + void CRT_setColors(int colorScheme); #endif diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c index 66793e164..8fa347294 100644 --- a/DisplayOptionsPanel.c +++ b/DisplayOptionsPanel.c @@ -74,6 +74,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) { if (result == HANDLED) { this->settings->changed = true; this->settings->lastUpdate++; + CRT_updateDelay(); Header* header = this->scr->header; Header_calculateHeight(header); Header_reinit(header);