From e4ebe18b67c366d367231a1123b057c82018cf5b Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 14 Feb 2023 11:51:54 +1100 Subject: [PATCH] Drop references to 'Process' in generic screen code Prepare the way for making screen tabs more generalised, able to cater to entities other than processes. 'actionTogglePauseProcessUpdate' -> 'actionTogglePauseUpdate' 'pauseProcessUpdate' -> 'pauseUpdate' 'hideProcessSelection' -> 'hideSelection' 'hideProcessSelection' -> 'hideSelection' Signed-off-by: Sohaib Mohamed --- Action.c | 6 +++--- Action.h | 6 +++--- CommandLine.c | 4 ++-- MainPanel.c | 6 +++--- ScreenManager.c | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Action.c b/Action.c index c5b16360c..73b86062c 100644 --- a/Action.c +++ b/Action.c @@ -568,8 +568,8 @@ static Htop_Reaction actionRedraw(ATTR_UNUSED State* st) { return HTOP_REFRESH | HTOP_REDRAW_BAR; } -static Htop_Reaction actionTogglePauseProcessUpdate(State* st) { - st->pauseProcessUpdate = !st->pauseProcessUpdate; +static Htop_Reaction actionTogglePauseUpdate(State* st) { + st->pauseUpdate = !st->pauseUpdate; return HTOP_REFRESH | HTOP_REDRAW_BAR; } @@ -836,7 +836,7 @@ void Action_setBindings(Htop_Action* keys) { #ifdef SCHEDULER_SUPPORT keys['Y'] = actionSetSchedPolicy; #endif - keys['Z'] = actionTogglePauseProcessUpdate; + keys['Z'] = actionTogglePauseUpdate; keys['['] = actionLowerPriority; keys['\014'] = actionRedraw; // Ctrl+L keys['\177'] = actionCollapseIntoParent; diff --git a/Action.h b/Action.h index 09b68bd72..04d090f8f 100644 --- a/Action.h +++ b/Action.h @@ -41,13 +41,13 @@ typedef struct State_ { ProcessList* pl; struct MainPanel_* mainPanel; Header* header; - bool pauseProcessUpdate; - bool hideProcessSelection; + bool pauseUpdate; + bool hideSelection; bool hideMeters; } State; static inline bool State_hideFunctionBar(const State* st) { - return st->settings->hideFunctionBar == 2 || (st->settings->hideFunctionBar == 1 && st->hideProcessSelection); + return st->settings->hideFunctionBar == 2 || (st->settings->hideFunctionBar == 1 && st->hideSelection); } typedef Htop_Reaction (*Htop_Action)(State* st); diff --git a/CommandLine.c b/CommandLine.c index 2b2a68c2a..9dd02dfc9 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -372,8 +372,8 @@ int CommandLine_run(int argc, char** argv) { .pl = pl, .mainPanel = panel, .header = header, - .pauseProcessUpdate = false, - .hideProcessSelection = false, + .pauseUpdate = false, + .hideSelection = false, .hideMeters = false, }; diff --git a/MainPanel.c b/MainPanel.c index 89b4e7d41..0889a5c20 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -70,7 +70,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { needReset = false; #endif if (needReset) - this->state->hideProcessSelection = false; + this->state->hideSelection = false; Settings* settings = this->state->settings; ScreenSettings* ss = settings->ss; @@ -107,7 +107,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { } result = HANDLED; } else if (ch == 27) { - this->state->hideProcessSelection = true; + this->state->hideSelection = true; return HANDLED; } else if (ch != ERR && ch > 0 && ch < KEY_MAX && this->keys[ch]) { reaction |= (this->keys[ch])(this->state); @@ -190,7 +190,7 @@ static void MainPanel_drawFunctionBar(Panel* super, bool hideFunctionBar) { return; IncSet_drawBar(this->inc, CRT_colors[FUNCTION_BAR]); - if (this->state->pauseProcessUpdate) { + if (this->state->pauseUpdate) { FunctionBar_append("PAUSED", CRT_colors[PAUSED]); } } diff --git a/ScreenManager.c b/ScreenManager.c index 87e718926..6b9fada51 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -131,12 +131,12 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi if (*rescan) { *oldTime = newTime; int oldUidDigits = Process_uidDigits; - if (!this->state->pauseProcessUpdate && (*sortTimeout == 0 || this->settings->ss->treeView)) { + if (!this->state->pauseUpdate && (*sortTimeout == 0 || this->settings->ss->treeView)) { pl->needsSort = true; *sortTimeout = 1; } // scan processes first - some header values are calculated there - ProcessList_scan(pl, this->state->pauseProcessUpdate); + ProcessList_scan(pl, this->state->pauseUpdate); // always update header, especially to avoid gaps in graph meters Header_updateData(this->header); // force redraw if the number of UID digits was changed @@ -206,7 +206,7 @@ static void ScreenManager_drawPanels(ScreenManager* this, int focus, bool force_ Panel_draw(panel, force_redraw, i == focus, - panel != (Panel*)this->state->mainPanel || !this->state->hideProcessSelection, + panel != (Panel*)this->state->mainPanel || !this->state->hideSelection, State_hideFunctionBar(this->state)); mvvline(panel->y, panel->x + panel->w, ' ', panel->h + (State_hideFunctionBar(this->state) ? 1 : 0)); }