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
d0c72c3f
Commit
d0c72c3f
authored
Mar 23, 2015
by
Hisham Muhammad
Browse files
Move FunctionBar inside Panel
parent
1084a3ff
Changes
27
Show whitespace changes
Inline
Side-by-side
ScreenManager.h
View file @
d0c72c3f
...
@@ -27,9 +27,7 @@ typedef struct ScreenManager_ {
...
@@ -27,9 +27,7 @@ typedef struct ScreenManager_ {
int
y2
;
int
y2
;
Orientation
orientation
;
Orientation
orientation
;
Vector
*
panels
;
Vector
*
panels
;
Vector
*
fuBars
;
int
panelCount
;
int
panelCount
;
const
FunctionBar
*
fuBar
;
const
Header
*
header
;
const
Header
*
header
;
const
Settings
*
settings
;
const
Settings
*
settings
;
bool
owner
;
bool
owner
;
...
@@ -43,7 +41,7 @@ void ScreenManager_delete(ScreenManager* this);
...
@@ -43,7 +41,7 @@ void ScreenManager_delete(ScreenManager* this);
extern
int
ScreenManager_size
(
ScreenManager
*
this
);
extern
int
ScreenManager_size
(
ScreenManager
*
this
);
void
ScreenManager_add
(
ScreenManager
*
this
,
Panel
*
item
,
FunctionBar
*
fuBar
,
int
size
);
void
ScreenManager_add
(
ScreenManager
*
this
,
Panel
*
item
,
int
size
);
Panel
*
ScreenManager_remove
(
ScreenManager
*
this
,
int
idx
);
Panel
*
ScreenManager_remove
(
ScreenManager
*
this
,
int
idx
);
...
...
SignalsPanel.c
View file @
d0c72c3f
...
@@ -62,8 +62,12 @@ static SignalItem signals[] = {
...
@@ -62,8 +62,12 @@ static SignalItem signals[] = {
{
.
name
=
"31 SIGSYS"
,
.
number
=
31
},
{
.
name
=
"31 SIGSYS"
,
.
number
=
31
},
};
};
static
const
char
*
SignalsFunctions
[]
=
{
"Send "
,
"Cancel "
,
NULL
};
static
const
char
*
SignalsKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
SignalsEvents
[]
=
{
13
,
27
};
Panel
*
SignalsPanel_new
()
{
Panel
*
SignalsPanel_new
()
{
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
));
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
)
,
FunctionBar_new
(
SignalsFunctions
,
SignalsKeys
,
SignalsEvents
)
);
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
signals
)
/
sizeof
(
SignalItem
);
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
signals
)
/
sizeof
(
SignalItem
);
i
++
)
Panel_set
(
this
,
i
,
(
Object
*
)
ListItem_new
(
signals
[
i
].
name
,
signals
[
i
].
number
));
Panel_set
(
this
,
i
,
(
Object
*
)
ListItem_new
(
signals
[
i
].
name
,
signals
[
i
].
number
));
Panel_setHeader
(
this
,
"Send signal:"
);
Panel_setHeader
(
this
,
"Send signal:"
);
...
...
TraceScreen.c
View file @
d0c72c3f
...
@@ -12,6 +12,7 @@ in the source distribution for its full text.
...
@@ -12,6 +12,7 @@ in the source distribution for its full text.
#include "ListItem.h"
#include "ListItem.h"
#include "IncSet.h"
#include "IncSet.h"
#include "String.h"
#include "String.h"
#include "FunctionBar.h"
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -27,7 +28,6 @@ in the source distribution for its full text.
...
@@ -27,7 +28,6 @@ in the source distribution for its full text.
/*{
/*{
#include "Process.h"
#include "Process.h"
#include "Panel.h"
#include "Panel.h"
#include "FunctionBar.h"
typedef struct TraceScreen_ {
typedef struct TraceScreen_ {
Process* process;
Process* process;
...
@@ -37,16 +37,17 @@ typedef struct TraceScreen_ {
...
@@ -37,16 +37,17 @@ typedef struct TraceScreen_ {
}*/
}*/
static
const
char
*
ts
Functions
[]
=
{
"Search "
,
"Filter "
,
"AutoScroll "
,
"Stop Tracing "
,
"Done "
,
NULL
};
static
const
char
*
TraceScreen
Functions
[]
=
{
"Search "
,
"Filter "
,
"AutoScroll "
,
"Stop Tracing "
,
"Done "
,
NULL
};
static
const
char
*
ts
Keys
[]
=
{
"F3"
,
"F4"
,
"F8"
,
"F9"
,
"Esc"
};
static
const
char
*
TraceScreen
Keys
[]
=
{
"F3"
,
"F4"
,
"F8"
,
"F9"
,
"Esc"
};
static
int
ts
Events
[]
=
{
KEY_F
(
3
),
KEY_F
(
4
),
KEY_F
(
8
),
KEY_F
(
9
),
27
};
static
int
TraceScreen
Events
[]
=
{
KEY_F
(
3
),
KEY_F
(
4
),
KEY_F
(
8
),
KEY_F
(
9
),
27
};
TraceScreen
*
TraceScreen_new
(
Process
*
process
)
{
TraceScreen
*
TraceScreen_new
(
Process
*
process
)
{
TraceScreen
*
this
=
(
TraceScreen
*
)
malloc
(
sizeof
(
TraceScreen
));
TraceScreen
*
this
=
(
TraceScreen
*
)
malloc
(
sizeof
(
TraceScreen
));
this
->
process
=
process
;
this
->
process
=
process
;
this
->
display
=
Panel_new
(
0
,
1
,
COLS
,
LINES
-
2
,
false
,
Class
(
ListItem
));
FunctionBar
*
fuBar
=
FunctionBar_new
(
TraceScreenFunctions
,
TraceScreenKeys
,
TraceScreenEvents
);
this
->
display
=
Panel_new
(
0
,
1
,
COLS
,
LINES
-
2
,
false
,
Class
(
ListItem
),
fuBar
);
this
->
tracing
=
true
;
this
->
tracing
=
true
;
return
this
;
return
this
;
}
}
...
@@ -105,7 +106,7 @@ void TraceScreen_run(TraceScreen* this) {
...
@@ -105,7 +106,7 @@ void TraceScreen_run(TraceScreen* this) {
bool
follow
=
false
;
bool
follow
=
false
;
bool
looping
=
true
;
bool
looping
=
true
;
FunctionBar
*
bar
=
FunctionBar_new
(
tsFunctions
,
tsKeys
,
tsEvents
)
;
FunctionBar
*
bar
=
panel
->
defaultBar
;
IncSet
*
inc
=
IncSet_new
(
bar
);
IncSet
*
inc
=
IncSet_new
(
bar
);
Vector
*
lines
=
Vector_new
(
panel
->
items
->
type
,
true
,
DEFAULT_SIZE
);
Vector
*
lines
=
Vector_new
(
panel
->
items
->
type
,
true
,
DEFAULT_SIZE
);
...
@@ -219,7 +220,6 @@ void TraceScreen_run(TraceScreen* this) {
...
@@ -219,7 +220,6 @@ void TraceScreen_run(TraceScreen* this) {
}
}
IncSet_delete
(
inc
);
IncSet_delete
(
inc
);
FunctionBar_delete
((
Object
*
)
bar
);
Vector_delete
(
lines
);
Vector_delete
(
lines
);
kill
(
child
,
SIGTERM
);
kill
(
child
,
SIGTERM
);
...
...
TraceScreen.h
View file @
d0c72c3f
...
@@ -11,7 +11,6 @@ in the source distribution for its full text.
...
@@ -11,7 +11,6 @@ in the source distribution for its full text.
#include "Process.h"
#include "Process.h"
#include "Panel.h"
#include "Panel.h"
#include "FunctionBar.h"
typedef
struct
TraceScreen_
{
typedef
struct
TraceScreen_
{
Process
*
process
;
Process
*
process
;
...
...
htop.c
View file @
d0c72c3f
...
@@ -35,8 +35,6 @@ static void printVersionFlag() {
...
@@ -35,8 +35,6 @@ static void printVersionFlag() {
exit
(
0
);
exit
(
0
);
}
}
static
const
char
*
defaultFunctions
[]
=
{
"Help "
,
"Setup "
,
"Search"
,
"Filter"
,
"Tree "
,
"SortBy"
,
"Nice -"
,
"Nice +"
,
"Kill "
,
"Quit "
,
NULL
};
static
void
printHelpFlag
()
{
static
void
printHelpFlag
()
{
fputs
(
"htop "
VERSION
" - "
COPYRIGHT
"
\n
"
fputs
(
"htop "
VERSION
" - "
COPYRIGHT
"
\n
"
"Released under the GNU GPL.
\n\n
"
"Released under the GNU GPL.
\n\n
"
...
@@ -219,12 +217,10 @@ int main(int argc, char** argv) {
...
@@ -219,12 +217,10 @@ int main(int argc, char** argv) {
CRT_init
(
settings
->
delay
,
settings
->
colorScheme
);
CRT_init
(
settings
->
delay
,
settings
->
colorScheme
);
FunctionBar
*
defaultBar
=
FunctionBar_new
(
defaultFunctions
,
NULL
,
NULL
);
MainPanel
*
panel
=
MainPanel_new
();
MainPanel
*
panel
=
MainPanel_new
(
defaultBar
);
ProcessList_setPanel
(
pl
,
(
Panel
*
)
panel
);
ProcessList_setPanel
(
pl
,
(
Panel
*
)
panel
);
MainPanel_updateTreeFunctions
(
defaultBar
,
settings
->
treeView
);
MainPanel_updateTreeFunctions
(
panel
,
settings
->
treeView
);
if
(
flags
.
sortKey
>
0
)
{
if
(
flags
.
sortKey
>
0
)
{
settings
->
sortKey
=
flags
.
sortKey
;
settings
->
sortKey
=
flags
.
sortKey
;
...
@@ -243,7 +239,7 @@ int main(int argc, char** argv) {
...
@@ -243,7 +239,7 @@ int main(int argc, char** argv) {
MainPanel_setState
(
panel
,
&
state
);
MainPanel_setState
(
panel
,
&
state
);
ScreenManager
*
scr
=
ScreenManager_new
(
0
,
header
->
height
,
0
,
-
1
,
HORIZONTAL
,
header
,
settings
,
true
);
ScreenManager
*
scr
=
ScreenManager_new
(
0
,
header
->
height
,
0
,
-
1
,
HORIZONTAL
,
header
,
settings
,
true
);
ScreenManager_add
(
scr
,
(
Panel
*
)
panel
,
defaultBar
,
-
1
);
ScreenManager_add
(
scr
,
(
Panel
*
)
panel
,
-
1
);
ProcessList_scan
(
pl
);
ProcessList_scan
(
pl
);
millisleep
(
75
);
millisleep
(
75
);
...
...
linux/IOPriorityPanel.c
View file @
d0c72c3f
...
@@ -13,8 +13,13 @@ in the source distribution for its full text.
...
@@ -13,8 +13,13 @@ in the source distribution for its full text.
#include "ListItem.h"
#include "ListItem.h"
}*/
}*/
static
const
char
*
IOPriorityFunctions
[]
=
{
"Set "
,
"Cancel "
,
NULL
};
static
const
char
*
IOPriorityKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
IOPriorityEvents
[]
=
{
13
,
27
};
Panel
*
IOPriorityPanel_new
(
IOPriority
currPrio
)
{
Panel
*
IOPriorityPanel_new
(
IOPriority
currPrio
)
{
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
));
FunctionBar
*
fuBar
=
FunctionBar_new
(
IOPriorityFunctions
,
IOPriorityKeys
,
IOPriorityEvents
);
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
),
fuBar
);
Panel_setHeader
(
this
,
"IO Priority:"
);
Panel_setHeader
(
this
,
"IO Priority:"
);
Panel_add
(
this
,
(
Object
*
)
ListItem_new
(
"None (based on nice)"
,
IOPriority_None
));
Panel_add
(
this
,
(
Object
*
)
ListItem_new
(
"None (based on nice)"
,
IOPriority_None
));
...
...
linux/Platform.c
View file @
d0c72c3f
...
@@ -46,8 +46,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
...
@@ -46,8 +46,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
if
(
!
p
)
return
HTOP_OK
;
if
(
!
p
)
return
HTOP_OK
;
IOPriority
ioprio
=
p
->
ioPriority
;
IOPriority
ioprio
=
p
->
ioPriority
;
Panel
*
ioprioPanel
=
IOPriorityPanel_new
(
ioprio
);
Panel
*
ioprioPanel
=
IOPriorityPanel_new
(
ioprio
);
const
char
*
fuFunctions
[]
=
{
"Set "
,
"Cancel "
,
NULL
};
void
*
set
=
Action_pickFromVector
(
st
,
ioprioPanel
,
21
);
void
*
set
=
Action_pickFromVector
(
st
,
ioprioPanel
,
21
,
fuFunctions
);
if
(
set
)
{
if
(
set
)
{
IOPriority
ioprio
=
IOPriorityPanel_getIOPriority
(
ioprioPanel
);
IOPriority
ioprio
=
IOPriorityPanel_getIOPriority
(
ioprioPanel
);
bool
ok
=
MainPanel_foreachProcess
((
MainPanel
*
)
panel
,
(
MainPanel_ForeachProcessFn
)
LinuxProcess_setIOPriority
,
(
size_t
)
ioprio
,
NULL
);
bool
ok
=
MainPanel_foreachProcess
((
MainPanel
*
)
panel
,
(
MainPanel_ForeachProcessFn
)
LinuxProcess_setIOPriority
,
(
size_t
)
ioprio
,
NULL
);
...
...
Prev
1
2
Next
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