Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
1084a3ff
Commit
1084a3ff
authored
Mar 22, 2015
by
Hisham Muhammad
Browse files
Working on integration of IncSet in new branch.
parent
09c71529
Changes
6
Show whitespace changes
Inline
Side-by-side
Action.c
View file @
1084a3ff
...
@@ -52,7 +52,6 @@ typedef enum {
...
@@ -52,7 +52,6 @@ typedef enum {
typedef Htop_Reaction (*Htop_Action)();
typedef Htop_Reaction (*Htop_Action)();
typedef struct State_ {
typedef struct State_ {
IncSet* inc;
Settings* settings;
Settings* settings;
UsersTable* ut;
UsersTable* ut;
ProcessList* pl;
ProcessList* pl;
...
@@ -225,12 +224,14 @@ static Htop_Reaction actionToggleTreeView(State* st) {
...
@@ -225,12 +224,14 @@ static Htop_Reaction actionToggleTreeView(State* st) {
}
}
static
Htop_Reaction
actionIncFilter
(
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
;
return
HTOP_REFRESH
|
HTOP_KEEP_FOLLOWING
;
}
}
static
Htop_Reaction
actionIncSearch
(
State
*
st
)
{
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
;
return
HTOP_REFRESH
|
HTOP_KEEP_FOLLOWING
;
}
}
...
...
Action.h
View file @
1084a3ff
...
@@ -31,7 +31,6 @@ typedef enum {
...
@@ -31,7 +31,6 @@ typedef enum {
typedef
Htop_Reaction
(
*
Htop_Action
)();
typedef
Htop_Reaction
(
*
Htop_Action
)();
typedef
struct
State_
{
typedef
struct
State_
{
IncSet
*
inc
;
Settings
*
settings
;
Settings
*
settings
;
UsersTable
*
ut
;
UsersTable
*
ut
;
ProcessList
*
pl
;
ProcessList
*
pl
;
...
...
MainPanel.c
View file @
1084a3ff
...
@@ -20,6 +20,7 @@ in the source distribution for its full text.
...
@@ -20,6 +20,7 @@ in the source distribution for its full text.
typedef struct MainPanel_ {
typedef struct MainPanel_ {
Panel super;
Panel super;
State* state;
State* state;
IncSet* inc;
FunctionBar* fuBar;
FunctionBar* fuBar;
Htop_Action *keys;
Htop_Action *keys;
pid_t pidSearch;
pid_t pidSearch;
...
@@ -65,7 +66,13 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
...
@@ -65,7 +66,13 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
if
(
ch
==
27
)
{
if
(
ch
==
27
)
{
return
HANDLED
;
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
);
reaction
|=
(
this
->
keys
[
ch
])(
this
->
state
);
result
=
HANDLED
;
result
=
HANDLED
;
}
else
if
(
isdigit
(
ch
))
{
}
else
if
(
isdigit
(
ch
))
{
...
@@ -92,7 +99,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
...
@@ -92,7 +99,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
if
(
reaction
&
HTOP_REDRAW_BAR
)
{
if
(
reaction
&
HTOP_REDRAW_BAR
)
{
MainPanel_updateTreeFunctions
(
this
->
fuBar
,
this
->
state
->
settings
->
treeView
);
MainPanel_updateTreeFunctions
(
this
->
fuBar
,
this
->
state
->
settings
->
treeView
);
IncSet_drawBar
(
this
->
state
->
inc
);
IncSet_drawBar
(
this
->
inc
);
}
}
if
(
reaction
&
HTOP_UPDATE_PANELHDR
)
{
if
(
reaction
&
HTOP_UPDATE_PANELHDR
)
{
ProcessList_printHeader
(
this
->
state
->
pl
,
Panel_getHeader
(
super
));
ProcessList_printHeader
(
this
->
state
->
pl
,
Panel_getHeader
(
super
));
...
@@ -163,6 +170,7 @@ MainPanel* MainPanel_new(FunctionBar* fuBar) {
...
@@ -163,6 +170,7 @@ MainPanel* MainPanel_new(FunctionBar* fuBar) {
Panel_init
((
Panel
*
)
this
,
1
,
1
,
1
,
1
,
Class
(
Process
),
false
);
Panel_init
((
Panel
*
)
this
,
1
,
1
,
1
,
1
,
Class
(
Process
),
false
);
this
->
keys
=
calloc
(
KEY_MAX
,
sizeof
(
Htop_Action
));
this
->
keys
=
calloc
(
KEY_MAX
,
sizeof
(
Htop_Action
));
this
->
fuBar
=
fuBar
;
this
->
fuBar
=
fuBar
;
this
->
inc
=
IncSet_new
(
fuBar
);
Action_setBindings
(
this
->
keys
);
Action_setBindings
(
this
->
keys
);
Platform_setBindings
(
this
->
keys
);
Platform_setBindings
(
this
->
keys
);
...
@@ -178,6 +186,7 @@ void MainPanel_delete(Object* object) {
...
@@ -178,6 +186,7 @@ void MainPanel_delete(Object* object) {
Panel
*
super
=
(
Panel
*
)
object
;
Panel
*
super
=
(
Panel
*
)
object
;
MainPanel
*
this
=
(
MainPanel
*
)
object
;
MainPanel
*
this
=
(
MainPanel
*
)
object
;
Panel_done
(
super
);
Panel_done
(
super
);
IncSet_delete
(
this
->
inc
);
free
(
this
->
keys
);
free
(
this
->
keys
);
free
(
this
);
free
(
this
);
}
}
MainPanel.h
View file @
1084a3ff
...
@@ -16,6 +16,7 @@ in the source distribution for its full text.
...
@@ -16,6 +16,7 @@ in the source distribution for its full text.
typedef
struct
MainPanel_
{
typedef
struct
MainPanel_
{
Panel
super
;
Panel
super
;
State
*
state
;
State
*
state
;
IncSet
*
inc
;
FunctionBar
*
fuBar
;
FunctionBar
*
fuBar
;
Htop_Action
*
keys
;
Htop_Action
*
keys
;
pid_t
pidSearch
;
pid_t
pidSearch
;
...
...
ScreenManager.c
View file @
1084a3ff
...
@@ -149,7 +149,6 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
...
@@ -149,7 +149,6 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
*
redraw
=
true
;
*
redraw
=
true
;
}
}
if
(
*
redraw
)
{
if
(
*
redraw
)
{
//pl->incFilter = IncSet_filter(inc);
ProcessList_rebuildPanel
(
pl
);
ProcessList_rebuildPanel
(
pl
);
Header_draw
(
this
->
header
);
Header_draw
(
this
->
header
);
}
}
...
@@ -195,13 +194,12 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
...
@@ -195,13 +194,12 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
if
(
redraw
)
{
if
(
redraw
)
{
ScreenManager_drawPanels
(
this
,
focus
);
ScreenManager_drawPanels
(
this
,
focus
);
}
FunctionBar
*
bar
=
(
FunctionBar
*
)
Vector_get
(
this
->
fuBars
,
focus
);
FunctionBar
*
bar
=
(
FunctionBar
*
)
Vector_get
(
this
->
fuBars
,
focus
);
if
(
bar
)
if
(
bar
)
this
->
fuBar
=
bar
;
this
->
fuBar
=
bar
;
if
(
this
->
fuBar
)
if
(
this
->
fuBar
)
FunctionBar_draw
(
this
->
fuBar
,
NULL
);
FunctionBar_draw
(
this
->
fuBar
,
NULL
);
}
int
prevCh
=
ch
;
int
prevCh
=
ch
;
ch
=
getch
();
ch
=
getch
();
...
...
htop.c
View file @
1084a3ff
...
@@ -233,10 +233,7 @@ int main(int argc, char** argv) {
...
@@ -233,10 +233,7 @@ int main(int argc, char** argv) {
}
}
ProcessList_printHeader
(
pl
,
Panel_getHeader
((
Panel
*
)
panel
));
ProcessList_printHeader
(
pl
,
Panel_getHeader
((
Panel
*
)
panel
));
IncSet
*
inc
=
IncSet_new
(
defaultBar
);
State
state
=
{
State
state
=
{
.
inc
=
inc
,
.
settings
=
settings
,
.
settings
=
settings
,
.
ut
=
ut
,
.
ut
=
ut
,
.
pl
=
pl
,
.
pl
=
pl
,
...
@@ -460,7 +457,6 @@ int main(int argc, char** argv) {
...
@@ -460,7 +457,6 @@ int main(int argc, char** argv) {
ScreenManager_delete
(
scr
);
ScreenManager_delete
(
scr
);
IncSet_delete
(
inc
);
UsersTable_delete
(
ut
);
UsersTable_delete
(
ut
);
Settings_delete
(
settings
);
Settings_delete
(
settings
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment