mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Rename 'display' field to 'displayindex' in setMode and love.conf.
Fixes #1711.
This commit is contained in:
@@ -478,13 +478,13 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
f.minwidth = std::max(f.minwidth, 1);
|
||||
f.minheight = std::max(f.minheight, 1);
|
||||
|
||||
f.display = std::min(std::max(f.display, 0), getDisplayCount() - 1);
|
||||
f.displayindex = std::min(std::max(f.displayindex, 0), getDisplayCount() - 1);
|
||||
|
||||
// Use the desktop resolution if a width or height of 0 is specified.
|
||||
if (width == 0 || height == 0)
|
||||
{
|
||||
SDL_DisplayMode mode = {};
|
||||
SDL_GetDesktopDisplayMode(f.display, &mode);
|
||||
SDL_GetDesktopDisplayMode(f.displayindex, &mode);
|
||||
width = mode.w;
|
||||
height = mode.h;
|
||||
}
|
||||
@@ -509,16 +509,16 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
{
|
||||
// The position needs to be in the global coordinate space.
|
||||
SDL_Rect displaybounds = {};
|
||||
SDL_GetDisplayBounds(f.display, &displaybounds);
|
||||
SDL_GetDisplayBounds(f.displayindex, &displaybounds);
|
||||
x += displaybounds.x;
|
||||
y += displaybounds.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (f.centered)
|
||||
x = y = SDL_WINDOWPOS_CENTERED_DISPLAY(f.display);
|
||||
x = y = SDL_WINDOWPOS_CENTERED_DISPLAY(f.displayindex);
|
||||
else
|
||||
x = y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(f.display);
|
||||
x = y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(f.displayindex);
|
||||
}
|
||||
|
||||
SDL_DisplayMode fsmode = {0, width, height, 0, nullptr};
|
||||
@@ -526,12 +526,12 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
if (f.fullscreen && f.fstype == FULLSCREEN_EXCLUSIVE)
|
||||
{
|
||||
// Fullscreen window creation will bug out if no mode can be used.
|
||||
if (SDL_GetClosestDisplayMode(f.display, &fsmode, &fsmode) == nullptr)
|
||||
if (SDL_GetClosestDisplayMode(f.displayindex, &fsmode, &fsmode) == nullptr)
|
||||
{
|
||||
// GetClosestDisplayMode will fail if we request a size larger
|
||||
// than the largest available display mode, so we'll try to use
|
||||
// the largest (first) mode in that case.
|
||||
if (SDL_GetDisplayMode(f.display, 0, &fsmode) < 0)
|
||||
if (SDL_GetDisplayMode(f.displayindex, 0, &fsmode) < 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -607,7 +607,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
// Enforce minimum window dimensions.
|
||||
SDL_SetWindowMinimumSize(window, f.minwidth, f.minheight);
|
||||
|
||||
if (this->settings.display != f.display || f.useposition || f.centered)
|
||||
if (this->settings.displayindex != f.displayindex || f.useposition || f.centered)
|
||||
SDL_SetWindowPosition(window, x, y);
|
||||
|
||||
SDL_RaiseWindow(window);
|
||||
@@ -727,7 +727,7 @@ void Window::updateSettings(const WindowSettings &newsettings, bool updateGraphi
|
||||
settings.borderless = (wflags & SDL_WINDOW_BORDERLESS) != 0;
|
||||
settings.centered = newsettings.centered;
|
||||
|
||||
getPosition(settings.x, settings.y, settings.display);
|
||||
getPosition(settings.x, settings.y, settings.displayindex);
|
||||
|
||||
setHighDPIAllowed((wflags & SDL_WINDOW_ALLOW_HIGHDPI) != 0);
|
||||
|
||||
@@ -745,7 +745,7 @@ void Window::updateSettings(const WindowSettings &newsettings, bool updateGraphi
|
||||
settings.depth = newsettings.depth;
|
||||
|
||||
SDL_DisplayMode dmode = {};
|
||||
SDL_GetCurrentDisplayMode(settings.display, &dmode);
|
||||
SDL_GetCurrentDisplayMode(settings.displayindex, &dmode);
|
||||
|
||||
// May be 0 if the refresh rate can't be determined.
|
||||
settings.refreshrate = (double) dmode.refresh_rate;
|
||||
|
||||
Reference in New Issue
Block a user