aboutsummaryrefslogtreecommitdiffstats
path: root/MetersPanel.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /MetersPanel.c
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'MetersPanel.c')
-rw-r--r--MetersPanel.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/MetersPanel.c b/MetersPanel.c
index 417834a..7e47ad8 100644
--- a/MetersPanel.c
+++ b/MetersPanel.c
@@ -1,15 +1,21 @@
/*
htop - MetersPanel.c
(C) 2004-2011 Hisham H. Muhammad
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "MetersPanel.h"
#include <stdlib.h>
-#include <assert.h>
+
#include "CRT.h"
+#include "FunctionBar.h"
+#include "Header.h"
+#include "ListItem.h"
+#include "Meter.h"
+#include "Object.h"
+#include "ProvideCurses.h"
// Note: In code the meters are known to have bar/text/graph "Modes", but in UI
@@ -27,6 +33,13 @@ static const char* const MetersMovingKeys[] = {"Space", "Enter", "Up", "Dn", "<-
static int MetersMovingEvents[] = {' ', 13, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, ERR, KEY_DC, KEY_F(10)};
static FunctionBar* Meters_movingBar = NULL;
+void MetersPanel_cleanup() {
+ if (Meters_movingBar) {
+ FunctionBar_delete(Meters_movingBar);
+ Meters_movingBar = NULL;
+ }
+}
+
static void MetersPanel_delete(Object* object) {
Panel* super = (Panel*) object;
MetersPanel* this = (MetersPanel*) object;
@@ -48,7 +61,7 @@ void MetersPanel_setMoving(MetersPanel* this, bool moving) {
Panel_setSelectionColor(super, CRT_colors[PANEL_SELECTION_FOLLOW]);
super->currentBar = Meters_movingBar;
}
- FunctionBar_draw(this->super.currentBar, NULL);
+ FunctionBar_draw(this->super.currentBar);
}
static inline bool moveToNeighbor(MetersPanel* this, MetersPanel* neighbor, int selected) {
@@ -170,7 +183,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
}
}
if (result == HANDLED || sideMove) {
- Header* header = (Header*) this->scr->header;
+ Header* header = this->scr->header;
this->settings->changed = true;
Header_calculateHeight(header);
Header_draw(header);
@@ -179,7 +192,7 @@ static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) {
return result;
}
-PanelClass MetersPanel_class = {
+const PanelClass MetersPanel_class = {
.super = {
.extends = Class(Panel),
.delete = MetersPanel_delete

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