Skip to content

Commit e92832f

Browse files
Update rcore_desktop_sdl.c (#5332)
1 parent cfb43fa commit e92832f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/platforms/rcore_desktop_sdl.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void ToggleFullscreen(void)
463463
const int monitorCount = SDL_GetNumVideoDisplays();
464464

465465
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
466-
if ((monitor > 0) && (monitor <= monitorCount))
466+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
467467
#else
468468
if ((monitor >= 0) && (monitor < monitorCount))
469469
#endif
@@ -491,7 +491,7 @@ void ToggleBorderlessWindowed(void)
491491
const int monitorCount = SDL_GetNumVideoDisplays();
492492

493493
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
494-
if ((monitor > 0) && (monitor <= monitorCount))
494+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
495495
#else
496496
if ((monitor >= 0) && (monitor < monitorCount))
497497
#endif
@@ -548,7 +548,7 @@ void SetWindowState(unsigned int flags)
548548
const int monitorCount = SDL_GetNumVideoDisplays();
549549

550550
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
551-
if ((monitor > 0) && (monitor <= monitorCount))
551+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
552552
#else
553553
if ((monitor >= 0) && (monitor < monitorCount))
554554
#endif
@@ -612,7 +612,7 @@ void SetWindowState(unsigned int flags)
612612
const int monitorCount = SDL_GetNumVideoDisplays();
613613

614614
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
615-
if ((monitor > 0) && (monitor <= monitorCount))
615+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
616616
#else
617617
if ((monitor >= 0) && (monitor < monitorCount))
618618
#endif
@@ -833,7 +833,7 @@ void SetWindowMonitor(int monitor)
833833
{
834834
const int monitorCount = SDL_GetNumVideoDisplays();
835835
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
836-
if ((monitor > 0) && (monitor <= monitorCount))
836+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
837837
#else
838838
if ((monitor >= 0) && (monitor < monitorCount))
839839
#endif
@@ -961,7 +961,7 @@ Vector2 GetMonitorPosition(int monitor)
961961
{
962962
const int monitorCount = SDL_GetNumVideoDisplays();
963963
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
964-
if ((monitor > 0) && (monitor <= monitorCount))
964+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
965965
#else
966966
if ((monitor >= 0) && (monitor < monitorCount))
967967
#endif
@@ -989,7 +989,7 @@ int GetMonitorWidth(int monitor)
989989

990990
const int monitorCount = SDL_GetNumVideoDisplays();
991991
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
992-
if ((monitor > 0) && (monitor <= monitorCount))
992+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
993993
#else
994994
if ((monitor >= 0) && (monitor < monitorCount))
995995
#endif
@@ -1010,7 +1010,7 @@ int GetMonitorHeight(int monitor)
10101010

10111011
const int monitorCount = SDL_GetNumVideoDisplays();
10121012
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
1013-
if ((monitor > 0) && (monitor <= monitorCount))
1013+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
10141014
#else
10151015
if ((monitor >= 0) && (monitor < monitorCount))
10161016
#endif
@@ -1031,7 +1031,7 @@ int GetMonitorPhysicalWidth(int monitor)
10311031

10321032
const int monitorCount = SDL_GetNumVideoDisplays();
10331033
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
1034-
if ((monitor > 0) && (monitor <= monitorCount))
1034+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
10351035
#else
10361036
if ((monitor >= 0) && (monitor < monitorCount))
10371037
#endif
@@ -1055,7 +1055,7 @@ int GetMonitorPhysicalHeight(int monitor)
10551055

10561056
const int monitorCount = SDL_GetNumVideoDisplays();
10571057
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
1058-
if ((monitor > 0) && (monitor <= monitorCount))
1058+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
10591059
#else
10601060
if ((monitor >= 0) && (monitor < monitorCount))
10611061
#endif
@@ -1079,7 +1079,7 @@ int GetMonitorRefreshRate(int monitor)
10791079

10801080
const int monitorCount = SDL_GetNumVideoDisplays();
10811081
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
1082-
if ((monitor > 0) && (monitor <= monitorCount))
1082+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
10831083
#else
10841084
if ((monitor >= 0) && (monitor < monitorCount))
10851085
#endif
@@ -1099,7 +1099,7 @@ const char *GetMonitorName(int monitor)
10991099
const int monitorCount = SDL_GetNumVideoDisplays();
11001100

11011101
#if defined(USING_VERSION_SDL3) // SDL3 Migration: Monitor is an id instead of index now, returns 0 on failure
1102-
if ((monitor > 0) && (monitor <= monitorCount))
1102+
if (SDL_GetDisplayProperties(monitor) != 0) // Returns 0 on failure, so a value other than zero indicates that the monitor id is valid
11031103
#else
11041104
if ((monitor >= 0) && (monitor < monitorCount))
11051105
#endif

0 commit comments

Comments
 (0)