| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | /* Post the event, if desired */ |
| | | posted = 0; |
| | | #if !SDL_EVENTS_DISABLED |
| | | if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { |
| | | if (SDL_GetEventState(SDL_SENSORUPDATE) == SDL_ENABLE) { |
| | | SDL_Event event; |
| | | event.type = SDL_SENSORUPDATE; |
| | | event.sensor.which = sensor->instance_id; |
| | |
| | | SDL_SensorUpdate(void) |
| | | { |
| | | int i; |
| | | SDL_Sensor *sensor; |
| | | SDL_Sensor *sensor, *next; |
| | | |
| | | if (!SDL_WasInit(SDL_INIT_SENSOR)) { |
| | | return; |
| | | } |
| | | |
| | | SDL_LockSensors(); |
| | | |
| | |
| | | SDL_updating_sensor = SDL_FALSE; |
| | | |
| | | /* If any sensors were closed while updating, free them here */ |
| | | for (sensor = SDL_sensors; sensor; sensor = sensor->next) { |
| | | for (sensor = SDL_sensors; sensor; sensor = next) { |
| | | next = sensor->next; |
| | | if (sensor->ref_count <= 0) { |
| | | SDL_SensorClose(sensor); |
| | | } |