summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-07 12:42:59 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-07 12:42:59 +0200
commit159639b9f1d351a883127ff55ac93d814e430067 (patch)
tree725d15e7644ff1c4284fbe31216f8efcdacf4dbf
parent9fbb99e298aed79ae6a6f968594604699bb6c35d (diff)
Windows: Call the updater; added a missing resources
-rw-r--r--CMakeLists.txt7
-rw-r--r--Depends.cmake11
-rw-r--r--src/app.c5
-rw-r--r--src/main.c3
-rw-r--r--src/resources.c2
-rw-r--r--src/resources.h1
-rw-r--r--src/ui/root.c3
7 files changed, 32 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 41c1b392..b0d8f70c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,7 @@ option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative p
54option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW}) 54option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW})
55option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON) 55option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON)
56option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF) 56option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF)
57option (ENABLE_WINSPARKLE "Use WinSparkle for automatic updates" OFF)
57option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF) 58option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF)
58 59
59include (BuildType.cmake) 60include (BuildType.cmake)
@@ -149,6 +150,8 @@ set (SOURCES
149 src/stb_image.h 150 src/stb_image.h
150 src/stb_image_resize.h 151 src/stb_image_resize.h
151 src/stb_truetype.h 152 src/stb_truetype.h
153 src/updater.c
154 src/updater.h
152 src/visited.c 155 src/visited.c
153 src/visited.h 156 src/visited.h
154 # Audio playback: 157 # Audio playback:
@@ -403,6 +406,10 @@ if (APPLE)
403endif () 406endif ()
404if (MSYS) 407if (MSYS)
405 target_link_libraries (app PUBLIC d2d1 uuid dwmapi) # querying DPI 408 target_link_libraries (app PUBLIC d2d1 uuid dwmapi) # querying DPI
409 if (ENABLE_WINSPARKLE)
410 target_link_libraries (app PUBLIC winsparkle)
411 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_WINSPARKLE=1)
412 endif ()
406endif () 413endif ()
407if (UNIX) 414if (UNIX)
408 target_link_libraries (app PUBLIC m) 415 target_link_libraries (app PUBLIC m)
diff --git a/Depends.cmake b/Depends.cmake
index 3af9102d..3faeca75 100644
--- a/Depends.cmake
+++ b/Depends.cmake
@@ -146,6 +146,17 @@ else ()
146 endif () 146 endif ()
147endif () 147endif ()
148 148
149if (ENABLE_WINSPARKLE)
150 # We're assuming this is Windows.
151 add_library (winsparkle INTERFACE)
152 target_include_directories (winsparkle INTERFACE ${WINSPARKLE_DIR}/include)
153 target_link_libraries (winsparkle INTERFACE ${WINSPARKLE_DIR}/x64/Release/WinSparkle.dll)
154 install (
155 PROGRAMS ${WINSPARKLE_DIR}/x64/Release/WinSparkle.dll
156 DESTINATION .
157 )
158endif ()
159
149find_package (PkgConfig REQUIRED) 160find_package (PkgConfig REQUIRED)
150pkg_check_modules (SDL2 REQUIRED sdl2) 161pkg_check_modules (SDL2 REQUIRED sdl2)
151pkg_check_modules (MPG123 IMPORTED_TARGET libmpg123) 162pkg_check_modules (MPG123 IMPORTED_TARGET libmpg123)
diff --git a/src/app.c b/src/app.c
index 9e636651..78754d5d 100644
--- a/src/app.c
+++ b/src/app.c
@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
33#include "ipc.h" 33#include "ipc.h"
34#include "periodic.h" 34#include "periodic.h"
35#include "sitespec.h" 35#include "sitespec.h"
36#include "updater.h"
36#include "ui/certimportwidget.h" 37#include "ui/certimportwidget.h"
37#include "ui/color.h" 38#include "ui/color.h"
38#include "ui/command.h" 39#include "ui/command.h"
@@ -3121,6 +3122,10 @@ iBool handleCommand_App(const char *cmd) {
3121 } 3122 }
3122 return iFalse; 3123 return iFalse;
3123 } 3124 }
3125 else if (equal_Command(cmd, "updater.check")) {
3126 checkNow_Updater();
3127 return iTrue;
3128 }
3124 else if (equal_Command(cmd, "fontpack.enable")) { 3129 else if (equal_Command(cmd, "fontpack.enable")) {
3125 const iString *packId = collect_String(suffix_Command(cmd, "id")); 3130 const iString *packId = collect_String(suffix_Command(cmd, "id"));
3126 enablePack_Fonts(packId, arg_Command(cmd)); 3131 enablePack_Fonts(packId, arg_Command(cmd));
diff --git a/src/main.c b/src/main.c
index f7ac6522..6e5e99e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,6 +21,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 21SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "app.h" 23#include "app.h"
24#include "updater.h"
24 25
25#if defined (iPlatformAppleDesktop) 26#if defined (iPlatformAppleDesktop)
26# include "macos.h" 27# include "macos.h"
@@ -82,11 +83,13 @@ int main(int argc, char **argv) {
82 if (SDL_Init(SDL_INIT_AUDIO)) { 83 if (SDL_Init(SDL_INIT_AUDIO)) {
83 fprintf(stderr, "[SDL] audio init failed: %s\n", SDL_GetError()); 84 fprintf(stderr, "[SDL] audio init failed: %s\n", SDL_GetError());
84 } 85 }
86 init_Updater();
85 run_App(argc, argv); 87 run_App(argc, argv);
86 SDL_Quit(); 88 SDL_Quit();
87#if defined (LAGRANGE_ENABLE_MPG123) 89#if defined (LAGRANGE_ENABLE_MPG123)
88 mpg123_exit(); 90 mpg123_exit();
89#endif 91#endif
92 deinit_Updater();
90 deinit_Foundation(); 93 deinit_Foundation();
91 return 0; 94 return 0;
92} 95}
diff --git a/src/resources.c b/src/resources.c
index 4cf9b85c..4138c035 100644
--- a/src/resources.c
+++ b/src/resources.c
@@ -54,6 +54,7 @@ iBlock blobUk_Resources;
54iBlock blobZh_Hans_Resources; 54iBlock blobZh_Hans_Resources;
55iBlock blobZh_Hant_Resources; 55iBlock blobZh_Hant_Resources;
56iBlock imageShadow_Resources; 56iBlock imageShadow_Resources;
57iBlock imageLagrange64_Resources;
57 58
58static struct { 59static struct {
59 iBlock *data; 60 iBlock *data;
@@ -86,6 +87,7 @@ static struct {
86 { &blobZh_Hans_Resources, "lang/zh_Hans.bin" }, 87 { &blobZh_Hans_Resources, "lang/zh_Hans.bin" },
87 { &blobZh_Hant_Resources, "lang/zh_Hant.bin" }, 88 { &blobZh_Hant_Resources, "lang/zh_Hant.bin" },
88 { &imageShadow_Resources, "shadow.png" }, 89 { &imageShadow_Resources, "shadow.png" },
90 { &imageLagrange64_Resources, "lagrange-64.png" },
89}; 91};
90 92
91iBool init_Resources(const char *path) { 93iBool init_Resources(const char *path) {
diff --git a/src/resources.h b/src/resources.h
index c3ee1b53..6133a1eb 100644
--- a/src/resources.h
+++ b/src/resources.h
@@ -59,3 +59,4 @@ extern iBlock blobZh_Hans_Resources;
59extern iBlock blobZh_Hant_Resources; 59extern iBlock blobZh_Hant_Resources;
60extern iBlock imageShadow_Resources; 60extern iBlock imageShadow_Resources;
61extern iBlock fontpackDefault_Resources; 61extern iBlock fontpackDefault_Resources;
62extern iBlock imageLagrange64_Resources;
diff --git a/src/ui/root.c b/src/ui/root.c
index f66e0f29..114ab040 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -78,6 +78,9 @@ static const iMenuItem navMenuItems_[] = {
78 { gear_Icon " ${menu.preferences}", SDLK_COMMA, KMOD_PRIMARY, "preferences" }, 78 { gear_Icon " ${menu.preferences}", SDLK_COMMA, KMOD_PRIMARY, "preferences" },
79 { "${menu.help}", SDLK_F1, 0, "!open url:about:help" }, 79 { "${menu.help}", SDLK_F1, 0, "!open url:about:help" },
80 { "${menu.releasenotes}", 0, 0, "!open url:about:version" }, 80 { "${menu.releasenotes}", 0, 0, "!open url:about:version" },
81 #if defined (LAGRANGE_ENABLE_WINSPARKLE)
82 { "${menu.update}", 0, 0, "updater.check" },
83 #endif
81 { "---" }, 84 { "---" },
82 { "${menu.quit}", 'q', KMOD_PRIMARY, "quit" } 85 { "${menu.quit}", 'q', KMOD_PRIMARY, "quit" }
83}; 86};