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

@@ -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) {