aboutsummaryrefslogtreecommitdiffstats
path: root/Action.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2018-04-11 01:26:28 +0200
committerDaniel Lange <DLange@git.local>2018-04-11 01:26:28 +0200
commit097fb9e4a3460fe1b6b3fc645ef97acb44946141 (patch)
tree58ba6c6459b926f555a539fab1ec01ff4e93d9ce /Action.c
parent2f3c2439d8d88cf7c1ecef0bcb2b33f747f3ed06 (diff)
parentc60f4cf3c1d91bd786db8e081699f420f44631f3 (diff)
downloaddebian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.tar.gz
debian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.tar.bz2
debian_htop-097fb9e4a3460fe1b6b3fc645ef97acb44946141.zip
Updated version 2.2.0 from 'upstream/2.2.0'
with Debian dir ed195b175f9cd34e0ba2b22dfecc727ab25e1463
Diffstat (limited to 'Action.c')
-rw-r--r--Action.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/Action.c b/Action.c
index a6394ac..518d103 100644
--- a/Action.c
+++ b/Action.c
@@ -115,7 +115,7 @@ static void Action_runSetup(Settings* settings, const Header* header, ProcessLis
static bool changePriority(MainPanel* panel, int delta) {
bool anyTagged;
- bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, delta, &anyTagged);
+ bool ok = MainPanel_foreachProcess(panel, (MainPanel_ForeachProcessFn) Process_changePriorityBy, (Arg){ .i = delta }, &anyTagged);
if (!ok)
beep();
return anyTagged;
@@ -155,6 +155,21 @@ static bool expandCollapse(Panel* panel) {
return true;
}
+static bool collapseIntoParent(Panel* panel) {
+ Process* p = (Process*) Panel_getSelected(panel);
+ if (!p) return false;
+ pid_t ppid = Process_getParentPid(p);
+ for (int i = 0; i < Panel_size(panel); i++) {
+ Process* q = (Process*) Panel_get(panel, i);
+ if (q->pid == ppid) {
+ q->showChildren = false;
+ Panel_setSelected(panel, i);
+ return true;
+ }
+ }
+ return false;
+}
+
Htop_Reaction Action_setSortKey(Settings* settings, ProcessField sortKey) {
settings->sortKey = sortKey;
settings->direction = 1;
@@ -185,6 +200,7 @@ static Htop_Reaction sortBy(State* st) {
// ----------------------------------------
static Htop_Reaction actionResize(State* st) {
+ clear();
Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1);
return HTOP_REDRAW_BAR;
}
@@ -260,6 +276,14 @@ static Htop_Reaction actionExpandOrCollapse(State* st) {
return changed ? HTOP_RECALCULATE : HTOP_OK;
}
+static Htop_Reaction actionCollapseIntoParent(State* st) {
+ if (!st->settings->treeView) {
+ return HTOP_OK;
+ }
+ bool changed = collapseIntoParent(st->panel);
+ return changed ? HTOP_RECALCULATE : HTOP_OK;
+}
+
static Htop_Reaction actionExpandCollapseOrSortColumn(State* st) {
return st->settings->treeView ? actionExpandOrCollapse(st) : actionSetSortColumn(st);
}
@@ -284,7 +308,7 @@ static Htop_Reaction actionSetAffinity(State* st) {
void* set = Action_pickFromVector(st, affinityPanel, 15);
if (set) {
Affinity* affinity = AffinityPanel_getAffinity(affinityPanel, st->pl);
- bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (size_t) affinity, NULL);
+ bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) Affinity_set, (Arg){ .v = affinity }, NULL);
if (!ok) beep();
Affinity_delete(affinity);
}
@@ -301,7 +325,7 @@ static Htop_Reaction actionKill(State* st) {
Panel_setHeader(st->panel, "Sending...");
Panel_draw(st->panel, true);
refresh();
- MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (size_t) sgn->key, NULL);
+ MainPanel_foreachProcess((MainPanel*)st->panel, (MainPanel_ForeachProcessFn) Process_sendSignal, (Arg){ .i = sgn->key }, NULL);
napms(500);
}
}
@@ -556,6 +580,7 @@ void Action_setBindings(Htop_Action* keys) {
keys['+'] = actionExpandOrCollapse;
keys['='] = actionExpandOrCollapse;
keys['-'] = actionExpandOrCollapse;
+ keys['\177'] = actionCollapseIntoParent;
keys['u'] = actionFilterByUser;
keys['F'] = Action_follow;
keys['S'] = actionSetup;

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