summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-08-19 19:09:54 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-08-19 19:09:54 -0300
commit78be8201dc86c4d57226d845f04ac496cd64d9b6 (patch)
tree5ecabb1ad2e8b57452179eb35273dd1062ebf149
parentb003636958377ecad3ee5df4ca2de8717c4530b9 (diff)
Add expand/collapse on additional clicks!
-rw-r--r--Action.c1
-rw-r--r--CRT.c1
-rw-r--r--CRT.h1
-rw-r--r--ScreenManager.c6
4 files changed, 8 insertions, 1 deletions
diff --git a/Action.c b/Action.c
index aee28f3d..6c387def 100644
--- a/Action.c
+++ b/Action.c
@@ -530,6 +530,7 @@ void Action_setBindings(Htop_Action* keys) {
keys['a'] = actionSetAffinity;
keys[KEY_F(9)] = actionKill;
keys['k'] = actionKill;
+ keys[KEY_RECLICK] = actionExpandOrCollapse;
keys['+'] = actionExpandOrCollapse;
keys['='] = actionExpandOrCollapse;
keys['-'] = actionExpandOrCollapse;
diff --git a/CRT.c b/CRT.c
index 1b44b694..517f0c82 100644
--- a/CRT.c
+++ b/CRT.c
@@ -31,6 +31,7 @@ in the source distribution for its full text.
#define KEY_WHEELUP KEY_F(20)
#define KEY_WHEELDOWN KEY_F(21)
+#define KEY_RECLICK KEY_F(22)
//#link curses
diff --git a/CRT.h b/CRT.h
index 69497d76..216c5a4c 100644
--- a/CRT.h
+++ b/CRT.h
@@ -22,6 +22,7 @@ in the source distribution for its full text.
#define KEY_WHEELUP KEY_F(20)
#define KEY_WHEELDOWN KEY_F(21)
+#define KEY_RECLICK KEY_F(22)
//#link curses
diff --git a/ScreenManager.c b/ScreenManager.c
index 657065c6..df7431fd 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -208,12 +208,16 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
ch = EVENT_HEADER_CLICK(mevent.x - panel->x);
break;
} else if (mevent.y > panel->y && mevent.y <= panel->y+panel->h) {
+ ch = KEY_MOUSE;
if (panel == panelFocus || this->allowFocusChange) {
focus = i;
panelFocus = setCurrentPanel(panel);
+ Object* oldSelection = Panel_getSelected(panel);
Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1);
+ if (Panel_getSelected(panel) == oldSelection) {
+ ch = KEY_RECLICK;
+ }
}
- ch = KEY_MOUSE;
break;
}
}