Simplify flags testing (#7220)

This commit is contained in:
Sylvain Becker 2023-02-03 22:08:42 +01:00 committed by GitHub
parent dcd17f5473
commit cb6b8b0132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 218 additions and 218 deletions

View File

@ -175,18 +175,18 @@ int SDL_InitSubSystem(Uint32 flags)
SDL_DBus_Init();
#endif
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
/* game controller implies joystick */
flags |= SDL_INIT_JOYSTICK;
}
if ((flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO))) {
if (flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO)) {
/* video or joystick or audio implies events */
flags |= SDL_INIT_EVENTS;
}
#if SDL_VIDEO_DRIVER_WINDOWS
if ((flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK))) {
if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) {
if (SDL_HelperWindowCreate() < 0) {
goto quit_and_error;
}
@ -198,7 +198,7 @@ int SDL_InitSubSystem(Uint32 flags)
#endif
/* Initialize the event subsystem */
if ((flags & SDL_INIT_EVENTS)) {
if (flags & SDL_INIT_EVENTS) {
#if !SDL_EVENTS_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS);
@ -217,7 +217,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the timer subsystem */
if ((flags & SDL_INIT_TIMER)) {
if (flags & SDL_INIT_TIMER) {
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if (SDL_ShouldInitSubsystem(SDL_INIT_TIMER)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER);
@ -236,7 +236,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the video subsystem */
if ((flags & SDL_INIT_VIDEO)) {
if (flags & SDL_INIT_VIDEO) {
#if !SDL_VIDEO_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_VIDEO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO);
@ -255,7 +255,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the audio subsystem */
if ((flags & SDL_INIT_AUDIO)) {
if (flags & SDL_INIT_AUDIO) {
#if !SDL_AUDIO_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_AUDIO)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO);
@ -274,7 +274,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the joystick subsystem */
if ((flags & SDL_INIT_JOYSTICK)) {
if (flags & SDL_INIT_JOYSTICK) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_JOYSTICK)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK);
@ -292,7 +292,7 @@ int SDL_InitSubSystem(Uint32 flags)
#endif
}
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
#if !SDL_JOYSTICK_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_GAMEPAD)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD);
@ -311,7 +311,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the haptic subsystem */
if ((flags & SDL_INIT_HAPTIC)) {
if (flags & SDL_INIT_HAPTIC) {
#if !SDL_HAPTIC_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_HAPTIC)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_HAPTIC);
@ -330,7 +330,7 @@ int SDL_InitSubSystem(Uint32 flags)
}
/* Initialize the sensor subsystem */
if ((flags & SDL_INIT_SENSOR)) {
if (flags & SDL_INIT_SENSOR) {
#if !SDL_SENSOR_DISABLED
if (SDL_ShouldInitSubsystem(SDL_INIT_SENSOR)) {
SDL_IncrementSubsystemRefCount(SDL_INIT_SENSOR);
@ -366,7 +366,7 @@ void SDL_QuitSubSystem(Uint32 flags)
{
/* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED
if ((flags & SDL_INIT_SENSOR)) {
if (flags & SDL_INIT_SENSOR) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_SENSOR)) {
SDL_QuitSensors();
}
@ -375,7 +375,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_JOYSTICK_DISABLED
if ((flags & SDL_INIT_GAMEPAD)) {
if (flags & SDL_INIT_GAMEPAD) {
/* game controller implies joystick */
flags |= SDL_INIT_JOYSTICK;
@ -385,7 +385,7 @@ void SDL_QuitSubSystem(Uint32 flags)
SDL_DecrementSubsystemRefCount(SDL_INIT_GAMEPAD);
}
if ((flags & SDL_INIT_JOYSTICK)) {
if (flags & SDL_INIT_JOYSTICK) {
/* joystick implies events */
flags |= SDL_INIT_EVENTS;
@ -397,7 +397,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_HAPTIC_DISABLED
if ((flags & SDL_INIT_HAPTIC)) {
if (flags & SDL_INIT_HAPTIC) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_HAPTIC)) {
SDL_QuitHaptics();
}
@ -406,7 +406,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_AUDIO_DISABLED
if ((flags & SDL_INIT_AUDIO)) {
if (flags & SDL_INIT_AUDIO) {
/* audio implies events */
flags |= SDL_INIT_EVENTS;
@ -418,7 +418,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_VIDEO_DISABLED
if ((flags & SDL_INIT_VIDEO)) {
if (flags & SDL_INIT_VIDEO) {
/* video implies events */
flags |= SDL_INIT_EVENTS;
@ -430,7 +430,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if ((flags & SDL_INIT_TIMER)) {
if (flags & SDL_INIT_TIMER) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_QuitTimers();
}
@ -439,7 +439,7 @@ void SDL_QuitSubSystem(Uint32 flags)
#endif
#if !SDL_EVENTS_DISABLED
if ((flags & SDL_INIT_EVENTS)) {
if (flags & SDL_INIT_EVENTS) {
if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) {
SDL_QuitEvents();
}

View File

@ -293,10 +293,10 @@ static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma
src -= 15;
dst -= 15; /* adjust to read SSE blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128i *mmsrc = (const __m128i *)src;
const __m128i zero = _mm_setzero_si128();
@ -357,10 +357,10 @@ static void SDLCALL SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma
src -= 15;
dst -= 15; /* adjust to read SSE blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128i *mmsrc = (const __m128i *)src;
const __m128i zero = _mm_setzero_si128();
@ -423,10 +423,10 @@ static void SDLCALL SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
src -= 7;
dst -= 7; /* adjust to read SSE blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
while (i >= 8) { /* 8 * 16-bit */
@ -476,10 +476,10 @@ static void SDLCALL SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
src -= 7;
dst -= 7; /* adjust to read SSE blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 divby32768 = _mm_set1_ps(DIVBY32768);
const __m128 minus1 = _mm_set1_ps(-1.0f);
@ -528,10 +528,10 @@ static void SDLCALL SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
*dst = ((float)(*src >> 8)) * DIVBY8388607;
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 divby8388607 = _mm_set1_ps(DIVBY8388607);
const __m128i *mmsrc = (const __m128i *)src;
@ -578,10 +578,10 @@ static void SDLCALL SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 one = _mm_set1_ps(1.0f);
const __m128 negone = _mm_set1_ps(-1.0f);
@ -641,10 +641,10 @@ static void SDLCALL SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 one = _mm_set1_ps(1.0f);
const __m128 negone = _mm_set1_ps(-1.0f);
@ -704,10 +704,10 @@ static void SDLCALL SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
const __m128 one = _mm_set1_ps(1.0f);
const __m128 negone = _mm_set1_ps(-1.0f);
@ -765,10 +765,10 @@ static void SDLCALL SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
/* This calculates differently than the scalar path because SSE2 can't
pack int32 data down to unsigned int16. _mm_packs_epi32 does signed
@ -834,8 +834,8 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || ((((size_t)src) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
SDL_assert(!i || !(((size_t)src) & 15));
{
/* Aligned! Do SSE blocks as long as we have 16 bytes available. */
@ -889,10 +889,10 @@ static void SDLCALL SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForma
src -= 15;
dst -= 15; /* adjust to read NEON blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const int8_t *mmsrc = (const int8_t *)src;
const float32x4_t divby128 = vdupq_n_f32(DIVBY128);
@ -945,10 +945,10 @@ static void SDLCALL SDL_Convert_U8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForma
src -= 15;
dst -= 15; /* adjust to read NEON blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const uint8_t *mmsrc = (const uint8_t *)src;
const float32x4_t divby128 = vdupq_n_f32(DIVBY128);
@ -1002,10 +1002,10 @@ static void SDLCALL SDL_Convert_S16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
src -= 7;
dst -= 7; /* adjust to read NEON blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768);
while (i >= 8) { /* 8 * 16-bit */
@ -1051,10 +1051,10 @@ static void SDLCALL SDL_Convert_U16_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
src -= 7;
dst -= 7; /* adjust to read NEON blocks from the start. */
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t divby32768 = vdupq_n_f32(DIVBY32768);
const float32x4_t negone = vdupq_n_f32(-1.0f);
@ -1099,10 +1099,10 @@ static void SDLCALL SDL_Convert_S32_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
*dst = ((float)(*src >> 8)) * DIVBY8388607;
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t divby8388607 = vdupq_n_f32(DIVBY8388607);
const int32_t *mmsrc = (const int32_t *)src;
@ -1149,10 +1149,10 @@ static void SDLCALL SDL_Convert_F32_to_S8_NEON(SDL_AudioCVT *cvt, SDL_AudioForma
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t one = vdupq_n_f32(1.0f);
const float32x4_t negone = vdupq_n_f32(-1.0f);
@ -1214,10 +1214,10 @@ static void SDLCALL SDL_Convert_F32_to_U8_NEON(SDL_AudioCVT *cvt, SDL_AudioForma
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t one = vdupq_n_f32(1.0f);
const float32x4_t negone = vdupq_n_f32(-1.0f);
@ -1280,10 +1280,10 @@ static void SDLCALL SDL_Convert_F32_to_S16_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t one = vdupq_n_f32(1.0f);
const float32x4_t negone = vdupq_n_f32(-1.0f);
@ -1341,10 +1341,10 @@ static void SDLCALL SDL_Convert_F32_to_U16_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
/* Make sure src is aligned too. */
if ((((size_t)src) & 15) == 0) {
if (!(((size_t)src) & 15)) {
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */
const float32x4_t one = vdupq_n_f32(1.0f);
const float32x4_t negone = vdupq_n_f32(-1.0f);
@ -1402,8 +1402,8 @@ static void SDLCALL SDL_Convert_F32_to_S32_NEON(SDL_AudioCVT *cvt, SDL_AudioForm
}
}
SDL_assert(!i || ((((size_t)dst) & 15) == 0));
SDL_assert(!i || ((((size_t)src) & 15) == 0));
SDL_assert(!i || !(((size_t)dst) & 15));
SDL_assert(!i || !(((size_t)src) & 15));
{
/* Aligned! Do NEON blocks as long as we have 16 bytes available. */

View File

@ -226,10 +226,10 @@ static void DSOUND_WaitDevice(_THIS)
/* Try to restore a lost sound buffer */
IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status);
if ((status & DSBSTATUS_BUFFERLOST)) {
if (status & DSBSTATUS_BUFFERLOST) {
IDirectSoundBuffer_Restore(this->hidden->mixbuf);
IDirectSoundBuffer_GetStatus(this->hidden->mixbuf, &status);
if ((status & DSBSTATUS_BUFFERLOST)) {
if (status & DSBSTATUS_BUFFERLOST) {
break;
}
}

View File

@ -251,7 +251,7 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl
return;
}
if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
if (udev_class & SDL_UDEV_DEVICE_JOYSTICK) {
return;
}

View File

@ -476,7 +476,7 @@ static int CPU_haveNEON(void)
AndroidCpuFamily cpu_family = android_getCpuFamily();
if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
uint64_t cpu_features = android_getCpuFeatures();
if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) {
return 1;
}
}

View File

@ -930,8 +930,8 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
state == SDL_PRESSED &&
(keyboard->modstate & SDL_KMOD_ALT) &&
keyboard->focus &&
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0 &&
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) != 0 &&
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) &&
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) &&
SDL_GetHintBoolean(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, SDL_TRUE)) {
/* We will temporarily forfeit our grab by minimizing our window,
allowing the user to escape the application */
@ -1009,7 +1009,7 @@ SDL_HardwareKeyboardKeyPressed(void)
SDL_Scancode scancode;
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) {
if ((keyboard->keysource[scancode] & KEYBOARD_HARDWARE) != 0) {
if (keyboard->keysource[scancode] & KEYBOARD_HARDWARE) {
return SDL_TRUE;
}
}

View File

@ -310,7 +310,7 @@ static SDL_bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint3
SDL_Mouse *mouse = SDL_GetMouse();
SDL_bool inWindow = SDL_TRUE;
if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
if (window && !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
if (x < 0.0f || y < 0.0f || x >= (float)window->w || y >= (float)window->h) {
inWindow = SDL_FALSE;
}
@ -482,7 +482,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
return 0;
}
} else {
if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) {
if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
if (mouse->WarpMouse) {
mouse->WarpMouse(window, center_x, center_y);
} else {
@ -532,7 +532,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
/* make sure that the pointers find themselves inside the windows,
unless we have the mouse captured. */
if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) {
if (window && !(window->flags & SDL_WINDOW_MOUSE_CAPTURE)) {
int x_min = 0, x_max = window->w - 1;
int y_min = 0, y_max = window->h - 1;
const SDL_Rect *confine = SDL_GetWindowMouseRect(window);

View File

@ -67,7 +67,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
SDL_WINDOWPOS_ISUNDEFINED(data2)) {
return 0;
}
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->windowed.x = data1;
window->windowed.y = data2;
}
@ -78,7 +78,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
window->y = data2;
break;
case SDL_EVENT_WINDOW_RESIZED:
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
window->windowed.w = data1;
window->windowed.h = data2;
}

View File

@ -585,7 +585,7 @@ int SDL_HapticGetEffectStatus(SDL_Haptic *haptic, int effect)
return -1;
}
if ((haptic->supported & SDL_HAPTIC_STATUS) == 0) {
if (!(haptic->supported & SDL_HAPTIC_STATUS)) {
return SDL_SetError("Haptic: Device does not support status queries.");
}
@ -604,7 +604,7 @@ int SDL_HapticSetGain(SDL_Haptic *haptic, int gain)
return -1;
}
if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) {
if (!(haptic->supported & SDL_HAPTIC_GAIN)) {
return SDL_SetError("Haptic: Device does not support setting gain.");
}
@ -646,7 +646,7 @@ int SDL_HapticSetAutocenter(SDL_Haptic *haptic, int autocenter)
return -1;
}
if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) {
if (!(haptic->supported & SDL_HAPTIC_AUTOCENTER)) {
return SDL_SetError("Haptic: Device does not support setting autocenter.");
}
@ -670,7 +670,7 @@ int SDL_HapticPause(SDL_Haptic *haptic)
return -1;
}
if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
if (!(haptic->supported & SDL_HAPTIC_PAUSE)) {
return SDL_SetError("Haptic: Device does not support setting pausing.");
}
@ -686,7 +686,7 @@ int SDL_HapticUnpause(SDL_Haptic *haptic)
return -1;
}
if ((haptic->supported & SDL_HAPTIC_PAUSE) == 0) {
if (!(haptic->supported & SDL_HAPTIC_PAUSE)) {
return 0; /* Not going to be paused, so we pretend it's unpaused. */
}

View File

@ -183,7 +183,7 @@ static SDL_bool HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device)
ctx->wireless[i] = (curSlot[0] & 0x20) != 0;
/* Only allow rumble if the adapter's second USB cable is connected */
ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) != 0 && !ctx->wireless[i];
ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) && !ctx->wireless[i];
if (curSlot[0] & 0x30) { /* 0x10 - Wired, 0x20 - Wireless */
if (ctx->joysticks[i] == 0) {
@ -312,7 +312,7 @@ static void HIDAPI_DriverGameCube_HandleNintendoPacket(SDL_HIDAPI_Device *device
ctx->wireless[i] = (curSlot[0] & 0x20) != 0;
/* Only allow rumble if the adapter's second USB cable is connected */
ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) != 0 && !ctx->wireless[i];
ctx->rumbleAllowed[i] = (curSlot[0] & 0x04) && !ctx->wireless[i];
if (curSlot[0] & 0x30) { /* 0x10 - Wired, 0x20 - Wireless */
if (ctx->joysticks[i] == 0) {

View File

@ -317,16 +317,16 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_PS4_PROTOCOL
HIDAPI_DumpPacket("PS4 capabilities: size = %d", data, size);
#endif
if ((capabilities & 0x02) != 0) {
if (capabilities & 0x02) {
ctx->sensors_supported = SDL_TRUE;
}
if ((capabilities & 0x04) != 0) {
if (capabilities & 0x04) {
ctx->lightbar_supported = SDL_TRUE;
}
if ((capabilities & 0x08) != 0) {
if (capabilities & 0x08) {
ctx->vibration_supported = SDL_TRUE;
}
if ((capabilities & 0x40) != 0) {
if (capabilities & 0x40) {
ctx->touchpad_supported = SDL_TRUE;
}
@ -895,7 +895,7 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
/* Some fightsticks, ex: Victrix FS Pro will only this these digital trigger bits and not the analog values so this needs to run whenever the
trigger is evaluated
*/
if ((packet->rgucButtonsHatAndCounter[1] & 0x0C) != 0) {
if (packet->rgucButtonsHatAndCounter[1] & 0x0C) {
Uint8 data = packet->rgucButtonsHatAndCounter[1];
packet->ucTriggerLeft = (data & 0x04) && packet->ucTriggerLeft == 0 ? 255 : packet->ucTriggerLeft;
packet->ucTriggerRight = (data & 0x08) && packet->ucTriggerRight == 0 ? 255 : packet->ucTriggerRight;
@ -940,12 +940,12 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
}
if (ctx->report_touchpad) {
touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);
touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);
@ -1007,7 +1007,7 @@ static SDL_bool HIDAPI_DriverPS4_IsPacketValid(SDL_DriverPS4_Context *ctx, Uint8
* This is usually the ID over USB, but the DS4v2 that started shipping with the PS4 Slim will also send this
* packet over BT with a size of 128
*/
if (size >= 64 && (data[31] & 0x04) == 0) {
if (size >= 64 && !(data[31] & 0x04)) {
return SDL_TRUE;
}
break;

View File

@ -433,19 +433,19 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
#ifdef DEBUG_PS5_PROTOCOL
HIDAPI_DumpPacket("PS5 capabilities: size = %d", data, size);
#endif
if ((capabilities & 0x02) != 0) {
if (capabilities & 0x02) {
ctx->sensors_supported = SDL_TRUE;
}
if ((capabilities & 0x04) != 0) {
if (capabilities & 0x04) {
ctx->lightbar_supported = SDL_TRUE;
}
if ((capabilities & 0x08) != 0) {
if (capabilities & 0x08) {
ctx->vibration_supported = SDL_TRUE;
}
if ((capabilities & 0x40) != 0) {
if (capabilities & 0x40) {
ctx->touchpad_supported = SDL_TRUE;
}
if ((capabilities2 & 0x80) != 0) {
if (capabilities2 & 0x80) {
ctx->playerled_supported = SDL_TRUE;
}
@ -1232,12 +1232,12 @@ static void HIDAPI_DriverPS5_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
Uint64 timestamp = SDL_GetTicksNS();
if (ctx->report_touchpad) {
touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);
touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);
@ -1275,12 +1275,12 @@ static void HIDAPI_DriverPS5_HandleStatePacketAlt(SDL_Joystick *joystick, SDL_hi
Uint64 timestamp = SDL_GetTicksNS();
if (ctx->report_touchpad) {
touchpad_state = ((packet->ucTouchpadCounter1 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter1 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);
touchpad_state = ((packet->ucTouchpadCounter2 & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(packet->ucTouchpadCounter2 & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8);
touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_state, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_state ? 1.0f : 0.0f);

View File

@ -377,7 +377,7 @@ static void HIDAPI_DriverShield_HandleTouchPacketV103(SDL_Joystick *joystick, SD
SDL_SendJoystickButton(timestamp, joystick, SDL_CONTROLLER_BUTTON_SHIELD_V103_TOUCHPAD, (data[1] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
/* It's a triangular pad, but just use the center as the usable touch area */
touchpad_state = ((data[1] & 0x80) == 0) ? SDL_PRESSED : SDL_RELEASED;
touchpad_state = !(data[1] & 0x80) ? SDL_PRESSED : SDL_RELEASED;
touchpad_x = clamp((float)(data[2] - 0x70) / 0x50, 0.0f, 1.0f);
touchpad_y = clamp((float)(data[4] - 0x40) / 0x15, 0.0f, 1.0f);
SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_state, touchpad_x, touchpad_y, touchpad_state ? 1.0f : 0.0f);

View File

@ -248,7 +248,7 @@ static int WriteSegmentToSteamControllerPacketAssembler(SteamControllerPacketAss
DPRINTF("GOT PACKET HEADER = 0x%x\n", uSegmentHeader);
if ((uSegmentHeader & REPORT_SEGMENT_DATA_FLAG) == 0) {
if (!(uSegmentHeader & REPORT_SEGMENT_DATA_FLAG)) {
// We get empty segments, just ignore them
return 0;
}

View File

@ -791,13 +791,13 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
if (axis == 32704) {
axis = 32767;
}
if (axis == -32768 && size == 30 && (data[22] & 0x80) != 0) {
if (axis == -32768 && size == 30 && (data[22] & 0x80)) {
axis = 32767;
}
SDL_SendJoystickAxis(timestamp, joystick, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, axis);
axis = ((int)SDL_SwapLE16(*(Sint16 *)(&data[8])) * 64) - 32768;
if (axis == -32768 && size == 30 && (data[22] & 0x40) != 0) {
if (axis == -32768 && size == 30 && (data[22] & 0x40)) {
axis = 32767;
}
if (axis == 32704) {

View File

@ -453,7 +453,7 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta
LPDIRECTINPUTDEVICE8 device = NULL;
/* We are only supporting HID devices. */
CHECK((pDeviceInstance->dwDevType & DIDEVTYPE_HID) != 0);
CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID);
CHECK(SUCCEEDED(IDirectInput8_CreateDevice(dinput, &pDeviceInstance->guidInstance, &device, NULL)));
CHECK(QueryDeviceName(device, &name));
@ -564,7 +564,7 @@ static BOOL CALLBACK EnumJoystickPresentCallback(LPCDIDEVICEINSTANCE pDeviceInst
BOOL result = DIENUM_CONTINUE;
/* We are only supporting HID devices. */
CHECK((pDeviceInstance->dwDevType & DIDEVTYPE_HID) != 0);
CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID);
CHECK(SUCCEEDED(IDirectInput8_CreateDevice(dinput, &pDeviceInstance->guidInstance, &device, NULL)));
CHECK(QueryDeviceInfo(device, &vendor, &product));

View File

@ -868,10 +868,10 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 fl
goto error;
}
if ((flags & SDL_RENDERER_PRESENTVSYNC) != 0) {
if (flags & SDL_RENDERER_PRESENTVSYNC) {
renderer->wanted_vsync = SDL_TRUE;
if ((renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) == 0) {
if (!(renderer->info.flags & SDL_RENDERER_PRESENTVSYNC)) {
renderer->simulate_vsync = SDL_TRUE;
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
}

View File

@ -294,7 +294,7 @@ static int D3D_ActivateRenderer(SDL_Renderer *renderer)
SDL_GetWindowSizeInPixels(window, &w, &h);
data->pparams.BackBufferWidth = w;
data->pparams.BackBufferHeight = h;
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) {
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
}
if (fullscreen_mode) {
@ -1606,7 +1606,7 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
renderer->driverdata = data;
SDL_GetWindowSizeInPixels(window, &w, &h);
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) {
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) {
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
}

View File

@ -2355,7 +2355,7 @@ D3D11_CreateRenderer(SDL_Window *window, Uint32 flags)
*/
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
#else
if ((flags & SDL_RENDERER_PRESENTVSYNC)) {
if (flags & SDL_RENDERER_PRESENTVSYNC) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
}
renderer->SetVSync = D3D11_SetVSync;

View File

@ -2991,7 +2991,7 @@ D3D12_CreateRenderer(SDL_Window *window, Uint32 flags)
renderer->info.flags = SDL_RENDERER_ACCELERATED;
renderer->driverdata = data;
if ((flags & SDL_RENDERER_PRESENTVSYNC)) {
if (flags & SDL_RENDERER_PRESENTVSYNC) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC;
}
renderer->SetVSync = D3D12_SetVSync;

View File

@ -387,7 +387,7 @@ SDL_iconv(SDL_iconv_t cd,
left = 1;
}
} else {
if ((p[0] & 0x80) != 0x00) {
if (p[0] & 0x80) {
/* Skip illegal sequences
return SDL_ICONV_EILSEQ;
*/

View File

@ -254,7 +254,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) {
return -1;
}
if ((state->window_flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) {
state->num_windows = SDL_atoi(argv[index]);
}
return 2;
@ -1359,7 +1359,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
state->window_w = w;
state->window_h = h;
}
if ((state->window_flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (state->window_flags & SDL_WINDOW_FULLSCREEN) {
if (state->fullscreen_exclusive) {
SDL_SetWindowFullscreenMode(state->windows[i], &state->fullscreen_mode);
}
@ -1835,7 +1835,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
SDL_GetDisplayBounds(displays[index], &rect);
flags = SDL_GetWindowFlags(window);
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (flags & SDL_WINDOW_FULLSCREEN) {
SDL_SetWindowFullscreen(window, SDL_FALSE);
SDL_Delay(15);
}
@ -1870,7 +1870,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
if (state->verbose & VERBOSE_EVENT) {
if (((event->type != SDL_EVENT_MOUSE_MOTION) &&
(event->type != SDL_EVENT_FINGER_MOTION)) ||
((state->verbose & VERBOSE_MOTION) != 0)) {
(state->verbose & VERBOSE_MOTION)) {
SDLTest_PrintEvent(event);
}
}
@ -2055,7 +2055,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
if (withShift) {
SDL_Window *current_win = SDL_GetKeyboardFocus();
if (current_win) {
const SDL_bool shouldCapture = (SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE) == 0;
const SDL_bool shouldCapture = !(SDL_GetWindowFlags(current_win) & SDL_WINDOW_MOUSE_CAPTURE);
const int rc = SDL_CaptureMouse(shouldCapture);
SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", (rc == 0) ? "succeeded" : "failed");
}
@ -2149,7 +2149,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (flags & SDL_WINDOW_FULLSCREEN) {
SDL_SetWindowFullscreen(window, SDL_FALSE);
} else {
SDL_SetWindowFullscreen(window, SDL_TRUE);
@ -2160,7 +2160,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
Uint32 flags = SDL_GetWindowFlags(window);
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (flags & SDL_WINDOW_FULLSCREEN) {
SDL_SetWindowFullscreen(window, SDL_FALSE);
} else {
SDL_SetWindowFullscreenMode(window, NULL);
@ -2187,7 +2187,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) {
const Uint32 flags = SDL_GetWindowFlags(window);
const SDL_bool b = ((flags & SDL_WINDOW_BORDERLESS) != 0) ? SDL_TRUE : SDL_FALSE;
const SDL_bool b = (flags & SDL_WINDOW_BORDERLESS) ? SDL_TRUE : SDL_FALSE;
SDL_SetWindowBordered(window, b);
}
}

View File

@ -3295,7 +3295,7 @@ static Uint32 UTF8_getch(const char *src, size_t srclen, int *inc)
left = 1;
}
} else {
if ((p[0] & 0x80) == 0x00) {
if (!(p[0] & 0x80)) {
ch = (Uint32)p[0];
}
}

View File

@ -63,7 +63,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread)
TInt status = CreateUnique(NewThread, &rthread, thread);
if (status != KErrNone) {
delete (((RThread *)(thread->handle)));
delete (RThread *)thread->handle;
thread->handle = NULL;
return SDL_SetError("Not enough resources to create thread");
}

View File

@ -47,7 +47,7 @@ static void BlitBto1(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -64,7 +64,7 @@ static void BlitBto1(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -101,7 +101,7 @@ static void BlitBto2(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -136,7 +136,7 @@ static void BlitBto3(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -175,7 +175,7 @@ static void BlitBto4(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -209,7 +209,7 @@ static void BlitBto1Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -226,7 +226,7 @@ static void BlitBto1Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -261,7 +261,7 @@ static void BlitBto2Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -294,7 +294,7 @@ static void BlitBto3Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -328,7 +328,7 @@ static void BlitBto4Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -367,7 +367,7 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -413,7 +413,7 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 7) == 0) {
if (!(c & 7)) {
byte = *src++;
}
bit = (byte & 0x80) >> 7;
@ -458,7 +458,7 @@ static void Blit4bto4(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 0x1) == 0) {
if (!(c & 0x1)) {
byte = *src++;
}
bit = (byte & 0xF0) >> 4;
@ -491,7 +491,7 @@ static void Blit4bto4Key(SDL_BlitInfo *info)
while (height--) {
Uint8 byte = 0, bit;
for (c = 0; c < width; ++c) {
if ((c & 0x1) == 0) {
if (!(c & 0x1)) {
byte = *src++;
}
bit = (byte & 0xF0) >> 4;

View File

@ -972,7 +972,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
}
#if SDL_VIDEO_DRIVER_ANDROID
if ((_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) != 0) {
if (_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) {
/* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset.
* This is required because some Android devices like to complain about it
* by "silently" failing, logging a hint which could be easily overlooked:

View File

@ -1324,7 +1324,7 @@ end:
(copy_flags & SDL_COPY_MODULATE_ALPHA)) {
SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
}
if ((copy_flags & SDL_COPY_RLE_DESIRED)) {
if (copy_flags & SDL_COPY_RLE_DESIRED) {
SDL_SetSurfaceRLE(convert, SDL_RLEACCEL);
}

View File

@ -1257,7 +1257,7 @@ SDL_DisplayID SDL_GetDisplayForWindow(SDL_Window *window)
* (for example if the window is off-screen), but other code may expect it
* to succeed in that situation, so we fall back to a generic position-
* based implementation in that case. */
if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN)) {
displayID = window->fullscreen_mode.displayID;
}
if (!displayID) {
@ -1651,7 +1651,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
/* ensure no more than one of these flags is set */
type_flags = flags & (SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_POPUP_MENU);
if ((type_flags & (type_flags - 1)) != 0) {
if (type_flags & (type_flags - 1)) {
SDL_SetError("Conflicting window flags specified");
return NULL;
}
@ -1672,7 +1672,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
/* ensure no more than one of these flags is set */
graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);
if ((graphics_flags & (graphics_flags - 1)) != 0) {
if (graphics_flags & (graphics_flags - 1)) {
SDL_SetError("Conflicting window flags specified");
return NULL;
}
@ -1876,7 +1876,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
/* ensure no more than one of these flags is set */
graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);
if ((graphics_flags & (graphics_flags - 1)) != 0) {
if (graphics_flags & (graphics_flags - 1)) {
return SDL_SetError("Conflicting window flags specified");
}
@ -2172,7 +2172,7 @@ void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
}
}
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
window->windowed.x = x;
}
@ -2198,7 +2198,7 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
CHECK_WINDOW_MAGIC(window, );
/* Fullscreen windows are always at their display's origin */
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
SDL_DisplayID displayID;
if (x) {
@ -2237,9 +2237,9 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
{
CHECK_WINDOW_MAGIC(window, );
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
const int want = (bordered != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
const int have = !(window->flags & SDL_WINDOW_BORDERLESS);
if ((want != have) && (_this->SetWindowBordered)) {
if (want) {
window->flags &= ~SDL_WINDOW_BORDERLESS;
@ -2254,7 +2254,7 @@ void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
{
CHECK_WINDOW_MAGIC(window, );
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
const int want = (resizable != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
if ((want != have) && (_this->SetWindowResizable)) {
@ -2271,7 +2271,7 @@ void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top)
{
CHECK_WINDOW_MAGIC(window, );
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
const int want = (on_top != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0);
if ((want != have) && (_this->SetWindowAlwaysOnTop)) {
@ -2424,7 +2424,7 @@ void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
window->min_w = min_w;
window->min_h = min_h;
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
if (_this->SetWindowMinimumSize) {
_this->SetWindowMinimumSize(_this, window);
}
@ -2464,7 +2464,7 @@ void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
window->max_w = max_w;
window->max_h = max_h;
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
if (_this->SetWindowMaximumSize) {
_this->SetWindowMaximumSize(_this, window);
}
@ -2884,13 +2884,13 @@ SDL_bool SDL_GetWindowGrab(SDL_Window *window)
SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0);
return window == _this->grabbed_window && (_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED);
}
SDL_bool SDL_GetWindowMouseGrab(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0);
return window == _this->grabbed_window && (_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED);
}
SDL_Window *SDL_GetGrabbedWindow(void)
@ -2953,7 +2953,7 @@ void SDL_OnWindowHidden(SDL_Window *window)
void SDL_OnWindowDisplayChanged(SDL_Window *window)
{
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
SDL_Rect rect;
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && window->fullscreen_exclusive) {
@ -3063,7 +3063,7 @@ static SDL_bool SDL_ShouldMinimizeOnFocusLoss(SDL_Window *window)
{
const char *hint;
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0 || window->is_destroying) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) {
return SDL_FALSE;
}

View File

@ -78,7 +78,7 @@ int Android_CreateWindow(_THIS, SDL_Window *window)
/* Do not create EGLSurface for Vulkan window since it will then make the window
incompatible with vkCreateAndroidSurfaceKHR */
#if SDL_VIDEO_OPENGL_EGL
if ((window->flags & SDL_WINDOW_OPENGL) != 0) {
if (window->flags & SDL_WINDOW_OPENGL) {
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->native_window);
if (data->egl_surface == EGL_NO_SURFACE) {

View File

@ -307,7 +307,7 @@ void Cocoa_InitKeyboard(_THIS)
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command");
data.modifierFlags = (unsigned int)[NSEvent modifierFlags];
SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) != 0);
SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE);
}
void Cocoa_StartTextInput(_THIS)

View File

@ -103,7 +103,7 @@
SDL_Window *window = [self findSDLWindow];
if (window == NULL) {
return NO;
} else if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
} else if (window->flags & SDL_WINDOW_FULLSCREEN) {
return NO;
} else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) {
return NO;
@ -323,7 +323,7 @@ static NSUInteger GetWindowStyle(SDL_Window *window)
{
NSUInteger style = 0;
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
style = NSWindowStyleMaskBorderless;
} else {
style = GetWindowWindowedStyle(window);
@ -394,7 +394,7 @@ static SDL_bool AdjustCoordinatesForGrab(SDL_Window *window, float x, float y, C
}
}
if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) {
if (window->flags & SDL_WINDOW_MOUSE_GRABBED) {
float left = (float)window->x;
float right = left + window->w - 1;
float top = (float)window->y;
@ -663,7 +663,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
- (void)clearFocusClickPending:(NSInteger)button
{
if ((focusClickPending & (1 << button)) != 0) {
if (focusClickPending & (1 << button)) {
focusClickPending &= ~(1 << button);
if (focusClickPending == 0) {
[self onMovingOrFocusClickPendingStateCleared];
@ -869,7 +869,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
{
const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock;
_data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags;
SDL_ToggleModState(SDL_KMOD_CAPS, newflags != 0);
SDL_ToggleModState(SDL_KMOD_CAPS, newflags ? SDL_TRUE : SDL_FALSE);
}
}

View File

@ -866,7 +866,7 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
}
}
if ((window_data->window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(window_data->window->flags & SDL_WINDOW_FULLSCREEN)) {
/* this will only work if the canvas size is set through css */
if (window_data->window->flags & SDL_WINDOW_RESIZABLE) {
double w = window_data->window->w;

View File

@ -52,7 +52,7 @@ static int _InitWindow(_THIS, SDL_Window *window) {
window->y + window->h - 1
);
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* TODO: Add support for this flag */
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
}

View File

@ -148,9 +148,9 @@ int RISCOS_InitEvents(_THIS)
}
status = (_kernel_osbyte(202, 0, 255) & 0xFF);
SDL_ToggleModState(SDL_KMOD_NUM, (status & (1 << 2)) == 0);
SDL_ToggleModState(SDL_KMOD_CAPS, (status & (1 << 4)) == 0);
SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) != 0);
SDL_ToggleModState(SDL_KMOD_NUM, (status & (1 << 2)) ? SDL_FALSE : SDL_TRUE);
SDL_ToggleModState(SDL_KMOD_CAPS, (status & (1 << 4)) ? SDL_FALSE : SDL_TRUE);
SDL_ToggleModState(SDL_KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE);
_kernel_swi(OS_Mouse, &regs, &regs);
driverdata->last_mouse_buttons = regs.r[2];

View File

@ -233,7 +233,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
int i;
for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) {
if ((event.buttonMask & SDL_BUTTON(i)) != 0) {
if (event.buttonMask & SDL_BUTTON(i)) {
Uint8 button;
switch (i) {
@ -289,7 +289,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
int i;
for (i = 1; i <= MAX_MOUSE_BUTTONS; ++i) {
if ((event.buttonMask & SDL_BUTTON(i)) != 0) {
if (event.buttonMask & SDL_BUTTON(i)) {
Uint8 button;
switch (i) {

View File

@ -265,7 +265,7 @@ int VITA_CreateWindow(_THIS, SDL_Window *window)
else {
win.windowSize = PSP2_WINDOW_960X544;
}
if ((window->flags & SDL_WINDOW_OPENGL) != 0) {
if (window->flags & SDL_WINDOW_OPENGL) {
if (SDL_getenv("VITA_PVR_OGL") != NULL) {
/* Set version to 2.1 and PROFILE to ES */
temp_major = _this->gl_config.major_version;
@ -362,9 +362,9 @@ static void utf16_to_utf8(const uint16_t *src, uint8_t *dst)
{
int i;
for (i = 0; src[i]; i++) {
if ((src[i] & 0xFF80) == 0) {
if (!(src[i] & 0xFF80)) {
*(dst++) = src[i] & 0xFF;
} else if ((src[i] & 0xF800) == 0) {
} else if (!(src[i] & 0xF800)) {
*(dst++) = ((src[i] >> 6) & 0xFF) | 0xC0;
*(dst++) = (src[i] & 0x3F) | 0x80;
} else if ((src[i] & 0xFC00) == 0xD800 && (src[i + 1] & 0xFC00) == 0xDC00) {

View File

@ -634,7 +634,7 @@ static void display_handle_done(void *data,
/* Add emulated modes if wp_viewporter is supported and mode emulation is enabled. */
if (video->viewporter && mode_emulation_enabled) {
const SDL_bool rot_90 = ((driverdata->transform & WL_OUTPUT_TRANSFORM_90) != 0) ||
const SDL_bool rot_90 = (driverdata->transform & WL_OUTPUT_TRANSFORM_90) ||
(driverdata->screen_width < driverdata->screen_height);
AddEmulatedModes(driverdata, rot_90);
}

View File

@ -276,7 +276,7 @@ static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit)
min_height = 0;
max_width = 0;
max_height = 0;
} else if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) {
} else if (window->flags & SDL_WINDOW_RESIZABLE) {
min_width = window->min_w;
min_height = window->min_h;
max_width = window->max_w;
@ -508,7 +508,7 @@ static void handle_configure_xdg_toplevel(void *data,
/* xdg_toplevel spec states that this is a suggestion.
* Ignore if less than or greater than max/min size.
*/
if ((window->flags & SDL_WINDOW_RESIZABLE)) {
if (window->flags & SDL_WINDOW_RESIZABLE) {
if ((floating && !wind->floating) || width == 0 || height == 0) {
/* This happens when we're being restored from a
* non-floating state, so use the cached floating size here.

View File

@ -412,34 +412,34 @@ static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data, SDL
if (rawButtons != data->mouse_button_flags) {
Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL);
SDL_bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0;
if ((rawButtons & RI_MOUSE_BUTTON_1_DOWN)) {
if (rawButtons & RI_MOUSE_BUTTON_1_DOWN) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_1_UP)) {
if (rawButtons & RI_MOUSE_BUTTON_1_UP) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_1_UP), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_2_DOWN)) {
if (rawButtons & RI_MOUSE_BUTTON_2_DOWN) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_2_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_2_UP)) {
if (rawButtons & RI_MOUSE_BUTTON_2_UP) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_2_UP), mouseFlags, swapButtons, data, SDL_BUTTON_RIGHT, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_3_DOWN)) {
if (rawButtons & RI_MOUSE_BUTTON_3_DOWN) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_3_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_3_UP)) {
if (rawButtons & RI_MOUSE_BUTTON_3_UP) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_3_UP), mouseFlags, swapButtons, data, SDL_BUTTON_MIDDLE, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_4_DOWN)) {
if (rawButtons & RI_MOUSE_BUTTON_4_DOWN) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_4_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_4_UP)) {
if (rawButtons & RI_MOUSE_BUTTON_4_UP) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_4_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X1, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_5_DOWN)) {
if (rawButtons & RI_MOUSE_BUTTON_5_DOWN) {
WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_5_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID);
}
if ((rawButtons & RI_MOUSE_BUTTON_5_UP)) {
if (rawButtons & RI_MOUSE_BUTTON_5_UP) {
WIN_CheckWParamMouseButton(!(rawButtons & RI_MOUSE_BUTTON_5_UP), mouseFlags, swapButtons, data, SDL_BUTTON_X2, mouseID);
}
data->mouse_button_flags = rawButtons;
@ -531,9 +531,9 @@ static void WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus)
*/
WIN_CheckClipboardUpdate(data->videodata);
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) ? SDL_TRUE : SDL_FALSE);
WIN_UpdateWindowICCProfile(data->window, SDL_TRUE);
} else {
@ -907,7 +907,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
*/
SDL_bool remote_desktop = GetSystemMetrics(SM_REMOTESESSION) ? SDL_TRUE : SDL_FALSE;
SDL_bool virtual_desktop = (rawmouse->usFlags & MOUSE_VIRTUAL_DESKTOP) ? SDL_TRUE : SDL_FALSE;
SDL_bool normalized_coordinates = ((rawmouse->usFlags & 0x40) == 0) ? SDL_TRUE : SDL_FALSE;
SDL_bool normalized_coordinates = !(rawmouse->usFlags & 0x40) ? SDL_TRUE : SDL_FALSE;
int w = GetSystemMetrics(virtual_desktop ? SM_CXVIRTUALSCREEN : SM_CXSCREEN);
int h = GetSystemMetrics(virtual_desktop ? SM_CYVIRTUALSCREEN : SM_CYSCREEN);
int x = normalized_coordinates ? (int)(((float)rawmouse->lLastX / 65535.0f) * w) : (int)rawmouse->lLastX;
@ -1491,7 +1491,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCCALCSIZE:
{
Uint32 window_flags = SDL_GetWindowFlags(data->window);
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) != 0 && (window_flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) {
/* When borderless, need to tell windows that the size of the non-client area is 0 */
if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
int w, h;

View File

@ -108,9 +108,9 @@ void WIN_InitKeyboard(_THIS)
SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Windows");
/* Are system caps/num/scroll lock active? Set our state to match. */
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) != 0);
SDL_ToggleModState(SDL_KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) ? SDL_TRUE : SDL_FALSE);
}
void WIN_UpdateKeymap(SDL_bool send_event)

View File

@ -73,27 +73,27 @@ static DWORD GetWindowStyle(SDL_Window *window)
{
DWORD style = 0;
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
style |= STYLE_FULLSCREEN;
} else {
if ((window->flags & SDL_WINDOW_BORDERLESS) != 0) {
if (window->flags & SDL_WINDOW_BORDERLESS) {
style |= STYLE_BORDERLESS_WINDOWED;
} else {
style |= STYLE_NORMAL;
}
if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) {
if (window->flags & SDL_WINDOW_RESIZABLE) {
/* You can have a borderless resizable window, but Windows doesn't always draw it correctly,
see https://bugzilla.libsdl.org/show_bug.cgi?id=4466
*/
if ((window->flags & SDL_WINDOW_BORDERLESS) == 0 ||
if (!(window->flags & SDL_WINDOW_BORDERLESS) ||
SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_FALSE)) {
style |= STYLE_RESIZABLE;
}
}
/* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */
if ((window->flags & SDL_WINDOW_MINIMIZED) != 0) {
if (window->flags & SDL_WINDOW_MINIMIZED) {
style |= WS_MINIMIZE;
}
}
@ -908,7 +908,7 @@ void WIN_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *displa
int x, y;
int w, h;
if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN)) {
/* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary.
* Also, Windows would preview the minimized window with the wrong size.
*/
@ -1261,7 +1261,7 @@ void WIN_UpdateClipCursor(SDL_Window *window)
mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h;
if (IntersectRect(&intersection, &rect, &mouse_rect)) {
SDL_memcpy(&rect, &intersection, sizeof(rect));
} else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) {
} else if (window->flags & SDL_WINDOW_MOUSE_GRABBED) {
/* Mouse rect was invalid, just do the normal grab */
} else {
SDL_zero(rect);
@ -1322,7 +1322,7 @@ int WIN_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
} else {
const BYTE alpha = (BYTE)((int)(opacity * 255.0f));
/* want it transparent, mark it layered if necessary. */
if ((style & WS_EX_LAYERED) == 0) {
if (!(style & WS_EX_LAYERED)) {
if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) {
return WIN_SetError("SetWindowLong()");
}

View File

@ -412,9 +412,9 @@ void X11_ReconcileKeyboardState(_THIS)
/* Sync up the keyboard modifier state */
if (X11_XQueryPointer(display, DefaultRootWindow(display), &junk_window, &junk_window, &x, &y, &x, &y, &mask)) {
SDL_ToggleModState(SDL_KMOD_CAPS, (mask & LockMask) != 0);
SDL_ToggleModState(SDL_KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0);
SDL_ToggleModState(SDL_KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) != 0);
SDL_ToggleModState(SDL_KMOD_CAPS, (mask & LockMask) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) ? SDL_TRUE : SDL_FALSE);
SDL_ToggleModState(SDL_KMOD_SCROLL, (mask & X11_GetScrollLockModifierMask(_this)) ? SDL_TRUE : SDL_FALSE);
}
keyboardState = SDL_GetKeyboardState(0);
@ -962,7 +962,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
/* In order for interaction with the window decorations and menu to work properly
on Mutter, we need to ungrab the keyboard when the the mouse leaves. */
if ((data->window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
if (!(data->window->flags & SDL_WINDOW_FULLSCREEN)) {
X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE);
}
@ -1465,15 +1465,15 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
const Uint32 changed = flags ^ data->window->flags;
if ((changed & (SDL_WINDOW_HIDDEN | SDL_WINDOW_FULLSCREEN)) != 0) {
if ((flags & SDL_WINDOW_HIDDEN) != 0) {
if (flags & SDL_WINDOW_HIDDEN) {
X11_DispatchUnmapNotify(data);
} else {
X11_DispatchMapNotify(data);
}
}
if ((changed & SDL_WINDOW_MAXIMIZED) != 0) {
if ((flags & SDL_WINDOW_MAXIMIZED) != 0) {
if (changed & SDL_WINDOW_MAXIMIZED) {
if (flags & SDL_WINDOW_MAXIMIZED) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);

View File

@ -138,21 +138,21 @@ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
}
*/
if ((flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0) {
if (flags & SDL_WINDOW_ALWAYS_ON_TOP) {
atoms[count++] = _NET_WM_STATE_ABOVE;
}
if ((flags & SDL_WINDOW_SKIP_TASKBAR) != 0) {
if (flags & SDL_WINDOW_SKIP_TASKBAR) {
atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR;
atoms[count++] = _NET_WM_STATE_SKIP_PAGER;
}
if ((flags & SDL_WINDOW_INPUT_FOCUS) != 0) {
if (flags & SDL_WINDOW_INPUT_FOCUS) {
atoms[count++] = _NET_WM_STATE_FOCUSED;
}
if ((flags & SDL_WINDOW_MAXIMIZED) != 0) {
if (flags & SDL_WINDOW_MAXIMIZED) {
atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
}
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (flags & SDL_WINDOW_FULLSCREEN) {
atoms[count++] = _NET_WM_STATE_FULLSCREEN;
}
@ -207,7 +207,7 @@ X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow)
}
if (fullscreen == 1) {
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* Pick whatever state the window expects */
flags |= (window->flags & SDL_WINDOW_FULLSCREEN);
} else {
@ -544,7 +544,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window)
}
SetWindowBordered(display, screen, w,
(window->flags & SDL_WINDOW_BORDERLESS) == 0);
!(window->flags & SDL_WINDOW_BORDERLESS));
sizehints = X11_XAllocSizeHints();
/* Setup the normal size hints */
@ -1042,8 +1042,8 @@ int X11_SetWindowInputFocus(_THIS, SDL_Window *window)
void X11_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
{
const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0);
const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0);
const SDL_bool focused = (window->flags & SDL_WINDOW_INPUT_FOCUS) ? SDL_TRUE : SDL_FALSE;
const SDL_bool visible = (!(window->flags & SDL_WINDOW_HIDDEN)) ? SDL_TRUE : SDL_FALSE;
SDL_WindowData *data = window->driverdata;
SDL_DisplayData *displaydata = SDL_GetDisplayDriverDataForWindow(window);
Display *display = data->videodata->display;
@ -1234,7 +1234,7 @@ static void X11_SetWindowMaximized(_THIS, SDL_Window *window, SDL_bool maximized
} else {
window->flags &= ~SDL_WINDOW_MAXIMIZED;
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
if (window->flags & SDL_WINDOW_FULLSCREEN) {
/* Fullscreen windows are maximized on some window managers,
and this is functional behavior, so don't remove that state
now, we'll take care of it when we leave fullscreen mode.
@ -1356,7 +1356,7 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis
e.xclient.message_type = _NET_WM_STATE;
e.xclient.format = 32;
e.xclient.window = data->xwindow;
if ((window->flags & SDL_WINDOW_MAXIMIZED) != 0) {
if (window->flags & SDL_WINDOW_MAXIMIZED) {
e.xclient.data.l[0] = _NET_WM_STATE_ADD;
} else {
e.xclient.data.l[0] = _NET_WM_STATE_REMOVE;

View File

@ -532,7 +532,7 @@ WatchJoystick(SDL_Joystick *joystick)
break;
}
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
if (event.key.keysym.sym != SDLK_ESCAPE) {
break;
}
SDL_FALLTHROUGH;
@ -766,7 +766,7 @@ int main(int argc, char *argv[])
while (SDL_PollEvent(&event) > 0) {
switch (event.type) {
case SDL_EVENT_KEY_DOWN:
if ((event.key.keysym.sym != SDLK_ESCAPE)) {
if (event.key.keysym.sym != SDLK_ESCAPE) {
break;
}
SDL_FALLTHROUGH;

View File

@ -349,7 +349,7 @@ static SDL_bool ShowingFront()
}
}
}
if ((SDL_GetModState() & SDL_KMOD_SHIFT) != 0) {
if (SDL_GetModState() & SDL_KMOD_SHIFT) {
showing_front = SDL_FALSE;
}
return showing_front;

View File

@ -731,7 +731,7 @@ int main(int argc, char *argv[])
if (textlen == 0) {
break;
}
if ((text[textlen - 1] & 0x80) == 0x00) {
if (!(text[textlen - 1] & 0x80)) {
/* One byte */
text[textlen - 1] = 0x00;
break;