diff options
author | Youngjae Lee <ls4154.lee@gmail.com> | 2021-01-14 13:37:46 +0900 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-01-28 09:21:18 +0100 |
commit | 3c61813ea6c2be755c8df0b92b9c5f5ac8a11366 (patch) | |
tree | 95f749b53ab523a467a3e632f032407db2024bd8 /InfoScreen.c | |
parent | fd458458296ef932a51829ce82fe70b261dbff75 (diff) |
InfoScreen: add mouse wheel scroll
Diffstat (limited to 'InfoScreen.c')
-rw-r--r-- | InfoScreen.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/InfoScreen.c b/InfoScreen.c index 3ebb063b..76d9838a 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -109,11 +109,19 @@ void InfoScreen_run(InfoScreen* this) { MEVENT mevent; int ok = getmouse(&mevent); if (ok == OK) { - if (mevent.y >= panel->y && mevent.y < LINES - 1) { - Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1); - ch = 0; - } else if (mevent.y == LINES - 1) { - ch = IncSet_synthesizeEvent(this->inc, mevent.x); + if (mevent.bstate & BUTTON1_RELEASED) { + if (mevent.y >= panel->y && mevent.y < LINES - 1) { + Panel_setSelected(panel, mevent.y - panel->y + panel->scrollV - 1); + ch = 0; + } else if (mevent.y == LINES - 1) { + ch = IncSet_synthesizeEvent(this->inc, mevent.x); + } + #if NCURSES_MOUSE_VERSION > 1 + } else if (mevent.bstate & BUTTON4_PRESSED) { + ch = KEY_WHEELUP; + } else if (mevent.bstate & BUTTON5_PRESSED) { + ch = KEY_WHEELDOWN; + #endif } } } |