From e87596ad1f7755c50f7a00edc85e66908ad1ba10 Mon Sep 17 00:00:00 2001 From: Steve Fryatt Date: Sun, 8 Sep 2013 00:47:55 +0100 Subject: Restructure handling of DragEnd events. Add ro_mouse module to process mouse events during drags and on null polls. Implement support in ro_mouse for tracking the mouse during drags and passing on DragEnd events. Remove ro_gui_drag_end() and update all of its clients so that they use ro_mouse. Remove the unused ro_gui_window_frame_resize_end(). Termination of save drags with Escape is unimplemented, but appears broken anyway. The use of gui_drag_type is still required to handle Message_DatasaveAck processing. Mouse tracking is still handled via gui.c. --- riscos/window.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'riscos/window.c') diff --git a/riscos/window.c b/riscos/window.c index d3375bebe..dbe505eb5 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -68,6 +68,7 @@ #include "riscos/help.h" #include "riscos/hotlist.h" #include "riscos/menus.h" +#include "riscos/mouse.h" #include "utils/nsoption.h" #include "riscos/oslib_pre7.h" #include "riscos/save.h" @@ -108,6 +109,8 @@ static bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu, wimp_selection *selection, menu_action action); static void ro_gui_window_menu_close(wimp_w w, wimp_i i, wimp_menu *menu); +static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data); + static void ro_gui_window_scroll_action(struct gui_window *g, int scroll_x, int scroll_y); @@ -1239,8 +1242,10 @@ bool gui_window_scroll_start(struct gui_window *g) return false; } - gui_track_gui_window = g; + gui_track_gui_window = g; // \TODO -- Remove? gui_current_drag_type = GUI_DRAG_SCROLL; + ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at, + NULL, g); return true; } @@ -1295,6 +1300,8 @@ bool gui_window_drag_start(struct gui_window *g, gui_drag_type type, case GDRAGGING_SCROLLBAR: /* Dragging a core scrollbar */ gui_current_drag_type = GUI_DRAG_SCROLL; + ro_mouse_drag_start(ro_gui_window_scroll_end, ro_gui_window_mouse_at, + NULL, g); break; default: @@ -3350,13 +3357,14 @@ bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message) /** * Handle pointer movements in a browser window. * - * \param g browser window that the pointer is in - * \param pointer new mouse position + * \param *pointer new mouse position + * \param *data browser window that the pointer is in */ -void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer) +void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data) { os_coord pos; + struct gui_window *g = (struct gui_window *) data; if (ro_gui_window_to_window_pos(g, pointer->pos.x, pointer->pos.y, &pos)) browser_window_mouse_track(g->bw, @@ -3500,14 +3508,16 @@ void ro_gui_window_iconise(struct gui_window *g, /** * Completes scrolling of a browser window * - * \param g gui window + * \param *drag The DragEnd event data block. + * \param *data gui window block pointer. */ -void ro_gui_window_scroll_end(struct gui_window *g, wimp_dragged *drag) +static void ro_gui_window_scroll_end(wimp_dragged *drag, void *data) { wimp_pointer pointer; os_error *error; os_coord pos; + struct gui_window *g = (struct gui_window *) data; gui_current_drag_type = GUI_DRAG_NONE; if (!g) @@ -3540,19 +3550,6 @@ void ro_gui_window_scroll_end(struct gui_window *g, wimp_dragged *drag) } -/** - * Completes resizing of a browser frame - * - * \param g gui window - */ - -void ro_gui_window_frame_resize_end(struct gui_window *g, wimp_dragged *drag) -{ - /* our clean-up is the same as for page scrolling */ - ro_gui_window_scroll_end(g, drag); -} - - /** * Process Mouse_Click events in a toolbar's button bar. This does not handle * other clicks in a toolbar: these are handled by the toolbar module itself. -- cgit v1.2.3