From e054f21ad54222df6bed182457bcfb52a435389b Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 15 May 2013 13:03:54 +0200
Subject: Add simple mouse support.
---
src/sdtui.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
(limited to 'src')
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 ();
--
cgit v1.2.3-70-g09d2