Skip to content

Commit

Permalink
Drop references to 'Process' in generic screen code
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
natoscott committed May 7, 2023
1 parent 8a8df71 commit e4ebe18
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions CommandLine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
6 changes: 3 additions & 3 deletions MainPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions ScreenManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit e4ebe18

Please sign in to comment.