SDL API renaming: SDL_rect.h

Fixes https://github.com/libsdl-org/SDL/issues/6887
This commit is contained in:
Sam Lantinga
2022-12-27 11:01:11 -08:00
parent a28d1d59be
commit 58aecf0a54
32 changed files with 379 additions and 323 deletions

View File

@@ -395,16 +395,16 @@ SDL3_0.0.0 {
SDL_SetYUVConversionMode;
SDL_GetYUVConversionMode;
SDL_GetYUVConversionModeForResolution;
SDL_HasIntersection;
SDL_IntersectRect;
SDL_UnionRect;
SDL_EnclosePoints;
SDL_IntersectRectAndLine;
SDL_HasIntersectionF;
SDL_IntersectFRect;
SDL_UnionFRect;
SDL_EncloseFPoints;
SDL_IntersectFRectAndLine;
SDL_HasRectIntersection;
SDL_GetRectIntersection;
SDL_GetRectUnion;
SDL_GetRectEnclosingPoints;
SDL_GetRectAndLineIntersection;
SDL_HasRectIntersectionF;
SDL_GetRectIntersectionF;
SDL_GetRectUnionF;
SDL_GetRectEnclosingPointsF;
SDL_GetRectAndLineIntersectionF;
SDL_CreateShapedWindow;
SDL_IsShapedWindow;
SDL_SetWindowShape;

View File

@@ -277,11 +277,11 @@
#define SDL_GetRGBA SDL_GetRGBA_REAL
#define SDL_GetPlatform SDL_GetPlatform_REAL
#define SDL_GetPowerInfo SDL_GetPowerInfo_REAL
#define SDL_HasIntersection SDL_HasIntersection_REAL
#define SDL_IntersectRect SDL_IntersectRect_REAL
#define SDL_UnionRect SDL_UnionRect_REAL
#define SDL_EnclosePoints SDL_EnclosePoints_REAL
#define SDL_IntersectRectAndLine SDL_IntersectRectAndLine_REAL
#define SDL_HasRectIntersection SDL_HasRectIntersection_REAL
#define SDL_GetRectIntersection SDL_GetRectIntersection_REAL
#define SDL_GetRectUnion SDL_GetRectUnion_REAL
#define SDL_GetRectEnclosingPoints SDL_GetRectEnclosingPoints_REAL
#define SDL_GetRectAndLineIntersection SDL_GetRectAndLineIntersection_REAL
#define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL
#define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL
#define SDL_CreateRenderer SDL_CreateRenderer_REAL
@@ -828,11 +828,11 @@
#define SDL_GetTouchName SDL_GetTouchName_REAL
#define SDL_ClearComposition SDL_ClearComposition_REAL
#define SDL_IsTextInputShown SDL_IsTextInputShown_REAL
#define SDL_HasIntersectionF SDL_HasIntersectionF_REAL
#define SDL_IntersectFRect SDL_IntersectFRect_REAL
#define SDL_UnionFRect SDL_UnionFRect_REAL
#define SDL_EncloseFPoints SDL_EncloseFPoints_REAL
#define SDL_IntersectFRectAndLine SDL_IntersectFRectAndLine_REAL
#define SDL_HasRectIntersectionF SDL_HasRectIntersectionF_REAL
#define SDL_GetRectIntersectionF SDL_GetRectIntersectionF_REAL
#define SDL_GetRectUnionF SDL_GetRectUnionF_REAL
#define SDL_GetRectEnclosingPointsF SDL_GetRectEnclosingPointsF_REAL
#define SDL_GetRectAndLineIntersectionF SDL_GetRectAndLineIntersectionF_REAL
#define SDL_GetRenderWindow SDL_GetRenderWindow_REAL
#define SDL_bsearch SDL_bsearch_REAL
#define SDL_GetGamepadPathForIndex SDL_GetGamepadPathForIndex_REAL

View File

@@ -304,11 +304,11 @@ SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, U
SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormat *b, Uint8 *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),)
SDL_DYNAPI_PROC(const char*,SDL_GetPlatform,(void),(),return)
SDL_DYNAPI_PROC(SDL_PowerState,SDL_GetPowerInfo,(int *a, int *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_UnionRect,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_bool,SDL_EnclosePoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectRectAndLine,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersection,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(int a, int b, Uint32 c, SDL_Window **d, SDL_Renderer **e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b, Uint32 c),(a,b,c),return)
@@ -895,11 +895,11 @@ SDL_DYNAPI_PROC(int,SDL_AndroidSendMessage,(Uint32 a, int b),(a,b),return)
SDL_DYNAPI_PROC(const char*,SDL_GetTouchName,(int a),(a),return)
SDL_DYNAPI_PROC(void,SDL_ClearComposition,(void),(),)
SDL_DYNAPI_PROC(SDL_bool,SDL_IsTextInputShown,(void),(),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_UnionFRect,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_bool,SDL_EncloseFPoints,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_IntersectFRectAndLine,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersectionF,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersectionF,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_GetRectUnionF,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPointsF,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersectionF,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_bsearch,(const void *a, const void *b, size_t c, size_t d, int (SDLCALL *e)(const void *, const void *)),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(const char*,SDL_GetGamepadPathForIndex,(int a),(a),return)

View File

@@ -567,7 +567,7 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_
window_rect.y = 0;
window_rect.w = x_max + 1;
window_rect.h = y_max + 1;
if (SDL_IntersectRect(confine, &window_rect, &mouse_rect)) {
if (SDL_GetRectIntersection(confine, &window_rect, &mouse_rect)) {
x_min = mouse_rect.x;
y_min = mouse_rect.y;
x_max = x_min + mouse_rect.w - 1;

View File

@@ -1729,7 +1729,7 @@ int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect,
real_rect.w = texture->w;
real_rect.h = texture->h;
if (rect) {
if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) {
return 0;
}
}
@@ -1895,7 +1895,7 @@ int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect,
real_rect.w = texture->w;
real_rect.h = texture->h;
if (rect) {
SDL_IntersectRect(rect, &real_rect, &real_rect);
SDL_GetRectIntersection(rect, &real_rect, &real_rect);
}
if (real_rect.w == 0 || real_rect.h == 0) {
@@ -1955,7 +1955,7 @@ int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect,
real_rect.w = texture->w;
real_rect.h = texture->h;
if (rect) {
SDL_IntersectRect(rect, &real_rect, &real_rect);
SDL_GetRectIntersection(rect, &real_rect, &real_rect);
}
if (real_rect.w == 0 || real_rect.h == 0) {
@@ -2057,7 +2057,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,
real_rect.w = texture->w;
real_rect.h = texture->h;
if (rect) {
SDL_IntersectRect(rect, &real_rect, &real_rect);
SDL_GetRectIntersection(rect, &real_rect, &real_rect);
}
ret = SDL_LockTexture(texture, &real_rect, &pixels, &pitch);
@@ -3382,14 +3382,14 @@ int SDL_RenderTextureF(SDL_Renderer *renderer, SDL_Texture *texture,
real_srcrect.w = texture->w;
real_srcrect.h = texture->h;
if (srcrect) {
if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) {
return 0;
}
}
RenderGetViewportSize(renderer, &real_dstrect);
if (dstrect) {
if (!SDL_HasIntersectionF(dstrect, &real_dstrect)) {
if (!SDL_HasRectIntersectionF(dstrect, &real_dstrect)) {
return 0;
}
real_dstrect = *dstrect;
@@ -3522,7 +3522,7 @@ int SDL_RenderTextureRotatedF(SDL_Renderer *renderer, SDL_Texture *texture,
real_srcrect.w = texture->w;
real_srcrect.h = texture->h;
if (srcrect) {
if (!SDL_IntersectRect(srcrect, &real_srcrect, &real_srcrect)) {
if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) {
return 0;
}
}
@@ -4158,7 +4158,7 @@ int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect,
real_rect.w = (int)SDL_floor(renderer->viewport.w);
real_rect.h = (int)SDL_floor(renderer->viewport.h);
if (rect) {
if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
if (!SDL_GetRectIntersection(rect, &real_rect, &real_rect)) {
return 0;
}
if (real_rect.y > rect->y) {

View File

@@ -1252,7 +1252,7 @@ static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
METAL_GetOutputSize(renderer, &output.w, &output.h);
}
if (SDL_IntersectRect(&output, &clip, &clip)) {
if (SDL_GetRectIntersection(&output, &clip, &clip)) {
MTLScissorRect mtlrect;
mtlrect.x = clip.x;
mtlrect.y = clip.y;

View File

@@ -223,7 +223,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
/* If 'rect' == NULL, then fill the whole surface */
if (rect) {
/* Perform clipping */
if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) {
if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) {
return 0;
}
rect = &clipped;
@@ -335,7 +335,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
for (i = 0; i < count; ++i) {
/* Perform clipping */
if (!SDL_IntersectRect(&rects[i], &dst->clip_rect, &rect)) {
if (!SDL_GetRectIntersection(&rects[i], &dst->clip_rect, &rect)) {
continue;
}
status = func(dst, &rect, blendMode, r, g, b, a);

View File

@@ -809,7 +809,7 @@ int SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2,
/* Perform clipping */
/* FIXME: We don't actually want to clip, as it may change line slope */
if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
return 0;
}
@@ -843,7 +843,7 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count,
/* Perform clipping */
/* FIXME: We don't actually want to clip, as it may change line slope */
if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
continue;
}

View File

@@ -148,7 +148,7 @@ int SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color)
/* Perform clipping */
/* FIXME: We don't actually want to clip, as it may change line slope */
if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
return 0;
}
@@ -182,7 +182,7 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count,
/* Perform clipping */
/* FIXME: We don't actually want to clip, as it may change line slope */
if (!SDL_IntersectRectAndLine(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
continue;
}

View File

@@ -644,7 +644,7 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
clip_rect.y = cliprect->y + viewport->y;
clip_rect.w = cliprect->w;
clip_rect.h = cliprect->h;
SDL_IntersectRect(viewport, &clip_rect, &clip_rect);
SDL_GetRectIntersection(viewport, &clip_rect, &clip_rect);
SDL_SetSurfaceClipRect(surface, &clip_rect);
} else {
SDL_SetSurfaceClipRect(surface, drawstate->viewport);

View File

@@ -251,14 +251,14 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
rect.y = 0;
rect.w = dst->w;
rect.h = dst->h;
SDL_IntersectRect(&dstrect, &rect, &dstrect);
SDL_GetRectIntersection(&dstrect, &rect, &dstrect);
}
{
/* Clip triangle with surface clip rect */
SDL_Rect rect;
SDL_GetSurfaceClipRect(dst, &rect);
SDL_IntersectRect(&dstrect, &rect, &dstrect);
SDL_GetRectIntersection(&dstrect, &rect, &dstrect);
}
if (blend != SDL_BLENDMODE_NONE) {
@@ -547,14 +547,14 @@ int SDL_SW_BlitTriangle(
rect.w = dst->w;
rect.h = dst->h;
SDL_IntersectRect(&dstrect, &rect, &dstrect);
SDL_GetRectIntersection(&dstrect, &rect, &dstrect);
}
{
/* Clip triangle with surface clip rect */
SDL_Rect rect;
SDL_GetSurfaceClipRect(dst, &rect);
SDL_IntersectRect(&dstrect, &rect, &dstrect);
SDL_GetRectIntersection(&dstrect, &rect, &dstrect);
}
/* Set destination pointer */

View File

@@ -1303,7 +1303,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_ShowWindow(state->windows[i]);
if (!SDL_RectEmpty(&state->confine)) {
if (!SDL_IsRectEmpty(&state->confine)) {
SDL_SetWindowMouseRect(state->windows[i], &state->confine);
}
@@ -1921,7 +1921,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_RectEmpty(&clip)) {
if (SDL_IsRectEmpty(&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_RectEmpty(srcrect)) {
if (okay && !SDL_IsRectEmpty(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_RectEmpty(rect)) {
if (SDL_IsRectEmpty(rect)) {
return 0;
}
}
@@ -427,7 +427,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
for (i = 0; i < count; ++i) {
rect = &rects[i];
/* Perform clipping */
if (!SDL_IntersectRect(rect, &dst->clip_rect, &clipped)) {
if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) {
continue;
}
rect = &clipped;

View File

@@ -90,22 +90,22 @@ SDL_GetSpanEnclosingRect(int width, int height,
#define POINTTYPE SDL_Point
#define SCALARTYPE int
#define COMPUTEOUTCODE ComputeOutCode
#define SDL_HASINTERSECTION SDL_HasIntersection
#define SDL_INTERSECTRECT SDL_IntersectRect
#define SDL_RECTEMPTY SDL_RectEmpty
#define SDL_UNIONRECT SDL_UnionRect
#define SDL_ENCLOSEPOINTS SDL_EnclosePoints
#define SDL_INTERSECTRECTANDLINE SDL_IntersectRectAndLine
#define SDL_HASINTERSECTION SDL_HasRectIntersection
#define SDL_INTERSECTRECT SDL_GetRectIntersection
#define SDL_RECTEMPTY SDL_IsRectEmpty
#define SDL_UNIONRECT SDL_GetRectUnion
#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPoints
#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersection
#include "SDL_rect_impl.h"
#define RECTTYPE SDL_FRect
#define POINTTYPE SDL_FPoint
#define SCALARTYPE float
#define COMPUTEOUTCODE ComputeOutCodeF
#define SDL_HASINTERSECTION SDL_HasIntersectionF
#define SDL_INTERSECTRECT SDL_IntersectFRect
#define SDL_RECTEMPTY SDL_FRectEmpty
#define SDL_UNIONRECT SDL_UnionFRect
#define SDL_ENCLOSEPOINTS SDL_EncloseFPoints
#define SDL_INTERSECTRECTANDLINE SDL_IntersectFRectAndLine
#define SDL_HASINTERSECTION SDL_HasRectIntersectionF
#define SDL_INTERSECTRECT SDL_GetRectIntersectionF
#define SDL_RECTEMPTY SDL_IsRectEmptyF
#define SDL_UNIONRECT SDL_GetRectUnionF
#define SDL_ENCLOSEPOINTS SDL_GetRectEnclosingPointsF
#define SDL_INTERSECTRECTANDLINE SDL_GetRectAndLineIntersectionF
#include "SDL_rect_impl.h"

View File

@@ -607,7 +607,7 @@ SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
surface->clip_rect = full_rect;
return SDL_TRUE;
}
return SDL_IntersectRect(rect, &full_rect, &surface->clip_rect);
return SDL_GetRectIntersection(rect, &full_rect, &surface->clip_rect);
}
void SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
@@ -896,11 +896,11 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect,
tmp.y = 0;
tmp.w = src->w;
tmp.h = src->h;
SDL_IntersectRect(&tmp, &final_src, &final_src);
SDL_GetRectIntersection(&tmp, &final_src, &final_src);
}
/* Clip again */
SDL_IntersectRect(&dst->clip_rect, &final_dst, &final_dst);
SDL_GetRectIntersection(&dst->clip_rect, &final_dst, &final_dst);
if (dstrect) {
*dstrect = final_dst;

View File

@@ -1108,7 +1108,7 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
SDL_GetDisplayBounds(i, &display_rect);
/* Check if the window is fully enclosed */
if (SDL_EnclosePoints(&center, 1, &display_rect, NULL)) {
if (SDL_GetRectEnclosingPoints(&center, 1, &display_rect, NULL)) {
return i;
}
@@ -2900,7 +2900,7 @@ SDL_GetWindowMouseRect(SDL_Window *window)
{
CHECK_WINDOW_MAGIC(window, NULL);
if (SDL_RectEmpty(&window->mouse_rect)) {
if (SDL_IsRectEmpty(&window->mouse_rect)) {
return NULL;
} else {
return &window->mouse_rect;

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_PointInRect(&pt, &r)) {
if (SDL_IsPointInRect(&pt, &r)) {
return i;
}
}

View File

@@ -381,7 +381,7 @@ static SDL_bool AdjustCoordinatesForGrab(SDL_Window *window, int x, int y, CGPoi
window_rect.w = window->w;
window_rect.h = window->h;
if (SDL_IntersectRect(&window->mouse_rect, &window_rect, &mouse_rect)) {
if (SDL_GetRectIntersection(&window->mouse_rect, &window_rect, &mouse_rect)) {
int left = window->x + mouse_rect.x;
int right = left + mouse_rect.w - 1;
int top = window->y + mouse_rect.y;
@@ -428,16 +428,16 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
window_rect.h = window->h;
if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) {
SDL_IntersectRect(&window->mouse_rect, &window_rect, &mouse_rect);
SDL_GetRectIntersection(&window->mouse_rect, &window_rect, &mouse_rect);
}
if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0 &&
SDL_RectEmpty(&mouse_rect)) {
SDL_IsRectEmpty(&mouse_rect)) {
SDL_memcpy(&mouse_rect, &window_rect, sizeof(mouse_rect));
}
}
if (SDL_RectEmpty(&mouse_rect)) {
if (SDL_IsRectEmpty(&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_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
if (SDL_IsRectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
return 0;
}
if (SDL_RectEmpty(&window->mouse_rect)) {
if (SDL_IsRectEmpty(&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_RectEmpty(rect)) {
if (!SDL_IsRectEmpty(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_RectEquals(rect, &input->text_input->cursor_rect)) {
if (!SDL_AreRectsEqual(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_RectEmpty(&window->mouse_rect) && !(window->flags & SDL_WINDOW_MOUSE_GRABBED)) {
if (SDL_IsRectEmpty(&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_RectEmpty(&window->mouse_rect)) {
} else if (SDL_IsRectEmpty(&window->mouse_rect)) {
Wayland_input_unconfine_pointer(data->input, window);
}
}

View File

@@ -876,7 +876,7 @@ int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *r
const long *p = (long *)propdata;
const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] };
retval = 0;
if (!SDL_IntersectRect(rect, &usable, rect)) {
if (!SDL_GetRectIntersection(rect, &usable, rect)) {
SDL_zerop(rect);
}
}

View File

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