aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen_file.c
diff options
context:
space:
mode:
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;
}