Update upstream source from tag 'upstream/0.1.5'
Update to upstream version '0.1.5'
with Debian dir 2b2db4aeb9
This commit is contained in:
commit
5f4833cd64
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.19)
|
||||
|
||||
set(HYPRCURSOR_VERSION "0.1.4")
|
||||
set(HYPRCURSOR_VERSION "0.1.5")
|
||||
add_compile_definitions(HYPRCURSOR_VERSION="${HYPRCURSOR_VERSION}")
|
||||
|
||||
project(hyprcursor
|
||||
|
|
@ -20,7 +20,7 @@ configure_file(hyprcursor.pc.in hyprcursor.pc @ONLY)
|
|||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprlang>=0.4.0 libzip cairo librsvg-2.0)
|
||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprlang>=0.4.2 libzip cairo librsvg-2.0)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
message(STATUS "Configuring hyprcursor in Debug")
|
||||
|
|
@ -48,7 +48,9 @@ target_link_libraries(hyprcursor PkgConfig::deps)
|
|||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# for std::expected.
|
||||
# probably evil. Arch's clang is very outdated tho...
|
||||
target_compile_options(hyprcursor PUBLIC -std=gnu++2b -D__cpp_concepts=202002L -Wno-macro-redefined)
|
||||
target_compile_options(hyprcursor PUBLIC
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++2b -D__cpp_concepts=202002L>
|
||||
-Wno-builtin-macro-redefined)
|
||||
endif()
|
||||
|
||||
# hyprcursor-util
|
||||
|
|
@ -70,8 +72,5 @@ add_test(NAME "Test libhyprcursor in C" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/te
|
|||
add_dependencies(tests hyprcursor_test_c)
|
||||
|
||||
# Installation
|
||||
install(DIRECTORY "include/hyprcursor" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} DIRECTORY_PERMISSIONS
|
||||
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
||||
GROUP_WRITE GROUP_READ GROUP_EXECUTE
|
||||
WORLD_WRITE WORLD_READ WORLD_EXECUTE)
|
||||
install(DIRECTORY "include/hyprcursor" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(FILES ${CMAKE_BINARY_DIR}/hyprcursor.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ static std::optional<std::string> extractXTheme(const std::string& xpath_, const
|
|||
std::cout << "Found xcursor " << xcursor.path().stem().string() << "\n";
|
||||
|
||||
// decompile xcursor
|
||||
const auto OUT = spawnSync(std::format("rm -f /tmp/hyprcursor-util/* && cd /tmp/hyprcursor-util && xcur2png {} -d /tmp/hyprcursor-util 2>&1",
|
||||
const auto OUT = spawnSync(std::format("rm -f /tmp/hyprcursor-util/* && cd /tmp/hyprcursor-util && xcur2png '{}' -d /tmp/hyprcursor-util 2>&1",
|
||||
std::filesystem::canonical(xcursor.path()).string()));
|
||||
|
||||
// read the config
|
||||
|
|
|
|||
|
|
@ -99,13 +99,31 @@ static std::string getFullPathForThemeName(const std::string& name) {
|
|||
if (!themeDir.is_directory())
|
||||
continue;
|
||||
|
||||
if (!name.empty() && themeDir.path().stem().string() != name)
|
||||
continue;
|
||||
|
||||
const auto MANIFESTPATH = themeDir.path().string() + "/manifest.hl";
|
||||
|
||||
if (std::filesystem::exists(MANIFESTPATH))
|
||||
return std::filesystem::canonical(themeDir.path()).string();
|
||||
if (name.empty()) {
|
||||
if (std::filesystem::exists(MANIFESTPATH))
|
||||
return std::filesystem::canonical(themeDir.path()).string();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(MANIFESTPATH))
|
||||
continue;
|
||||
|
||||
std::unique_ptr<Hyprlang::CConfig> manifest;
|
||||
try {
|
||||
manifest = std::make_unique<Hyprlang::CConfig>(MANIFESTPATH.c_str(), Hyprlang::SConfigOptions{});
|
||||
manifest->addConfigValue("name", Hyprlang::STRING{""});
|
||||
manifest->commence();
|
||||
manifest->parse();
|
||||
} catch (const char* e) { continue; }
|
||||
|
||||
const std::string NAME = std::any_cast<Hyprlang::STRING>(manifest->getConfigValue("name"));
|
||||
|
||||
if (NAME != name)
|
||||
continue;
|
||||
|
||||
return std::filesystem::canonical(themeDir.path()).string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,12 +491,15 @@ static Hyprlang::CParseResult parseDefineSize(const char* C, const char* V) {
|
|||
|
||||
image.filename = RHS;
|
||||
|
||||
try {
|
||||
image.size = std::stoull(LHS);
|
||||
} catch (std::exception& e) {
|
||||
result.setError(e.what());
|
||||
return result;
|
||||
}
|
||||
if (!image.filename.ends_with(".svg")) {
|
||||
try {
|
||||
image.size = std::stoull(LHS);
|
||||
} catch (std::exception& e) {
|
||||
result.setError(e.what());
|
||||
return result;
|
||||
}
|
||||
} else
|
||||
image.size = 0;
|
||||
|
||||
currentTheme->shapes.back()->images.push_back(image);
|
||||
|
||||
|
|
@ -508,7 +529,7 @@ static cairo_status_t readPNG(void* data, unsigned char* output, unsigned int le
|
|||
|
||||
size_t toRead = len > DATA->dataLen - DATA->readNeedle ? DATA->dataLen - DATA->readNeedle : len;
|
||||
|
||||
std::memcpy(output, DATA->data + DATA->readNeedle, toRead);
|
||||
std::memcpy(output, (uint8_t*)DATA->data + DATA->readNeedle, toRead);
|
||||
DATA->readNeedle += toRead;
|
||||
|
||||
if (DATA->readNeedle >= DATA->dataLen) {
|
||||
|
|
@ -615,7 +636,7 @@ std::optional<std::string> CHyprcursorImplementation::loadTheme() {
|
|||
// load image
|
||||
Debug::log(TRACE, "Loading {} for shape {}", i.filename, cursor.path().stem().string());
|
||||
auto* IMAGE = LOADEDSHAPE.images.emplace_back(std::make_unique<SLoadedCursorImage>()).get();
|
||||
IMAGE->side = i.size;
|
||||
IMAGE->side = SHAPE->shapeType == SHAPE_SVG ? 0 : i.size;
|
||||
IMAGE->delay = i.delay;
|
||||
IMAGE->isSVG = SHAPE->shapeType == SHAPE_SVG;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ int main(int argc, char** argv) {
|
|||
printf("mgr null\n");
|
||||
return 1;
|
||||
}
|
||||
if (!hyprcursor_manager_valid(mgr)) {
|
||||
printf("mgr is invalid\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct hyprcursor_cursor_style_info info = {.size = 48};
|
||||
if (!hyprcursor_load_theme_style(mgr, info)) {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,12 @@
|
|||
int main(int argc, char** argv) {
|
||||
Hyprcursor::CHyprcursorManager mgr(nullptr);
|
||||
|
||||
Hyprcursor::SCursorStyleInfo style{.size = 48};
|
||||
if (!mgr.valid()) {
|
||||
std::cout << "mgr is invalid\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Hyprcursor::SCursorStyleInfo style{.size = 48};
|
||||
// preload size 48 for testing
|
||||
if (!mgr.loadThemeStyle(style)) {
|
||||
std::cout << "failed loading style\n";
|
||||
|
|
|
|||
Loading…
Reference in New Issue