diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index ea2233c..1a4d610 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -49,6 +49,7 @@ jobs: sudo apt-get update sudo apt-get install -y cmake build-essential git \ libglfw3-dev libfreetype6-dev libfontconfig1-dev \ + zlib1g-dev libharfbuzz-dev \ libx11-dev libxrandr-dev libxi-dev libgtk-3-dev \ mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev \ libxinerama-dev libxcursor-dev libxkbcommon-dev @@ -83,6 +84,7 @@ jobs: run: | dnf install -y cmake gcc gcc-c++ make rpm-build git \ glfw-devel freetype-devel fontconfig-devel \ + zlib-devel harfbuzz-devel \ libX11-devel libXrandr-devel libXi-devel \ mesa-libGL-devel mesa-libGLU-devel \ libXinerama-devel libXcursor-devel \ diff --git a/AUR/PKGBUILD-git b/AUR/PKGBUILD-git index 3e78ae8..4390971 100644 --- a/AUR/PKGBUILD-git +++ b/AUR/PKGBUILD-git @@ -10,6 +10,8 @@ depends=( glfw freetype2 fontconfig + zlib + harfbuzz mesa libglvnd libxcursor diff --git a/CMakeLists.txt b/CMakeLists.txt index 41406f4..340523d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,8 +57,8 @@ endif() message(STATUS "clrsync version: ${SEMVER}") configure_file( - ${CMAKE_SOURCE_DIR}/src/core/version.hpp.in - ${CMAKE_SOURCE_DIR}/src/core/version.hpp + ${CMAKE_SOURCE_DIR}/src/core/common/version.hpp.in + ${CMAKE_SOURCE_DIR}/src/core/common/version.hpp @ONLY ) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 100dccd..9b61288 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -7,17 +7,18 @@ if(WIN32) freetype URL https://download.savannah.gnu.org/releases/freetype/freetype-2.14.1.tar.gz ) + + set(FT_DISABLE_ZLIB FALSE CACHE BOOL "" FORCE) + set(FT_DISABLE_BZIP2 TRUE CACHE BOOL "" FORCE) + set(FT_DISABLE_PNG TRUE CACHE BOOL "" FORCE) + set(FT_DISABLE_HARFBUZZ FALSE CACHE BOOL "" FORCE) + set(FT_DISABLE_BROTLI TRUE CACHE BOOL "" FORCE) + FetchContent_MakeAvailable(freetype) elseif(APPLE) option(USE_SYSTEM_GLFW ON) find_package(Freetype REQUIRED) find_package(ZLIB REQUIRED) - find_package(BZip2 REQUIRED) - find_package(PNG REQUIRED) - - - find_library(BROTLIDEC_LIBRARY NAMES brotlidec) - find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon) find_package(PkgConfig QUIET) if(PkgConfig_FOUND) @@ -28,11 +29,6 @@ else() find_package(PkgConfig REQUIRED) find_package(Fontconfig REQUIRED) find_package(ZLIB REQUIRED) - find_package(BZip2 REQUIRED) - find_package(PNG REQUIRED) - - find_library(BROTLIDEC_LIBRARY NAMES brotlidec) - find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon) pkg_check_modules(HARFBUZZ harfbuzz) pkg_check_modules(WAYLAND_CLIENT wayland-client) @@ -77,11 +73,6 @@ else() endif() set(FREETYPE_EXTRA_LIBS "") -if(BROTLIDEC_LIBRARY AND BROTLICOMMON_LIBRARY) - list(APPEND FREETYPE_EXTRA_LIBS ${BROTLIDEC_LIBRARY} ${BROTLICOMMON_LIBRARY}) - message(STATUS "Found Brotli libraries") -endif() - if(HARFBUZZ_FOUND) list(APPEND FREETYPE_EXTRA_LIBS ${HARFBUZZ_LIBRARIES}) message(STATUS "Found HarfBuzz") diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake index 3aba090..81d1022 100644 --- a/cmake/Packaging.cmake +++ b/cmake/Packaging.cmake @@ -27,7 +27,7 @@ set(CPACK_NSIS_CREATE_DESKTOP_LINKS "bin/clrsync_gui.exe;clrsync") # Debian set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Daniel Dada ") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.31), libglfw3, libfreetype6") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.31), libglfw3, libfreetype6, zlib1g, libharfbuzz0b") set(CPACK_DEBIAN_PACKAGE_SECTION "utils") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") @@ -36,6 +36,6 @@ set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") set(CPACK_RPM_PACKAGE_LICENSE "MIT") set(CPACK_RPM_PACKAGE_GROUP "Applications/System") set(CPACK_RPM_PACKAGE_URL "https://github.com/obsqrbtz/clrsync") -set(CPACK_RPM_PACKAGE_REQUIRES "freetype, glfw, fontconfig") +set(CPACK_RPM_PACKAGE_REQUIRES "freetype, glfw, fontconfig, zlib, harfbuzz") include(CPack) diff --git a/extra/palletes/cursed-light.toml b/extra/palettes/cursed-light.toml similarity index 100% rename from extra/palletes/cursed-light.toml rename to extra/palettes/cursed-light.toml diff --git a/extra/palletes/cursed.toml b/extra/palettes/cursed.toml similarity index 100% rename from extra/palletes/cursed.toml rename to extra/palettes/cursed.toml diff --git a/extra/palletes/nord.toml b/extra/palettes/nord.toml similarity index 100% rename from extra/palletes/nord.toml rename to extra/palettes/nord.toml diff --git a/package.nix b/package.nix index 869e3de..c389c0d 100644 --- a/package.nix +++ b/package.nix @@ -15,7 +15,6 @@ wayland, libxkbcommon, zlib, - bzip2, wayland-scanner, gtk3, glib, @@ -71,7 +70,6 @@ stdenv.mkDerivation rec { wayland-protocols libxkbcommon zlib - bzip2 gtk3 gsettings-desktop-schemas glib diff --git a/src/cli/main.cpp b/src/cli/main.cpp index 87d28cd..75dd566 100644 --- a/src/cli/main.cpp +++ b/src/cli/main.cpp @@ -4,15 +4,15 @@ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "core/common/error.hpp" +#include "core/common/utils.hpp" +#include "core/common/version.hpp" +#include "core/config/config.hpp" +#include "core/io/toml_file.hpp" +#include "core/palette/palette_file.hpp" +#include "core/palette/palette_manager.hpp" +#include "core/theme/theme_renderer.hpp" +#include "core/theme/theme_template.hpp" void handle_show_vars() { diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 657c284..5a50688 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -2,8 +2,8 @@ set(CORE_SOURCES palette/color.cpp io/toml_file.cpp config/config.cpp - utils.cpp - version.cpp + common/utils.cpp + common/version.cpp theme/theme_template.cpp ) diff --git a/src/core/error.hpp b/src/core/common/error.hpp similarity index 100% rename from src/core/error.hpp rename to src/core/common/error.hpp diff --git a/src/core/utils.cpp b/src/core/common/utils.cpp similarity index 100% rename from src/core/utils.cpp rename to src/core/common/utils.cpp diff --git a/src/core/utils.hpp b/src/core/common/utils.hpp similarity index 90% rename from src/core/utils.hpp rename to src/core/common/utils.hpp index 8862fec..73496e9 100644 --- a/src/core/utils.hpp +++ b/src/core/common/utils.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include "core/palette/color_keys.hpp" namespace clrsync::core { diff --git a/src/core/version.cpp b/src/core/common/version.cpp similarity index 77% rename from src/core/version.cpp rename to src/core/common/version.cpp index db88d4b..5fcb19c 100644 --- a/src/core/version.cpp +++ b/src/core/common/version.cpp @@ -1,4 +1,4 @@ -#include "version.hpp" +#include "core/common/version.hpp" namespace clrsync::core { diff --git a/src/core/version.hpp b/src/core/common/version.hpp similarity index 80% rename from src/core/version.hpp rename to src/core/common/version.hpp index 999bb54..ce904aa 100644 --- a/src/core/version.hpp +++ b/src/core/common/version.hpp @@ -6,7 +6,7 @@ namespace clrsync::core { -const std::string GIT_SEMVER = "0.1.6+git.g613c2c8"; +const std::string GIT_SEMVER = "0.1.6+git.g7641846"; const std::string version_string(); } // namespace clrsync::core diff --git a/src/core/version.hpp.in b/src/core/common/version.hpp.in similarity index 100% rename from src/core/version.hpp.in rename to src/core/common/version.hpp.in diff --git a/src/core/config/config.cpp b/src/core/config/config.cpp index fce655c..0c1bf60 100644 --- a/src/core/config/config.cpp +++ b/src/core/config/config.cpp @@ -1,8 +1,8 @@ #include "config.hpp" -#include "core/error.hpp" -#include "core/utils.hpp" +#include "core/common/error.hpp" +#include "core/common/utils.hpp" -#include +#include "core/palette/color.hpp" #include #include diff --git a/src/core/config/config.hpp b/src/core/config/config.hpp index 299d722..101d713 100644 --- a/src/core/config/config.hpp +++ b/src/core/config/config.hpp @@ -1,9 +1,9 @@ #ifndef CLRSYNC_CORE_CONFIG_HPP #define CLRSYNC_CORE_CONFIG_HPP -#include -#include -#include +#include "core/common/error.hpp" +#include "core/io/file.hpp" +#include "core/theme/theme_template.hpp" #include #include #include diff --git a/src/core/io/file.hpp b/src/core/io/file.hpp index 7621635..5dc811e 100644 --- a/src/core/io/file.hpp +++ b/src/core/io/file.hpp @@ -1,6 +1,6 @@ #ifndef CLRSYNC_CORE_IO_FILE_HPP #define CLRSYNC_CORE_IO_FILE_HPP -#include +#include "core/common/error.hpp" #include #include #include diff --git a/src/core/io/toml_file.cpp b/src/core/io/toml_file.cpp index 9b31e5e..1af6883 100644 --- a/src/core/io/toml_file.cpp +++ b/src/core/io/toml_file.cpp @@ -1,5 +1,5 @@ -#include "toml_file.hpp" -#include "core/utils.hpp" +#include "core/io/toml_file.hpp" +#include "core/common/utils.hpp" #include #include #include diff --git a/src/core/io/toml_file.hpp b/src/core/io/toml_file.hpp index 7ba2187..7559492 100644 --- a/src/core/io/toml_file.hpp +++ b/src/core/io/toml_file.hpp @@ -1,7 +1,7 @@ #ifndef CLRSYNC_CORE_IO_TOML_FILE_HPP #define CLRSYNC_CORE_IO_TOML_FILE_HPP -#include -#include +#include "core/common/error.hpp" +#include "core/io/file.hpp" #include #include diff --git a/src/core/palette/palette.hpp b/src/core/palette/palette.hpp index 16147aa..6900d3e 100644 --- a/src/core/palette/palette.hpp +++ b/src/core/palette/palette.hpp @@ -4,8 +4,8 @@ #include #include -#include -#include +#include "core/palette/color.hpp" +#include "core/palette/color_keys.hpp" namespace clrsync::core { diff --git a/src/core/palette/palette_file.hpp b/src/core/palette/palette_file.hpp index 4fcb3d9..bf2734c 100644 --- a/src/core/palette/palette_file.hpp +++ b/src/core/palette/palette_file.hpp @@ -5,9 +5,9 @@ #include #include -#include -#include -#include +#include "core/io/file.hpp" +#include "core/palette/color_keys.hpp" +#include "core/palette/palette.hpp" #include diff --git a/src/core/palette/palette_manager.hpp b/src/core/palette/palette_manager.hpp index 666e71c..5a64c7a 100644 --- a/src/core/palette/palette_manager.hpp +++ b/src/core/palette/palette_manager.hpp @@ -1,14 +1,13 @@ #ifndef CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP #define CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP -#include "core/utils.hpp" -#include +#include "core/common/utils.hpp" #include #include -#include -#include -#include +#include "core/config/config.hpp" +#include "core/palette/palette.hpp" +#include "core/palette/palette_file.hpp" #include namespace clrsync::core diff --git a/src/core/theme/template_manager.hpp b/src/core/theme/template_manager.hpp index 6a5f430..e8bc230 100644 --- a/src/core/theme/template_manager.hpp +++ b/src/core/theme/template_manager.hpp @@ -1,8 +1,8 @@ #ifndef CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP #define CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP -#include -#include +#include "core/config/config.hpp" +#include "core/theme/theme_template.hpp" #include #include diff --git a/src/core/theme/theme_renderer.hpp b/src/core/theme/theme_renderer.hpp index 1e18d22..1f2de4b 100644 --- a/src/core/theme/theme_renderer.hpp +++ b/src/core/theme/theme_renderer.hpp @@ -1,9 +1,10 @@ #ifndef CLRSYNC_CORE_THEME_THEME_RENDERER_HPP #define CLRSYNC_CORE_THEME_THEME_RENDERER_HPP -#include -#include -#include -#include +#include "core/common/error.hpp" +#include "core/config/config.hpp" +#include "core/palette/palette_manager.hpp" +#include "core/theme/template_manager.hpp" +#include #include namespace clrsync::core diff --git a/src/core/theme/theme_template.cpp b/src/core/theme/theme_template.cpp index 018a570..9745520 100644 --- a/src/core/theme/theme_template.cpp +++ b/src/core/theme/theme_template.cpp @@ -1,5 +1,5 @@ #include "theme_template.hpp" -#include "core/utils.hpp" +#include "core/common/utils.hpp" #include #include #include diff --git a/src/core/theme/theme_template.hpp b/src/core/theme/theme_template.hpp index b40b72f..21b50a6 100644 --- a/src/core/theme/theme_template.hpp +++ b/src/core/theme/theme_template.hpp @@ -1,8 +1,8 @@ #ifndef clrsync_CORE_IO_THEME_TEMPLATE_HPP #define clrsync_CORE_IO_THEME_TEMPLATE_HPP -#include -#include +#include "core/common/error.hpp" +#include "core/palette/palette.hpp" #include namespace clrsync::core diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 2d08745..4209cda 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -1,12 +1,13 @@ +#include #include #include #include +#include "core/common/error.hpp" +#include "core/common/utils.hpp" #include "core/config/config.hpp" -#include "core/error.hpp" #include "core/io/toml_file.hpp" -#include "core/utils.hpp" #include "gui/helpers/imgui_helpers.hpp" #include "gui/platform/font_loader.hpp" diff --git a/src/gui/platform/windows/file_browser_windows.cpp b/src/gui/platform/windows/file_browser_windows.cpp index 1ab75da..b136554 100644 --- a/src/gui/platform/windows/file_browser_windows.cpp +++ b/src/gui/platform/windows/file_browser_windows.cpp @@ -1,12 +1,15 @@ #ifdef _WIN32 -#include "gui/platform/file_browser.hpp" -#include - +// clang-format off +#define WIN32_LEAN_AND_MEAN +#include #include #include #include -#include +// clang-format on + +#include "gui/platform/file_browser.hpp" +#include namespace file_dialogs { @@ -140,7 +143,11 @@ std::string select_folder_dialog(const std::string &title, const std::string &in if (SUCCEEDED(hr)) { std::wstring wpath(pszFilePath); - std::string result(wpath.begin(), wpath.end()); + int size = WideCharToMultiByte(CP_UTF8, 0, wpath.c_str(), -1, nullptr, 0, + nullptr, nullptr); + std::string result(size - 1, 0); + WideCharToMultiByte(CP_UTF8, 0, wpath.c_str(), -1, &result[0], size, nullptr, + nullptr); CoTaskMemFree(pszFilePath); pItem->Release(); pFileOpen->Release(); diff --git a/src/gui/views/about_window.cpp b/src/gui/views/about_window.cpp index 1d9aaf8..d270230 100644 --- a/src/gui/views/about_window.cpp +++ b/src/gui/views/about_window.cpp @@ -1,5 +1,5 @@ -#include "about_window.hpp" -#include "core/version.hpp" +#include "gui/views/about_window.hpp" +#include "core/common/version.hpp" #include "gui/helpers/imgui_helpers.hpp" #include "imgui.h" diff --git a/src/gui/views/settings_window.cpp b/src/gui/views/settings_window.cpp index 7063248..2d03aad 100644 --- a/src/gui/views/settings_window.cpp +++ b/src/gui/views/settings_window.cpp @@ -1,6 +1,6 @@ #include "gui/views/settings_window.hpp" +#include "core/common/error.hpp" #include "core/config/config.hpp" -#include "core/error.hpp" #include "gui/helpers/imgui_helpers.hpp" #include "gui/platform/file_browser.hpp" #include "gui/platform/font_loader.hpp" diff --git a/src/gui/views/template_editor.cpp b/src/gui/views/template_editor.cpp index 01b0b98..4c1b000 100644 --- a/src/gui/views/template_editor.cpp +++ b/src/gui/views/template_editor.cpp @@ -1,8 +1,8 @@ #include "template_editor.hpp" +#include "core/common/utils.hpp" #include "core/config/config.hpp" #include "core/palette/color_keys.hpp" #include "core/theme/theme_template.hpp" -#include "core/utils.hpp" #include "gui/helpers/imgui_helpers.hpp" #include "gui/platform/file_browser.hpp" #include "imgui.h" diff --git a/src/gui/views/template_editor.hpp b/src/gui/views/template_editor.hpp index b8dd682..7a9dcf3 100644 --- a/src/gui/views/template_editor.hpp +++ b/src/gui/views/template_editor.hpp @@ -2,9 +2,9 @@ #define CLRSYNC_GUI_TEMPLATE_EDITOR_HPP #include "color_text_edit/TextEditor.h" +#include "core/palette/palette.hpp" #include "gui/controllers/template_controller.hpp" #include "imgui.h" -#include #include #include