Commit 7a961596 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

ncurses does not support the scrollwheel well, but this is a step in that direction.

parent 9599e565
/* /*
htop - htop.c htop - htop.c
(C) 2004-2010 Hisham H. Muhammad (C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file Released under the GNU GPL, see the COPYING file
in the source distribution for its full text. in the source distribution for its full text.
*/ */
...@@ -37,7 +37,7 @@ in the source distribution for its full text. ...@@ -37,7 +37,7 @@ in the source distribution for its full text.
#define INCSEARCH_MAX 40 #define INCSEARCH_MAX 40
#define COPYRIGHT "(C) 2004-2010 Hisham Muhammad" #define COPYRIGHT "(C) 2004-2011 Hisham Muhammad"
static void printVersionFlag() { static void printVersionFlag() {
fputs("htop " VERSION " - " COPYRIGHT "\n" fputs("htop " VERSION " - " COPYRIGHT "\n"
...@@ -496,6 +496,7 @@ int main(int argc, char** argv) { ...@@ -496,6 +496,7 @@ int main(int argc, char** argv) {
MEVENT mevent; MEVENT mevent;
int ok = getmouse(&mevent); int ok = getmouse(&mevent);
if (ok == OK) { if (ok == OK) {
if (mevent.bstate & BUTTON1_CLICKED) {
if (mevent.y == panel->y) { if (mevent.y == panel->y) {
int x = panel->scrollH + mevent.x + 1; int x = panel->scrollH + mevent.x + 1;
ProcessField field = ProcessList_keyAt(pl, x); ProcessField field = ProcessList_keyAt(pl, x);
...@@ -519,7 +520,13 @@ int main(int argc, char** argv) { ...@@ -519,7 +520,13 @@ int main(int argc, char** argv) {
else bar = defaultBar; else bar = defaultBar;
ch = FunctionBar_synthesizeEvent(bar, mevent.x); ch = FunctionBar_synthesizeEvent(bar, mevent.x);
} }
} else if (mevent.bstate & BUTTON4_CLICKED) {
ch = KEY_UP;
#if NCURSES_MOUSE_VERSION > 1
} else if (mevent.bstate & BUTTON5_CLICKED) {
ch = KEY_DOWN;
#endif
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment