comparison include/SDL_events.h @ 1722:5daa04d862f1 SDL-1.3

Added a userdata parameter for event filters. Added a function to filter the existing queued events. Added explicit support for relative mouse mode to the API.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 30 Jun 2006 08:18:44 +0000
parents 8d7fecceb9ef
children 6c63fc2bd986
comparison
equal deleted inserted replaced
1721:1cc762cafff8 1722:5daa04d862f1
375 This function sets up a filter to process all events before they 375 This function sets up a filter to process all events before they
376 change internal state and are posted to the internal event queue. 376 change internal state and are posted to the internal event queue.
377 377
378 The filter is protypted as: 378 The filter is protypted as:
379 */ 379 */
380 typedef int (SDLCALL * SDL_EventFilter) (SDL_Event * event); 380 typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
381 /* 381 /*
382 If the filter returns 1, then the event will be added to the internal queue. 382 If the filter returns 1, then the event will be added to the internal queue.
383 If it returns 0, then the event will be dropped from the queue, but the 383 If it returns 0, then the event will be dropped from the queue, but the
384 internal state will still be updated. This allows selective filtering of 384 internal state will still be updated. This allows selective filtering of
385 dynamically arriving events. 385 dynamically arriving events.
392 application window. If the event filter returns 1, then the window will 392 application window. If the event filter returns 1, then the window will
393 be closed, otherwise the window will remain open if possible. 393 be closed, otherwise the window will remain open if possible.
394 If the quit event is generated by an interrupt signal, it will bypass the 394 If the quit event is generated by an interrupt signal, it will bypass the
395 internal queue and be delivered to the application at the next event poll. 395 internal queue and be delivered to the application at the next event poll.
396 */ 396 */
397 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter); 397 extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
398 void *userdata);
398 399
399 /* 400 /*
400 Return the current event filter - can be used to "chain" filters. 401 Return the current event filter - can be used to "chain" filters.
401 If there is no event filter set, this function returns NULL. 402 If there is no event filter set, this function returns NULL.
402 */ 403 */
403 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void); 404 extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void **userdata);
405
406 /*
407 Run the filter function on the current event queue, removing any
408 events for which the filter returns 0.
409 */
410 extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
411 void *userdata);
404 412
405 /* 413 /*
406 This function allows you to set the state of processing certain events. 414 This function allows you to set the state of processing certain events.
407 If 'state' is set to SDL_IGNORE, that event will be automatically dropped 415 If 'state' is set to SDL_IGNORE, that event will be automatically dropped
408 from the event queue and will not event be filtered. 416 from the event queue and will not event be filtered.