diff options
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/gui.c | 9 | ||||
-rw-r--r-- | riscos/gui.h | 6 | ||||
-rw-r--r-- | riscos/window.c | 28 |
3 files changed, 32 insertions, 11 deletions
diff --git a/riscos/gui.c b/riscos/gui.c index 018cd0d93..7f78286d3 100644 --- a/riscos/gui.c +++ b/riscos/gui.c @@ -896,7 +896,8 @@ void gui_poll(bool active) { wimp_event_no event; wimp_block block; - const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP; + const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN | + wimp_SAVE_FP; /* Poll wimp. */ xhourglass_off(); @@ -1019,7 +1020,8 @@ void gui_multitask(void) return; xhourglass_off(); - event = wimp_poll(wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP, &block, 0); + event = wimp_poll(wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP, + &block, 0); xhourglass_on(); gui_last_poll = clock(); @@ -1071,7 +1073,8 @@ void ro_gui_null_reason_code(void) if (gui_track_wimp_w == dialog_url_complete) ro_gui_url_complete_mouse_at(&pointer); else if (gui_track_gui_window) - ro_gui_window_mouse_at(gui_track_gui_window, &pointer); + ro_gui_window_mouse_at(gui_track_gui_window, + &pointer); break; } } diff --git a/riscos/gui.h b/riscos/gui.h index 1c6bd41cc..21df85bbf 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -153,8 +153,10 @@ void ro_gui_throb(void); struct gui_window *ro_gui_window_lookup(wimp_w window); struct gui_window *ro_gui_toolbar_lookup(wimp_w window); void ro_gui_scroll_request(wimp_scroll *scroll); -bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos); -bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *pos); +bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, + os_coord *pos); +bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, + os_coord *pos); bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message); bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message); void ro_gui_window_process_reformats(void); diff --git a/riscos/window.c b/riscos/window.c index 0ae8aa077..86d51edd3 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -84,6 +84,9 @@ static bool iconise_used[64]; static int iconise_next = 0; +/** Whether a pressed mouse button has become a drag */ +static bool mouse_drag; + /** List of all browser windows. */ static struct gui_window *window_list = 0; /** GUI window which is being redrawn. Valid only during redraw. */ @@ -140,8 +143,8 @@ static void ro_gui_window_launch_url(struct gui_window *g, const char *url); static void ro_gui_window_clone_options(struct browser_window *new_bw, struct browser_window *old_bw); static browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons); -static bool ro_gui_window_import_text(struct gui_window *g, const char *filename, - bool toolbar); +static bool ro_gui_window_import_text(struct gui_window *g, + const char *filename, bool toolbar); struct update_box { int x0; @@ -3003,11 +3006,19 @@ browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons) { browser_mouse_state state = 0; - if (buttons & (wimp_CLICK_SELECT)) state |= BROWSER_MOUSE_CLICK_1; - if (buttons & (wimp_CLICK_ADJUST)) state |= BROWSER_MOUSE_CLICK_2; + if (buttons & (wimp_CLICK_SELECT)) + state |= BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_CLICK_1; + if (buttons & (wimp_CLICK_ADJUST)) + state |= BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_2; - if (buttons & (wimp_DRAG_SELECT)) state |= BROWSER_MOUSE_DRAG_1; - if (buttons & (wimp_DRAG_ADJUST)) state |= BROWSER_MOUSE_DRAG_2; + if (buttons & (wimp_DRAG_SELECT)) { + state |= BROWSER_MOUSE_DRAG_1; + mouse_drag = true; + } + if (buttons & (wimp_DRAG_ADJUST)) { + state |= BROWSER_MOUSE_DRAG_2; + mouse_drag = true; + } if (ro_gui_shift_pressed()) state |= BROWSER_MOUSE_MOD_1; if (ro_gui_ctrl_pressed()) state |= BROWSER_MOUSE_MOD_2; @@ -3025,9 +3036,14 @@ browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons) { browser_mouse_state state = 0; + if (buttons & (wimp_CLICK_SELECT)) state |= BROWSER_MOUSE_HOLDING_1; if (buttons & (wimp_CLICK_ADJUST)) state |= BROWSER_MOUSE_HOLDING_2; + if (!(buttons & (wimp_CLICK_SELECT) || buttons & (wimp_CLICK_ADJUST))) + mouse_drag = false; + if (mouse_drag) state |= BROWSER_MOUSE_DRAG_ON; + if (ro_gui_shift_pressed()) state |= BROWSER_MOUSE_MOD_1; if (ro_gui_ctrl_pressed()) state |= BROWSER_MOUSE_MOD_2; |