NetSurf
Functions | Variables
mouse.c File Reference

Mouse dragging and tracking support implementation. More...

#include <assert.h>
#include <oslib/wimp.h>
#include "utils/log.h"
#include "riscos/mouse.h"
#include "riscos/gui.h"
Include dependency graph for mouse.c:

Go to the source code of this file.

Functions

void ro_mouse_poll (void)
 Process Null polls for any drags and mouse trackers that are currently active. More...
 
void ro_mouse_drag_start (void(*drag_end)(wimp_dragged *dragged, void *data), void(*drag_track)(wimp_pointer *pointer, void *data), void(*drag_cancel)(void *data), void *data)
 Start a drag, providing a function to be called when the Wimp_DragEnd event is received and optionally a tracking function to be called on null polls in between times. More...
 
void ro_mouse_drag_end (wimp_dragged *dragged)
 Process Wimp_DragEnd events by terminating an active drag track and passing the details on to any registered event handler. More...
 
void ro_mouse_track_start (void(*poll_end)(wimp_leaving *leaving, void *data), void(*poll_track)(wimp_pointer *pointer, void *data), void *data)
 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. More...
 
void ro_mouse_pointer_leaving_window (wimp_leaving *leaving)
 Process Wimp_PointerLeaving events by terminating an active mouse track and passing the details on to any registered event handler. More...
 
void ro_mouse_kill (void *data)
 Kill any tracking events if the data pointers match the supplied pointer. More...
 
os_t ro_mouse_poll_interval (void)
 Return the desired polling interval to allow the mouse tracking to be carried out. More...
 

Variables

static void(* ro_mouse_drag_end_callback )(wimp_dragged *dragged, void *data) = NULL
 
static void(* ro_mouse_drag_track_callback )(wimp_pointer *pointer, void *data) = NULL
 
static void(* ro_mouse_drag_cancel_callback )(void *data) = NULL
 
static void * ro_mouse_drag_data = NULL
 
static bool ro_mouse_ignore_leaving_event = false
 
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
 

Detailed Description

Mouse dragging and tracking support implementation.

Two different functions are provided:-

  1. Wimp_DragBox support, allowing clients to start a drag and specify callbacks to be used
    • 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.

Definition in file mouse.c.

Function Documentation

◆ ro_mouse_drag_end()

void ro_mouse_drag_end ( wimp_dragged *  dragged)

Process Wimp_DragEnd events by terminating an active drag track and passing the details on to any registered event handler.

Process Wimp_DragEnd events by passing the details on to any registered event handler.

Parameters
*draggedThe Wimp_DragEnd data block.

Definition at line 146 of file mouse.c.

References ro_mouse_drag_cancel_callback, ro_mouse_drag_data, ro_mouse_drag_end_callback, ro_mouse_drag_track_callback, and ro_warn_user().

Referenced by ro_gui_handle_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_mouse_drag_start()

void ro_mouse_drag_start ( void(*)(wimp_dragged *dragged, void *data)  drag_end,
void(*)(wimp_pointer *pointer, void *data)  drag_track,
void(*)(void *data)  drag_cancel,
void *  data 
)

Start a drag, providing a function to be called when the Wimp_DragEnd event is received and optionally a tracking function to be called on null polls in between times.

Parameters
*drag_endCallback for when the drag terminates, or NULL for none.
*drag_trackCallback for mouse tracking during the drag, or NULL for none.
*drag_cancelCallback for cancelling the drag, or NULL if the drag can't be cancelled.
*dataData to be passed to the callback functions, or NULL.

Definition at line 115 of file mouse.c.

References ro_mouse_drag_cancel_callback, ro_mouse_drag_data, ro_mouse_drag_end_callback, ro_mouse_drag_track_callback, and ro_mouse_ignore_leaving_event.

Referenced by gui_drag_save_object(), gui_drag_save_selection(), gui_start_selection(), gui_window_drag_start(), gui_window_scroll_start(), ro_cw_drag_start(), ro_gui_button_bar_click(), ro_gui_download_click(), ro_gui_drag_save_link(), and ro_gui_save_start_drag().

Here is the caller graph for this function:

◆ ro_mouse_kill()

void ro_mouse_kill ( void *  data)

Kill any tracking events if the data pointers match the supplied pointer.

Parameters
*dataThe data of the client to be killed.

Definition at line 248 of file mouse.c.

References ro_mouse_drag_cancel_callback, ro_mouse_drag_data, ro_mouse_drag_end_callback, ro_mouse_drag_track_callback, ro_mouse_poll_data, ro_mouse_poll_end_callback, and ro_mouse_poll_track_callback.

Referenced by gui_window_destroy().

Here is the caller graph for this function:

◆ ro_mouse_pointer_leaving_window()

void ro_mouse_pointer_leaving_window ( wimp_leaving *  leaving)

Process Wimp_PointerLeaving events by terminating an active mouse track and passing the details on to any registered event handler.

If the ignore mask is set, we don't pass the event on to the client as it is assumed that it's a result of starting a Wimp_DragBox operation.

Parameters
*leavingThe Wimp_PointerLeaving data block.

Definition at line 224 of file mouse.c.

References ro_mouse_ignore_leaving_event, ro_mouse_poll_data, ro_mouse_poll_end_callback, and ro_mouse_poll_track_callback.

Referenced by ro_gui_handle_event().

Here is the caller graph for this function:

◆ ro_mouse_poll()

void ro_mouse_poll ( void  )

Process Null polls for any drags and mouse trackers that are currently active.

Definition at line 71 of file mouse.c.

References NSLOG, ro_mouse_drag_data, ro_mouse_drag_track_callback, ro_mouse_poll_data, ro_mouse_poll_track_callback, and ro_warn_user().

Referenced by ro_gui_handle_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ro_mouse_poll_interval()

os_t ro_mouse_poll_interval ( void  )

Return the desired polling interval to allow the mouse tracking to be carried out.

Returns
Desired poll interval (0 for none required).

Definition at line 272 of file mouse.c.

References ro_mouse_drag_track_callback, and ro_mouse_poll_track_callback.

Referenced by riscos_poll().

Here is the caller graph for this function:

◆ ro_mouse_track_start()

void ro_mouse_track_start ( void(*)(wimp_leaving *leaving, void *data)  poll_end,
void(*)(wimp_pointer *pointer, void *data)  poll_track,
void *  data 
)

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.

Parameters
*poll_endCallback for when the pointer leaves the window, or NULL for none. Claimants can receive *leaving==NULL if a new tracker is started before a PointerLeaving event is received.
*poll_trackCallback for mouse tracking while the pointer remains in the window, or NULL for none.
*dataData to be passed to the callback functions, or NULL.

Definition at line 177 of file mouse.c.

References NSLOG, ro_mouse_ignore_leaving_event, ro_mouse_poll_data, ro_mouse_poll_end_callback, and ro_mouse_poll_track_callback.

Referenced by ro_cw_pointer_entering(), ro_gui_url_complete_entering(), and ro_gui_window_pointer_entering().

Here is the caller graph for this function:

Variable Documentation

◆ ro_mouse_drag_cancel_callback

void(* ro_mouse_drag_cancel_callback) (void *data) ( void *  data) = NULL
static

Definition at line 52 of file mouse.c.

Referenced by ro_mouse_drag_end(), ro_mouse_drag_start(), and ro_mouse_kill().

◆ ro_mouse_drag_data

void* ro_mouse_drag_data = NULL
static

Definition at line 53 of file mouse.c.

Referenced by ro_mouse_drag_end(), ro_mouse_drag_start(), ro_mouse_kill(), and ro_mouse_poll().

◆ ro_mouse_drag_end_callback

void(* ro_mouse_drag_end_callback) (wimp_dragged *dragged, void *data) ( wimp_dragged *  dragged,
void *  data 
) = NULL
static

Definition at line 48 of file mouse.c.

Referenced by ro_mouse_drag_end(), ro_mouse_drag_start(), and ro_mouse_kill().

◆ ro_mouse_drag_track_callback

void(* ro_mouse_drag_track_callback) (wimp_pointer *pointer, void *data) ( wimp_pointer *  pointer,
void *  data 
) = NULL
static

◆ ro_mouse_ignore_leaving_event

bool ro_mouse_ignore_leaving_event = false
static

◆ ro_mouse_poll_data

void* ro_mouse_poll_data = NULL
static

◆ ro_mouse_poll_end_callback

void(* ro_mouse_poll_end_callback) (wimp_leaving *leaving, void *data) ( wimp_leaving *  leaving,
void *  data 
) = NULL
static

Definition at line 59 of file mouse.c.

Referenced by ro_mouse_kill(), ro_mouse_pointer_leaving_window(), and ro_mouse_track_start().

◆ ro_mouse_poll_track_callback

void(* ro_mouse_poll_track_callback) (wimp_pointer *pointer, void *data) ( wimp_pointer *  pointer,
void *  data 
) = NULL
static