SDL API renaming: *Is* functions

Feedback from @icculus:
"IsTablet" uses "is" as a form of "to be" ...like, the actual question is of its nature.

The rest is just a superfluous word in the question and it flows as better English with if (RectEmpty) than if (IsRectEmpty)

Fixes https://github.com/libsdl-org/SDL/issues/6932
This commit is contained in:
Sam Lantinga
2022-12-28 19:34:01 -08:00
parent 66351fd4ba
commit ea0c2f55be
34 changed files with 174 additions and 180 deletions

View File

@@ -426,18 +426,18 @@ SDL3_0.0.0 {
SDL_IsChromebook;
SDL_IsDeXMode;
SDL_IsGamepad;
SDL_IsGamepadConnected;
SDL_IsGamepadSensorEnabled;
SDL_IsJoystickConnected;
SDL_GamepadConnected;
SDL_GamepadSensorEnabled;
SDL_JoystickConnected;
SDL_IsJoystickVirtual;
SDL_IsRenderClipEnabled;
SDL_IsRenderTargetSupported;
SDL_IsScreenKeyboardShown;
SDL_IsScreenSaverEnabled;
SDL_RenderClipEnabled;
SDL_RenderTargetSupported;
SDL_ScreenKeyboardShown;
SDL_ScreenSaverEnabled;
SDL_IsShapedWindow;
SDL_IsTablet;
SDL_IsTextInputActive;
SDL_IsTextInputShown;
SDL_TextInputActive;
SDL_TextInputShown;
SDL_JoystickHasLED;
SDL_JoystickHasRumble;
SDL_JoystickHasRumbleTriggers;

View File

@@ -452,18 +452,18 @@
#define SDL_IsChromebook SDL_IsChromebook_REAL
#define SDL_IsDeXMode SDL_IsDeXMode_REAL
#define SDL_IsGamepad SDL_IsGamepad_REAL
#define SDL_IsGamepadConnected SDL_IsGamepadConnected_REAL
#define SDL_IsGamepadSensorEnabled SDL_IsGamepadSensorEnabled_REAL
#define SDL_IsJoystickConnected SDL_IsJoystickConnected_REAL
#define SDL_GamepadConnected SDL_GamepadConnected_REAL
#define SDL_GamepadSensorEnabled SDL_GamepadSensorEnabled_REAL
#define SDL_JoystickConnected SDL_JoystickConnected_REAL
#define SDL_IsJoystickVirtual SDL_IsJoystickVirtual_REAL
#define SDL_IsRenderClipEnabled SDL_IsRenderClipEnabled_REAL
#define SDL_IsRenderTargetSupported SDL_IsRenderTargetSupported_REAL
#define SDL_IsScreenKeyboardShown SDL_IsScreenKeyboardShown_REAL
#define SDL_IsScreenSaverEnabled SDL_IsScreenSaverEnabled_REAL
#define SDL_RenderClipEnabled SDL_RenderClipEnabled_REAL
#define SDL_RenderTargetSupported SDL_RenderTargetSupported_REAL
#define SDL_ScreenKeyboardShown SDL_ScreenKeyboardShown_REAL
#define SDL_ScreenSaverEnabled SDL_ScreenSaverEnabled_REAL
#define SDL_IsShapedWindow SDL_IsShapedWindow_REAL
#define SDL_IsTablet SDL_IsTablet_REAL
#define SDL_IsTextInputActive SDL_IsTextInputActive_REAL
#define SDL_IsTextInputShown SDL_IsTextInputShown_REAL
#define SDL_TextInputActive SDL_TextInputActive_REAL
#define SDL_TextInputShown SDL_TextInputShown_REAL
#define SDL_JoystickHasLED SDL_JoystickHasLED_REAL
#define SDL_JoystickHasRumble SDL_JoystickHasRumble_REAL
#define SDL_JoystickHasRumbleTriggers SDL_JoystickHasRumbleTriggers_REAL

View File

@@ -523,18 +523,18 @@ SDL_DYNAPI_PROC(void,SDL_HideWindow,(SDL_Window *a),(a),)
SDL_DYNAPI_PROC(int,SDL_Init,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(int,SDL_InitSubSystem,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepad,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepadConnected,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickConnected,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickConnected,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickVirtual,(SDL_JoystickID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsRenderClipEnabled,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsRenderTargetSupported,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenKeyboardShown,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsScreenSaverEnabled,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_RenderClipEnabled,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTargetSupported,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsShapedWindow,(const SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputActive,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputShown,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputActive,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputShown,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasLED,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasRumble,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickHasRumbleTriggers,(SDL_Joystick *a),(a),return)

View File

@@ -2572,7 +2572,7 @@ int SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_b
/*
* Query whether sensor data reporting is enabled for a gamepad
*/
SDL_bool SDL_IsGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type)
SDL_bool SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type)
{
SDL_bool retval = SDL_FALSE;
@@ -2764,14 +2764,14 @@ const char * SDL_GetGamepadSerial(SDL_Gamepad *gamepad)
* Return if the gamepad in question is currently attached to the system,
* \return 0 if not plugged in, 1 if still present.
*/
SDL_bool SDL_IsGamepadConnected(SDL_Gamepad *gamepad)
SDL_bool SDL_GamepadConnected(SDL_Gamepad *gamepad)
{
SDL_Joystick *joystick = SDL_GetGamepadJoystick(gamepad);
if (joystick == NULL) {
return SDL_FALSE;
}
return SDL_IsJoystickConnected(joystick);
return SDL_JoystickConnected(joystick);
}
/*

View File

@@ -906,7 +906,7 @@ Uint8 SDL_GetJoystickButton(SDL_Joystick *joystick, int button)
* Return if the joystick in question is currently attached to the system,
* \return SDL_FALSE if not plugged in, SDL_TRUE if still present.
*/
SDL_bool SDL_IsJoystickConnected(SDL_Joystick *joystick)
SDL_bool SDL_JoystickConnected(SDL_Joystick *joystick)
{
SDL_bool retval;

View File

@@ -2141,7 +2141,7 @@ void SDL_UnlockTexture(SDL_Texture *texture)
}
SDL_bool
SDL_IsRenderTargetSupported(SDL_Renderer *renderer)
SDL_RenderTargetSupported(SDL_Renderer *renderer)
{
if (renderer == NULL || !renderer->SetRenderTarget) {
return SDL_FALSE;
@@ -2151,7 +2151,7 @@ SDL_IsRenderTargetSupported(SDL_Renderer *renderer)
int SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
{
if (!SDL_IsRenderTargetSupported(renderer)) {
if (!SDL_RenderTargetSupported(renderer)) {
return SDL_Unsupported();
}
@@ -2483,7 +2483,7 @@ void SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
}
SDL_bool
SDL_IsRenderClipEnabled(SDL_Renderer *renderer)
SDL_RenderClipEnabled(SDL_Renderer *renderer)
{
CHECK_RENDERER_MAGIC(renderer, SDL_FALSE)
return renderer->clipping_enabled;

View File

@@ -1295,7 +1295,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_ShowWindow(state->windows[i]);
if (!SDL_IsRectEmpty(&state->confine)) {
if (!SDL_RectEmpty(&state->confine)) {
SDL_SetWindowMouseRect(state->windows[i], &state->confine);
}
@@ -1913,7 +1913,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Rect clip;
SDL_GetWindowSize(state->windows[i], &w, &h);
SDL_GetRenderClipRect(state->renderers[i], &clip);
if (SDL_IsRectEmpty(&clip)) {
if (SDL_RectEmpty(&clip)) {
clip.x = w / 4;
clip.y = h / 4;
clip.w = w / 2;

View File

@@ -59,7 +59,7 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect,
}
/* Set up source and destination buffer pointers, and BLIT! */
if (okay && !SDL_IsRectEmpty(srcrect)) {
if (okay && !SDL_RectEmpty(srcrect)) {
SDL_BlitFunc RunBlit;
SDL_BlitInfo *info = &src->map->info;

View File

@@ -240,7 +240,7 @@ int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
if (rect == NULL) {
rect = &dst->clip_rect;
/* Don't attempt to fill if the surface's clip_rect is empty */
if (SDL_IsRectEmpty(rect)) {
if (SDL_RectEmpty(rect)) {
return 0;
}
}

View File

@@ -92,7 +92,7 @@ SDL_GetSpanEnclosingRect(int width, int height,
#define COMPUTEOUTCODE ComputeOutCode
#define SDL_HASINTERSECTION SDL_HasRectIntersection
#define SDL_INTERSECTRECT SDL_GetRectIntersection
#define SDL_RECTEMPTY SDL_IsRectEmpty
#define SDL_RECTEMPTY SDL_RectEmpty
#define SDL_UNIONRECT SDL_GetRectUnion
#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPoints
#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersection
@@ -104,7 +104,7 @@ SDL_GetSpanEnclosingRect(int width, int height,
#define COMPUTEOUTCODE ComputeOutCodeF
#define SDL_HASINTERSECTION SDL_HasRectIntersectionF
#define SDL_INTERSECTRECT SDL_GetRectIntersectionF
#define SDL_RECTEMPTY SDL_IsRectEmptyF
#define SDL_RECTEMPTY SDL_RectEmptyF
#define SDL_UNIONRECT SDL_GetRectUnionF
#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPointsF
#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersectionF

View File

@@ -2899,7 +2899,7 @@ SDL_GetWindowMouseRect(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, NULL);
if (SDL_IsRectEmpty(&window->mouse_rect)) {
if (SDL_RectEmpty(&window->mouse_rect)) {
return NULL;
} else {
return &window->mouse_rect;
@@ -3148,7 +3148,7 @@ void SDL_DestroyWindow(SDL_Window *window)
}
SDL_bool
SDL_IsScreenSaverEnabled()
SDL_ScreenSaverEnabled()
{
if (_this == NULL) {
return SDL_TRUE;
@@ -4252,7 +4252,7 @@ void SDL_ClearComposition(void)
}
SDL_bool
SDL_IsTextInputShown(void)
SDL_TextInputShown(void)
{
if (_this && _this->IsTextInputShown) {
return _this->IsTextInputShown(_this);
@@ -4262,7 +4262,7 @@ SDL_IsTextInputShown(void)
}
SDL_bool
SDL_IsTextInputActive(void)
SDL_TextInputActive(void)
{
return SDL_EventEnabled(SDL_TEXTINPUT);
}
@@ -4304,7 +4304,7 @@ SDL_HasScreenKeyboardSupport(void)
}
SDL_bool
SDL_IsScreenKeyboardShown(SDL_Window *window)
SDL_ScreenKeyboardShown(SDL_Window *window)
{
if (window && _this && _this->IsScreenKeyboardShown) {
return _this->IsScreenKeyboardShown(_this, window);

View File

@@ -148,7 +148,7 @@ void Android_PumpEvents_Blocking(_THIS)
#endif
/* Make sure SW Keyboard is restored when an app becomes foreground */
if (SDL_IsTextInputActive()) {
if (SDL_TextInputActive()) {
Android_StartTextInput(_this); /* Only showTextInput */
}
}
@@ -232,7 +232,7 @@ void Android_PumpEvents_NonBlocking(_THIS)
#endif
/* Make sure SW Keyboard is restored when an app becomes foreground */
if (SDL_IsTextInputActive()) {
if (SDL_TextInputActive()) {
Android_StartTextInput(_this); /* Only showTextInput */
}
}

View File

@@ -236,7 +236,7 @@ static SDL_Window *SDL_FindWindowAtPoint(const int x, const int y)
SDL_Window *i;
for (i = SDL_GetVideoDevice()->windows; i; i = i->next) {
const SDL_Rect r = { i->x, i->y, i->w, i->h };
if (SDL_IsPointInRect(&pt, &r)) {
if (SDL_PointInRect(&pt, &r)) {
return i;
}
}

View File

@@ -432,12 +432,12 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
}
if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0 &&
SDL_IsRectEmpty(&mouse_rect)) {
SDL_RectEmpty(&mouse_rect)) {
SDL_memcpy(&mouse_rect, &window_rect, sizeof(mouse_rect));
}
}
if (SDL_IsRectEmpty(&mouse_rect)) {
if (SDL_RectEmpty(&mouse_rect)) {
nswindow.mouseConfinementRect = NSZeroRect;
} else {
NSRect rect;

View File

@@ -2758,11 +2758,11 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi
}
/* Don't confine the pointer if it shouldn't be confined. */
if (SDL_IsRectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
return 0;
}
if (SDL_IsRectEmpty(&window->mouse_rect)) {
if (SDL_RectEmpty(&window->mouse_rect)) {
confine_rect = NULL;
} else {
SDL_Rect scaled_mouse_rect;

View File

@@ -76,7 +76,7 @@ void Wayland_StartTextInput(_THIS)
zwp_text_input_v3_set_content_type(input->text_input->text_input,
ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE,
ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL);
if (!SDL_IsRectEmpty(rect)) {
if (!SDL_RectEmpty(rect)) {
/* This gets reset on enable so we have to cache it */
zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input,
rect->x,
@@ -122,7 +122,7 @@ void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect)
if (driverdata->text_input_manager) {
struct SDL_WaylandInput *input = driverdata->input;
if (input != NULL && input->text_input) {
if (!SDL_AreRectsEqual(rect, &input->text_input->cursor_rect)) {
if (!SDL_RectsEqual(rect, &input->text_input->cursor_rect)) {
SDL_copyp(&input->text_input->cursor_rect, rect);
zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input,
rect->x,

View File

@@ -1841,7 +1841,7 @@ void Wayland_SetWindowMouseRect(_THIS, SDL_Window *window)
* Just know that this call lets you confine with a rect, SetWindowGrab
* lets you confine without a rect.
*/
if (SDL_IsRectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
if (SDL_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
Wayland_input_unconfine_pointer(data->input, window);
} else {
Wayland_input_confine_pointer(data->input, window);
@@ -1854,7 +1854,7 @@ void Wayland_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
if (grabbed) {
Wayland_input_confine_pointer(data->input, window);
} else if (SDL_IsRectEmpty(&window->mouse_rect)) {
} else if (SDL_RectEmpty(&window->mouse_rect)) {
Wayland_input_unconfine_pointer(data->input, window);
}
}

View File

@@ -71,7 +71,7 @@ int X11_XfixesIsInitialized()
void X11_SetWindowMouseRect(_THIS, SDL_Window *window)
{
if (SDL_IsRectEmpty(&window->mouse_rect)) {
if (SDL_RectEmpty(&window->mouse_rect)) {
X11_ConfineCursorWithFlags(_this, window, NULL, 0);
} else {
if (window->flags & SDL_WINDOW_INPUT_FOCUS) {