mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-19 08:41:20 +00:00
Displays are now referenced by instance ID instead of index
This commit is contained in:
@@ -915,15 +915,15 @@ static SDL_RenderLineMethod SDL_GetRenderLineMethod()
|
||||
|
||||
static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Window *window)
|
||||
{
|
||||
int display_index = SDL_GetWindowDisplayIndex(window);
|
||||
SDL_DisplayID displayID = SDL_GetDisplayForWindow(window);
|
||||
SDL_DisplayMode mode;
|
||||
float refresh_rate;
|
||||
int num, den;
|
||||
|
||||
if (display_index < 0) {
|
||||
display_index = 0;
|
||||
if (displayID == 0) {
|
||||
displayID = SDL_GetPrimaryDisplay();
|
||||
}
|
||||
if (SDL_GetDesktopDisplayMode(display_index, &mode) == 0 && mode.refresh_rate > 0.0f) {
|
||||
if (SDL_GetDesktopDisplayMode(displayID, &mode) == 0 && mode.refresh_rate > 0.0f) {
|
||||
refresh_rate = mode.refresh_rate;
|
||||
} else {
|
||||
/* Pick a good default refresh rate */
|
||||
|
||||
@@ -1557,7 +1557,7 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
Uint32 window_flags;
|
||||
int w, h;
|
||||
SDL_DisplayMode fullscreen_mode;
|
||||
int displayIndex;
|
||||
SDL_DisplayID displayID;
|
||||
|
||||
if (SDL_GetWindowWMInfo(window, &windowinfo, SDL_SYSWM_CURRENT_VERSION) < 0 ||
|
||||
windowinfo.subsystem != SDL_SYSWM_WINDOWS) {
|
||||
@@ -1639,8 +1639,8 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||
}
|
||||
|
||||
/* Get the adapter for the display that the window is on */
|
||||
displayIndex = SDL_GetWindowDisplayIndex(window);
|
||||
data->adapter = SDL_Direct3D9GetAdapterIndex(displayIndex);
|
||||
displayID = SDL_GetDisplayForWindow(window);
|
||||
data->adapter = SDL_Direct3D9GetAdapterIndex(displayID);
|
||||
|
||||
IDirect3D9_GetDeviceCaps(data->d3d, data->adapter, D3DDEVTYPE_HAL, &caps);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user