Ticket #2093: fixed mouse events handling in file panel.

Dont handle wheel events on 2nd line where sort indicator
and column header are located.
Type accuracy.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2010-03-12 11:49:49 +00:00
parent 1445e6b59f
commit 14fce3b91e

View File

@ -3210,60 +3210,68 @@ mouse_sort_col (Gpm_Event * event, WPanel * panel)
/*
* Mouse callback of the panel minus repainting.
* If the event is redirected to the menu, *redir is set to 1.
* If the event is redirected to the menu, *redir is set to TRUE.
*/
static int
do_panel_event (Gpm_Event * event, WPanel * panel, int *redir)
do_panel_event (Gpm_Event * event, WPanel * panel, gboolean *redir)
{
const int lines = llines (panel);
const gboolean is_active = dlg_widget_active (panel);
const gboolean mouse_down = (event->type & GPM_DOWN) != 0;
/* "." button show/hide hidden files */
if (event->type & GPM_DOWN && event->x == panel->widget.cols - 5 && event->y == 1)
*redir = FALSE;
/* 1st line */
if (mouse_down && event->y == 1)
{
toggle_show_hidden ();
repaint_screen ();
/* "<" button */
if (event->x == 2)
{
directory_history_prev (panel);
return MOU_NORMAL;
}
/* "." button show/hide hidden files */
if (event->x == panel->widget.cols - 5)
{
toggle_show_hidden ();
repaint_screen ();
return MOU_NORMAL;
}
/* ">" button */
if (event->x == panel->widget.cols - 1)
{
directory_history_next (panel);
return MOU_NORMAL;
}
/* "^" button */
if (event->x >= panel->widget.cols - 4 && event->x <= panel->widget.cols - 2)
{
directory_history_list (panel);
return MOU_NORMAL;
}
/* rest of the upper frame, the menu is invisible - call menu */
if (!menubar_visible)
{
*redir = TRUE;
event->x += panel->widget.x;
return the_menubar->widget.mouse (event, the_menubar);
}
/* no other events on 1st line */
return MOU_NORMAL;
}
/* "<" button */
if (mouse_down && event->y == 1 && event->x == 2)
{
directory_history_prev (panel);
return MOU_NORMAL;
}
/* ">" button */
if (mouse_down && event->y == 1 && event->x == panel->widget.cols - 1)
{
directory_history_next (panel);
return MOU_NORMAL;
}
/* "^" button */
if (mouse_down && event->y == 1 && event->x >= panel->widget.cols - 4
&& event->x <= panel->widget.cols - 2)
{
directory_history_list (panel);
return MOU_NORMAL;
}
/* sort on clicked column */
if (event->type & GPM_DOWN && event->y == 2)
/* sort on clicked column; don't handle wheel events */
if (mouse_down && (event->buttons & (GPM_B_UP | GPM_B_DOWN)) == 0 && event->y == 2)
{
mouse_sort_col (event, panel);
return MOU_NORMAL;
}
/* rest of the upper frame, the menu is invisible - call menu */
if (mouse_down && event->y == 1 && !menubar_visible)
{
*redir = 1;
event->x += panel->widget.x;
return the_menubar->widget.mouse (event, the_menubar);
}
/* Mouse wheel events */
if (mouse_down && (event->buttons & GPM_B_UP))
{
@ -3348,7 +3356,7 @@ panel_event (Gpm_Event * event, void *data)
{
WPanel *panel = data;
int ret;
int redir = MOU_NORMAL;
gboolean redir;
ret = do_panel_event (event, panel, &redir);
if (!redir)