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; } }