From a22c4b5f924e589e7cbe0e12b03f0f7e038781ba Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 31 Mar 2014 03:45:22 -0300 Subject: [PATCH] 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. --- src/modules/event/sdl/Event.cpp | 4 +++- src/modules/window/sdl/Window.cpp | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/event/sdl/Event.cpp b/src/modules/event/sdl/Event.cpp index 425da01fa..c2a2b648c 100644 --- a/src/modules/event/sdl/Event.cpp +++ b/src/modules/event/sdl/Event.cpp @@ -27,6 +27,7 @@ #include "graphics/Graphics.h" #include "window/Window.h" #include "common/Exception.h" +#include "common/config.h" #include @@ -427,7 +428,8 @@ Message *Event::convertWindowEvent(const SDL_Event &e) const int px_w = e.window.data1; 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); if (sdlwin) SDL_GL_GetDrawableSize(sdlwin, &px_w, &px_h); diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index af8a0940e..6854e11f9 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -116,7 +116,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) if (f.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) sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI; #endif @@ -130,7 +131,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) Uint32 testflags = SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN_DESKTOP | 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; #endif @@ -202,7 +204,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) int width = curMode.width; 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); #endif @@ -431,7 +434,8 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype) int width = curMode.width; 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); #endif @@ -633,7 +637,8 @@ double Window::getPixelScale() const { 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) { int wheight;