From b95c9d42a509e7560c92143d88fcedfd1562046a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 22 Mar 2010 22:10:20 +0300 Subject: [PATCH] Applied mouse_scroll_pages option to the mouse wheel. Signed-off-by: Andrew Borodin --- src/screen.c | 39 ++++++++++++++------------------------- src/setup.h | 7 ++++--- 2 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/screen.c b/src/screen.c index d068a11cb..2afa846b1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3288,7 +3288,7 @@ do_panel_event (Gpm_Event * event, WPanel * panel, gboolean * redir) { if (is_active) { - if (panel->top_file > 0) + if (panels_options.mouse_move_pages && (panel->top_file > 0)) prev_page (panel); else /* We are in first page */ move_up (panel); @@ -3300,7 +3300,8 @@ do_panel_event (Gpm_Event * event, WPanel * panel, gboolean * redir) { if (is_active) { - if (panel->top_file + ITEMS (panel) < panel->count) + if (panels_options.mouse_move_pages + && (panel->top_file + ITEMS (panel) < panel->count)) next_page (panel); else /* We are in last page */ move_down (panel); @@ -3316,32 +3317,20 @@ do_panel_event (Gpm_Event * event, WPanel * panel, gboolean * redir) if (!is_active) change_panel (); - if (event->y <= 0) - { - mark_if_marking (panel, event); - if (panels_options.mouse_move_pages) - prev_page (panel); - else - move_up (panel); - return MOU_REPEAT; - } + if (event->y > lines) + return MOU_NORMAL; - if (!((panel->top_file + event->y <= panel->count) && event->y <= lines)) + if (panel->top_file + event->y > panel->count) + my_index = panel->count - 1; + else { - mark_if_marking (panel, event); - if (panels_options.mouse_move_pages) - next_page (panel); - else - move_down (panel); - return MOU_REPEAT; - } + my_index = panel->top_file + event->y - 1; + if (panel->split && (event->x > ((panel->widget.cols - 2) / 2))) + my_index += llines (panel); - my_index = panel->top_file + event->y - 1; - if (panel->split && (event->x > ((panel->widget.cols - 2) / 2))) - my_index += llines (panel); - - if (my_index >= panel->count) - my_index = panel->count - 1; + if (my_index >= panel->count) + my_index = panel->count - 1; + } if (my_index != panel->selected) { diff --git a/src/setup.h b/src/setup.h index f1c518109..5283105f9 100644 --- a/src/setup.h +++ b/src/setup.h @@ -62,11 +62,12 @@ typedef struct gboolean navigate_with_arrows; /* If TRUE: l&r arrows are used to chdir if the input line is empty */ gboolean kilobyte_si; /* If TRUE, SI units (1000 based) will be used for larger units * (kilobyte, megabyte, ...). If FALSE, binary units (1024 based) will be used */ - gboolean scroll_pages; /* If TRUE, up/down keys scroll the pane listing by pages */ - gboolean mouse_move_pages; /* Move page/item? When clicking on the top or bottom of a panel */ + gboolean scroll_pages; /* If TRUE, panel is scrolled by half the display when the cursor reaches + the end or the beginning of the panel */ + gboolean mouse_move_pages; /* Scroll page/item using mouse wheel */ gboolean reverse_files_only; /* If TRUE, only selection of files is inverted */ gboolean auto_save_setup; - gboolean filetype_mode; /* If TRUE - then add per file type hilighting */ + gboolean filetype_mode; /* If TRUE then add per file type hilighting */ gboolean permission_mode; /* If TRUE, we use permission hilighting */ qsearch_mode_t qsearch_mode; /* Quick search mode */ } panels_options_t; -- 2.11.4.GIT