summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2013-02-26 20:24:27 +0000
committerHisham Muhammad <hisham@gobolinux.org>2013-02-26 20:24:27 +0000
commitee5dc46fee6de72dbfd14de447ccf18d9fb9cd7a (patch)
tree4324d0c21db3b255198b681e836a360b7b0f2123
parenta0810561f3bb86910ce0f43d9d673d29c576fcbb (diff)
Don't end up killing init if process selected to be killed terminates before the user selects a signal. Closes #3606072.
-rw-r--r--ScreenManager.c3
-rw-r--r--htop.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/ScreenManager.c b/ScreenManager.c
index 9218909b..646ee2f0 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -173,7 +173,8 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
for (int i = 0; i < this->panelCount; i++) {
Panel* panel = (Panel*) Vector_get(this->panels, i);
if (mevent.x > panel->x && mevent.x <= panel->x+panel->w &&
- mevent.y > panel->y && mevent.y <= panel->y+panel->h) {
+ mevent.y > panel->y && mevent.y <= panel->y+panel->h &&
+ (this->allowFocusChange || panelFocus == panel) ) {
focus = i;
panelFocus = panel;
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
diff --git a/htop.c b/htop.c
index cdee8eeb..de9df527 100644
--- a/htop.c
+++ b/htop.c
@@ -217,9 +217,10 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
Panel* panelFocus;
int ch;
bool unfollow = false;
+ Process* p = (Process*)Panel_getSelected(panel);
+ int pid = p ? p->pid : -1;
if (header->pl->following == -1) {
- Process* p = (Process*)Panel_getSelected(panel);
- header->pl->following = p ? p->pid : -1;
+ header->pl->following = pid;
unfollow = true;
}
ScreenManager_run(scr, &panelFocus, &ch);
@@ -231,7 +232,11 @@ static Object* pickFromVector(Panel* panel, Panel* list, int x, int y, const cha
Panel_resize(panel, COLS, LINES-y-1);
FunctionBar_draw(prevBar, NULL);
if (panelFocus == list && ch == 13) {
- return Panel_getSelected(list);
+ Process* selected = (Process*)Panel_getSelected(panel);
+ if (selected->pid == pid)
+ return Panel_getSelected(list);
+ else
+ beep();
}
return NULL;
}

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