Browse Source

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
Alex Szpakowski 10 years ago
parent
commit
e26e170f78
2 changed files with 0 additions and 30 deletions
  1. 0 3
      src/modules/event/sdl/Event.cpp
  2. 0 27
      src/modules/window/sdl/Window.cpp

+ 0 - 3
src/modules/event/sdl/Event.cpp

@@ -553,12 +553,9 @@ Message *Event::convertWindowEvent(const SDL_Event &e) const
 			int px_w = e.window.data1;
 			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);
 			if (sdlwin)
 				SDL_GL_GetDrawableSize(sdlwin, &px_w, &px_h);
-#endif
 
 			win->onWindowResize(e.window.data1, e.window.data2);
 

+ 0 - 27
src/modules/window/sdl/Window.cpp

@@ -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_MULTISAMPLESAMPLES, (msaa > 0) ? msaa : 0);
 
-#if SDL_VERSION_ATLEAST(2,0,1)
 	SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, sRGB ? 1 : 0);
-#endif
 }
 
 void Window::setGLContextAttributes(const ContextAttribs &attribs)
@@ -404,11 +402,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 	if (f.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)
 		sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI;
-#endif
 
 	int x = f.x;
 	int y = f.y;
@@ -478,11 +473,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 	{
 		int width = curMode.width;
 		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);
-#endif
 
 		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);
 
-#if SDL_VERSION_ATLEAST(2,0,1)
 	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
 	// mode.
@@ -620,11 +607,7 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
 		{
 			int width = curMode.width;
 			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);
-#endif
 
 			gfx->setViewportSize(width, height);
 		}
@@ -864,14 +847,7 @@ bool Window::isMouseGrabbed() const
 void Window::getPixelDimensions(int &w, int &h) const
 {
 	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);
-#else
-		SDL_GetWindowSize(window, &w, &h);
-#endif
-	}
 	else
 	{
 		w = curMode.width;
@@ -883,8 +859,6 @@ double Window::getPixelScale() const
 {
 	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)
 	{
 		int wheight;
@@ -895,7 +869,6 @@ double Window::getPixelScale() const
 
 		scale = (double) dheight / wheight;
 	}
-#endif
 
 	return scale;
 }