aboutsummaryrefslogtreecommitdiff
path: root/src/sdtui.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-05-15 13:03:54 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-05-15 13:03:54 +0200
commite054f21ad54222df6bed182457bcfb52a435389b (patch)
tree20cafbe9ac179cac15a4bfc4018bfab3a1c6ffbe /src/sdtui.c
parenta7a85a8e55f585b7a2df5a0466fbab7735fe8048 (diff)
downloadtdv-e054f21ad54222df6bed182457bcfb52a435389b.tar.gz
tdv-e054f21ad54222df6bed182457bcfb52a435389b.tar.xz
tdv-e054f21ad54222df6bed182457bcfb52a435389b.zip
Add simple mouse support.
Diffstat (limited to 'src/sdtui.c')
-rw-r--r--src/sdtui.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/sdtui.c b/src/sdtui.c
index 3ba64cf..d2e0679 100644
--- a/src/sdtui.c
+++ b/src/sdtui.c
@@ -483,10 +483,19 @@ app_process_curses_event (CursesEvent *event)
case KEY_RESIZE:
// TODO adapt to the new window size, COLS, LINES
// mind the position of the selection cursor
+ app_reload_view ();
app_redraw ();
break;
case KEY_MOUSE:
- // TODO move the item cursor, event->mouse.{x,y,bstate}
+ // TODO move the input entry cursor
+ if ((event->mouse.bstate & BUTTON1_PRESSED) &&
+ event->mouse.y > 0 &&
+ event->mouse.y <= (int) (count_view_items () - g_top_offset))
+ {
+ g_selected = event->mouse.y - 1;
+ app_redraw_view ();
+ app_redraw_top (); // FIXME just focus
+ }
break;
case KEY_UP:
@@ -712,6 +721,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
nodelay (stdscr, TRUE); /* Don't block on get_wch(). */
mousemask (ALL_MOUSE_EVENTS, NULL); /* Register mouse events. */
+ mouseinterval (0);
if (pipe (g_winch_pipe) == -1)
abort ();