From ffc6b35f3ab6a0e40f0bab43c61ad66b0d0dc475 Mon Sep 17 00:00:00 2001 From: chrisws Date: Mon, 13 Feb 2023 19:54:33 +1030 Subject: [PATCH 1/2] SDL: fall back to non-static libs when not available #176 --- configure.ac | 15 ++++++++++++++- src/platform/sdl/runtime.cpp | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 03a831ab..dbcf0dc6 100644 --- a/configure.ac +++ b/configure.ac @@ -212,10 +212,23 @@ function buildSDL() { (cd images && xxd -i sb-desktop-128x128.png > ../src/platform/sdl/icon.h) + HAVE_SDL2_STATIC=yes + AC_MSG_CHECKING([if installed SDL2 supports static libs]) + AC_PATH_PROGS_FEATURE_CHECK([SDL2_STATIC_TMP], [sdl2-config], + AS_IF([`"$ac_path_SDL2_STATIC_TMP" --static-libs 2>&1 | sed '/Usage/!{q1};' > /dev/null`], [HAVE_SDL2_STATIC=no])) + AC_MSG_RESULT([$HAVE_SDL2_STATIC]) + + if test "x$HAVE_SDL2_STATIC" = "xno"; then + SDL_LIBS=`sdl2-config --libs` + else + SDL_LIBS=`sdl2-config --static-libs` + fi + dnl backlinking support for modules PACKAGE_LIBS="${PACKAGE_LIBS} -ldl -no-pie" PACKAGE_LIBS="${PACKAGE_LIBS} ${FONTCONFIG_LIBS}" - PACKAGE_LIBS="-static-libgcc ${PACKAGE_LIBS} `sdl2-config --static-libs` `pkg-config freetype2 --libs`" + + PACKAGE_LIBS="-static-libgcc ${PACKAGE_LIBS} ${SDL_LIBS} `pkg-config freetype2 --libs`" esac PACKAGE_CFLAGS="${PACKAGE_CFLAGS} `sdl2-config --cflags` `pkg-config freetype2 --cflags` -fno-exceptions" diff --git a/src/platform/sdl/runtime.cpp b/src/platform/sdl/runtime.cpp index d0e6dc71..27ffc8fe 100644 --- a/src/platform/sdl/runtime.cpp +++ b/src/platform/sdl/runtime.cpp @@ -714,10 +714,13 @@ void Runtime::saveWindowRect() { // // System platform methods // +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wint-in-bool-context" bool System::getPen3() { SDL_PumpEvents(); return (SDL_BUTTON(SDL_BUTTON_LEFT) && SDL_GetMouseState(&_touchCurX, &_touchCurY)); } +#pragma GCC diagnostic pop void System::completeKeyword(int index) const { if (get_focus_edit() && isEditing()) { From 01d128a1c115fd3c43c336038316a486358f9dd3 Mon Sep 17 00:00:00 2001 From: chrisws Date: Sat, 18 Feb 2023 11:16:55 +1030 Subject: [PATCH 2/2] SDL: fixed an issue with window resizing #144 --- ChangeLog | 3 +++ src/platform/sdl/runtime.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc45077e..0ef350f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2023-01-20 (12.26) + SDL: Fixed an issue with window resizing #144 + 2023-01-20 (12.26) COMMON: Fixed DIM lower bound COMMON: RGB and RGBF now clamp parameters diff --git a/src/platform/sdl/runtime.cpp b/src/platform/sdl/runtime.cpp index 27ffc8fe..49bab154 100644 --- a/src/platform/sdl/runtime.cpp +++ b/src/platform/sdl/runtime.cpp @@ -533,14 +533,19 @@ void Runtime::pollEvents(bool blocking) { case SDL_WINDOWEVENT_FOCUS_GAINED: break; case SDL_WINDOWEVENT_RESIZED: + case SDL_WINDOWEVENT_SIZE_CHANGED: onResize(ev.window.data1, ev.window.data2); break; case SDL_WINDOWEVENT_EXPOSED: + case SDL_WINDOWEVENT_SHOWN: _graphics->redraw(); break; case SDL_WINDOWEVENT_LEAVE: _output->removeHover(); break; + default: + trace("Unhandled window event [%d]", ev.window.event); + break; } break; case SDL_DROPFILE: @@ -611,8 +616,6 @@ void Runtime::setWindowRect(int x, int y, int width, int height) { logEntered(); if (width > 0 && height > 0) { SDL_SetWindowSize(_window, width, height); - _graphics->resize(width, height); - resize(); } if (x > 0 && y > 0) { SDL_SetWindowPosition(_window, x, y);