Skip to content

Commit

Permalink
Resolve a problem in F2/Setup update interval adjustments
Browse files Browse the repository at this point in the history
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
  • Loading branch information
natoscott authored and BenBE committed Aug 5, 2024
1 parent ebb5898 commit a750f38
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRT.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions DisplayOptionsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a750f38

Please sign in to comment.