From b9ac008b8097cb58efd5a1fdc016c6ebb9e9241a Mon Sep 17 00:00:00 2001 From: James Booth Date: Thu, 17 Jan 2013 19:40:55 +0000 Subject: Added /mouse command for enabling/disabling mouse handling Defaults to on. --- src/windows.c | 58 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'src/windows.c') diff --git a/src/windows.c b/src/windows.c index 5659cc20..f708b4a3 100644 --- a/src/windows.c +++ b/src/windows.c @@ -125,8 +125,10 @@ ui_init(void) initscr(); raw(); keypad(stdscr, TRUE); - mousemask(ALL_MOUSE_EVENTS, NULL); - mouseinterval(5); + if (prefs_get_mouse()) { + mousemask(ALL_MOUSE_EVENTS, NULL); + mouseinterval(5); + } ui_load_colours(); refresh(); create_title_bar(); @@ -1251,6 +1253,11 @@ cons_show_ui_prefs(void) cons_show("Version checking (/vercheck) : ON"); else cons_show("Version checking (/vercheck) : OFF"); + + if (prefs_get_mouse()) + cons_show("Mouse handling (/mouse) : ON"); + else + cons_show("Mouse handling (/mouse) : OFF"); } void @@ -2192,42 +2199,45 @@ _win_handle_page(const wint_t * const ch) int page_space = rows - 4; int *page_start = &(current->y_pos); - MEVENT mouse_event; + if (prefs_get_mouse()) { + MEVENT mouse_event; - if (*ch == KEY_MOUSE) { - if (getmouse(&mouse_event) == OK) { + if (*ch == KEY_MOUSE) { + if (getmouse(&mouse_event) == OK) { #ifdef PLATFORM_CYGWIN - if (mouse_event.bstate & BUTTON5_PRESSED) { // mouse wheel down + if (mouse_event.bstate & BUTTON5_PRESSED) { // mouse wheel down #else - if (mouse_event.bstate & BUTTON2_PRESSED) { // mouse wheel down + if (mouse_event.bstate & BUTTON2_PRESSED) { // mouse wheel down #endif - *page_start += 4; + *page_start += 4; - // only got half a screen, show full screen - if ((y - (*page_start)) < page_space) - *page_start = y - page_space; + // only got half a screen, show full screen + if ((y - (*page_start)) < page_space) + *page_start = y - page_space; - // went past end, show full screen - else if (*page_start >= y) - *page_start = y - page_space; + // went past end, show full screen + else if (*page_start >= y) + *page_start = y - page_space; - current->paged = 1; - dirty = TRUE; - } else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up - *page_start -= 4; + current->paged = 1; + dirty = TRUE; + } else if (mouse_event.bstate & BUTTON4_PRESSED) { // mouse wheel up + *page_start -= 4; - // went past beginning, show first page - if (*page_start < 0) - *page_start = 0; + // went past beginning, show first page + if (*page_start < 0) + *page_start = 0; - current->paged = 1; - dirty = TRUE; + current->paged = 1; + dirty = TRUE; + } } } + } // page up - } else if (*ch == KEY_PPAGE) { + if (*ch == KEY_PPAGE) { *page_start -= page_space; // went past beginning, show first page -- cgit 1.4.1-2-gfad0