Browse Source

SDL API renaming: SDL_video.h

Fixes https://github.com/libsdl-org/SDL/issues/6880
Sam Lantinga 2 years ago
parent
commit
c6969df4d7

+ 2 - 0
WhatsNew.txt

@@ -32,6 +32,8 @@ General:
     * SDL_FreeSurface => SDL_DestroySurface
     * SDL_GetClipRect => SDL_GetSurfaceClipRect
     * SDL_GetColorKey => SDL_GetSurfaceColorKey
+    * SDL_GetPointDisplayIndex => SDL_GetDisplayIndexForPoint
+    * SDL_GetRectDisplayIndex => SDL_GetDisplayIndexForRect
     * SDL_HasColorKey => SDL_SurfaceHasColorKey
     * SDL_HasSurfaceRLE => SDL_SurfaceHasRLE
     * SDL_JoystickAttachVirtual => SDL_AttachVirtualJoystick

+ 4 - 0
docs/README-migration.md

@@ -592,3 +592,7 @@ SDL_VideoInit() and SDL_VideoQuit() have been removed. Instead you can call SDL_
 
 
 
+The following functions have been renamed:
+* SDL_GetPointDisplayIndex => SDL_GetDisplayIndexForPoint
+* SDL_GetRectDisplayIndex => SDL_GetDisplayIndexForRect
+

+ 8 - 0
include/SDL3/SDL_oldnames.h

@@ -207,6 +207,10 @@
 #define SDL_UpperBlit SDL_BlitSurface
 #define SDL_UpperBlitScaled SDL_BlitSurfaceScaled
 
+/* ##SDL_video.h */
+#define SDL_GetPointDisplayIndex SDL_GetDisplayIndexForPoint
+#define SDL_GetRectDisplayIndex SDL_GetDisplayIndexForRect
+
 #else /* !SDL_ENABLE_OLD_NAMES */
 
 /* ##SDL_audio.h */
@@ -377,6 +381,10 @@
 #define SDL_UpperBlit SDL_UpperBlit_renamed_SDL_BlitSurface
 #define SDL_UpperBlitScaled SDL_UpperBlitScaled_renamed_SDL_BlitSurfaceScaled
 
+/* ##SDL_video.h */
+#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayIndexForPoint
+#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayIndexForRect
+
 #endif /* SDL_ENABLE_OLD_NAMES */
 
 #endif /* SDL_oldnames_h_ */

+ 2 - 2
include/SDL3/SDL_video.h

@@ -540,7 +540,7 @@ extern DECLSPEC SDL_DisplayMode * SDLCALL SDL_GetClosestDisplayMode(int displayI
  * \sa SDL_GetDisplayBounds
  * \sa SDL_GetNumVideoDisplays
  */
-extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point);
+extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForPoint(const SDL_Point * point);
 
 /**
  * Get the index of the display primarily containing a rect
@@ -555,7 +555,7 @@ extern DECLSPEC int SDLCALL SDL_GetPointDisplayIndex(const SDL_Point * point);
  * \sa SDL_GetDisplayBounds
  * \sa SDL_GetNumVideoDisplays
  */
-extern DECLSPEC int SDLCALL SDL_GetRectDisplayIndex(const SDL_Rect * rect);
+extern DECLSPEC int SDLCALL SDL_GetDisplayIndexForRect(const SDL_Rect * rect);
 
 /**
  * Get the index of the display associated with a window.

+ 2 - 2
src/dynapi/SDL_dynapi.sym

@@ -536,8 +536,8 @@ SDL3_0.0.0 {
     SDL_GetDesktopDisplayMode;
     SDL_GetCurrentDisplayMode;
     SDL_GetClosestDisplayMode;
-    SDL_GetPointDisplayIndex;
-    SDL_GetRectDisplayIndex;
+    SDL_GetDisplayIndexForPoint;
+    SDL_GetDisplayIndexForRect;
     SDL_GetWindowDisplayIndex;
     SDL_SetWindowDisplayMode;
     SDL_GetWindowDisplayMode;

+ 2 - 2
src/dynapi/SDL_dynapi_overrides.h

@@ -852,8 +852,8 @@
 #define SDL_GetOriginalMemoryFunctions SDL_GetOriginalMemoryFunctions_REAL
 #define SDL_ResetKeyboard SDL_ResetKeyboard_REAL
 #define SDL_GetDefaultAudioInfo SDL_GetDefaultAudioInfo_REAL
-#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_REAL
-#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_REAL
+#define SDL_GetDisplayIndexForPoint SDL_GetDisplayIndexForPoint_REAL
+#define SDL_GetDisplayIndexForRect SDL_GetDisplayIndexForRect_REAL
 #define SDL_ResetHint SDL_ResetHint_REAL
 #define SDL_crc16 SDL_crc16_REAL
 #define SDL_GetWindowSizeInPixels SDL_GetWindowSizeInPixels_REAL

+ 2 - 2
src/dynapi/SDL_dynapi_procs.h

@@ -924,8 +924,8 @@ SDL_DYNAPI_PROC(int,SDL_GDKGetTaskQueue,(XTaskQueueHandle *a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),)
 SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),)
 SDL_DYNAPI_PROC(int,SDL_GetDefaultAudioInfo,(char **a, SDL_AudioSpec *b, int c),(a,b,c),return)
-SDL_DYNAPI_PROC(int,SDL_GetPointDisplayIndex,(const SDL_Point *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_GetRectDisplayIndex,(const SDL_Rect *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayIndexForPoint,(const SDL_Point *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayIndexForRect,(const SDL_Rect *a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return)
 SDL_DYNAPI_PROC(Uint16,SDL_crc16,(Uint16 a, const void *b, size_t c),(a,b,c),return)
 SDL_DYNAPI_PROC(void,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),)

+ 1 - 1
src/video/SDL_sysvideo.h

@@ -513,7 +513,7 @@ extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vin
 
 extern void SDL_ToggleDragAndDropSupport(void);
 
-extern int SDL_GetPointDisplayIndex(const SDL_Point *point);
+extern int SDL_GetDisplayIndexForPoint(const SDL_Point *point);
 
 extern int SDL_GL_SwapWindowWithResult(SDL_Window *window);
 

+ 2 - 2
src/video/SDL_video.c

@@ -1133,12 +1133,12 @@ static int GetRectDisplayIndex(int x, int y, int w, int h)
     return closest;
 }
 
-int SDL_GetPointDisplayIndex(const SDL_Point *point)
+int SDL_GetDisplayIndexForPoint(const SDL_Point *point)
 {
     return GetRectDisplayIndex(point->x, point->y, 1, 1);
 }
 
-int SDL_GetRectDisplayIndex(const SDL_Rect *rect)
+int SDL_GetDisplayIndexForRect(const SDL_Rect *rect)
 {
     return GetRectDisplayIndex(rect->x, rect->y, rect->w, rect->h);
 }

+ 1 - 1
src/video/windows/SDL_windowsmodes.c

@@ -610,7 +610,7 @@ void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut)
     }
 
     /* Can't use MonitorFromPoint for this because we currently have SDL coordinates, not pixels */
-    displayIndex = SDL_GetPointDisplayIndex(&point);
+    displayIndex = SDL_GetDisplayIndexForPoint(&point);
 
     if (displayIndex < 0) {
         return;