Browse Source

Explicitly #ifdef'd out SDL 2.0.1+ function calls for Linux to avoid runtime function resolving problems when love is built with SDL 2.0.1+ headers but run using SDL 2.0.0.

Alex Szpakowski 11 years ago
parent
commit
a22c4b5f92
2 changed files with 13 additions and 6 deletions
  1. 3 1
      src/modules/event/sdl/Event.cpp
  2. 10 5
      src/modules/window/sdl/Window.cpp

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

@@ -27,6 +27,7 @@
 #include "graphics/Graphics.h"
 #include "graphics/Graphics.h"
 #include "window/Window.h"
 #include "window/Window.h"
 #include "common/Exception.h"
 #include "common/Exception.h"
+#include "common/config.h"
 
 
 #include <cmath>
 #include <cmath>
 
 
@@ -427,7 +428,8 @@ 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;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+			// 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);

+ 10 - 5
src/modules/window/sdl/Window.cpp

@@ -116,7 +116,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 	if (f.borderless)
 	if (f.borderless)
 		sdlflags |= SDL_WINDOW_BORDERLESS;
 		sdlflags |= SDL_WINDOW_BORDERLESS;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+	// 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
 #endif
@@ -130,7 +131,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
 		Uint32 testflags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP
 		Uint32 testflags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP
 			| SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
 			| SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+		// FIXME: disabled in Linux for runtime SDL 2.0.0 compatibility.
+#if SDL_VERSION_ATLEAST(2,0,1) && !defined(LOVE_LINUX)
 		testflags |= SDL_WINDOW_ALLOW_HIGHDPI;
 		testflags |= SDL_WINDOW_ALLOW_HIGHDPI;
 #endif
 #endif
 
 
@@ -202,7 +204,8 @@ 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;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+		// 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
 #endif
 
 
@@ -431,7 +434,8 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
 			int width = curMode.width;
 			int width = curMode.width;
 			int height = curMode.height;
 			int height = curMode.height;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+			// 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
 #endif
 
 
@@ -633,7 +637,8 @@ double Window::getPixelScale() const
 {
 {
 	double scale = 1.0;
 	double scale = 1.0;
 
 
-#if SDL_VERSION_ATLEAST(2,0,1)
+	// 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;