From 2249dbaf9aba9f6ebe540a08920ae88736f59f36 Mon Sep 17 00:00:00 2001 From: Steve Fryatt Date: Mon, 18 Apr 2011 23:03:45 +0000 Subject: Restore some Adjust-double-click functionality to RO treeviews. svn path=/trunk/netsurf/; revision=12201 --- riscos/treeview.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'riscos') diff --git a/riscos/treeview.c b/riscos/treeview.c index f96f761d6..8cc3ea12b 100644 --- a/riscos/treeview.c +++ b/riscos/treeview.c @@ -749,6 +749,7 @@ static bool ro_treeview_mouse_click(wimp_pointer *pointer) wimp_window_state state; int xpos, ypos; browser_mouse_state mouse; + bool handled = false; tv = (ro_treeview *) ro_gui_wimp_event_get_user_data(pointer->w); if (tv == NULL) { @@ -800,7 +801,7 @@ static bool ro_treeview_mouse_click(wimp_pointer *pointer) } if (mouse != 0) { - tree_mouse_action(tv->tree, mouse, xpos, ypos); + handled = tree_mouse_action(tv->tree, mouse, xpos, ypos); tv->drag = tree_drag_status(tv->tree); if (tv->drag != TREE_NO_DRAG) { @@ -822,13 +823,27 @@ static bool ro_treeview_mouse_click(wimp_pointer *pointer) tv->callbacks->toolbar_button_update(); } - /* We assume that the owning module will have attached a window menu - * to our parent window with the auto flag unset (so that we can fudge - * the selection above). If it hasn't, this call will quietly fail. + /* Special actions for some mouse buttons. Adjust closes the dialog; + * Menu opens a menu. For the latter, we assume that the owning module + * will have attached a window menu to our parent window with the auto + * flag unset (so that we can fudge the selection above). If it hasn't, + * the call will quietly fail. + * + * \TODO -- Adjust-click close isn't a perfect copy of what the RO + * version did: adjust clicks anywhere close the tree, and + * selections persist. */ - if (pointer->buttons == wimp_CLICK_MENU) + switch(pointer->buttons) { + case wimp_CLICK_ADJUST: + if (handled) + ro_gui_dialog_close(tv->w); + break; + + case wimp_CLICK_MENU: ro_gui_wimp_event_process_window_menu_click(pointer); + break; + } return true; } -- cgit v1.2.3