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! However, some third-party extensions to RISC OS * appear to make this possible (MouseAxess being one), so in the * event that there's still a claimant we tidy them up first and then * log the fact in case there are any unexpected consequences. * * NB: The Poll End callback will get called with *leaving == NULL in * this situation, as there's no PointerLeaving event to pass on. */ if (ro_mouse_poll_end_callback != NULL || ro_mouse_poll_track_callback != NULL || ro_mouse_poll_data != NULL) { if (ro_mouse_poll_end_callback != NULL && ro_mouse_ignore_leaving_event == false) ro_mouse_poll_end_callback(NULL, ro_mouse_poll_data); LOG("Unexpected mouse track termination."); ro_mouse_ignore_leaving_event = false; ro_mouse_poll_end_callback = NULL; ro_mouse_poll_track_callback = NULL; ro_mouse_poll_data = NULL; } /* Now record details of the new claimant. */ ro_mouse_poll_end_callback = poll_end; ro_mouse_poll_track_callback = poll_track; ro_mouse_poll_data = data; }
void ro_mouse_pointer_leaving_window(wimp_leaving *leaving) { if (ro_mouse_poll_end_callback != NULL && ro_mouse_ignore_leaving_event == false) ro_mouse_poll_end_callback(leaving, ro_mouse_poll_data); ro_mouse_ignore_leaving_event = false; /* 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; }