Mail Archives: djgpp/1996/10/01/17:46:53
Tero Parvinen wrote:
>
> I downloaded the sample-interrupt-handlers-v2.zip package from www.delorie.com
> and I tried to use the functions in mouse.s.
> I can't get the m_setUserFunction function to work.
>
> I'm not sure about the syntax because the package is not exactly well documented.
> I suppose the first parameter is the
> address of the callback function and the second is the mask for the events. I
> suppose I don't have to use the dpmi-functions
> to make a callback wrapper because the mouse routines provide one if I interpreted
> the mouse.s file correctly.
>
> So what I would like to do is declare a pure C-function which would get called by
> the mouse handler. How should I declare
> the C-function and what should I pass as the first parameter of m_setUserFunction?
>
> If someone has managed to do this, any help would be appreciated.
> I would prefer an answer in e-mail if possible. (Tero DOT Parvinen AT hut DOT fi is a good
> address ;) )
Sorry about the lack of docs.
Here's how to use the callback function:
void c_callback_function(short mask, short mouse_x, short mouse_y,
short delta_x, short delta_y,
short button_flags)
{
/* mask the the set of events that cause the callback to trigger */
...
}
mouse_event_handler_initialization_function()
{
m_init(); /* allocatate the callback and lock the mouse memory */
/*Don't forget to lock your callback function and it's data!!!!*/
m_setUserFunction(c_callback_function,mask_for_mouse_events);
/* mask_for_events is used to determine when your function gets called
* I usually use 0xffff to get all possible events (see Ralf Brown's
* list for more details
*/
...
}
mouse_event_handler_deinitialization_function()
{
m_uninit(); /* dellocate the callback and unlock the mouse memroy */
}
Hope this helps
Bill
- Raw text -