summaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2021-02-12 18:48:09 +0100
committerDaniel Lange <DLange@git.local>2021-02-13 16:47:04 +0100
commit2c6222e30a25a833e8554709818e1c378ca46848 (patch)
tree676239606f4fbc2fd6c11bf2b675edd9bd1cbdc1 /ProcessList.c
parentc44b2ec795d243126fd5a53169ec533f4a5b3bd0 (diff)
Option and key ("*") to collapse / expand all branches under PID 1
(and PID 2 if kernel threads are shown) Based on hishamhm/htop#510 by Krishna Chaitanya, B Closes #68
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 5e6e917b..dcfa05dc 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -494,6 +494,16 @@ void ProcessList_expandTree(ProcessList* this) {
}
}
+void ProcessList_collapseAllBranches(ProcessList* this) {
+ int size = Vector_size(this->processes);
+ for (int i = 0; i < size; i++) {
+ Process* process = (Process*) Vector_get(this->processes, i);
+ // FreeBSD has pid 0 = kernel and pid 1 = init, so init has tree_depth = 1
+ if (process->tree_depth > 0 && process->pid > 1)
+ process->showChildren = false;
+ }
+}
+
void ProcessList_rebuildPanel(ProcessList* this) {
const char* incFilter = this->incFilter;

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