aboutsummaryrefslogtreecommitdiffstats
path: root/ScreenManager.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2023-02-05 04:25:56 +0100
committerDaniel Lange <DLange@git.local>2023-02-05 04:25:56 +0100
commitf288666edc9180a2e81e6655951878124f321df6 (patch)
treeda70bf44b2423f6f8e9a070c063fed79d190b489 /ScreenManager.c
parent937052b231259a47d881d539ad5748245ef55b99 (diff)
downloaddebian_htop-f288666edc9180a2e81e6655951878124f321df6.tar.gz
debian_htop-f288666edc9180a2e81e6655951878124f321df6.tar.bz2
debian_htop-f288666edc9180a2e81e6655951878124f321df6.zip
New upstream version 3.2.2upstream/3.2.2
Diffstat (limited to 'ScreenManager.c')
-rw-r--r--ScreenManager.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/ScreenManager.c b/ScreenManager.c
index e4b04bd..55cacd2 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -24,7 +24,7 @@ in the source distribution for its full text.
#include "XUtils.h"
-ScreenManager* ScreenManager_new(Header* header, const Settings* settings, const State* state, bool owner) {
+ScreenManager* ScreenManager_new(Header* header, const Settings* settings, State* state, bool owner) {
ScreenManager* this;
this = xMalloc(sizeof(ScreenManager));
this->x1 = 0;
@@ -53,18 +53,28 @@ void ScreenManager_add(ScreenManager* this, Panel* item, int size) {
ScreenManager_insert(this, item, size, Vector_size(this->panels));
}
+static int header_height(const ScreenManager* this) {
+ if (this->state->hideMeters)
+ return 0;
+
+ if (this->header)
+ return this->header->height;
+
+ return 0;
+}
+
void ScreenManager_insert(ScreenManager* this, Panel* item, int size, int idx) {
int lastX = 0;
if (idx > 0) {
const Panel* last = (const Panel*) Vector_get(this->panels, idx - 1);
lastX = last->x + last->w + 1;
}
- int height = LINES - this->y1 - (this->header ? this->header->height : 0) + this->y2;
+ int height = LINES - this->y1 - header_height(this) + this->y2;
if (size <= 0) {
size = COLS - this->x1 + this->x2 - lastX;
}
Panel_resize(item, size, height);
- Panel_move(item, lastX, this->y1 + (this->header ? this->header->height : 0));
+ Panel_move(item, lastX, this->y1 + header_height(this));
if (idx < this->panelCount) {
for (int i = idx + 1; i <= this->panelCount; i++) {
Panel* p = (Panel*) Vector_get(this->panels, i);
@@ -91,7 +101,7 @@ Panel* ScreenManager_remove(ScreenManager* this, int idx) {
}
void ScreenManager_resize(ScreenManager* this) {
- int y1_header = this->y1 + (this->header ? this->header->height : 0);
+ int y1_header = this->y1 + header_height(this);
int panels = this->panelCount;
int lastX = 0;
for (int i = 0; i < panels - 1; i++) {
@@ -105,7 +115,7 @@ void ScreenManager_resize(ScreenManager* this) {
Panel_move(panel, lastX, y1_header);
}
-static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTimeout, bool* redraw, bool* rescan, bool* timedOut, bool *force_redraw) {
+static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTimeout, bool* redraw, bool* rescan, bool* timedOut, bool* force_redraw) {
ProcessList* pl = this->header->pl;
Platform_gettime_realtime(&pl->realtime, &pl->realtimeMs);
@@ -137,7 +147,8 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
}
if (*redraw) {
ProcessList_rebuildPanel(pl);
- Header_draw(this->header);
+ if (!this->state->hideMeters)
+ Header_draw(this->header);
}
*rescan = false;
}
@@ -376,6 +387,11 @@ tryRight:
}
break;
+ case '#':
+ this->state->hideMeters = !this->state->hideMeters;
+ ScreenManager_resize(this);
+ force_redraw = true;
+ break;
case 27:
case 'q':
case KEY_F(10):

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