mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Enabled high-dpi code on Linux (even though SDL doesn't support it yet on Linux, as of 2.0.4.) SDL 2.0.1 or newer is now required on Linux.
I'd rather have high-dpi work on Linux without needing to rebuild love when it's eventually implemented in SDL, rather than preserve backwards-compatibility with SDL 2.0.0 on Linux (which isn't important for love 0.10.0.) --HG-- branch : minor
This commit is contained in:
@@ -553,12 +553,9 @@ Message *Event::convertWindowEvent(const SDL_Event &e) const
|
|||||||
int px_w = e.window.data1;
|
int px_w = e.window.data1;
|
||||||
int px_h = e.window.data2;
|
int px_h = e.window.data2;
|
||||||
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
SDL_Window *sdlwin = SDL_GetWindowFromID(e.window.windowID);
|
SDL_Window *sdlwin = SDL_GetWindowFromID(e.window.windowID);
|
||||||
if (sdlwin)
|
if (sdlwin)
|
||||||
SDL_GL_GetDrawableSize(sdlwin, &px_w, &px_h);
|
SDL_GL_GetDrawableSize(sdlwin, &px_w, &px_h);
|
||||||
#endif
|
|
||||||
|
|
||||||
win->onWindowResize(e.window.data1, e.window.data2);
|
win->onWindowResize(e.window.data1, e.window.data2);
|
||||||
|
|
||||||
|
|||||||
@@ -89,9 +89,7 @@ void Window::setGLFramebufferAttributes(int msaa, bool sRGB)
|
|||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, (msaa > 0) ? 1 : 0);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, (msaa > 0) ? 1 : 0);
|
||||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, (msaa > 0) ? msaa : 0);
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, (msaa > 0) ? msaa : 0);
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1)
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, sRGB ? 1 : 0);
|
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, sRGB ? 1 : 0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setGLContextAttributes(const ContextAttribs &attribs)
|
void Window::setGLContextAttributes(const ContextAttribs &attribs)
|
||||||
@@ -404,11 +402,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
if (f.borderless)
|
if (f.borderless)
|
||||||
sdlflags |= SDL_WINDOW_BORDERLESS;
|
sdlflags |= SDL_WINDOW_BORDERLESS;
|
||||||
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
if (f.highdpi)
|
if (f.highdpi)
|
||||||
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
|
||||||
#endif
|
|
||||||
|
|
||||||
int x = f.x;
|
int x = f.x;
|
||||||
int y = f.y;
|
int y = f.y;
|
||||||
@@ -478,11 +473,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
{
|
{
|
||||||
int width = curMode.width;
|
int width = curMode.width;
|
||||||
int height = curMode.height;
|
int height = curMode.height;
|
||||||
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
SDL_GL_GetDrawableSize(window, &width, &height);
|
SDL_GL_GetDrawableSize(window, &width, &height);
|
||||||
#endif
|
|
||||||
|
|
||||||
gfx->setMode(width, height, curMode.settings.sRGB);
|
gfx->setMode(width, height, curMode.settings.sRGB);
|
||||||
}
|
}
|
||||||
@@ -539,11 +530,7 @@ void Window::updateSettings(const WindowSettings &newsettings)
|
|||||||
|
|
||||||
getPosition(curMode.settings.x, curMode.settings.y, curMode.settings.display);
|
getPosition(curMode.settings.x, curMode.settings.y, curMode.settings.display);
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1)
|
|
||||||
curMode.settings.highdpi = (wflags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
|
curMode.settings.highdpi = (wflags & SDL_WINDOW_ALLOW_HIGHDPI) != 0;
|
||||||
#else
|
|
||||||
curMode.settings.highdpi = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Only minimize on focus loss if the window is in exclusive-fullscreen
|
// Only minimize on focus loss if the window is in exclusive-fullscreen
|
||||||
// mode.
|
// mode.
|
||||||
@@ -620,11 +607,7 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
|
|||||||
{
|
{
|
||||||
int width = curMode.width;
|
int width = curMode.width;
|
||||||
int height = curMode.height;
|
int height = curMode.height;
|
||||||
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
SDL_GL_GetDrawableSize(window, &width, &height);
|
SDL_GL_GetDrawableSize(window, &width, &height);
|
||||||
#endif
|
|
||||||
|
|
||||||
gfx->setViewportSize(width, height);
|
gfx->setViewportSize(width, height);
|
||||||
}
|
}
|
||||||
@@ -864,14 +847,7 @@ bool Window::isMouseGrabbed() const
|
|||||||
void Window::getPixelDimensions(int &w, int &h) const
|
void Window::getPixelDimensions(int &w, int &h) const
|
||||||
{
|
{
|
||||||
if (window)
|
if (window)
|
||||||
{
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
SDL_GL_GetDrawableSize(window, &w, &h);
|
SDL_GL_GetDrawableSize(window, &w, &h);
|
||||||
#else
|
|
||||||
SDL_GetWindowSize(window, &w, &h);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w = curMode.width;
|
w = curMode.width;
|
||||||
@@ -883,8 +859,6 @@ double Window::getPixelScale() const
|
|||||||
{
|
{
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
|
|
||||||
// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
|
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
int wheight;
|
int wheight;
|
||||||
@@ -895,7 +869,6 @@ double Window::getPixelScale() const
|
|||||||
|
|
||||||
scale = (double) dheight / wheight;
|
scale = (double) dheight / wheight;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user