summaryrefslogtreecommitdiffstats
path: root/ScreenManager.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-11-01 01:09:51 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commit45869513bfebba80cc2ab42e4218f68b34b1e6ac (patch)
treef064631dbff141bf1c945db8cff40b7bb82fd169 /ScreenManager.c
parent61e14d4bb25268593019e6df3eb02264b4ac8e0e (diff)
Embracing branches
Diffstat (limited to 'ScreenManager.c')
-rw-r--r--ScreenManager.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/ScreenManager.c b/ScreenManager.c
index f586d04a..b8e1713a 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -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;
+ }
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy