aboutsummaryrefslogtreecommitdiffstats
path: root/ScreenManager.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:29 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:29 +0200
commiteaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95 (patch)
tree833f3fae6e3604a439f909c245a6e35f574997d7 /ScreenManager.c
parent283707c5e5bc436b78ea23bf5500cb6b16a01148 (diff)
downloaddebian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.tar.gz
debian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.tar.bz2
debian_htop-eaf11cc12a1aa4b050a8a1e7ea3770d3d9c81e95.zip
Imported Upstream version 1.0upstream/1.0
Diffstat (limited to 'ScreenManager.c')
-rw-r--r--ScreenManager.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/ScreenManager.c b/ScreenManager.c
index 2be94f6..38d4e23 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -1,6 +1,6 @@
/*
htop
-(C) 2004-2010 Hisham H. Muhammad
+(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
@@ -9,10 +9,12 @@ in the source distribution for its full text.
#include "Panel.h"
#include "Object.h"
#include "Vector.h"
+#include "Header.h"
#include "FunctionBar.h"
#include "debug.h"
#include <assert.h>
+#include <time.h>
#include <stdbool.h>
@@ -32,13 +34,15 @@ typedef struct ScreenManager_ {
Vector* items;
Vector* fuBars;
int itemCount;
- FunctionBar* fuBar;
+ const FunctionBar* fuBar;
+ const Header* header;
+ time_t lastScan;
bool owner;
} ScreenManager;
}*/
-ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, bool owner) {
+ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, const Header* header, bool owner) {
ScreenManager* this;
this = malloc(sizeof(ScreenManager));
this->x1 = x1;
@@ -50,6 +54,7 @@ ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation ori
this->items = Vector_new(PANEL_CLASS, owner, DEFAULT_SIZE, NULL);
this->fuBars = Vector_new(FUNCTIONBAR_CLASS, true, DEFAULT_SIZE, NULL);
this->itemCount = 0;
+ this->header = header;
this->owner = owner;
return this;
}
@@ -119,14 +124,24 @@ void ScreenManager_resize(ScreenManager* this, int x1, int y1, int x2, int y2) {
void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
bool quit = false;
int focus = 0;
-
+
Panel* panelFocus = (Panel*) Vector_get(this->items, focus);
if (this->fuBar)
FunctionBar_draw(this->fuBar, NULL);
+ this->lastScan = 0;
+
int ch = 0;
while (!quit) {
int items = this->itemCount;
+ if (this->header) {
+ time_t now = time(NULL);
+ if (now > this->lastScan) {
+ ProcessList_scan(this->header->pl);
+ this->lastScan = now;
+ }
+ Header_draw(this->header);
+ }
for (int i = 0; i < items; i++) {
Panel* panel = (Panel*) Vector_get(this->items, i);
Panel_draw(panel, i == focus);

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