chore: minor adjustments

This commit is contained in:
2025-12-18 14:57:15 +03:00
parent 7641846600
commit 292a748ac4
35 changed files with 79 additions and 78 deletions

View File

@@ -49,6 +49,7 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y cmake build-essential git \ sudo apt-get install -y cmake build-essential git \
libglfw3-dev libfreetype6-dev libfontconfig1-dev \ libglfw3-dev libfreetype6-dev libfontconfig1-dev \
zlib1g-dev libharfbuzz-dev \
libx11-dev libxrandr-dev libxi-dev libgtk-3-dev \ libx11-dev libxrandr-dev libxi-dev libgtk-3-dev \
mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev \ mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev \
libxinerama-dev libxcursor-dev libxkbcommon-dev libxinerama-dev libxcursor-dev libxkbcommon-dev
@@ -83,6 +84,7 @@ jobs:
run: | run: |
dnf install -y cmake gcc gcc-c++ make rpm-build git \ dnf install -y cmake gcc gcc-c++ make rpm-build git \
glfw-devel freetype-devel fontconfig-devel \ glfw-devel freetype-devel fontconfig-devel \
zlib-devel harfbuzz-devel \
libX11-devel libXrandr-devel libXi-devel \ libX11-devel libXrandr-devel libXi-devel \
mesa-libGL-devel mesa-libGLU-devel \ mesa-libGL-devel mesa-libGLU-devel \
libXinerama-devel libXcursor-devel \ libXinerama-devel libXcursor-devel \

View File

@@ -10,6 +10,8 @@ depends=(
glfw glfw
freetype2 freetype2
fontconfig fontconfig
zlib
harfbuzz
mesa mesa
libglvnd libglvnd
libxcursor libxcursor

View File

@@ -57,8 +57,8 @@ endif()
message(STATUS "clrsync version: ${SEMVER}") message(STATUS "clrsync version: ${SEMVER}")
configure_file( configure_file(
${CMAKE_SOURCE_DIR}/src/core/version.hpp.in ${CMAKE_SOURCE_DIR}/src/core/common/version.hpp.in
${CMAKE_SOURCE_DIR}/src/core/version.hpp ${CMAKE_SOURCE_DIR}/src/core/common/version.hpp
@ONLY @ONLY
) )

View File

@@ -7,17 +7,18 @@ if(WIN32)
freetype freetype
URL https://download.savannah.gnu.org/releases/freetype/freetype-2.14.1.tar.gz 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) FetchContent_MakeAvailable(freetype)
elseif(APPLE) elseif(APPLE)
option(USE_SYSTEM_GLFW ON) option(USE_SYSTEM_GLFW ON)
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
find_package(ZLIB 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) find_package(PkgConfig QUIET)
if(PkgConfig_FOUND) if(PkgConfig_FOUND)
@@ -28,11 +29,6 @@ else()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
find_package(Fontconfig REQUIRED) find_package(Fontconfig REQUIRED)
find_package(ZLIB 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(HARFBUZZ harfbuzz)
pkg_check_modules(WAYLAND_CLIENT wayland-client) pkg_check_modules(WAYLAND_CLIENT wayland-client)
@@ -77,11 +73,6 @@ else()
endif() endif()
set(FREETYPE_EXTRA_LIBS "") 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) if(HARFBUZZ_FOUND)
list(APPEND FREETYPE_EXTRA_LIBS ${HARFBUZZ_LIBRARIES}) list(APPEND FREETYPE_EXTRA_LIBS ${HARFBUZZ_LIBRARIES})
message(STATUS "Found HarfBuzz") message(STATUS "Found HarfBuzz")

View File

@@ -27,7 +27,7 @@ set(CPACK_NSIS_CREATE_DESKTOP_LINKS "bin/clrsync_gui.exe;clrsync")
# Debian # Debian
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Daniel Dada <dan@binarygoose.dev>") set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Daniel Dada <dan@binarygoose.dev>")
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_SECTION "utils")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") 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_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_GROUP "Applications/System") set(CPACK_RPM_PACKAGE_GROUP "Applications/System")
set(CPACK_RPM_PACKAGE_URL "https://github.com/obsqrbtz/clrsync") 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) include(CPack)

View File

@@ -15,7 +15,6 @@
wayland, wayland,
libxkbcommon, libxkbcommon,
zlib, zlib,
bzip2,
wayland-scanner, wayland-scanner,
gtk3, gtk3,
glib, glib,
@@ -71,7 +70,6 @@ stdenv.mkDerivation rec {
wayland-protocols wayland-protocols
libxkbcommon libxkbcommon
zlib zlib
bzip2
gtk3 gtk3
gsettings-desktop-schemas gsettings-desktop-schemas
glib glib

View File

@@ -4,15 +4,15 @@
#include <argparse/argparse.hpp> #include <argparse/argparse.hpp>
#include <core/config/config.hpp> #include "core/common/error.hpp"
#include <core/error.hpp> #include "core/common/utils.hpp"
#include <core/io/toml_file.hpp> #include "core/common/version.hpp"
#include <core/palette/palette_file.hpp> #include "core/config/config.hpp"
#include <core/palette/palette_manager.hpp> #include "core/io/toml_file.hpp"
#include <core/theme/theme_renderer.hpp> #include "core/palette/palette_file.hpp"
#include <core/theme/theme_template.hpp> #include "core/palette/palette_manager.hpp"
#include <core/utils.hpp> #include "core/theme/theme_renderer.hpp"
#include <core/version.hpp> #include "core/theme/theme_template.hpp"
void handle_show_vars() void handle_show_vars()
{ {

View File

@@ -2,8 +2,8 @@ set(CORE_SOURCES
palette/color.cpp palette/color.cpp
io/toml_file.cpp io/toml_file.cpp
config/config.cpp config/config.cpp
utils.cpp common/utils.cpp
version.cpp common/version.cpp
theme/theme_template.cpp theme/theme_template.cpp
) )

View File

@@ -4,7 +4,7 @@
#include <filesystem> #include <filesystem>
#include <string> #include <string>
#include <core/palette/color_keys.hpp> #include "core/palette/color_keys.hpp"
namespace clrsync::core namespace clrsync::core
{ {

View File

@@ -1,4 +1,4 @@
#include "version.hpp" #include "core/common/version.hpp"
namespace clrsync::core namespace clrsync::core
{ {

View File

@@ -6,7 +6,7 @@
namespace clrsync::core 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(); const std::string version_string();
} // namespace clrsync::core } // namespace clrsync::core

View File

@@ -1,8 +1,8 @@
#include "config.hpp" #include "config.hpp"
#include "core/error.hpp" #include "core/common/error.hpp"
#include "core/utils.hpp" #include "core/common/utils.hpp"
#include <core/palette/color.hpp> #include "core/palette/color.hpp"
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>

View File

@@ -1,9 +1,9 @@
#ifndef CLRSYNC_CORE_CONFIG_HPP #ifndef CLRSYNC_CORE_CONFIG_HPP
#define CLRSYNC_CORE_CONFIG_HPP #define CLRSYNC_CORE_CONFIG_HPP
#include <core/error.hpp> #include "core/common/error.hpp"
#include <core/io/file.hpp> #include "core/io/file.hpp"
#include <core/theme/theme_template.hpp> #include "core/theme/theme_template.hpp"
#include <filesystem> #include <filesystem>
#include <memory> #include <memory>
#include <string> #include <string>

View File

@@ -1,6 +1,6 @@
#ifndef CLRSYNC_CORE_IO_FILE_HPP #ifndef CLRSYNC_CORE_IO_FILE_HPP
#define CLRSYNC_CORE_IO_FILE_HPP #define CLRSYNC_CORE_IO_FILE_HPP
#include <core/error.hpp> #include "core/common/error.hpp"
#include <cstdint> #include <cstdint>
#include <map> #include <map>
#include <string> #include <string>

View File

@@ -1,5 +1,5 @@
#include "toml_file.hpp" #include "core/io/toml_file.hpp"
#include "core/utils.hpp" #include "core/common/utils.hpp"
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <vector> #include <vector>

View File

@@ -1,7 +1,7 @@
#ifndef CLRSYNC_CORE_IO_TOML_FILE_HPP #ifndef CLRSYNC_CORE_IO_TOML_FILE_HPP
#define CLRSYNC_CORE_IO_TOML_FILE_HPP #define CLRSYNC_CORE_IO_TOML_FILE_HPP
#include <core/error.hpp> #include "core/common/error.hpp"
#include <core/io/file.hpp> #include "core/io/file.hpp"
#include <string> #include <string>
#include <toml/toml.hpp> #include <toml/toml.hpp>

View File

@@ -4,8 +4,8 @@
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <core/palette/color.hpp> #include "core/palette/color.hpp"
#include <core/palette/color_keys.hpp> #include "core/palette/color_keys.hpp"
namespace clrsync::core namespace clrsync::core
{ {

View File

@@ -5,9 +5,9 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
#include <core/io/file.hpp> #include "core/io/file.hpp"
#include <core/palette/color_keys.hpp> #include "core/palette/color_keys.hpp"
#include <core/palette/palette.hpp> #include "core/palette/palette.hpp"
#include <memory> #include <memory>

View File

@@ -1,14 +1,13 @@
#ifndef CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP #ifndef CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP
#define CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP #define CLRSYNC_CORE_PALETTE_PALETTE_MANAGER_HPP
#include "core/utils.hpp" #include "core/common/utils.hpp"
#include <iostream>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <core/config/config.hpp> #include "core/config/config.hpp"
#include <core/palette/palette.hpp> #include "core/palette/palette.hpp"
#include <core/palette/palette_file.hpp> #include "core/palette/palette_file.hpp"
#include <filesystem> #include <filesystem>
namespace clrsync::core namespace clrsync::core

View File

@@ -1,8 +1,8 @@
#ifndef CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP #ifndef CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP
#define CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP #define CLRSYNC_CORE_THEME_TEMPLATE_MANAGER_HPP
#include <core/config/config.hpp> #include "core/config/config.hpp"
#include <core/theme/theme_template.hpp> #include "core/theme/theme_template.hpp"
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>

View File

@@ -1,9 +1,10 @@
#ifndef CLRSYNC_CORE_THEME_THEME_RENDERER_HPP #ifndef CLRSYNC_CORE_THEME_THEME_RENDERER_HPP
#define CLRSYNC_CORE_THEME_THEME_RENDERER_HPP #define CLRSYNC_CORE_THEME_THEME_RENDERER_HPP
#include <core/config/config.hpp> #include "core/common/error.hpp"
#include <core/error.hpp> #include "core/config/config.hpp"
#include <core/palette/palette_manager.hpp> #include "core/palette/palette_manager.hpp"
#include <core/theme/template_manager.hpp> #include "core/theme/template_manager.hpp"
#include <iostream>
#include <string> #include <string>
namespace clrsync::core namespace clrsync::core

View File

@@ -1,5 +1,5 @@
#include "theme_template.hpp" #include "theme_template.hpp"
#include "core/utils.hpp" #include "core/common/utils.hpp"
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>

View File

@@ -1,8 +1,8 @@
#ifndef clrsync_CORE_IO_THEME_TEMPLATE_HPP #ifndef clrsync_CORE_IO_THEME_TEMPLATE_HPP
#define clrsync_CORE_IO_THEME_TEMPLATE_HPP #define clrsync_CORE_IO_THEME_TEMPLATE_HPP
#include <core/error.hpp> #include "core/common/error.hpp"
#include <core/palette/palette.hpp> #include "core/palette/palette.hpp"
#include <string> #include <string>
namespace clrsync::core namespace clrsync::core

View File

@@ -1,12 +1,13 @@
#include <iostream>
#include <memory> #include <memory>
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h> #include <GLFW/glfw3native.h>
#include "core/common/error.hpp"
#include "core/common/utils.hpp"
#include "core/config/config.hpp" #include "core/config/config.hpp"
#include "core/error.hpp"
#include "core/io/toml_file.hpp" #include "core/io/toml_file.hpp"
#include "core/utils.hpp"
#include "gui/helpers/imgui_helpers.hpp" #include "gui/helpers/imgui_helpers.hpp"
#include "gui/platform/font_loader.hpp" #include "gui/platform/font_loader.hpp"

View File

@@ -1,12 +1,15 @@
#ifdef _WIN32 #ifdef _WIN32
#include "gui/platform/file_browser.hpp" // clang-format off
#include <filesystem> #define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commdlg.h> #include <commdlg.h>
#include <shlobj.h> #include <shlobj.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <windows.h> // clang-format on
#include "gui/platform/file_browser.hpp"
#include <filesystem>
namespace file_dialogs namespace file_dialogs
{ {
@@ -140,7 +143,11 @@ std::string select_folder_dialog(const std::string &title, const std::string &in
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
std::wstring wpath(pszFilePath); 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); CoTaskMemFree(pszFilePath);
pItem->Release(); pItem->Release();
pFileOpen->Release(); pFileOpen->Release();

View File

@@ -1,5 +1,5 @@
#include "about_window.hpp" #include "gui/views/about_window.hpp"
#include "core/version.hpp" #include "core/common/version.hpp"
#include "gui/helpers/imgui_helpers.hpp" #include "gui/helpers/imgui_helpers.hpp"
#include "imgui.h" #include "imgui.h"

View File

@@ -1,6 +1,6 @@
#include "gui/views/settings_window.hpp" #include "gui/views/settings_window.hpp"
#include "core/common/error.hpp"
#include "core/config/config.hpp" #include "core/config/config.hpp"
#include "core/error.hpp"
#include "gui/helpers/imgui_helpers.hpp" #include "gui/helpers/imgui_helpers.hpp"
#include "gui/platform/file_browser.hpp" #include "gui/platform/file_browser.hpp"
#include "gui/platform/font_loader.hpp" #include "gui/platform/font_loader.hpp"

View File

@@ -1,8 +1,8 @@
#include "template_editor.hpp" #include "template_editor.hpp"
#include "core/common/utils.hpp"
#include "core/config/config.hpp" #include "core/config/config.hpp"
#include "core/palette/color_keys.hpp" #include "core/palette/color_keys.hpp"
#include "core/theme/theme_template.hpp" #include "core/theme/theme_template.hpp"
#include "core/utils.hpp"
#include "gui/helpers/imgui_helpers.hpp" #include "gui/helpers/imgui_helpers.hpp"
#include "gui/platform/file_browser.hpp" #include "gui/platform/file_browser.hpp"
#include "imgui.h" #include "imgui.h"

View File

@@ -2,9 +2,9 @@
#define CLRSYNC_GUI_TEMPLATE_EDITOR_HPP #define CLRSYNC_GUI_TEMPLATE_EDITOR_HPP
#include "color_text_edit/TextEditor.h" #include "color_text_edit/TextEditor.h"
#include "core/palette/palette.hpp"
#include "gui/controllers/template_controller.hpp" #include "gui/controllers/template_controller.hpp"
#include "imgui.h" #include "imgui.h"
#include <core/palette/palette.hpp>
#include <string> #include <string>
#include <vector> #include <vector>