mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 04:26:50 +03:00
Move all mouse tracking into ro_mouse module.
Add Pointer Entering Window events to wimp_event module and add handlers to all modules requiring mouse tracking. Updated: Treeview, URL Complete, History and GUI Window. Delete all handling for Pointer Entering/Leaving from ro_gui.
This commit is contained in:
parent
e87596ad1f
commit
a00e0f91c7
@ -158,6 +158,8 @@ void ro_gui_dialog_init(void)
|
||||
dialog_url_complete = ro_gui_dialog_create("url_suggest");
|
||||
ro_gui_wimp_event_register_mouse_click(dialog_url_complete,
|
||||
ro_gui_url_complete_click);
|
||||
ro_gui_wimp_event_register_pointer_entering_window(dialog_url_complete,
|
||||
ro_gui_url_complete_entering);
|
||||
ro_gui_wimp_event_register_redraw_window(dialog_url_complete,
|
||||
ro_gui_url_complete_redraw);
|
||||
ro_gui_wimp_event_set_help_prefix(dialog_url_complete, "HelpAutoURL");
|
||||
|
133
riscos/gui.c
133
riscos/gui.c
@ -163,8 +163,6 @@ static const char *task_name = "NetSurf";
|
||||
|
||||
/** The pointer is over a window which is tracking mouse movement. */
|
||||
static bool gui_track = false;
|
||||
/** Handle of window which the pointer is over. */
|
||||
static wimp_w gui_track_wimp_w;
|
||||
/** Browser window which the pointer is over, or 0 if none. */
|
||||
struct gui_window *gui_track_gui_window;
|
||||
|
||||
@ -239,10 +237,7 @@ static void ro_gui_choose_language(void);
|
||||
static void ro_gui_signal(int sig);
|
||||
static void ro_gui_cleanup(void);
|
||||
static void ro_gui_handle_event(wimp_event_no event, wimp_block *block);
|
||||
static void ro_gui_null_reason_code(void);
|
||||
static void ro_gui_close_window_request(wimp_close *close);
|
||||
static void ro_gui_pointer_leaving_window(wimp_leaving *leaving);
|
||||
static void ro_gui_pointer_entering_window(wimp_entering *entering);
|
||||
static void ro_gui_check_resolvers(void);
|
||||
static void ro_gui_keypress(wimp_key *key);
|
||||
static void ro_gui_user_message(wimp_event_no event, wimp_message *message);
|
||||
@ -1036,7 +1031,7 @@ void gui_poll(bool active)
|
||||
xhourglass_off();
|
||||
if (active) {
|
||||
event = wimp_poll(mask, &block, 0);
|
||||
} else if (sched_active || gui_track || browser_reformat_pending ||
|
||||
} else if (sched_active || gui_track || TRUE || browser_reformat_pending ||
|
||||
bitmap_maintenance) {
|
||||
os_t t = os_read_monotonic_time();
|
||||
|
||||
@ -1095,7 +1090,8 @@ void ro_gui_handle_event(wimp_event_no event, wimp_block *block)
|
||||
{
|
||||
switch (event) {
|
||||
case wimp_NULL_REASON_CODE:
|
||||
ro_gui_null_reason_code();
|
||||
ro_gui_throb();
|
||||
ro_mouse_poll();
|
||||
break;
|
||||
|
||||
case wimp_REDRAW_WINDOW_REQUEST:
|
||||
@ -1111,11 +1107,11 @@ void ro_gui_handle_event(wimp_event_no event, wimp_block *block)
|
||||
break;
|
||||
|
||||
case wimp_POINTER_LEAVING_WINDOW:
|
||||
ro_gui_pointer_leaving_window(&block->leaving);
|
||||
ro_mouse_pointer_leaving_window(&block->leaving);
|
||||
break;
|
||||
|
||||
case wimp_POINTER_ENTERING_WINDOW:
|
||||
ro_gui_pointer_entering_window(&block->entering);
|
||||
ro_gui_wimp_event_pointer_entering_window(&block->entering);
|
||||
break;
|
||||
|
||||
case wimp_MOUSE_CLICK:
|
||||
@ -1152,63 +1148,6 @@ void ro_gui_handle_event(wimp_event_no event, wimp_block *block)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Null_Reason_Code events.
|
||||
*/
|
||||
|
||||
void ro_gui_null_reason_code(void)
|
||||
{
|
||||
wimp_pointer pointer;
|
||||
os_error *error;
|
||||
|
||||
ro_gui_throb();
|
||||
|
||||
ro_mouse_poll();
|
||||
|
||||
if (!gui_track)
|
||||
return;
|
||||
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_pointer_info: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gui_current_drag_type) {
|
||||
|
||||
/* pointer is allowed to wander outside the initiating window
|
||||
for certain drag types */
|
||||
|
||||
//case GUI_DRAG_SELECTION:
|
||||
case GUI_DRAG_SCROLL:
|
||||
//case GUI_DRAG_FRAME:
|
||||
assert(gui_track_gui_window);
|
||||
ro_gui_window_mouse_at(&pointer, gui_track_gui_window);
|
||||
break;
|
||||
|
||||
// case GUI_DRAG_SAVE:
|
||||
// ro_gui_selection_send_dragging(&pointer);
|
||||
// break;
|
||||
|
||||
default:
|
||||
if (ro_gui_global_history_check_window(gui_track_wimp_w) ||
|
||||
ro_gui_hotlist_check_window(gui_track_wimp_w) ||
|
||||
ro_gui_cookies_check_window(gui_track_wimp_w))
|
||||
ro_treeview_mouse_at(&pointer, NULL);
|
||||
if (gui_track_wimp_w == history_window)
|
||||
ro_gui_history_mouse_at(&pointer);
|
||||
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(&pointer,
|
||||
gui_track_gui_window);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Open_Window_Request events.
|
||||
*/
|
||||
@ -1246,68 +1185,6 @@ void ro_gui_close_window_request(wimp_close *close)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Pointer_Leaving_Window events.
|
||||
*/
|
||||
|
||||
void ro_gui_pointer_leaving_window(wimp_leaving *leaving)
|
||||
{
|
||||
if (gui_track_wimp_w == history_window)
|
||||
ro_gui_dialog_close(dialog_tooltip);
|
||||
|
||||
LOG(("Leaving window 0x%x", leaving->w));
|
||||
|
||||
switch (gui_current_drag_type) {
|
||||
case GUI_DRAG_SELECTION:
|
||||
case GUI_DRAG_SCROLL:
|
||||
case GUI_DRAG_SAVE:
|
||||
case GUI_DRAG_FRAME:
|
||||
//case GUI_DRAG_TREEVIEW:
|
||||
/* ignore Pointer_Leaving_Window event that the Wimp mysteriously
|
||||
issues when a Wimp_DragBox drag operation is started */
|
||||
break;
|
||||
|
||||
default:
|
||||
if (gui_track_gui_window)
|
||||
gui_window_set_pointer(gui_track_gui_window, GUI_POINTER_DEFAULT);
|
||||
gui_track_wimp_w = 0;
|
||||
gui_track_gui_window = NULL;
|
||||
gui_track = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Pointer_Entering_Window events.
|
||||
*/
|
||||
|
||||
void ro_gui_pointer_entering_window(wimp_entering *entering)
|
||||
{
|
||||
LOG(("Entering window 0x%x", entering->w));
|
||||
|
||||
switch (gui_current_drag_type) {
|
||||
case GUI_DRAG_SELECTION:
|
||||
case GUI_DRAG_SCROLL:
|
||||
case GUI_DRAG_SAVE:
|
||||
case GUI_DRAG_FRAME:
|
||||
//case GUI_DRAG_TREEVIEW:
|
||||
/* ignore entering new windows/frames */
|
||||
break;
|
||||
default:
|
||||
gui_track_wimp_w = entering->w;
|
||||
gui_track_gui_window = ro_gui_window_lookup(entering->w);
|
||||
gui_track = gui_track_gui_window ||
|
||||
gui_track_wimp_w == history_window ||
|
||||
gui_track_wimp_w == dialog_url_complete ||
|
||||
ro_gui_hotlist_check_window(gui_track_wimp_w) ||
|
||||
ro_gui_global_history_check_window(gui_track_wimp_w) ||
|
||||
ro_gui_cookies_check_window(gui_track_wimp_w);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Key_Pressed events.
|
||||
*/
|
||||
|
@ -162,7 +162,6 @@ bool ro_gui_alt_pressed(void);
|
||||
void ro_gui_history_init(void);
|
||||
void ro_gui_history_open(struct browser_window *bw, struct history *history,
|
||||
bool pointer);
|
||||
void ro_gui_history_mouse_at(wimp_pointer *pointer);
|
||||
|
||||
/* in filetype.c */
|
||||
int ro_content_filetype(struct hlcache_handle *c);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "desktop/browser_private.h"
|
||||
#include "utils/nsoption.h"
|
||||
#include "riscos/gui.h"
|
||||
#include "riscos/mouse.h"
|
||||
#include "riscos/wimp.h"
|
||||
#include "riscos/wimp_event.h"
|
||||
#include "riscos/wimputils.h"
|
||||
@ -51,7 +52,9 @@ wimp_w history_window;
|
||||
|
||||
static void ro_gui_history_redraw(wimp_draw *redraw);
|
||||
static bool ro_gui_history_click(wimp_pointer *pointer);
|
||||
|
||||
static void ro_gui_history_pointer_entering(wimp_entering *entering);
|
||||
static void ro_gui_history_track_end(wimp_leaving *leaving, void *data);
|
||||
static void ro_gui_history_mouse_at(wimp_pointer *pointer, void *data);
|
||||
|
||||
|
||||
/**
|
||||
@ -65,6 +68,8 @@ void ro_gui_history_init(void)
|
||||
ro_gui_history_redraw);
|
||||
ro_gui_wimp_event_register_mouse_click(history_window,
|
||||
ro_gui_history_click);
|
||||
ro_gui_wimp_event_register_pointer_entering_window(history_window,
|
||||
ro_gui_history_pointer_entering);
|
||||
ro_gui_wimp_event_set_help_prefix(history_window, "HelpHistory");
|
||||
}
|
||||
|
||||
@ -168,11 +173,38 @@ void ro_gui_history_redraw(wimp_draw *redraw)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Pointer Entering Window events the history window.
|
||||
*
|
||||
* \param *entering The Wimp_PointerEnteringWindow block.
|
||||
*/
|
||||
|
||||
void ro_gui_history_pointer_entering(wimp_entering *entering)
|
||||
{
|
||||
ro_mouse_track_start(ro_gui_history_track_end,
|
||||
ro_gui_history_mouse_at, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Pointer Leaving Window events the history window. These arrive as the
|
||||
* termination callback handler from ro_mouse's mouse tracking.
|
||||
*
|
||||
* \param *leaving The Wimp_PointerLeavingWindow block.
|
||||
* \param *data NULL data pointer.
|
||||
*/
|
||||
|
||||
void ro_gui_history_track_end(wimp_leaving *leaving, void *data)
|
||||
{
|
||||
ro_gui_dialog_close(dialog_tooltip);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle mouse movements over the history window.
|
||||
*/
|
||||
|
||||
void ro_gui_history_mouse_at(wimp_pointer *pointer)
|
||||
void ro_gui_history_mouse_at(wimp_pointer *pointer, void *data)
|
||||
{
|
||||
int x, y;
|
||||
int width;
|
||||
@ -181,6 +213,8 @@ void ro_gui_history_mouse_at(wimp_pointer *pointer)
|
||||
wimp_icon_state ic;
|
||||
os_box box = {0, 0, 0, 0};
|
||||
os_error *error;
|
||||
|
||||
LOG(("Mouse at..."));
|
||||
|
||||
/* If the mouse hasn't moved, or if we don't want tooltips, exit */
|
||||
if ((mouse_x == pointer->pos.x && mouse_y == pointer->pos.y) ||
|
||||
|
@ -27,6 +27,12 @@
|
||||
* - on Null Polls while the drag is active,
|
||||
* - when the drag terminates with Event_DragEnd, and
|
||||
* - when the drag terminates with Escape being pressed.
|
||||
*
|
||||
* 2. Mouse tracking support, allowing clients to track the mouse while it
|
||||
* remains in the current window and specify callbacks to be used
|
||||
*
|
||||
* - on Null Polls while the pointer is in the window, and
|
||||
* - when the pointer leaves the window.
|
||||
*/
|
||||
|
||||
#include "oslib/wimp.h"
|
||||
@ -44,6 +50,15 @@ static void (*ro_mouse_drag_track_callback)(wimp_pointer *pointer, void *data)
|
||||
static void (*ro_mouse_drag_cancel_callback)(void *data) = NULL;
|
||||
static void *ro_mouse_drag_data = NULL;
|
||||
|
||||
/* Data for the wimp poll handler. */
|
||||
|
||||
static void (*ro_mouse_poll_end_callback)(wimp_leaving *leaving, void *data)
|
||||
= NULL;
|
||||
static void (*ro_mouse_poll_track_callback)(wimp_pointer *pointer, void *data)
|
||||
= NULL;
|
||||
static void *ro_mouse_poll_data = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* Process Null polls for any drags and mouse trackers that are currently
|
||||
* active.
|
||||
@ -56,7 +71,8 @@ void ro_mouse_poll(void)
|
||||
|
||||
/* If no trackers are active, just exit. */
|
||||
|
||||
if (ro_mouse_drag_track_callback == NULL /* && no trackers */)
|
||||
if (ro_mouse_drag_track_callback == NULL &&
|
||||
ro_mouse_poll_track_callback == NULL)
|
||||
return;
|
||||
|
||||
error = xwimp_get_pointer_info(&pointer);
|
||||
@ -71,6 +87,11 @@ void ro_mouse_poll(void)
|
||||
|
||||
if (ro_mouse_drag_track_callback != NULL)
|
||||
ro_mouse_drag_track_callback(&pointer, ro_mouse_drag_data);
|
||||
|
||||
/* Process the window tracker, if one is active. */
|
||||
|
||||
if (ro_mouse_poll_track_callback != NULL)
|
||||
ro_mouse_poll_track_callback(&pointer, ro_mouse_poll_data);
|
||||
}
|
||||
|
||||
|
||||
@ -106,8 +127,8 @@ void ro_mouse_drag_start(void (*drag_end)(wimp_dragged *dragged, void *data),
|
||||
|
||||
|
||||
/**
|
||||
* Process Wimp_DragEnd events by passing the details on to any registered
|
||||
* event handler.
|
||||
* Process Wimp_DragEnd events by terminating an active drag track and passing
|
||||
* the details on to any registered event handler.
|
||||
*
|
||||
* \param *dragged The Wimp_DragEnd data block.
|
||||
*/
|
||||
@ -129,3 +150,54 @@ void ro_mouse_drag_end(wimp_dragged *dragged)
|
||||
ro_mouse_drag_data = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start tracking the mouse in a window, providing a function to be called on
|
||||
* null polls and optionally one to be called when it leaves the window.
|
||||
*
|
||||
* \param *drag_end Callback for when the pointer leaves the window, or
|
||||
* NULL for none.
|
||||
* \param *drag_track Callback for mouse tracking while the pointer remains
|
||||
* in the window, or NULL for none.
|
||||
* \param *data Data to be passed to the callback functions, or NULL.
|
||||
*/
|
||||
|
||||
void ro_mouse_track_start(void (*poll_end)(wimp_leaving *leaving, void *data),
|
||||
void (*poll_track)(wimp_pointer *pointer, void *data),
|
||||
void *data)
|
||||
{
|
||||
/* It should never be possible for the mouse to be in two windows
|
||||
* at the same time!
|
||||
*/
|
||||
|
||||
assert(ro_mouse_poll_end_callback == NULL &&
|
||||
ro_mouse_poll_track_callback == NULL &&
|
||||
ro_mouse_poll_data == NULL);
|
||||
|
||||
ro_mouse_poll_end_callback = poll_end;
|
||||
ro_mouse_poll_track_callback = poll_track;
|
||||
ro_mouse_poll_data = data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process Wimp_PointerLeaving events by terminating an active mouse track and
|
||||
* passing the details on to any registered event handler.
|
||||
*
|
||||
* \param *leaving The Wimp_PointerLeaving data block.
|
||||
*/
|
||||
|
||||
void ro_mouse_pointer_leaving_window(wimp_leaving *leaving)
|
||||
{
|
||||
if (ro_mouse_poll_end_callback != NULL)
|
||||
ro_mouse_poll_end_callback(leaving, ro_mouse_poll_data);
|
||||
|
||||
/* Poll tracking is a one-shot event, so clear the data ready for
|
||||
* another claimant.
|
||||
*/
|
||||
|
||||
ro_mouse_poll_end_callback = NULL;
|
||||
ro_mouse_poll_track_callback = NULL;
|
||||
ro_mouse_poll_data = NULL;
|
||||
}
|
||||
|
||||
|
@ -65,5 +65,30 @@ void ro_mouse_drag_start(void (*drag_end)(wimp_dragged *dragged, void *data),
|
||||
|
||||
void ro_mouse_drag_end(wimp_dragged *dragged);
|
||||
|
||||
|
||||
/**
|
||||
* Start tracking the mouse in a window, providing a function to be called on
|
||||
* null polls and optionally one to be called when it leaves the window.
|
||||
*
|
||||
* \param *drag_end Callback for when the pointer leaves the window, or
|
||||
* NULL for none.
|
||||
* \param *drag_track Callback for mouse tracking while the pointer remains
|
||||
* in the window, or NULL for none.
|
||||
* \param *data Data to be passed to the callback functions, or NULL.
|
||||
*/
|
||||
|
||||
void ro_mouse_track_start(void (*poll_end)(wimp_leaving *leaving, void *data),
|
||||
void (*poll_track)(wimp_pointer *pointer, void *data),
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* Process Wimp_PointerLeaving events by terminating an active mouse track and
|
||||
* passing the details on to any registered event handler.
|
||||
*
|
||||
* \param *leaving The Wimp_PointerLeaving data block.
|
||||
*/
|
||||
|
||||
void ro_mouse_pointer_leaving_window(wimp_leaving *leaving);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -100,6 +100,7 @@ static void ro_treeview_redraw_loop(wimp_draw *redraw, ro_treeview *tv,
|
||||
osbool more);
|
||||
static void ro_treeview_open(wimp_open *open);
|
||||
static bool ro_treeview_mouse_click(wimp_pointer *pointer);
|
||||
static void ro_treeview_pointer_entering(wimp_entering *entering);
|
||||
static void ro_treeview_drag_start(ro_treeview *tv, wimp_pointer *pointer,
|
||||
wimp_window_state *state);
|
||||
static void ro_treeview_drag_end(wimp_dragged *drag, void *data);
|
||||
@ -191,6 +192,8 @@ ro_treeview *ro_treeview_create(wimp_w window, struct toolbar *toolbar,
|
||||
|
||||
ro_gui_wimp_event_register_redraw_window(tv->w, ro_treeview_redraw);
|
||||
ro_gui_wimp_event_register_scroll_window(tv->w, ro_treeview_scroll);
|
||||
ro_gui_wimp_event_register_pointer_entering_window(tv->w,
|
||||
ro_treeview_pointer_entering);
|
||||
ro_gui_wimp_event_register_open_window(tv->w, ro_treeview_open);
|
||||
ro_gui_wimp_event_register_mouse_click(tv->w, ro_treeview_mouse_click);
|
||||
ro_gui_wimp_event_register_keypress(tv->w, ro_treeview_keypress);
|
||||
@ -413,6 +416,7 @@ void ro_treeview_scroll(wimp_scroll *scroll)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redraw a treeview window, once the initial readraw block has been collected.
|
||||
*
|
||||
@ -898,6 +902,23 @@ static bool ro_treeview_mouse_click(wimp_pointer *pointer)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Pointer Entering Window events for treeview windows.
|
||||
*
|
||||
* \param *entering The Wimp_PointerEnteringWindow block.
|
||||
*/
|
||||
|
||||
void ro_treeview_pointer_entering(wimp_entering *entering)
|
||||
{
|
||||
ro_treeview *tv;
|
||||
|
||||
tv = (ro_treeview *) ro_gui_wimp_event_get_user_data(entering->w);
|
||||
if (tv == NULL)
|
||||
return;
|
||||
|
||||
ro_mouse_track_start(NULL, ro_treeview_mouse_at, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Track the mouse under Null Polls from the wimp, to support dragging.
|
||||
*
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "utils/log.h"
|
||||
#include "riscos/global_history.h"
|
||||
#include "riscos/gui.h"
|
||||
#include "riscos/mouse.h"
|
||||
#include "utils/nsoption.h"
|
||||
#include "riscos/toolbar.h"
|
||||
#include "riscos/url_complete.h"
|
||||
@ -61,6 +62,7 @@ static int mouse_y;
|
||||
|
||||
static bool url_complete_callback(nsurl *url,
|
||||
const struct url_data *data);
|
||||
static void ro_gui_url_complete_mouse_at(wimp_pointer *pointer, void *data);
|
||||
|
||||
|
||||
/* This is an exported interface documented in url_complete.h */
|
||||
@ -624,7 +626,20 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw)
|
||||
|
||||
/* This is an exported interface documented in url_complete.h */
|
||||
|
||||
void ro_gui_url_complete_mouse_at(wimp_pointer *pointer)
|
||||
void ro_gui_url_complete_entering(wimp_entering *entering)
|
||||
{
|
||||
ro_mouse_track_start(NULL, ro_gui_url_complete_mouse_at, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle mouse movement over the URL completion window.
|
||||
*
|
||||
* \param *pointer The pointer state
|
||||
* \param *data NULL data pointer expected by mouse tracker
|
||||
*/
|
||||
|
||||
void ro_gui_url_complete_mouse_at(wimp_pointer *pointer, void *data)
|
||||
{
|
||||
wimp_mouse_state current;
|
||||
|
||||
|
@ -79,12 +79,12 @@ void ro_gui_url_complete_redraw(wimp_draw *redraw);
|
||||
|
||||
|
||||
/**
|
||||
* Handle mouse movement over the URL completion window.
|
||||
* Handle the pointer entering the URL completion window.
|
||||
*
|
||||
* \param pointer the pointer state
|
||||
*/
|
||||
* \param *entering The pointer entering data block.
|
||||
*/
|
||||
|
||||
void ro_gui_url_complete_mouse_at(wimp_pointer *pointer);
|
||||
void ro_gui_url_complete_entering(wimp_entering *entering);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -96,6 +96,7 @@ struct event_window {
|
||||
void (*close_window)(wimp_w w);
|
||||
void (*redraw_window)(wimp_draw *redraw);
|
||||
void (*scroll_window)(wimp_scroll *scroll);
|
||||
void (*entering_window)(wimp_entering *entering);
|
||||
bool (*menu_prepare)(wimp_w w, wimp_i i, wimp_menu *m,
|
||||
wimp_pointer *p);
|
||||
bool (*menu_selection)(wimp_w w, wimp_i i, wimp_menu *m,
|
||||
@ -1133,6 +1134,24 @@ bool ro_gui_wimp_event_scroll_window(wimp_scroll *scroll)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle any pointer entering window requests
|
||||
*
|
||||
* \param entering the pointer entering window request
|
||||
*/
|
||||
bool ro_gui_wimp_event_pointer_entering_window(wimp_entering *entering)
|
||||
{
|
||||
struct event_window *window;
|
||||
|
||||
window = ro_gui_wimp_event_find_window(entering->w);
|
||||
if ((window) && (window->entering_window)) {
|
||||
window->entering_window(entering);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Process a Menu click in a window, by checking for a registered window
|
||||
* menu and opening it if one is found.
|
||||
@ -1490,6 +1509,22 @@ bool ro_gui_wimp_event_register_scroll_window(wimp_w w,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a function to be called for all pointer entering window requests.
|
||||
*/
|
||||
|
||||
bool ro_gui_wimp_event_register_pointer_entering_window(wimp_w w,
|
||||
void (*callback)(wimp_entering *entering))
|
||||
{
|
||||
struct event_window *window;
|
||||
|
||||
window = ro_gui_wimp_event_get_window(w);
|
||||
if (!window)
|
||||
return false;
|
||||
window->entering_window = callback;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a function to be called before a menu is (re-)opened.
|
||||
*
|
||||
@ -1788,3 +1823,4 @@ void ro_gui_wimp_event_register_submenu(wimp_w w)
|
||||
ro_gui_wimp_event_close_window(ro_gui_wimp_event_submenu);
|
||||
ro_gui_wimp_event_submenu = w;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ bool ro_gui_wimp_event_open_window(wimp_open *open);
|
||||
bool ro_gui_wimp_event_close_window(wimp_w w);
|
||||
bool ro_gui_wimp_event_redraw_window(wimp_draw *redraw);
|
||||
bool ro_gui_wimp_event_scroll_window(wimp_scroll *scroll);
|
||||
bool ro_gui_wimp_event_pointer_entering_window(wimp_entering *entering);
|
||||
|
||||
bool ro_gui_wimp_event_process_window_menu_click(wimp_pointer *pointer);
|
||||
bool ro_gui_wimp_event_prepare_menu(wimp_w w, wimp_i i, wimp_menu *menu);
|
||||
@ -93,6 +94,8 @@ bool ro_gui_wimp_event_register_redraw_window(wimp_w w,
|
||||
void (*callback)(wimp_draw *redraw));
|
||||
bool ro_gui_wimp_event_register_scroll_window(wimp_w w,
|
||||
void (*callback)(wimp_scroll *scroll));
|
||||
bool ro_gui_wimp_event_register_pointer_entering_window(wimp_w w,
|
||||
void (*callback)(wimp_entering *entering));
|
||||
bool ro_gui_wimp_event_register_menu_prepare(wimp_w w,
|
||||
bool (*callback)(wimp_w w, wimp_i i, wimp_menu *m,
|
||||
wimp_pointer *p));
|
||||
|
@ -94,6 +94,8 @@ static void gui_window_set_extent(struct gui_window *g, int width, int height);
|
||||
|
||||
static void ro_gui_window_redraw(wimp_draw *redraw);
|
||||
static void ro_gui_window_scroll(wimp_scroll *scroll);
|
||||
static void ro_gui_window_pointer_entering(wimp_entering *entering);
|
||||
static void ro_gui_window_track_end(wimp_leaving *leaving, void *data);
|
||||
static void ro_gui_window_open(wimp_open *open);
|
||||
static void ro_gui_window_close(wimp_w w);
|
||||
static bool ro_gui_window_click(wimp_pointer *mouse);
|
||||
@ -546,6 +548,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
ro_gui_wimp_event_register_close_window(g->window, ro_gui_window_close);
|
||||
ro_gui_wimp_event_register_redraw_window(g->window, ro_gui_window_redraw);
|
||||
ro_gui_wimp_event_register_scroll_window(g->window, ro_gui_window_scroll);
|
||||
ro_gui_wimp_event_register_pointer_entering_window(g->window, ro_gui_window_pointer_entering);
|
||||
ro_gui_wimp_event_register_keypress(g->window, ro_gui_window_keypress);
|
||||
ro_gui_wimp_event_register_mouse_click(g->window, ro_gui_window_click);
|
||||
ro_gui_wimp_event_register_menu(g->window, ro_gui_browser_window_menu,
|
||||
@ -3134,6 +3137,37 @@ void ro_gui_window_scroll(wimp_scroll *scroll)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Pointer Entering Window events in a browser window.
|
||||
*
|
||||
* \param *entering The wimp pointer entering event data block.
|
||||
*/
|
||||
|
||||
static void ro_gui_window_pointer_entering(wimp_entering *entering)
|
||||
{
|
||||
struct gui_window *g = ro_gui_window_lookup(entering->w);
|
||||
|
||||
if (g != NULL)
|
||||
ro_mouse_track_start(ro_gui_window_track_end,
|
||||
ro_gui_window_mouse_at, g);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process Pointer Leaving Window events in a browser window. These arrive via
|
||||
* the termination callback handler from ro_mouse's mouse tracking.
|
||||
*
|
||||
* \param *leaving The wimp pointer leaving event data block.
|
||||
* \param *data The GUI window that the pointer is leaving.
|
||||
*/
|
||||
|
||||
static void ro_gui_window_track_end(wimp_leaving *leaving, void *data)
|
||||
{
|
||||
struct gui_window *g = (struct gui_window *) data;
|
||||
|
||||
if (g != NULL)
|
||||
gui_window_set_pointer(g, GUI_POINTER_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scroll a browser window, either via the core or directly using the
|
||||
|
Loading…
Reference in New Issue
Block a user