summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-03-22 22:39:33 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-03-22 22:39:33 -0300
commit1084a3ff8faf3aa98e8e9fbdab97a08a2c40482e (patch)
treeb2edc9cc57549ab4d98b107d159d6a6d21a200b4
parent09c7152990b6fd269ac0a023e2093dcf041e2f9d (diff)
Working on integration of IncSet in new branch.
-rw-r--r--Action.c7
-rw-r--r--Action.h1
-rw-r--r--MainPanel.c13
-rw-r--r--MainPanel.h1
-rw-r--r--ScreenManager.c12
-rw-r--r--htop.c4
6 files changed, 21 insertions, 17 deletions
diff --git a/Action.c b/Action.c
index 02329f7b..adc6ed98 100644
--- a/Action.c
+++ b/Action.c
@@ -52,7 +52,6 @@ typedef enum {
typedef Htop_Reaction (*Htop_Action)();
typedef struct State_ {
- IncSet* inc;
Settings* settings;
UsersTable* ut;
ProcessList* pl;
@@ -225,12 +224,14 @@ static Htop_Reaction actionToggleTreeView(State* st) {
}
static Htop_Reaction actionIncFilter(State* st) {
- IncSet_activate(st->inc, INC_FILTER);
+ IncSet* inc = ((MainPanel*)st->panel)->inc;
+ IncSet_activate(inc, INC_FILTER);
+ st->pl->incFilter = IncSet_filter(inc);
return HTOP_REFRESH | HTOP_KEEP_FOLLOWING;
}
static Htop_Reaction actionIncSearch(State* st) {
- IncSet_activate(st->inc, INC_SEARCH);
+ IncSet_activate(((MainPanel*)st->panel)->inc, INC_SEARCH);
return HTOP_REFRESH | HTOP_KEEP_FOLLOWING;
}
diff --git a/Action.h b/Action.h
index dd11fdb4..4228349c 100644
--- a/Action.h
+++ b/Action.h
@@ -31,7 +31,6 @@ typedef enum {
typedef Htop_Reaction (*Htop_Action)();
typedef struct State_ {
- IncSet* inc;
Settings* settings;
UsersTable* ut;
ProcessList* pl;
diff --git a/MainPanel.c b/MainPanel.c
index 48855876..2b70bab2 100644
--- a/MainPanel.c
+++ b/MainPanel.c
@@ -20,6 +20,7 @@ in the source distribution for its full text.
typedef struct MainPanel_ {
Panel super;
State* state;
+ IncSet* inc;
FunctionBar* fuBar;
Htop_Action *keys;
pid_t pidSearch;
@@ -65,7 +66,13 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
if (ch == 27) {
return HANDLED;
}
- if(ch != ERR && this->keys[ch]) {
+ if (ch != ERR && this->inc->active) {
+ bool redraw = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL);
+ if (redraw) {
+ reaction = HTOP_REFRESH | HTOP_REDRAW_BAR;
+ }
+ reaction |= HTOP_KEEP_FOLLOWING;
+ } else if (ch != ERR && this->keys[ch]) {
reaction |= (this->keys[ch])(this->state);
result = HANDLED;
} else if (isdigit(ch)) {
@@ -92,7 +99,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
if (reaction & HTOP_REDRAW_BAR) {
MainPanel_updateTreeFunctions(this->fuBar, this->state->settings->treeView);
- IncSet_drawBar(this->state->inc);
+ IncSet_drawBar(this->inc);
}
if (reaction & HTOP_UPDATE_PANELHDR) {
ProcessList_printHeader(this->state->pl, Panel_getHeader(super));
@@ -163,6 +170,7 @@ MainPanel* MainPanel_new(FunctionBar* fuBar) {
Panel_init((Panel*) this, 1, 1, 1, 1, Class(Process), false);
this->keys = calloc(KEY_MAX, sizeof(Htop_Action));
this->fuBar = fuBar;
+ this->inc = IncSet_new(fuBar);
Action_setBindings(this->keys);
Platform_setBindings(this->keys);
@@ -178,6 +186,7 @@ void MainPanel_delete(Object* object) {
Panel* super = (Panel*) object;
MainPanel* this = (MainPanel*) object;
Panel_done(super);
+ IncSet_delete(this->inc);
free(this->keys);
free(this);
}
diff --git a/MainPanel.h b/MainPanel.h
index 830890e5..3ff41097 100644
--- a/MainPanel.h
+++ b/MainPanel.h
@@ -16,6 +16,7 @@ in the source distribution for its full text.
typedef struct MainPanel_ {
Panel super;
State* state;
+ IncSet* inc;
FunctionBar* fuBar;
Htop_Action *keys;
pid_t pidSearch;
diff --git a/ScreenManager.c b/ScreenManager.c
index 53e36d9f..2d55af07 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -149,7 +149,6 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
*redraw = true;
}
if (*redraw) {
- //pl->incFilter = IncSet_filter(inc);
ProcessList_rebuildPanel(pl);
Header_draw(this->header);
}
@@ -195,13 +194,12 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
if (redraw) {
ScreenManager_drawPanels(this, focus);
+ FunctionBar* bar = (FunctionBar*) Vector_get(this->fuBars, focus);
+ if (bar)
+ this->fuBar = bar;
+ if (this->fuBar)
+ FunctionBar_draw(this->fuBar, NULL);
}
-
- FunctionBar* bar = (FunctionBar*) Vector_get(this->fuBars, focus);
- if (bar)
- this->fuBar = bar;
- if (this->fuBar)
- FunctionBar_draw(this->fuBar, NULL);
int prevCh = ch;
ch = getch();
diff --git a/htop.c b/htop.c
index af2a5103..026e04b6 100644
--- a/htop.c
+++ b/htop.c
@@ -233,10 +233,7 @@ int main(int argc, char** argv) {
}
ProcessList_printHeader(pl, Panel_getHeader((Panel*)panel));
- IncSet* inc = IncSet_new(defaultBar);
-
State state = {
- .inc = inc,
.settings = settings,
.ut = ut,
.pl = pl,
@@ -460,7 +457,6 @@ int main(int argc, char** argv) {
ScreenManager_delete(scr);
- IncSet_delete(inc);
UsersTable_delete(ut);
Settings_delete(settings);

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