mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 21:14:35 +03:00
Embracing branches
This commit is contained in:
@ -103,8 +103,12 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
|
||||
gettimeofday(&tv, NULL);
|
||||
double newTime = ((double)tv.tv_sec * 10) + ((double)tv.tv_usec / 100000);
|
||||
*timedOut = (newTime - *oldTime > this->settings->delay);
|
||||
*rescan = *rescan || *timedOut;
|
||||
if (newTime < *oldTime) *rescan = true; // clock was adjusted?
|
||||
*rescan |= *timedOut;
|
||||
|
||||
if (newTime < *oldTime) {
|
||||
*rescan = true; // clock was adjusted?
|
||||
}
|
||||
|
||||
if (*rescan) {
|
||||
*oldTime = newTime;
|
||||
ProcessList_scan(pl, this->state->pauseProcessUpdate);
|
||||
@ -134,8 +138,9 @@ static void ScreenManager_drawPanels(ScreenManager* this, int focus) {
|
||||
|
||||
static Panel* setCurrentPanel(const ScreenManager* this, Panel* panel) {
|
||||
FunctionBar_draw(panel->currentBar);
|
||||
if (panel == this->state->panel && this->state->pauseProcessUpdate)
|
||||
if (panel == this->state->panel && this->state->pauseProcessUpdate) {
|
||||
FunctionBar_append("PAUSED", CRT_colors[PAUSED]);
|
||||
}
|
||||
|
||||
return panel;
|
||||
}
|
||||
@ -218,8 +223,9 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||
if (closeTimeout == 100) {
|
||||
break;
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
closeTimeout = 0;
|
||||
}
|
||||
redraw = false;
|
||||
continue;
|
||||
}
|
||||
@ -261,14 +267,21 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||
if (this->panelCount < 2) {
|
||||
goto defaultHandler;
|
||||
}
|
||||
if (!this->allowFocusChange)
|
||||
|
||||
if (!this->allowFocusChange) {
|
||||
break;
|
||||
tryLeft:
|
||||
if (focus > 0)
|
||||
}
|
||||
|
||||
tryLeft:
|
||||
if (focus > 0) {
|
||||
focus--;
|
||||
}
|
||||
|
||||
panelFocus = setCurrentPanel(this, (Panel*) Vector_get(this->panels, focus));
|
||||
if (Panel_size(panelFocus) == 0 && focus > 0)
|
||||
if (Panel_size(panelFocus) == 0 && focus > 0) {
|
||||
goto tryLeft;
|
||||
}
|
||||
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
case KEY_CTRL('F'):
|
||||
@ -276,14 +289,20 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||
if (this->panelCount < 2) {
|
||||
goto defaultHandler;
|
||||
}
|
||||
if (!this->allowFocusChange)
|
||||
if (!this->allowFocusChange) {
|
||||
break;
|
||||
tryRight:
|
||||
if (focus < this->panelCount - 1)
|
||||
}
|
||||
|
||||
tryRight:
|
||||
if (focus < this->panelCount - 1) {
|
||||
focus++;
|
||||
}
|
||||
|
||||
panelFocus = setCurrentPanel(this, (Panel*) Vector_get(this->panels, focus));
|
||||
if (Panel_size(panelFocus) == 0 && focus < this->panelCount - 1)
|
||||
if (Panel_size(panelFocus) == 0 && focus < this->panelCount - 1) {
|
||||
goto tryRight;
|
||||
}
|
||||
|
||||
break;
|
||||
case KEY_F(10):
|
||||
case 'q':
|
||||
@ -291,15 +310,18 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||
quit = true;
|
||||
continue;
|
||||
default:
|
||||
defaultHandler:
|
||||
defaultHandler:
|
||||
sortTimeout = resetSortTimeout;
|
||||
Panel_onKey(panelFocus, ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lastFocus)
|
||||
if (lastFocus) {
|
||||
*lastFocus = panelFocus;
|
||||
if (lastKey)
|
||||
}
|
||||
|
||||
if (lastKey) {
|
||||
*lastKey = ch;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user