@ -41,18 +41,18 @@ in the source distribution for its full text.
Object * Action_pickFromVector ( State * st , Panel * list , int x , bool followProcess ) {
Panel * p anel = st - > p anel;
Main Panel* mainP anel = st - > mainP anel;
Header * header = st - > header ;
int y = pan el- > y ;
int y = ( ( Pan el* ) mainPanel ) - > y ;
ScreenManager * scr = ScreenManager_new ( header , st - > settings , st , false ) ;
scr - > allowFocusChange = false ;
ScreenManager_add ( scr , list , x - 1 ) ;
ScreenManager_add ( scr , p anel, - 1 ) ;
ScreenManager_add ( scr , ( Panel * ) mainP anel, - 1 ) ;
Panel * panelFocus ;
int ch ;
bool unfollow = false ;
int pid = followProcess ? MainPanel_selectedPid ( ( MainPanel * ) p anel) : - 1 ;
int pid = followProcess ? MainPanel_selectedPid ( mainP anel) : - 1 ;
if ( followProcess & & header - > pl - > following = = - 1 ) {
header - > pl - > following = pid ;
unfollow = true ;
@ -62,11 +62,11 @@ Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess)
header - > pl - > following = - 1 ;
}
ScreenManager_delete ( scr ) ;
Panel_move ( p anel, 0 , y ) ;
Panel_resize ( p anel, COLS , LINES - y - 1 ) ;
Panel_move ( ( Panel * ) mainP anel, 0 , y ) ;
Panel_resize ( ( Panel * ) mainP anel, COLS , LINES - y - 1 ) ;
if ( panelFocus = = list & & ch = = 13 ) {
if ( followProcess ) {
const Process * selected = ( const Process * ) Panel_getSelected ( p anel) ;
const Process * selected = ( const Process * ) Panel_getSelected ( ( Panel * ) mainP anel) ;
if ( selected & & selected - > pid = = pid )
return Panel_getSelected ( list ) ;
@ -235,25 +235,25 @@ static Htop_Reaction actionToggleTreeView(State* st) {
}
static Htop_Reaction actionIncFilter ( State * st ) {
IncSet * inc = ( ( MainPanel * ) st - > p anel) - > inc ;
IncSet_activate ( inc , INC_FILTER , st - > p anel) ;
IncSet * inc = ( st - > mainP anel) - > inc ;
IncSet_activate ( inc , INC_FILTER , ( Panel * ) st - > mainP anel) ;
st - > pl - > incFilter = IncSet_filter ( inc ) ;
return HTOP_REFRESH | HTOP_KEEP_FOLLOWING ;
}
static Htop_Reaction actionIncSearch ( State * st ) {
IncSet_reset ( ( ( MainPanel * ) st - > panel ) - > inc , INC_SEARCH ) ;
IncSet_activate ( ( ( MainPanel * ) st - > panel ) - > inc , INC_SEARCH , st - > p anel) ;
IncSet_reset ( st - > mainPanel - > inc , INC_SEARCH ) ;
IncSet_activate ( st - > mainPanel - > inc , INC_SEARCH , ( Panel * ) st - > mainP anel) ;
return HTOP_REFRESH | HTOP_KEEP_FOLLOWING ;
}
static Htop_Reaction actionHigherPriority ( State * st ) {
bool changed = changePriority ( ( MainPanel * ) st - > p anel, - 1 ) ;
bool changed = changePriority ( st - > mainP anel, - 1 ) ;
return changed ? HTOP_REFRESH : HTOP_OK ;
}
static Htop_Reaction actionLowerPriority ( State * st ) {
bool changed = changePriority ( ( MainPanel * ) st - > p anel, 1 ) ;
bool changed = changePriority ( st - > mainP anel, 1 ) ;
return changed ? HTOP_REFRESH : HTOP_OK ;
}
@ -265,7 +265,7 @@ static Htop_Reaction actionInvertSortOrder(State* st) {
}
static Htop_Reaction actionExpandOrCollapse ( State * st ) {
bool changed = expandCollapse ( st - > p anel) ;
bool changed = expandCollapse ( ( Panel * ) st - > mainP anel) ;
return changed ? HTOP_RECALCULATE : HTOP_OK ;
}
@ -273,7 +273,7 @@ static Htop_Reaction actionCollapseIntoParent(State* st) {
if ( ! st - > settings - > treeView ) {
return HTOP_OK ;
}
bool changed = collapseIntoParent ( st - > p anel) ;
bool changed = collapseIntoParent ( ( Panel * ) st - > mainP anel) ;
return changed ? HTOP_RECALCULATE : HTOP_OK ;
}
@ -290,9 +290,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
return HTOP_OK ;
# if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
Panel * panel = st - > panel ;
const Process * p = ( const Process * ) Panel_getSelected ( panel ) ;
const Process * p = ( const Process * ) Panel_getSelected ( ( Panel * ) st - > mainPanel ) ;
if ( ! p )
return HTOP_OK ;
@ -308,7 +306,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
const void * set = Action_pickFromVector ( st , affinityPanel , width , true ) ;
if ( set ) {
Affinity * affinity2 = AffinityPanel_getAffinity ( affinityPanel , st - > pl ) ;
bool ok = MainPanel_foreachProcess ( ( MainPanel * ) p anel, Affinity_set , ( Arg ) { . v = affinity2 } , NULL ) ;
bool ok = MainPanel_foreachProcess ( st - > mainP anel, Affinity_set , ( Arg ) { . v = affinity2 } , NULL ) ;
if ( ! ok )
beep ( ) ;
Affinity_delete ( affinity2 ) ;
@ -323,10 +321,10 @@ static Htop_Reaction actionKill(State* st) {
const ListItem * sgn = ( ListItem * ) Action_pickFromVector ( st , signalsPanel , 15 , true ) ;
if ( sgn ) {
if ( sgn - > key ! = 0 ) {
Panel_setHeader ( st - > p anel, " Sending... " ) ;
Panel_draw ( st - > p anel, false , true , true , State_hideFunctionBar ( st ) ) ;
Panel_setHeader ( ( Panel * ) st - > mainP anel, " Sending... " ) ;
Panel_draw ( ( Panel * ) st - > mainP anel, false , true , true , State_hideFunctionBar ( st ) ) ;
refresh ( ) ;
MainPanel_foreachProcess ( ( MainPanel * ) st - > p anel, Process_sendSignal , ( Arg ) { . i = sgn - > key } , NULL ) ;
MainPanel_foreachProcess ( st - > mainP anel, Process_sendSignal , ( Arg ) { . i = sgn - > key } , NULL ) ;
napms ( 500 ) ;
}
}
@ -354,21 +352,21 @@ static Htop_Reaction actionFilterByUser(State* st) {
}
Htop_Reaction Action_follow ( State * st ) {
st - > pl - > following = MainPanel_selectedPid ( ( MainPanel * ) st - > p anel) ;
Panel_setSelectionColor ( st - > p anel, PANEL_SELECTION_FOLLOW ) ;
st - > pl - > following = MainPanel_selectedPid ( st - > mainP anel) ;
Panel_setSelectionColor ( ( Panel * ) st - > mainP anel, PANEL_SELECTION_FOLLOW ) ;
return HTOP_KEEP_FOLLOWING ;
}
static Htop_Reaction actionSetup ( State * st ) {
Action_runSetup ( st ) ;
int headerHeight = Header_calculateHeight ( st - > header ) ;
Panel_move ( st - > p anel, 0 , headerHeight ) ;
Panel_resize ( st - > p anel, COLS , LINES - headerHeight - 1 ) ;
Panel_move ( ( Panel * ) st - > mainP anel, 0 , headerHeight ) ;
Panel_resize ( ( Panel * ) st - > mainP anel, COLS , LINES - headerHeight - 1 ) ;
return HTOP_REFRESH | HTOP_REDRAW_BAR | HTOP_UPDATE_PANELHDR ;
}
static Htop_Reaction actionLsof ( State * st ) {
const Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
const Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;
@ -381,7 +379,7 @@ static Htop_Reaction actionLsof(State* st) {
}
static Htop_Reaction actionShowLocks ( State * st ) {
const Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
const Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p ) return HTOP_OK ;
ProcessLocksScreen * pls = ProcessLocksScreen_new ( p ) ;
InfoScreen_run ( ( InfoScreen * ) pls ) ;
@ -392,7 +390,7 @@ static Htop_Reaction actionShowLocks(State* st) {
}
static Htop_Reaction actionStrace ( State * st ) {
const Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
const Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;
@ -408,12 +406,12 @@ static Htop_Reaction actionStrace(State* st) {
}
static Htop_Reaction actionTag ( State * st ) {
Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;
Process_toggleTag ( p ) ;
Panel_onKey ( st - > p anel, KEY_DOWN ) ;
Panel_onKey ( ( Panel * ) st - > mainP anel, KEY_DOWN ) ;
return HTOP_OK ;
}
@ -582,24 +580,24 @@ static Htop_Reaction actionHelp(State* st) {
}
static Htop_Reaction actionUntagAll ( State * st ) {
for ( int i = 0 ; i < Panel_size ( st - > p anel) ; i + + ) {
Process * p = ( Process * ) Panel_get ( st - > p anel, i ) ;
for ( int i = 0 ; i < Panel_size ( ( Panel * ) st - > mainP anel) ; i + + ) {
Process * p = ( Process * ) Panel_get ( ( Panel * ) st - > mainP anel, i ) ;
p - > tag = false ;
}
return HTOP_REFRESH ;
}
static Htop_Reaction actionTagAllChildren ( State * st ) {
Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;
tagAllChildren ( st - > p anel, p ) ;
tagAllChildren ( ( Panel * ) st - > mainP anel, p ) ;
return HTOP_OK ;
}
static Htop_Reaction actionShowEnvScreen ( State * st ) {
Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;
@ -612,7 +610,7 @@ static Htop_Reaction actionShowEnvScreen(State* st) {
}
static Htop_Reaction actionShowCommandScreen ( State * st ) {
Process * p = ( Process * ) Panel_getSelected ( st - > p anel) ;
Process * p = ( Process * ) Panel_getSelected ( ( Panel * ) st - > mainP anel) ;
if ( ! p )
return HTOP_OK ;