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
46 changed files with 218 additions and 218 deletions

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);