mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-02 03:54:41 +00:00
SDL_GetDisplays() follows the SDL_GetStringRule
This commit is contained in:
@@ -305,7 +305,7 @@ static int video_getWindowFlags(void *arg)
|
||||
*/
|
||||
static int video_getFullscreenDisplayModes(void *arg)
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
const SDL_DisplayMode **modes;
|
||||
int count;
|
||||
int i;
|
||||
@@ -323,7 +323,6 @@ static int video_getFullscreenDisplayModes(void *arg)
|
||||
SDLTest_AssertCheck(count >= 0, "Validate number of modes; expected: >= 0; got: %d", count);
|
||||
SDL_free((void *)modes);
|
||||
}
|
||||
SDL_free(displays);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -334,7 +333,7 @@ static int video_getFullscreenDisplayModes(void *arg)
|
||||
*/
|
||||
static int video_getClosestDisplayModeCurrentResolution(void *arg)
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
const SDL_DisplayMode **modes;
|
||||
SDL_DisplayMode current;
|
||||
const SDL_DisplayMode *closest;
|
||||
@@ -373,7 +372,6 @@ static int video_getClosestDisplayModeCurrentResolution(void *arg)
|
||||
}
|
||||
SDL_free((void *)modes);
|
||||
}
|
||||
SDL_free(displays);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -384,7 +382,7 @@ static int video_getClosestDisplayModeCurrentResolution(void *arg)
|
||||
*/
|
||||
static int video_getClosestDisplayModeRandomResolution(void *arg)
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
SDL_DisplayMode target;
|
||||
int i;
|
||||
int variation;
|
||||
@@ -411,7 +409,6 @@ static int video_getClosestDisplayModeRandomResolution(void *arg)
|
||||
SDLTest_AssertPass("Call to SDL_GetClosestFullscreenDisplayMode(target=random/variation%d)", variation);
|
||||
}
|
||||
}
|
||||
SDL_free(displays);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
@@ -1673,7 +1670,7 @@ cleanup:
|
||||
*/
|
||||
static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
SDL_Window *window;
|
||||
const char *title = "video_setWindowCenteredOnDisplay Test Window";
|
||||
int x, y, w, h;
|
||||
@@ -1869,8 +1866,6 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
destroyVideoSuiteTestWindow(window);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_free(displays);
|
||||
}
|
||||
|
||||
return TEST_COMPLETED;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
int i;
|
||||
SDLTest_CommonState *state;
|
||||
|
||||
@@ -47,7 +47,6 @@ int main(int argc, char **argv)
|
||||
bounds.x, bounds.y, bounds.w, bounds.h,
|
||||
usable.x, usable.y, usable.w, usable.h);
|
||||
}
|
||||
SDL_free(displays);
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
@@ -33,7 +33,7 @@ print_mode(const char *prefix, const SDL_DisplayMode *mode)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_DisplayID *displays;
|
||||
const SDL_DisplayID *displays;
|
||||
const SDL_DisplayMode **modes;
|
||||
const SDL_DisplayMode *mode;
|
||||
int num_displays, i;
|
||||
@@ -98,7 +98,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
SDL_Log("\n");
|
||||
}
|
||||
SDL_free(displays);
|
||||
|
||||
SDL_Quit();
|
||||
SDLTest_CommonDestroyState(state);
|
||||
|
||||
@@ -62,7 +62,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
|
||||
float x, y;
|
||||
float table_top;
|
||||
SDL_FPoint mouse_pos = { -1.0f, -1.0f };
|
||||
SDL_DisplayID *display_ids;
|
||||
const SDL_DisplayID *displays;
|
||||
|
||||
/* Get mouse position */
|
||||
if (SDL_GetMouseFocus() == window) {
|
||||
@@ -98,18 +98,18 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
|
||||
highlighted_mode = NULL;
|
||||
}
|
||||
|
||||
display_ids = SDL_GetDisplays(NULL);
|
||||
displays = SDL_GetDisplays(NULL);
|
||||
|
||||
if (display_ids) {
|
||||
for (i = 0; display_ids[i]; ++i) {
|
||||
const SDL_DisplayID display_id = display_ids[i];
|
||||
modes = SDL_GetFullscreenDisplayModes(display_id, NULL);
|
||||
if (displays) {
|
||||
for (i = 0; displays[i]; ++i) {
|
||||
SDL_DisplayID display = displays[i];
|
||||
modes = SDL_GetFullscreenDisplayModes(display, NULL);
|
||||
for (j = 0; modes[j]; ++j) {
|
||||
SDL_FRect cell_rect;
|
||||
const SDL_DisplayMode *mode = modes[j];
|
||||
|
||||
(void)SDL_snprintf(text, sizeof(text), "%s mode %d: %dx%d@%gx %gHz",
|
||||
SDL_GetDisplayName(display_id),
|
||||
SDL_GetDisplayName(display),
|
||||
j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate);
|
||||
|
||||
/* Update column width */
|
||||
@@ -145,7 +145,6 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
|
||||
}
|
||||
SDL_free((void *)modes);
|
||||
}
|
||||
SDL_free(display_ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user