From 0654c3939a9b1931a93e74ddd782e335485b3103 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 31 May 2018 22:27:34 +0200 Subject: [PATCH 01/11] Force main display (0) for fullscreen mode It seems that it doesn't work fine to set the fullscreen mode on the second display (at least with NVidia) and Windows. --- src/event.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/event.cxx b/src/event.cxx index f464fa0..1bf7a1f 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1667,7 +1667,10 @@ CEvent::SetFullScreen (bool bFullScreen) g_bFullScreen = bFullScreen; - int displayIndex = SDL_GetWindowDisplayIndex (g_window); + int displayIndex = 0; +#ifndef _WIN32 + displayIndex = SDL_GetWindowDisplayIndex (g_window); +#endif /* _WIN32 */ if (g_bFullScreen) { From 2d80222257f5745fd86d61e1800cdc08e1b7d8b8 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 31 May 2018 22:28:51 +0200 Subject: [PATCH 02/11] Do not change the bordered style on Windows It's useless and it seems that the textures reload doesn't work everytime in this case. --- src/event.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/event.cxx b/src/event.cxx index 1bf7a1f..0ae3b94 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1691,7 +1691,9 @@ CEvent::SetFullScreen (bool bFullScreen) } SDL_SetWindowFullscreen (g_window, bFullScreen ? SDL_WINDOW_FULLSCREEN : 0); +#ifndef _WIN32 SDL_SetWindowBordered (g_window, bFullScreen ? SDL_FALSE : SDL_TRUE); +#endif /* _WIN32 */ SDL_SetWindowGrab (g_window, bFullScreen ? SDL_TRUE : SDL_FALSE); if (!g_bFullScreen) From 3aba743cd4d343178477d9ebc3f8e8f45d76c791 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 31 May 2018 22:46:03 +0200 Subject: [PATCH 03/11] Reload the textures when the renderer is asking for It seems that it fixes textures lose completly. --- src/blupi.cxx | 5 +++++ src/event.cxx | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/blupi.cxx b/src/blupi.cxx index 30ec8e9..8c294ad 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -385,6 +385,11 @@ HandleEvent (const SDL_Event & event) } break; + case SDL_RENDER_DEVICE_RESET: + case SDL_RENDER_TARGETS_RESET: + g_pPixmap->ReloadTargetTextures (); + break; + case SDL_USEREVENT: { switch (event.user.code) diff --git a/src/event.cxx b/src/event.cxx index 0ae3b94..28f7719 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1702,7 +1702,6 @@ CEvent::SetFullScreen (bool bFullScreen) SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); m_pPixmap->LoadCursors (g_zoom); - m_pPixmap->ReloadTargetTextures (); /* Force this update before otherwise the coordinates retrieved with * the Warp SDL function are corresponding to the previous size. @@ -1761,7 +1760,6 @@ CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); m_pPixmap->LoadCursors (newScale); - m_pPixmap->ReloadTargetTextures (); /* Force this update before otherwise the coordinates retrieved with * the Warp SDL function are corresponding to the previous size. From b116a98d4e7ea64179662c6094b1e225336ea491 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 31 May 2018 22:46:43 +0200 Subject: [PATCH 04/11] Revert "Do not change the bordered style on Windows" It's not a problem... This reverts commit 2d80222257f5745fd86d61e1800cdc08e1b7d8b8. --- src/event.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index 28f7719..5201f93 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1691,9 +1691,7 @@ CEvent::SetFullScreen (bool bFullScreen) } SDL_SetWindowFullscreen (g_window, bFullScreen ? SDL_WINDOW_FULLSCREEN : 0); -#ifndef _WIN32 SDL_SetWindowBordered (g_window, bFullScreen ? SDL_FALSE : SDL_TRUE); -#endif /* _WIN32 */ SDL_SetWindowGrab (g_window, bFullScreen ? SDL_TRUE : SDL_FALSE); if (!g_bFullScreen) From af14cc196ff95d18f5f61a8ca7c29fbb0cfc85b6 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 6 Jun 2018 18:04:14 +0200 Subject: [PATCH 05/11] Sign the AppImage only if SIGN_APP is true --- CMakeLists.txt | 2 +- cmake/LinuxAppImageBuild.cmake | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b148a61..6123cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,7 +309,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND "${STATIC_BUILD}") if (USE_APPIMAGE) include (LinuxAppImageBuild) set (CMAKE_PACKAGED_OUTPUT_PREFIX ${CMAKE_INSTALL_PREFIX}) - APPIMAGE_PACKAGE (planetblupi ${PB_PACKAGE_NAME} ${PB_PRODUCT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/resources/linux" "${CMAKE_BINARY_DIR}/share" "" "" ${PB_ICON_REF}) + APPIMAGE_PACKAGE (planetblupi ${PB_PACKAGE_NAME} ${PB_PRODUCT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/resources/linux" "${CMAKE_BINARY_DIR}/share" "" "" ${PB_ICON_REF} SIGN_APP) elseif (MINGW) set (INSTALLER_FILE_NAME "${PB_PACKAGE_NAME}-${PB_VERSION_MAJOR}.${PB_VERSION_MINOR}.${PB_VERSION_PATCH}${PB_VERSION_EXTRA}") set (CPACK_PACKAGE_FILE_NAME "${INSTALLER_FILE_NAME}") diff --git a/cmake/LinuxAppImageBuild.cmake b/cmake/LinuxAppImageBuild.cmake index c67c605..4ebc588 100644 --- a/cmake/LinuxAppImageBuild.cmake +++ b/cmake/LinuxAppImageBuild.cmake @@ -6,7 +6,7 @@ set (APPIMAGE_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/deploy/linux-appimage" CACH set (APPIMAGE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/package/linux-appimage" CACHE PATH "AppImage output directory") set (APPIMAGE_FOLLOW_STANDARD OFF CACHE BOOL "Whether generator should follow the spec") -macro (APPIMAGE_PACKAGE TARGET APPIMAGE_TITLE APPIMAGE_DISPLAYNAME CONFIGDIR DATA LIBRARIES LIBRARY_FILES ICON_REF) +macro (APPIMAGE_PACKAGE TARGET APPIMAGE_TITLE APPIMAGE_DISPLAYNAME CONFIGDIR DATA LIBRARIES LIBRARY_FILES ICON_REF SIGN_APP) string (TOLOWER "${APPIMAGE_TITLE}" APPIMAGE_INTERNALNAME) string (MAKE_C_IDENTIFIER "${APPIMAGE_INTERNALNAME}" APPIMAGE_INTERNALNAME) @@ -133,11 +133,17 @@ macro (APPIMAGE_PACKAGE TARGET APPIMAGE_TITLE APPIMAGE_DISPLAYNAME CONFIGDIR DAT COMMAND ${CMAKE_COMMAND} -E copy "$" "${APPIMAGE_BINARY_DIR}" ) + if (SIGN_APP) + set (APPIMGKITARGS "-s") + else () + set (APPIMGKITARGS "") + endif () + # Do the actual packaging step with AppImageKit add_custom_command ( TARGET ${TARGET} POST_BUILD - COMMAND "${APPIMAGE_ASSISTANT_PROGRAM}" -s "${APPIMAGE_INTERMEDIATE_DIR}" "${APPIMAGE_FINAL_NAME}" + COMMAND "${APPIMAGE_ASSISTANT_PROGRAM}" "${APPIMGKITARGS}" "${APPIMAGE_INTERMEDIATE_DIR}" "${APPIMAGE_FINAL_NAME}" ) install ( From 50c728c791895d822b0f474a37dbdd609ba21337 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 7 Jun 2018 21:56:13 +0200 Subject: [PATCH 06/11] Fix linking with winpthread Closes issue #24. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6123cc9..46848cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,7 @@ if (MINGW) # Remove cmd window when executing planetblupi set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive") endif (MINGW) # Dependencies From 27b8a5d031df4ed9e743133e37150fb4fd343539 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Thu, 7 Jun 2018 21:58:56 +0200 Subject: [PATCH 07/11] Do not deploy winpthread anymore --- CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46848cf..8aa5c62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,14 +283,6 @@ if (NOT USE_APPIMAGE) ) endif () -# Copy libwinpthread-1.dll which seems not be linkable statically -if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND MINGW) - execute_process (COMMAND cygpath.exe --windows $ENV{MINGW_PREFIX} OUTPUT_VARIABLE MINGW_PATH) - string (REGEX REPLACE "[ \t\n\r]+$" "" MINGW_PATH "${MINGW_PATH}") - string (REGEX REPLACE "[\\]" "\\\\\\\\" MINGW_PATH "${MINGW_PATH}") - install (FILES "${MINGW_PATH}\\\\bin\\\\libwinpthread-1.dll" DESTINATION bin) -endif () - ######### ## Deploy ######### From 9c4b94baf8c8ab90be32eff1ca85c03a576b0de5 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 8 Jun 2018 07:47:12 +0200 Subject: [PATCH 08/11] Upgrade cmake version --- resources/nsis/bootstrap.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/resources/nsis/bootstrap.sh b/resources/nsis/bootstrap.sh index ac61603..d9005a7 100755 --- a/resources/nsis/bootstrap.sh +++ b/resources/nsis/bootstrap.sh @@ -1,6 +1,8 @@ #!/bin/sh -mv /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in.orig -mv /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in.orig -cp $(dirname $0)/NSIS.template.in /C/msys64/mingw64/share/cmake-3.9/Modules/NSIS.template.in -cp $(dirname $0)/NSIS.template.in /C/msys64/mingw32/share/cmake-3.9/Modules/NSIS.template.in +CMAKE_VERSION=3.11 + +mv /C/msys64/mingw64/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in /C/msys64/mingw64/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in.orig +mv /C/msys64/mingw32/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in /C/msys64/mingw32/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in.orig +cp $(dirname $0)/NSIS.template.in /C/msys64/mingw64/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in +cp $(dirname $0)/NSIS.template.in /C/msys64/mingw32/share/cmake-$CMAKE_VERSION/Modules/NSIS.template.in From ce411bfd88b1915ef2f82a898e0a320d411adf95 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 8 Jun 2018 07:47:35 +0200 Subject: [PATCH 09/11] Revert "Do not deploy winpthread anymore" This reverts commit 27b8a5d031df4ed9e743133e37150fb4fd343539. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8aa5c62..46848cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -283,6 +283,14 @@ if (NOT USE_APPIMAGE) ) endif () +# Copy libwinpthread-1.dll which seems not be linkable statically +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" AND MINGW) + execute_process (COMMAND cygpath.exe --windows $ENV{MINGW_PREFIX} OUTPUT_VARIABLE MINGW_PATH) + string (REGEX REPLACE "[ \t\n\r]+$" "" MINGW_PATH "${MINGW_PATH}") + string (REGEX REPLACE "[\\]" "\\\\\\\\" MINGW_PATH "${MINGW_PATH}") + install (FILES "${MINGW_PATH}\\\\bin\\\\libwinpthread-1.dll" DESTINATION bin) +endif () + ######### ## Deploy ######### From 33464784edd2bf98994a6bb1c7744d42688bb491 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 8 Jun 2018 07:47:39 +0200 Subject: [PATCH 10/11] Revert "Fix linking with winpthread" This reverts commit 50c728c791895d822b0f474a37dbdd609ba21337. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46848cf..6123cc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,6 @@ if (MINGW) # Remove cmd window when executing planetblupi set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive") endif (MINGW) # Dependencies From 34869f1736acb578e04c2d2a96d5c326e7b1837f Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Mon, 11 Jun 2018 18:18:07 +0200 Subject: [PATCH 11/11] Fix black backgrounds with opengles2 --- src/pixmap.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pixmap.cxx b/src/pixmap.cxx index d23181c..58a766a 100644 --- a/src/pixmap.cxx +++ b/src/pixmap.cxx @@ -254,8 +254,9 @@ CPixmap::Cache ( return false; } - SDL_SetTextureBlendMode ( - m_SDLTextureInfo[channel].texture, SDL_BLENDMODE_BLEND); + if (channel != CHBACK) + SDL_SetTextureBlendMode ( + m_SDLTextureInfo[channel].texture, SDL_BLENDMODE_BLEND); } SDL_SetRenderTarget (g_renderer, m_SDLTextureInfo[channel].texture);