diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4619bb7..3c3b3c1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \ libxft2 libxft-dev libexif12 libexif-dev \ gcc clang git bc - TCC_SHA="027b8fb9b88fe137447fb8bb1b61079be9702472" + TCC_SHA="29ae3ed4d5b83eec43598d6cd7949bccb41c8083" wget "https://github.com/TinyCC/tinycc/archive/${TCC_SHA}.tar.gz" && tar xzf "${TCC_SHA}.tar.gz" ( cd "tinycc-$TCC_SHA" && ./configure && make -j"$(nproc)" && sudo make install; ) - name: build diff --git a/README.md b/README.md index bc303d4..70376d7 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,6 @@ nsxiv is available on the following distributions/repositories. If you don't see your distro listed here, either contact your distro's package maintainer or consider packaging it yourself and adding it to the respective community repo. -Repos not tracked by repology: - -* Fedora: Enable the copr repo via `dnf copr enable mamg22/nsxiv`. - Dependencies ------------ diff --git a/config.def.h b/config.def.h index 685f525..5e0d03f 100644 --- a/config.def.h +++ b/config.def.h @@ -6,14 +6,14 @@ static const int WIN_HEIGHT = 600; /* colors and font can be overwritten via X resource properties. * See nsxiv(1), X(7) section Resources and xrdb(1) for more information. - */ -static const char *DEFAULT_WIN_BG = "white"; -static const char *DEFAULT_WIN_FG = "black"; -static const char *DEFAULT_MARK_COLOR = NULL; /* NULL means it will default to window foreground */ + * X resource value (NULL == default) */ +static const char *WIN_BG[] = { "Nsxiv.window.background", "white" }; +static const char *WIN_FG[] = { "Nsxiv.window.foreground", "black" }; +static const char *MARK_FG[] = { "Nsxiv.mark.foreground", NULL }; #if HAVE_LIBFONTS -static const char *DEFAULT_BAR_BG = NULL; /* NULL means it will default to window background */ -static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to window foreground */ -static const char *DEFAULT_FONT = "Hack Nerd Font-16"; +static const char *BAR_BG[] = { "Nsxiv.bar.background", "#005577" }; +static const char *BAR_FG[] = { "Nsxiv.bar.foreground", "#eadab1" }; +static const char *BAR_FONT[] = { "Nsxiv.bar.font", "monospace-16" }; /* if true, statusbar appears on top of the window */ static const bool TOP_STATUSBAR = false; @@ -77,7 +77,7 @@ static const bool ALPHA_LAYER = false; static const int thumb_sizes[] = { 32, 64, 96, 128, 160, 256, 512, 800, 1024 }; /* thumbnail size at startup, index into thumb_sizes[]: */ -static const int THUMB_SIZE = 5; +static const int THUMB_SIZE = 7; #endif #ifdef INCLUDE_MAPPINGS_CONFIG diff --git a/config.mk b/config.mk index 44ec692..20bb2b2 100644 --- a/config.mk +++ b/config.mk @@ -26,7 +26,7 @@ CC = c99 # CFLAGS, any additional compiler flags goes here CFLAGS = -Wall -pedantic -O2 -DNDEBUG # Uncomment for a debug build using gcc/clang -# CFLAGS = -Wall -pedantic -g3 -fsanitize=address,undefined +# CFLAGS = -Wall -pedantic -DDEBUG -g3 -fsanitize=address,undefined # LDFLAGS = $(CFLAGS) # icons that will be installed via `make icon` diff --git a/etc/nsxiv.1 b/etc/nsxiv.1 index 10f131a..e2fb4c8 100644 --- a/etc/nsxiv.1 +++ b/etc/nsxiv.1 @@ -569,11 +569,6 @@ TAAPArthur eylles Stein Gunnar Bakkeby explosion-mental -mamg22 -LuXu -Guilherme Freire -Sam Whitehead -Kian Kasad .EE .SH CONTRIBUTORS .EX diff --git a/etc/woodpecker/analysis.sh b/etc/woodpecker/analysis.sh index 330d140..5a227ce 100755 --- a/etc/woodpecker/analysis.sh +++ b/etc/woodpecker/analysis.sh @@ -1,21 +1,24 @@ #!/bin/sh -e std="c99" +NProc=$(( $(nproc) / 4 )) +if [ -z "$NProc" ] || [ "$NProc" -lt 1 ]; then NProc="1"; fi run_cppcheck() { cppcheck --std="$std" --enable=performance,portability \ --force --quiet --inline-suppr --error-exitcode=1 \ - --max-ctu-depth=8 -j"$(nproc)" \ - $(make OPT_DEP_DEFAULT="$1" dump_cppflags) \ + --max-ctu-depth=8 -j"$NProc" \ + $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG \ --suppress=varFuncNullUB --suppress=uninitvar \ - *.c + $(git ls-files *.c) } run_tidy() { checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)" - clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \ - -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) + git ls-files *.c | xargs -P"$NProc" -I{} clang-tidy --quiet \ + --warnings-as-errors="*" --checks="$checks" {} \ + -- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG } -run_cppcheck "0"; run_cppcheck "1"; -run_tidy "0"; run_tidy "1"; +run_cppcheck "0" & run_cppcheck "1" & run_tidy "0" & run_tidy "1"; +wait diff --git a/etc/woodpecker/analysis.yml b/etc/woodpecker/analysis.yml index 65da7aa..9ebcc4f 100644 --- a/etc/woodpecker/analysis.yml +++ b/etc/woodpecker/analysis.yml @@ -4,7 +4,7 @@ pipeline: analysis: image: alpine commands: | - apk add --no-cache build-base cppcheck clang-extra-tools \ + apk add --no-cache build-base cppcheck clang-extra-tools git \ imlib2-dev xorgproto \ libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null make config.h version.h diff --git a/etc/woodpecker/build.yml b/etc/woodpecker/build.yml index eced0d1..7c79a90 100644 --- a/etc/woodpecker/build.yml +++ b/etc/woodpecker/build.yml @@ -5,7 +5,7 @@ pipeline: build: image: alpine environment: - - TCC_SHA=027b8fb9b88fe137447fb8bb1b61079be9702472 + - TCC_SHA=29ae3ed4d5b83eec43598d6cd7949bccb41c8083 commands: | apk add --no-cache \ imlib2 imlib2-dev xorgproto \ diff --git a/image.c b/image.c index 4f9015d..426a05a 100644 --- a/image.c +++ b/image.c @@ -54,6 +54,10 @@ enum { DEF_GIF_DELAY = 75 }; enum { DEF_WEBP_DELAY = 75 }; #endif +#if HAVE_IMLIB2_MULTI_FRAME +enum { DEF_ANIM_DELAY = 75 }; +#endif + #define ZOOM_MIN (zoom_levels[0] / 100) #define ZOOM_MAX (zoom_levels[ARRLEN(zoom_levels) - 1] / 100) @@ -539,7 +543,7 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file) imlib_context_set_blend(!!(finfo.frame_flags & IMLIB_FRAME_BLEND)); imlib_blend_image_onto_image(frame, has_alpha, 0, 0, sw, sh, sx, sy, sw, sh); m->frames[m->cnt].im = canvas; - m->frames[m->cnt].delay = finfo.frame_delay; + m->frames[m->cnt].delay = finfo.frame_delay ? finfo.frame_delay : DEF_ANIM_DELAY; m->length += m->frames[m->cnt].delay; m->cnt++; imlib_context_set_image(frame); diff --git a/main.c b/main.c index 3868e8e..fed9528 100644 --- a/main.c +++ b/main.c @@ -434,12 +434,12 @@ static void update_info(void) r->p = r->buf; if (mode == MODE_THUMB) { if (tns.loadnext < tns.end) - bar_put(l, "Loading... %0*d", fw, tns.loadnext + 1); + bar_put(r, "Loading... %0*d | ", fw, tns.loadnext + 1); else if (tns.initnext < filecnt) - bar_put(l, "Caching... %0*d", fw, tns.initnext + 1); - else if (info.ft.err) - strncpy(l->buf, files[fileidx].name, l->size); + bar_put(r, "Caching... %0*d | ", fw, tns.initnext + 1); bar_put(r, "%s%0*d/%d", mark, fw, fileidx + 1, filecnt); + if (info.ft.err) + strncpy(l->buf, files[fileidx].name, l->size); } else { bar_put(r, "%s", mark); if (img.ss.on) { diff --git a/nsxiv.h b/nsxiv.h index 8011f9e..7e373c2 100644 --- a/nsxiv.h +++ b/nsxiv.h @@ -20,6 +20,10 @@ #ifndef NSXIV_H #define NSXIV_H +#if !defined(DEBUG) && !defined(NDEBUG) + #define NDEBUG +#endif + #include #include diff --git a/window.c b/window.c index b170614..387d789 100644 --- a/window.c +++ b/window.c @@ -141,20 +141,20 @@ void win_init(win_t *win) res_man = XResourceManagerString(e->dpy); db = res_man == NULL ? NULL : XrmGetStringDatabase(res_man); - win_bg = win_res(db, RES_CLASS ".window.background", DEFAULT_WIN_BG); - win_fg = win_res(db, RES_CLASS ".window.foreground", DEFAULT_WIN_FG); - mrk_fg = win_res(db, RES_CLASS ".mark.foreground", DEFAULT_MARK_COLOR ? DEFAULT_MARK_COLOR : win_fg); + win_bg = win_res(db, WIN_BG[0], WIN_BG[1] ? WIN_BG[1] : "white"); + win_fg = win_res(db, WIN_FG[0], WIN_FG[1] ? WIN_FG[1] : "black"); + mrk_fg = win_res(db, MARK_FG[0], MARK_FG[1] ? MARK_FG[1] : win_fg); win_alloc_color(e, win_bg, &win->win_bg); win_alloc_color(e, win_fg, &win->win_fg); win_alloc_color(e, mrk_fg, &win->mrk_fg); #if HAVE_LIBFONTS - bar_bg = win_res(db, RES_CLASS ".bar.background", DEFAULT_BAR_BG ? DEFAULT_BAR_BG : win_bg); - bar_fg = win_res(db, RES_CLASS ".bar.foreground", DEFAULT_BAR_FG ? DEFAULT_BAR_FG : win_fg); + bar_bg = win_res(db, BAR_BG[0], BAR_BG[1] ? BAR_BG[1] : win_bg); + bar_fg = win_res(db, BAR_FG[0], BAR_FG[1] ? BAR_FG[1] : win_fg); xft_alloc_color(e, bar_bg, &win->bar_bg); xft_alloc_color(e, bar_fg, &win->bar_fg); - f = win_res(db, RES_CLASS ".bar.font", DEFAULT_FONT); + f = win_res(db, BAR_FONT[0], BAR_FONT[1] ? BAR_FONT[1] : "monospace-8"); win_init_font(e, f); win->bar.l.buf = lbuf;