Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package fuzzel for openSUSE:Factory checked in at 2022-11-13 18:09:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fuzzel (Old) and /work/SRC/openSUSE:Factory/.fuzzel.new.1597 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fuzzel" Sun Nov 13 18:09:07 2022 rev:5 rq:1035472 version:1.8.2 Changes: -------- --- /work/SRC/openSUSE:Factory/fuzzel/fuzzel.changes 2022-10-28 19:32:27.699513333 +0200 +++ /work/SRC/openSUSE:Factory/.fuzzel.new.1597/fuzzel.changes 2022-11-13 18:09:22.071580578 +0100 @@ -1,0 +2,10 @@ +Sat Nov 5 23:22:10 UTC 2022 - Soc Virnyl Estela <socvirnyl.est...@gmail.com> + +- Update to version 1.8.2: + - Added: + * Fish completions + - Fixed: + * Unsupported icon formats not being skipped when loading application icons. + * Wrong size of PNG icons selected (#182) + +------------------------------------------------------------------- Old: ---- 1.8.1.tar.gz New: ---- 1.8.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fuzzel.spec ++++++ --- /var/tmp/diff_new_pack.fp4UJp/_old 2022-11-13 18:09:22.439582717 +0100 +++ /var/tmp/diff_new_pack.fp4UJp/_new 2022-11-13 18:09:22.443582739 +0100 @@ -17,7 +17,7 @@ Name: fuzzel -Version: 1.8.1 +Version: 1.8.2 Release: 0 Summary: A Wayland-native application launcher, similar to rofi's drun mode License: MIT @@ -54,6 +54,16 @@ %description zsh-completion Zsh command-line completion support for %{name} +%package fish-completion +Summary: Fish Completion for %{name} +Group: System/Shells +Supplements: (%{name} and fish) +Requires: fish +BuildArch: noarch + +%description fish-completion +Fish command-line completion support for %{name}. + %build export CFLAGS="%{optflags}" %if 0%{?sle_version} == 150400 && 0%{?is_opensuse} @@ -88,4 +98,9 @@ %dir %{_datadir}/zsh/site-functions %{_datadir}/zsh/site-functions/_%{name} +%files fish-completion +%dir %{_datadir}/fish +%dir %{_datadir}/fish/vendor_completions.d +%{_datadir}/fish/vendor_completions.d/fuzzel.fish + %changelog ++++++ 1.8.1.tar.gz -> 1.8.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/3rd-party/nanosvg/CMakeLists.txt new/fuzzel/3rd-party/nanosvg/CMakeLists.txt --- old/fuzzel/3rd-party/nanosvg/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/fuzzel/3rd-party/nanosvg/CMakeLists.txt 2022-11-04 13:37:30.000000000 +0100 @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.10) + +project(NanoSVG C) + +# CMake needs *.c files to do something useful +configure_file(src/nanosvg.h ${CMAKE_CURRENT_BINARY_DIR}/nanosvg.c) +configure_file(src/nanosvgrast.h ${CMAKE_CURRENT_BINARY_DIR}/nanosvgrast.c) + +add_library(nanosvg ${CMAKE_CURRENT_BINARY_DIR}/nanosvg.c) + +find_library(MATH_LIBRARY m) # Business as usual +if(MATH_LIBRARY) + target_link_libraries(nanosvg PUBLIC ${MATH_LIBRARY}) +endif() + +target_include_directories(nanosvg PUBLIC $<INSTALL_INTERFACE:include/nanosvg>) +target_compile_definitions(nanosvg PRIVATE NANOSVG_IMPLEMENTATION) + +# Same for nanosvgrast +add_library(nanosvgrast ${CMAKE_CURRENT_BINARY_DIR}/nanosvgrast.c) +target_link_libraries(nanosvgrast PUBLIC nanosvg) +target_include_directories(nanosvgrast PRIVATE src) +target_compile_definitions(nanosvgrast PRIVATE NANOSVGRAST_IMPLEMENTATION) + +# Installation and export: + +include(CMakePackageConfigHelpers) + +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + VERSION 1.0 + COMPATIBILITY AnyNewerVersion +) + +install(TARGETS nanosvg nanosvgrast + EXPORT ${PROJECT_NAME}Targets +) + +export(EXPORT ${PROJECT_NAME}Targets + FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" + NAMESPACE ${PROJECT_NAME}:: +) + +set(ConfigPackageLocation lib/cmake/${PROJECT_NAME}) + +configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + INSTALL_DESTINATION ${ConfigPackageLocation} + NO_CHECK_REQUIRED_COMPONENTS_MACRO +) + +install( + FILES + src/nanosvg.h + src/nanosvgrast.h + DESTINATION + include/nanosvg + ) + +install(EXPORT ${PROJECT_NAME}Targets + FILE + ${PROJECT_NAME}Targets.cmake + NAMESPACE + ${PROJECT_NAME}:: + DESTINATION + ${ConfigPackageLocation} +) + +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" + DESTINATION + ${ConfigPackageLocation} +) \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/3rd-party/nanosvg/Config.cmake.in new/fuzzel/3rd-party/nanosvg/Config.cmake.in --- old/fuzzel/3rd-party/nanosvg/Config.cmake.in 1970-01-01 01:00:00.000000000 +0100 +++ new/fuzzel/3rd-party/nanosvg/Config.cmake.in 2022-11-04 13:37:30.000000000 +0100 @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/NanoSVGTargets.cmake) + include("${CMAKE_CURRENT_LIST_DIR}/NanoSVGTargets.cmake") +endif () \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/3rd-party/nanosvg/README.md new/fuzzel/3rd-party/nanosvg/README.md --- old/fuzzel/3rd-party/nanosvg/README.md 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/3rd-party/nanosvg/README.md 2022-11-04 13:37:30.000000000 +0100 @@ -78,6 +78,16 @@ #include "nanosvg.h" ``` +Alternatively, you can install the library using CMake and import it into your project using the standard CMake `find_package` command. + +```CMake +add_executable(myexe main.c) + +find_package(NanoSVG REQUIRED) + +target_link_libraries(myexe NanoSVG::nanosvg NanoSVG::nanosvgrast) +``` + ## Compiling Example Project In order to compile the demo project, your will need to install [GLFW](http://www.glfw.org/) to compile. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/3rd-party/nanosvg/src/nanosvg.h new/fuzzel/3rd-party/nanosvg/src/nanosvg.h --- old/fuzzel/3rd-party/nanosvg/src/nanosvg.h 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/3rd-party/nanosvg/src/nanosvg.h 2022-11-04 13:37:30.000000000 +0100 @@ -181,12 +181,11 @@ #endif #endif -#endif // NANOSVG_H - #ifdef NANOSVG_IMPLEMENTATION #include <string.h> #include <stdlib.h> +#include <stdio.h> #include <math.h> #define NSVG_PI (3.14159265358979323846264338327f) @@ -611,7 +610,7 @@ } } -static NSVGparser* nsvg__createParser() +static NSVGparser* nsvg__createParser(void) { NSVGparser* p; p = (NSVGparser*)malloc(sizeof(NSVGparser)); @@ -1223,15 +1222,58 @@ return NSVG_RGB(128, 128, 128); } +// Parse rgb color. The pointer 'str' must point at "rgb(" (4+ characters). +// This function returns gray (rgb(128, 128, 128) == '#808080') on parse errors +// for backwards compatibility. Note: other image viewers return black instead. + static unsigned int nsvg__parseColorRGB(const char* str) { - unsigned int r=0, g=0, b=0; - float rf=0, gf=0, bf=0; - if (sscanf(str, "rgb(%u, %u, %u)", &r, &g, &b) == 3) // decimal integers - return NSVG_RGB(r, g, b); - if (sscanf(str, "rgb(%f%%, %f%%, %f%%)", &rf, &gf, &bf) == 3) // decimal integer percentage - return NSVG_RGB(roundf(rf*2.55f), roundf(gf*2.55f), roundf(bf*2.55f)); // (255 / 100.0f) - return NSVG_RGB(128, 128, 128); + int i; + unsigned int rgbi[3]; + float rgbf[3]; + // try decimal integers first + if (sscanf(str, "rgb(%u, %u, %u)", &rgbi[0], &rgbi[1], &rgbi[2]) != 3) { + // integers failed, try percent values (float, locale independent) + const char delimiter[3] = {',', ',', ')'}; + str += 4; // skip "rgb(" + for (i = 0; i < 3; i++) { + while (*str && (nsvg__isspace(*str))) str++; // skip leading spaces + if (*str == '+') str++; // skip '+' (don't allow '-') + if (!*str) break; + rgbf[i] = nsvg__atof(str); + + // Note 1: it would be great if nsvg__atof() returned how many + // bytes it consumed but it doesn't. We need to skip the number, + // the '%' character, spaces, and the delimiter ',' or ')'. + + // Note 2: The following code does not allow values like "33.%", + // i.e. a decimal point w/o fractional part, but this is consistent + // with other image viewers, e.g. firefox, chrome, eog, gimp. + + while (*str && nsvg__isdigit(*str)) str++; // skip integer part + if (*str == '.') { + str++; + if (!nsvg__isdigit(*str)) break; // error: no digit after '.' + while (*str && nsvg__isdigit(*str)) str++; // skip fractional part + } + if (*str == '%') str++; else break; + while (nsvg__isspace(*str)) str++; + if (*str == delimiter[i]) str++; + else break; + } + if (i == 3) { + rgbi[0] = roundf(rgbf[0] * 2.55f); + rgbi[1] = roundf(rgbf[1] * 2.55f); + rgbi[2] = roundf(rgbf[2] * 2.55f); + } else { + rgbi[0] = rgbi[1] = rgbi[2] = 128; + } + } + // clip values as the CSS spec requires + for (i = 0; i < 3; i++) { + if (rgbi[i] > 255) rgbi[i] = 255; + } + return NSVG_RGB(rgbi[0], rgbi[1], rgbi[2]); } typedef struct NSVGNamedColor { @@ -1639,9 +1681,9 @@ { int i = 0; str += 4; // "url("; - if (*str == '#') + if (*str && *str == '#') str++; - while (i < 63 && *str != ')') { + while (i < 63 && *str && *str != ')') { id[i] = *str++; i++; } @@ -3006,4 +3048,6 @@ free(image); } -#endif +#endif // NANOSVG_IMPLEMENTATION + +#endif // NANOSVG_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/3rd-party/nanosvg/src/nanosvgrast.h new/fuzzel/3rd-party/nanosvg/src/nanosvgrast.h --- old/fuzzel/3rd-party/nanosvg/src/nanosvgrast.h 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/3rd-party/nanosvg/src/nanosvgrast.h 2022-11-04 13:37:30.000000000 +0100 @@ -25,6 +25,8 @@ #ifndef NANOSVGRAST_H #define NANOSVGRAST_H +#include "nanosvg.h" + #ifndef NANOSVGRAST_CPLUSPLUS #ifdef __cplusplus extern "C" { @@ -47,7 +49,7 @@ */ // Allocated rasterizer context. -NSVGrasterizer* nsvgCreateRasterizer(); +NSVGrasterizer* nsvgCreateRasterizer(void); // Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) // r - pointer to rasterizer context @@ -72,11 +74,11 @@ #endif #endif -#endif // NANOSVGRAST_H - #ifdef NANOSVGRAST_IMPLEMENTATION #include <math.h> +#include <stdlib.h> +#include <string.h> #define NSVG__SUBSAMPLES 5 #define NSVG__FIXSHIFT 10 @@ -148,7 +150,7 @@ int width, height, stride; }; -NSVGrasterizer* nsvgCreateRasterizer() +NSVGrasterizer* nsvgCreateRasterizer(void) { NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer)); if (r == NULL) goto error; @@ -1406,7 +1408,8 @@ } // Rasterize edges - qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); + if (r->nedges != 0) + qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule nsvg__initPaint(&cache, &shape->fill, shape->opacity); @@ -1432,7 +1435,8 @@ } // Rasterize edges - qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); + if (r->nedges != 0) + qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule nsvg__initPaint(&cache, &shape->stroke, shape->opacity); @@ -1449,4 +1453,6 @@ r->stride = 0; } -#endif +#endif // NANOSVGRAST_IMPLEMENTATION + +#endif // NANOSVGRAST_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/CHANGELOG.md new/fuzzel/CHANGELOG.md --- old/fuzzel/CHANGELOG.md 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/CHANGELOG.md 2022-11-04 13:37:30.000000000 +0100 @@ -1,5 +1,6 @@ # Changelog +* [1.8.2](#1-8-2) * [1.8.1](#1-8-1) * [1.8.0](#1-8-0) * [1.7.0](#1-7-0) @@ -18,6 +19,24 @@ * [1.4.1](#1-4-1) +## 1.8.2 + +### Added + +* Fish completions ([#176][176]) + +[176]: https://codeberg.org/dnkl/fuzzel/issues/176 + + +### Fixed + +* Unsupported icon formats not being skipped when loading application + icons. +* Wrong size of PNG icons selected ([#182][182]) + +[182]: https://codeberg.org/dnkl/fuzzel/issues/182 + + ## 1.8.1 ### Fixed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/PKGBUILD new/fuzzel/PKGBUILD --- old/fuzzel/PKGBUILD 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/PKGBUILD 2022-11-04 13:37:30.000000000 +0100 @@ -3,7 +3,7 @@ SVG_BACKEND=librsvg # none|librsvg|nanosvg (librsvg force-enables cairo, nanosvg is bundled) pkgname=fuzzel -pkgver=1.8.1 +pkgver=1.8.2 pkgrel=1 pkgdesc="Simplistic application launcher for wayland" arch=('x86_64' 'aarch64') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/completions/fish/fuzzel.fish new/fuzzel/completions/fish/fuzzel.fish --- old/fuzzel/completions/fish/fuzzel.fish 1970-01-01 01:00:00.000000000 +0100 +++ new/fuzzel/completions/fish/fuzzel.fish 2022-11-04 13:37:30.000000000 +0100 @@ -0,0 +1,45 @@ +complete -c fuzzel + +complete -c fuzzel -f +complete -c fuzzel -r -s c -l config -d "path to configuration file (XDG_CONFIG_HOME/fuzzel/fuzzel.ini)" +complete -c fuzzel -x -s f -l font -a "(fc-list : family | sed 's/,/\n/g' | sort | uniq)" -d "font name and style in fontconfig format (monospace)" +complete -c fuzzel -x -s o -l output -a "(wlr-randr | grep -e '^[^[:space:]]\+' | cut -d ' ' -f 1)" -d "output (monitor) do display on (none)" +complete -c fuzzel -x -s D -l dpi-aware -a "no yes auto" -d "scale fonts using the monitor's DPI (auto)" +complete -c fuzzel -x -l icon-theme -a "(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 basename | sort)" -d "icon theme name (hicolor)" +complete -c fuzzel -s I -l no-icons -d "do not render any icons" +complete -c fuzzel -x -s F -l fields -a "filename name generic exec categories keywords comment" -d "comma separated list of XDG Desktop entry fields to match" +complete -c fuzzel -x -s p -l prompt -d "string to use as input prompt (\"> \")" + +# TODO: this currently doesnât quote the completed argument +complete -c fuzzel -x -s T -l terminal -a "(__fish_complete_subcommand)" -d "terminal command, with arguments ($TERMINAL -e)" + +complete -c fuzzel -x -s l -l lines -d "maximum number of matches to displayh (15)" +complete -c fuzzel -x -s w -l width -d "window width, in characters (30)" +complete -c fuzzel -x -s x -l horizontal-pad -d "horizontal padding, in pixels (40)" +complete -c fuzzel -x -s y -l vertical-pad -d "vertical padding, in pixels (8)" +complete -c fuzzel -x -s P -l inner-pad -d "vertical padding between prompt and matches, in pixels (0)" +complete -c fuzzel -x -s b -l background -d "background color (fdf6e3dd)" +complete -c fuzzel -x -s t -l text-color -d "text color (657b83ff)" +complete -c fuzzel -x -s m -l match-color -d "color of matched substring (cb4b16ff)" +complete -c fuzzel -x -s s -l selection-color -d "background color of selected item (eee8d5dd)" +complete -c fuzzel -x -s S -l selection-text-color -d "text color of selected item (657b83ff)" +complete -c fuzzel -x -s M -l selection-match-color -d "color of matched substring of selected item (cb4b16ff)" +complete -c fuzzel -x -s B -l border-width -d "width of border, in pixels (1)" +complete -c fuzzel -x -s r -l border-radius -d "amount of corner \"roundness\" (10)" +complete -c fuzzel -x -s C -l border-color -d "border color (002b36ff)" +complete -c fuzzel -l show-actions -d "include desktop actions (e.g. \"New Window\") in the list" +complete -c fuzzel -l no-fuzzy -d "disable fuzzy matching" +complete -c fuzzel -x -l fuzzy-min-length -d "search strings shorter than this will not be fuzzy matched" +complete -c fuzzel -x -l fuzzy-max-length-discrepancy -d "maximum allowed length difference between the search string and a fuzzy match (2)" +complete -c fuzzel -x -l fuzzy-max-distance -d "maximum allowed levenshtein distance between the search string and a fuzzy match (1)" +complete -c fuzzel -x -l line-height -d "override the line height from font metrics, in points or pixels" +complete -c fuzzel -x -l letter-spacing -d "additional letter spacing, in points or pixels" +complete -c fuzzel -x -l layer -a "top overlay" -d "which layer to render the fuzzel window on (top)" +complete -c fuzzel -s d -l dmenu -d "dmenu compatibility mode; list entries are read from stdin" +complete -c fuzzel -l index -d "print selected entry's index instead of its text (dmenu mode only)" +complete -c fuzzel -s R -l no-run-if-empty -d "exit immediately without showing the UI if stdin is empty (dmenu mode only)" +complete -c fuzzel -x -s d -l log-level -a "info warning error none" -d "log-level (info)" +complete -c fuzzel -x -s l -l log-colorize -a "always never auto" -d "enable or disable colorization of log output on stderr" +complete -c fuzzel -s S -l log-no-syslog -d "disable syslog logging" +complete -c fuzzel -s v -l version -d "show the version number and quit" +complete -c fuzzel -s h -l help -d "show help message and quit" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/completions/meson.build new/fuzzel/completions/meson.build --- old/fuzzel/completions/meson.build 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/completions/meson.build 2022-11-04 13:37:30.000000000 +0100 @@ -1,2 +1,4 @@ zsh_install_dir = join_paths(get_option('datadir'), 'zsh/site-functions') +fish_install_dir = join_paths(get_option('datadir'), 'fish', 'vendor_completions.d') install_data('zsh/_fuzzel', install_dir: zsh_install_dir) +install_data('fish/fuzzel.fish', install_dir: fish_install_dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/completions/zsh/_fuzzel new/fuzzel/completions/zsh/_fuzzel --- old/fuzzel/completions/zsh/_fuzzel 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/completions/zsh/_fuzzel 2022-11-04 13:37:30.000000000 +0100 @@ -50,11 +50,13 @@ ;; icon_theme) - _values 'icon themes' $(cd /usr/share/icons; echo *) + _values 'icon themes' $(find /usr/share/icons -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -n 1 basename | sort) ;; outputs) - if command -v swaymsg > /dev/null; then + if command -v wlr-randr > /dev/null; then + _values 'outputs' $(wlr-randr | grep -e '^[^[:space:]]\+' | cut -d ' ' -f 1) + elif command -v swaymsg > /dev/null; then _values 'outputs' $(swaymsg -t get_outputs --raw|grep name|cut -d '"' -f 4) fi ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/icon.c new/fuzzel/icon.c --- old/fuzzel/icon.c 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/icon.c 2022-11-04 13:37:30.000000000 +0100 @@ -409,6 +409,53 @@ icon->type = ICON_NONE; } +/* + * Path is expected to contain the iconâs basename. It doesnât have to + * have the extension filled in; it will be filled in by this + * function. + * + * Note that only supported image types are searched for. That is, if + * PNGs have been disabled, we only search for SVGs. + * + * Also note that we only check for the existence of a file; we donât + * validate it. + * + * Returns true if there exist an icon file (of the specified name) in + * <dir_fd>. In this case, path has been updated with the extension + * (.png or .svg). + */ +static bool +icon_file_exists(int dir_fd, char *path, size_t path_len) +{ +#if defined(FUZZEL_ENABLE_PNG_LIBPNG) + path[path_len - 3] = 'p'; + path[path_len - 2] = 'n'; + path[path_len - 1] = 'g'; + + if (faccessat(dir_fd, path, R_OK, 0) < 0) { +#if defined(FUZZEL_ENABLE_SVG_NANOSVG) || defined(FUZZEL_ENABLE_SVG_LIBRSVG) + path[path_len - 3] = 's'; + path[path_len - 2] = 'v'; + path[path_len - 1] = 'g'; + return faccessat(dir_fd, path, R_OK, 0) == 0; +#else + return false; +#endif + } + + return true; + +#elif defined(FUZZEL_ENABLE_SVG_NANOSVG) || defined(FUZZEL_ENABLE_SVG_LIBRSVG) + path[path_len - 3] = 's'; + path[path_len - 2] = 'v'; + path[path_len - 1] = 'g'; + + return faccessat(dir_fd, path, R_OK, 0) == 0; +#else + return false; +#endif +} + static bool lookup_icons(const icon_theme_list_t *themes, int icon_size, struct application_list *applications, @@ -490,7 +537,7 @@ const int threshold = icon_dir->threshold * scale; const enum icon_dir_type type = icon_dir->type; - bool is_exact_match = false;; + bool is_exact_match = false; int diff = INT_MAX; /* See if this directory is usable for the requested icon size */ @@ -498,6 +545,11 @@ case ICON_DIR_FIXED: is_exact_match = size == icon_size; diff = abs(size - icon_size); + LOG_DBG( + "%s/%s (fixed): " + "icon-size=%d, size=%d, exact=%d, diff=%d", + xdg_dir->path, theme_relative_path, icon_size, size, + is_exact_match, diff); break; case ICON_DIR_THRESHOLD: @@ -505,8 +557,15 @@ (size - threshold) <= icon_size && (size + threshold) >= icon_size; diff = icon_size < (size - threshold) - ? (size - threshold) - icon_size - : icon_size - (size + threshold); + ? min_size - icon_size + : (icon_size > (size + threshold) + ? icon_size - max_size + : 0); + LOG_DBG( + "%s/%s (threshold): " + "icon-size=%d, threshold=%d, exact=%d, diff=%d", + xdg_dir->path, theme_relative_path, icon_size, threshold, + is_exact_match, diff); break; case ICON_DIR_SCALABLE: @@ -515,7 +574,13 @@ max_size >= icon_size; diff = icon_size < min_size ? min_size - icon_size - : icon_size - max_size; + : (icon_size > max_size + ? icon_size - max_size + : 0); + LOG_DBG("%s/%s (scalable): " + "icon-size=%d, min=%d, max=%d, exact=%d, diff=%d", + xdg_dir->path, theme_relative_path, icon_size, + min_size, max_size, is_exact_match, diff); break; } @@ -533,17 +598,9 @@ size_t len = icon->file_name_len; char *path = icon->file_name; path[len - 4] = '.'; - path[len - 3] = 'p'; - path[len - 2] = 'n'; - path[len - 1] = 'g'; - - if (faccessat(dir_fd, path, R_OK, 0) < 0) { - path[len - 3] = 's'; - path[len - 2] = 'v'; - path[len - 1] = 'g'; - if (faccessat(dir_fd, path, R_OK, 0) < 0) - continue; - } + + if (!icon_file_exists(dir_fd, path, len)) + continue; if (!is_exact_match) { assert(diff < icon->min_diff.diff); @@ -638,19 +695,10 @@ size_t len = icon->file_name_len; char *path = icon->file_name; - path[len - 3] = 's'; - path[len - 2] = 'v'; - path[len - 1] = 'g'; - - if (faccessat(pixmaps_fd, path, R_OK, 0) < 0) { - path[len - 3] = 'p'; - path[len - 2] = 'n'; - path[len - 1] = 'g'; - if (faccessat(pixmaps_fd, path, R_OK, 0) < 0) { - close(pixmaps_fd); - continue; - } + if (!icon_file_exists(pixmaps_fd, path, len)) { + close(pixmaps_fd); + continue; } close(pixmaps_fd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/key-binding.c new/fuzzel/key-binding.c --- old/fuzzel/key-binding.c 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/key-binding.c 2022-11-04 13:37:30.000000000 +0100 @@ -4,7 +4,7 @@ #include <assert.h> #define LOG_MODULE "key-binding" -#define LOG_ENABLE_DBG 1 +#define LOG_ENABLE_DBG 0 #include "log.h" #define ALEN(v) (sizeof(v) / sizeof((v)[0])) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/main.c new/fuzzel/main.c --- old/fuzzel/main.c 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/main.c 2022-11-04 13:37:30.000000000 +0100 @@ -37,6 +37,8 @@ #include "wayland.h" #include "xdg.h" +#define max(x, y) ((x) > (y) ? (x) : (y)) + struct context { const struct config *conf; struct wayland *wayl; @@ -191,6 +193,38 @@ close(fd); } +static const char * +version_and_features(void) +{ + static char buf[256]; + snprintf(buf, sizeof(buf), "version: %s %ccairo %cpng %csvg%s %cassertions", + FUZZEL_VERSION, +#if defined(FUZZEL_ENABLE_CAIRO) + '+', +#else + '-', +#endif +#if defined(FUZZEL_ENABLE_PNG_LIBPNG) + '+', +#else + '-', +#endif +#if defined(FUZZEL_ENABLE_SVG_NANOSVG) + '+', "(nanosvg)", +#elif defined(FUZZEL_ENABLE_SVG_LIBRSVG) + '+', "(librsvg)", +#else + '-', "", +#endif +#if !defined(NDEBUG) + '+' +#else + '-' +#endif + ); + return buf; +} + static void print_usage(const char *prog_name) { @@ -263,13 +297,15 @@ font_reloaded(struct wayland *wayl, struct fcft_font *font, void *data) { struct context *ctx = data; + const struct config *conf = ctx->conf; applications_flush_text_run_cache(ctx->apps); mtx_lock(ctx->icon_lock); { - ctx->icon_size = font->height; - if (ctx->conf->icons_enabled) { + ctx->icon_size = render_icon_size(ctx->render); + + if (conf->icons_enabled) { icon_lookup_application_icons( *ctx->themes, ctx->icon_size, ctx->apps); } @@ -1019,7 +1055,7 @@ break; case 'v': - printf("fuzzel version %s\n", FUZZEL_VERSION); + printf("fuzzel %s\n", version_and_features()); return EXIT_SUCCESS; case 'h': @@ -1037,6 +1073,7 @@ } log_init(log_colorize, log_syslog, LOG_FACILITY_USER, log_level); + LOG_INFO("%s", version_and_features()); int ret = EXIT_FAILURE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/meson.build new/fuzzel/meson.build --- old/fuzzel/meson.build 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/meson.build 2022-11-04 13:37:30.000000000 +0100 @@ -1,5 +1,5 @@ project('fuzzel', 'c', - version: '1.8.1', + version: '1.8.2', license: 'MIT', meson_version: '>=0.58.0', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/render.c new/fuzzel/render.c --- old/fuzzel/render.c 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/render.c 2022-11-04 13:37:30.000000000 +0100 @@ -483,6 +483,7 @@ if (icon->svg == NULL) { if (!icon_from_svg(icon, icon->path)) return; + LOG_DBG("%s", icon->path); } #if defined(FUZZEL_ENABLE_SVG_LIBRSVG) @@ -569,6 +570,7 @@ if (icon->png == NULL) { if (!icon_from_png(icon, icon->path)) return; + LOG_DBG("%s", icon->path); } #if defined(FUZZEL_ENABLE_PNG_LIBPNG) @@ -808,6 +810,12 @@ return true; } +int +render_icon_size(const struct render *render) +{ + return render->icon_height; +} + void render_destroy(struct render *render) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/render.h new/fuzzel/render.h --- old/fuzzel/render.h 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/render.h 2022-11-04 13:37:30.000000000 +0100 @@ -28,3 +28,5 @@ void render_match_list( const struct render *render, struct buffer *buf, const struct prompt *prompt, const struct matches *matches); + +int render_icon_size(const struct render *render); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/wayland.c new/fuzzel/wayland.c --- old/fuzzel/wayland.c 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/wayland.c 2022-11-04 13:37:30.000000000 +0100 @@ -1081,13 +1081,18 @@ if (font == NULL) return false; + bool ret = render_set_font( + wayl->render, font, new_scale, new_dpi, + wayl->font_is_sized_by_dpi, &wayl->width, &wayl->height); + if (wayl->font_reloaded.cb != NULL) wayl->font_reloaded.cb(wayl, font, wayl->font_reloaded.data); + + return ret; } - return render_set_font( - wayl->render, font, new_scale, new_dpi, wayl->font_is_sized_by_dpi, - &wayl->width, &wayl->height); + return true; + } static float diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fuzzel/wayland.h new/fuzzel/wayland.h --- old/fuzzel/wayland.h 2022-10-27 14:05:38.000000000 +0200 +++ new/fuzzel/wayland.h 2022-11-04 13:37:30.000000000 +0100 @@ -28,5 +28,3 @@ int wayl_exit_code(const struct wayland *wayl); bool wayl_update_cache(const struct wayland *wayl); - -bool wayl_size_font_by_dpi(const struct wayland *wayl);