aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_file.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-07-02 21:11:56 +0000
committerKalle Wallin <kaw@linux.se>2004-07-02 21:11:56 +0000
commitb268b9992faa303d6283c5a88ba460b5fd73cef6 (patch)
tree9fb9980bc7b231796b79d5abf0de6153ea8228fe /src/screen_file.c
parent8a22ebb6b68d5696ef853f07de96553e4ae506c4 (diff)
downloadmpd-b268b9992faa303d6283c5a88ba460b5fd73cef6.tar.gz
mpd-b268b9992faa303d6283c5a88ba460b5fd73cef6.tar.xz
mpd-b268b9992faa303d6283c5a88ba460b5fd73cef6.zip
Added basic ncurses mouse support
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1770 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/screen_file.c')
-rw-r--r--src/screen_file.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/screen_file.c b/src/screen_file.c
index 3fbdf4329..02dc4c4b3 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -553,6 +553,37 @@ browse_update(screen_t *screen, mpdclient_t *c)
}
+#ifdef HAVE_GETMOUSE
+static int
+handle_mouse_event(screen_t *screen, mpdclient_t *c)
+{
+ int row;
+ int prev_selected = lw->selected;
+ unsigned long bstate;
+
+ if( screen_get_mouse_event(c, lw, filelist->length, &bstate, &row) )
+ return 1;
+
+ lw->selected = lw->start+row;
+ list_window_check_selected(lw, filelist->length);
+
+ if( bstate & BUTTON1_CLICKED )
+ {
+ if( prev_selected == lw->selected )
+ handle_enter(screen, c);
+ }
+ else if( bstate & BUTTON3_CLICKED )
+ {
+ if( prev_selected == lw->selected )
+ handle_select(screen, c);
+ }
+
+ return 1;
+}
+#else
+#define handle_mouse_event(s,c) (0)
+#endif
+
static int
browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
{
@@ -601,6 +632,8 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
return screen_find(screen, c,
lw, filelist->length,
cmd, list_callback);
+ case CMD_MOUSE_EVENT:
+ return handle_mouse_event(screen,c);
default:
break;
}