mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-08 22:33:18 +00:00
Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED
This commit is contained in:
@@ -199,7 +199,7 @@ int SDL_InitSubSystem(Uint32 flags)
|
||||
|
||||
/* Initialize the event subsystem */
|
||||
if (flags & SDL_INIT_EVENTS) {
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) {
|
||||
SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS);
|
||||
if (SDL_InitEvents() < 0) {
|
||||
@@ -438,7 +438,7 @@ void SDL_QuitSubSystem(Uint32 flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (flags & SDL_INIT_EVENTS) {
|
||||
if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) {
|
||||
SDL_QuitEvents();
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "usb_ids.h"
|
||||
#include "hidapi/SDL_hidapi_nintendo.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
@@ -3056,7 +3056,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
|
||||
|
||||
/* translate the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION;
|
||||
@@ -3076,7 +3076,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep
|
||||
static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadButton button, Uint8 state)
|
||||
{
|
||||
int posted;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
|
||||
SDL_AssertJoysticksLocked();
|
||||
@@ -3118,7 +3118,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
|
||||
|
||||
/* translate the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(event.type)) {
|
||||
event.common.timestamp = timestamp;
|
||||
event.gbutton.which = gamepad->joystick->instance_id;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "SDL_gamepad_c.h"
|
||||
#include "SDL_joystick_c.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../events/SDL_events_c.h"
|
||||
#endif
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
@@ -301,7 +301,7 @@ int SDL_InitJoysticks(void)
|
||||
SDL_joystick_lock = SDL_CreateMutex();
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1304,7 +1304,7 @@ void SDL_QuitJoysticks(void)
|
||||
SDL_joystick_player_count = 0;
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_QuitSubSystem(SDL_INIT_EVENTS);
|
||||
#endif
|
||||
|
||||
@@ -1404,7 +1404,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id)
|
||||
SDL_SetJoystickIDForPlayerIndex(player_index, instance_id);
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
{
|
||||
SDL_Event event;
|
||||
|
||||
@@ -1454,7 +1454,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
|
||||
{
|
||||
SDL_Joystick *joystick = NULL;
|
||||
int player_index;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
#endif
|
||||
|
||||
@@ -1469,7 +1469,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id)
|
||||
}
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
event.type = SDL_EVENT_JOYSTICK_REMOVED;
|
||||
event.common.timestamp = 0;
|
||||
|
||||
@@ -1538,7 +1538,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION;
|
||||
@@ -1580,7 +1580,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_JOYSTICK_HAT_MOTION;
|
||||
@@ -1597,7 +1597,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin
|
||||
int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 button, Uint8 state)
|
||||
{
|
||||
int posted;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_Event event;
|
||||
|
||||
SDL_AssertJoysticksLocked();
|
||||
@@ -1638,7 +1638,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(event.type)) {
|
||||
event.common.timestamp = timestamp;
|
||||
event.jbutton.which = joystick->instance_id;
|
||||
@@ -2850,7 +2850,7 @@ void SDL_SendJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel
|
||||
|
||||
SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */
|
||||
if (ePowerLevel != joystick->epowerlevel) {
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED;
|
||||
@@ -2954,7 +2954,7 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(event_type)) {
|
||||
SDL_Event event;
|
||||
event.type = event_type;
|
||||
@@ -2994,7 +2994,7 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT
|
||||
SDL_memcpy(sensor->data, data, num_values * sizeof(*data));
|
||||
|
||||
/* Post the event, if desired */
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "SDL_mfijoystick_c.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "SDL_syssensor.h"
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
#include "../events/SDL_events_c.h"
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@ int SDL_InitSensors(void)
|
||||
SDL_sensor_lock = SDL_CreateMutex();
|
||||
}
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ void SDL_QuitSensors(void)
|
||||
|
||||
SDL_UnlockSensors();
|
||||
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
SDL_QuitSubSystem(SDL_INIT_EVENTS);
|
||||
#endif
|
||||
|
||||
@@ -488,7 +488,7 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
#if !SDL_EVENTS_DISABLED
|
||||
#ifndef SDL_EVENTS_DISABLED
|
||||
if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) {
|
||||
SDL_Event event;
|
||||
event.type = SDL_EVENT_SENSOR_UPDATE;
|
||||
|
||||
Reference in New Issue
Block a user