From b268b9992faa303d6283c5a88ba460b5fd73cef6 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Fri, 2 Jul 2004 21:11:56 +0000 Subject: Added basic ncurses mouse support git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1770 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/screen.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'src/screen.c') diff --git a/src/screen.c b/src/screen.c index ba155a4cf..7b29f1f1e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -474,7 +474,10 @@ screen_init(mpdclient_t *c) keypad(stdscr, TRUE); /* return from getch() without blocking */ timeout(SCREEN_TIMEOUT); - + /* initialize mouse support */ +#ifdef HAVE_GETMOUSE + mousemask(ALL_MOUSE_EVENTS, NULL); +#endif if( COLStop_window.rows; + /* copy button state bits */ + *bstate = event.bstate; + /* if button 2 was pressed switch screen */ + if( event.bstate & BUTTON2_CLICKED ) + { + screen_cmd(c, CMD_SCREEN_NEXT); + return 1; + } + /* if the even occured above the list window move up */ + if( *row<0 && lw ) + { + if( event.bstate & BUTTON3_CLICKED ) + list_window_first(lw); + else + list_window_previous_page(lw); + return 1; + } + /* if the even occured below the list window move down */ + if( *row>=lw->rows && lw ) + { + if( event.bstate & BUTTON3_CLICKED ) + list_window_last(lw, lw_length); + else + list_window_next_page(lw, lw_length); + return 1; + } + return 0; +} +#endif + void screen_cmd(mpdclient_t *c, command_t cmd) { -- cgit v1.2.3