summaryrefslogtreecommitdiffstats
path: root/MainPanel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2015-03-24 23:12:43 -0300
committerHisham Muhammad <hisham@gobolinux.org>2015-03-24 23:12:43 -0300
commita93db5234c8e24c56c4b5b615de837afeeac5e74 (patch)
treef68394fa63113bc62798e1e9fff66caaae1a7f8a /MainPanel.c
parent38fd1bfaba8b742d476a146ee111bf24cce9193e (diff)
handle clicks on panel header line
Diffstat (limited to 'MainPanel.c')
-rw-r--r--MainPanel.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/MainPanel.c b/MainPanel.c
index 9927dee3..6276edbf 100644
--- a/MainPanel.c
+++ b/MainPanel.c
@@ -67,7 +67,21 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
Htop_Reaction reaction = HTOP_OK;
- if (ch != ERR && this->inc->active) {
+ if (EVENT_IS_HEADER_CLICK(ch)) {
+ int x = EVENT_HEADER_CLICK_GET_X(ch);
+ ProcessList* pl = this->state->pl;
+ Settings* settings = this->state->settings;
+ int hx = super->scrollH + x + 1;
+ ProcessField field = ProcessList_keyAt(pl, hx);
+ if (field == settings->sortKey) {
+ Settings_invertSortOrder(settings);
+ settings->treeView = false;
+ } else {
+ reaction |= Action_setSortKey(settings, field);
+ }
+ reaction |= HTOP_RECALCULATE;
+ result = HANDLED;
+ } else if (ch != ERR && this->inc->active) {
bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL);
if (filterChanged) {
this->state->pl->incFilter = IncSet_filter(this->inc);

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