Feature #852 ยป 0030-sdl3-Change-FilterMouseMotionEvents-return-type-to-b.patch
| client/gui-sdl3/gui_main.c | ||
|---|---|---|
|
Filter out mouse motion events for too small movement to react to.
|
||
|
This function may run in a separate event thread.
|
||
|
**************************************************************************/
|
||
|
int FilterMouseMotionEvents(void *data, SDL_Event *event)
|
||
|
bool FilterMouseMotionEvents(void *data, SDL_Event *event)
|
||
|
{
|
||
|
if (event->type == SDL_EVENT_MOUSE_MOTION) {
|
||
|
static int x = 0, y = 0;
|
||
| ... | ... | |
|
|| ((MOVE_STEP_Y > 0) && (abs(event->motion.y - y) >= MOVE_STEP_Y)) ) {
|
||
|
x = event->motion.x;
|
||
|
y = event->motion.y;
|
||
|
return 1; /* Catch it */
|
||
|
return TRUE; /* Catch it */
|
||
|
} else {
|
||
|
return 0; /* Drop it, we've handled it */
|
||
|
return FALSE; /* Drop it, we've handled it */
|
||
|
}
|
||
|
}
|
||
|
return 1;
|
||
|
return TRUE;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| client/gui-sdl3/gui_main.h | ||
|---|---|---|
|
#define DEFAULT_MOVE_STEP 5
|
||
|
extern int MOVE_STEP_X, MOVE_STEP_Y;
|
||
|
int FilterMouseMotionEvents(void *data, SDL_Event *event);
|
||
|
bool FilterMouseMotionEvents(void *data, SDL_Event *event);
|
||
|
Uint16 gui_event_loop(void *data, void (*loop_action)(void *data),
|
||
|
Uint16 (*key_down_handler)(SDL_Keycode key, void *data),
|
||