mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
WTree: fix double-click handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d2eac2f5af
commit
d5b35a7329
@ -301,15 +301,6 @@ tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case MSG_POST_KEY:
|
||||
/* The enter key will be processed by the tree widget */
|
||||
if (parm == '\n')
|
||||
{
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
case MSG_RESIZE:
|
||||
{
|
||||
Widget *bar;
|
||||
|
@ -572,36 +572,30 @@ tree_move_to_bottom (WTree * tree)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/** Handle mouse click */
|
||||
static void
|
||||
tree_mouse_click (WTree * tree, int y)
|
||||
{
|
||||
if (tree->tree_shown[y])
|
||||
{
|
||||
tree->selected_ptr = tree->tree_shown[y];
|
||||
tree->topdiff = y;
|
||||
}
|
||||
show_tree (tree);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
tree_chdir_sel (WTree * tree)
|
||||
{
|
||||
if (!tree->is_panel)
|
||||
return;
|
||||
if (tree->is_panel)
|
||||
{
|
||||
change_panel ();
|
||||
|
||||
change_panel ();
|
||||
if (do_cd (tree->selected_ptr->name, cd_exact))
|
||||
select_item (current_panel);
|
||||
else
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"),
|
||||
vfs_path_as_str (tree->selected_ptr->name), unix_error_string (errno));
|
||||
|
||||
if (do_cd (tree->selected_ptr->name, cd_exact))
|
||||
select_item (current_panel);
|
||||
widget_redraw (WIDGET (current_panel));
|
||||
change_panel ();
|
||||
show_tree (tree);
|
||||
}
|
||||
else
|
||||
message (D_ERROR, MSG_ERROR, _("Cannot chdir to \"%s\"\n%s"),
|
||||
tree->selected_ptr->name->str, unix_error_string (errno));
|
||||
{
|
||||
WDialog *h = WIDGET (tree)->owner;
|
||||
|
||||
change_panel ();
|
||||
show_tree (tree);
|
||||
h->ret_value = B_ENTER;
|
||||
dlg_stop (h);
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -653,11 +647,14 @@ tree_event (Gpm_Event * event, void *data)
|
||||
tree_move_forward (tree, tlines (tree) - 1);
|
||||
show_tree (tree);
|
||||
}
|
||||
else
|
||||
else if ((local.type & (GPM_UP | GPM_DOUBLE)) == (GPM_UP | GPM_DOUBLE))
|
||||
{
|
||||
tree_mouse_click (tree, local.y);
|
||||
if ((local.type & (GPM_UP | GPM_DOUBLE)) == (GPM_UP | GPM_DOUBLE))
|
||||
tree_chdir_sel (tree);
|
||||
if (tree->tree_shown[local.y] != NULL)
|
||||
{
|
||||
tree->selected_ptr = tree->tree_shown[local.y];
|
||||
tree->topdiff = local.y;
|
||||
}
|
||||
tree_chdir_sel (tree);
|
||||
}
|
||||
|
||||
return MOU_NORMAL;
|
||||
|
Loading…
Reference in New Issue
Block a user