Skip to content

Commit

Permalink
Remove some old sdl version code and require 2.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mateofio authored and carstene1ns committed May 22, 2020
1 parent 14dd095 commit 6d3439f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ if(${PLAYER_TARGET_PLATFORM} STREQUAL "SDL2")
src/sdl2_ui.h)
target_compile_definitions(${PROJECT_NAME} PUBLIC USE_SDL=2)

find_package(SDL2 REQUIRED)
find_package(SDL2 2.0.5 REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2main)
elseif(${PLAYER_TARGET_PLATFORM} STREQUAL "libretro")
target_sources(${PROJECT_NAME} PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ AS_IF([test "x$with_freetype" != "xno"], [
PKG_CHECK_MODULES([HARFBUZZ],[harfbuzz],[AC_DEFINE(HAVE_HARFBUZZ,[1],[Enable HarfBuzz text shaping])],[auto_harfbuzz=0])
])
])
PKG_CHECK_MODULES([SDL],[sdl2],[AC_DEFINE(USE_SDL,[2],[Enable SDL2])],[
PKG_CHECK_MODULES([SDL],[sdl2 >= 2.0.5],[AC_DEFINE(USE_SDL,[2],[Enable SDL2])],[
PKG_CHECK_MODULES([SDL],[sdl],[AC_DEFINE(USE_SDL,[1],[Enable SDL])])
])
AC_ARG_WITH([audio],[AS_HELP_STRING([--without-audio], [Disable audio support. @<:@default=on@:>@])])
Expand Down
7 changes: 0 additions & 7 deletions src/sdl2_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,8 @@ void Sdl2Ui::ToggleZoom() {
// get maximum usable window size
int display_index = SDL_GetWindowDisplayIndex(sdl_window);
SDL_Rect max_mode;
#if SDL_VERSION_ATLEAST(2, 0, 5)
// this takes account of the menu bar and dock on macOS and task bar on windows
SDL_GetDisplayUsableBounds(display_index, &max_mode);
#else
SDL_GetDisplayBounds(display_index, &max_mode);
#endif
// reset zoom, if it does not fit
if ((max_mode.h < SCREEN_TARGET_HEIGHT * current_display_mode.zoom) ||
(max_mode.w < SCREEN_TARGET_WIDTH * current_display_mode.zoom)) {
Expand Down Expand Up @@ -656,12 +652,9 @@ void Sdl2Ui::ProcessMouseWheelEvent(SDL_Event& evnt) {

int amount = evnt.wheel.y;

// FIXME: Debian ships older SDL2
#if SDL_VERSION_ATLEAST(2, 0, 4)
// translate direction
if (evnt.wheel.direction == SDL_MOUSEWHEEL_FLIPPED)
amount *= -1;
#endif

keys[Input::Keys::MOUSE_SCROLLUP] = amount > 0;
keys[Input::Keys::MOUSE_SCROLLDOWN] = amount < 0;
Expand Down

0 comments on commit 6d3439f

Please sign in to comment.