Make 'c' key work with threads as well.

This commit is contained in:
Hisham Muhammad 2017-09-14 17:10:39 -03:00
parent b9934ffa08
commit e3f65c8ec2
4 changed files with 6 additions and 2 deletions

View File

@ -142,7 +142,7 @@ static void tagAllChildren(Panel* panel, Process* parent) {
pid_t ppid = parent->pid; pid_t ppid = parent->pid;
for (int i = 0; i < Panel_size(panel); i++) { for (int i = 0; i < Panel_size(panel); i++) {
Process* p = (Process*) Panel_get(panel, i); Process* p = (Process*) Panel_get(panel, i);
if (!p->tag && p->ppid == ppid) { if (!p->tag && Process_isChildOf(p, ppid)) {
tagAllChildren(panel, p); tagAllChildren(panel, p);
} }
} }

View File

@ -172,6 +172,8 @@ typedef struct ProcessClass_ {
#define As_Process(this_) ((ProcessClass*)((this_)->super.klass)) #define As_Process(this_) ((ProcessClass*)((this_)->super.klass))
#define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_))
}*/ }*/
static int Process_getuid = -1; static int Process_getuid = -1;

View File

@ -151,6 +151,8 @@ typedef struct ProcessClass_ {
#define As_Process(this_) ((ProcessClass*)((this_)->super.klass)) #define As_Process(this_) ((ProcessClass*)((this_)->super.klass))
#define Process_isChildOf(process_, pid_) (process_->tgid == pid_ || (process_->tgid == process_->pid && process_->ppid == pid_))
#define ONE_K 1024L #define ONE_K 1024L
#define ONE_M (ONE_K * ONE_K) #define ONE_M (ONE_K * ONE_K)

View File

@ -173,7 +173,7 @@ static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int i
for (int i = Vector_size(this->processes) - 1; i >= 0; i--) { for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
Process* process = (Process*) (Vector_get(this->processes, i)); Process* process = (Process*) (Vector_get(this->processes, i));
if (process->show && (process->tgid == pid || (process->tgid == process->pid && process->ppid == pid))) { if (process->show && Process_isChildOf(process, pid)) {
process = (Process*) (Vector_take(this->processes, i)); process = (Process*) (Vector_take(this->processes, i));
Vector_add(children, process); Vector_add(children, process);
} }