This commit is contained in:
mrsu 2023-08-31 14:58:12 +01:00
commit b7f0e75a47
12 changed files with 41 additions and 39 deletions

View File

@ -16,7 +16,7 @@ jobs:
sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \ sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
libxft2 libxft-dev libexif12 libexif-dev \ libxft2 libxft-dev libexif12 libexif-dev \
gcc clang git bc 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" 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; ) ( cd "tinycc-$TCC_SHA" && ./configure && make -j"$(nproc)" && sudo make install; )
- name: build - name: build

View File

@ -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 your distro listed here, either contact your distro's package maintainer or
consider packaging it yourself and adding it to the respective community repo. 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 Dependencies
------------ ------------

View File

@ -6,14 +6,14 @@ static const int WIN_HEIGHT = 600;
/* colors and font can be overwritten via X resource properties. /* colors and font can be overwritten via X resource properties.
* See nsxiv(1), X(7) section Resources and xrdb(1) for more information. * See nsxiv(1), X(7) section Resources and xrdb(1) for more information.
*/ * X resource value (NULL == default) */
static const char *DEFAULT_WIN_BG = "white"; static const char *WIN_BG[] = { "Nsxiv.window.background", "white" };
static const char *DEFAULT_WIN_FG = "black"; static const char *WIN_FG[] = { "Nsxiv.window.foreground", "black" };
static const char *DEFAULT_MARK_COLOR = NULL; /* NULL means it will default to window foreground */ static const char *MARK_FG[] = { "Nsxiv.mark.foreground", NULL };
#if HAVE_LIBFONTS #if HAVE_LIBFONTS
static const char *DEFAULT_BAR_BG = NULL; /* NULL means it will default to window background */ static const char *BAR_BG[] = { "Nsxiv.bar.background", "#005577" };
static const char *DEFAULT_BAR_FG = NULL; /* NULL means it will default to window foreground */ static const char *BAR_FG[] = { "Nsxiv.bar.foreground", "#eadab1" };
static const char *DEFAULT_FONT = "Hack Nerd Font-16"; static const char *BAR_FONT[] = { "Nsxiv.bar.font", "monospace-16" };
/* if true, statusbar appears on top of the window */ /* if true, statusbar appears on top of the window */
static const bool TOP_STATUSBAR = false; 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 }; static const int thumb_sizes[] = { 32, 64, 96, 128, 160, 256, 512, 800, 1024 };
/* thumbnail size at startup, index into thumb_sizes[]: */ /* thumbnail size at startup, index into thumb_sizes[]: */
static const int THUMB_SIZE = 5; static const int THUMB_SIZE = 7;
#endif #endif
#ifdef INCLUDE_MAPPINGS_CONFIG #ifdef INCLUDE_MAPPINGS_CONFIG

View File

@ -26,7 +26,7 @@ CC = c99
# CFLAGS, any additional compiler flags goes here # CFLAGS, any additional compiler flags goes here
CFLAGS = -Wall -pedantic -O2 -DNDEBUG CFLAGS = -Wall -pedantic -O2 -DNDEBUG
# Uncomment for a debug build using gcc/clang # 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) # LDFLAGS = $(CFLAGS)
# icons that will be installed via `make icon` # icons that will be installed via `make icon`

View File

@ -569,11 +569,6 @@ TAAPArthur <taaparthur at gmail.com>
eylles <ed.ylles1997 at gmail.com> eylles <ed.ylles1997 at gmail.com>
Stein Gunnar Bakkeby <bakkeby at gmail.com> Stein Gunnar Bakkeby <bakkeby at gmail.com>
explosion-mental <explosion0mental at gmail.com> explosion-mental <explosion0mental at gmail.com>
mamg22 <marcomonizg at gmail.com>
LuXu
Guilherme Freire
Sam Whitehead
Kian Kasad <kian at kasad.com>
.EE .EE
.SH CONTRIBUTORS .SH CONTRIBUTORS
.EX .EX

View File

@ -1,21 +1,24 @@
#!/bin/sh -e #!/bin/sh -e
std="c99" std="c99"
NProc=$(( $(nproc) / 4 ))
if [ -z "$NProc" ] || [ "$NProc" -lt 1 ]; then NProc="1"; fi
run_cppcheck() { run_cppcheck() {
cppcheck --std="$std" --enable=performance,portability \ cppcheck --std="$std" --enable=performance,portability \
--force --quiet --inline-suppr --error-exitcode=1 \ --force --quiet --inline-suppr --error-exitcode=1 \
--max-ctu-depth=8 -j"$(nproc)" \ --max-ctu-depth=8 -j"$NProc" \
$(make OPT_DEP_DEFAULT="$1" dump_cppflags) \ $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG \
--suppress=varFuncNullUB --suppress=uninitvar \ --suppress=varFuncNullUB --suppress=uninitvar \
*.c $(git ls-files *.c)
} }
run_tidy() { run_tidy() {
checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)" checks="$(sed '/^#/d' etc/woodpecker/clang-tidy-checks | paste -d ',' -s)"
clang-tidy --warnings-as-errors="*" --checks="$checks" --quiet *.c \ git ls-files *.c | xargs -P"$NProc" -I{} clang-tidy --quiet \
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) --warnings-as-errors="*" --checks="$checks" {} \
-- -std="$std" $(make OPT_DEP_DEFAULT="$1" dump_cppflags) -DDEBUG
} }
run_cppcheck "0"; run_cppcheck "1"; run_cppcheck "0" & run_cppcheck "1" & run_tidy "0" & run_tidy "1";
run_tidy "0"; run_tidy "1"; wait

View File

@ -4,7 +4,7 @@ pipeline:
analysis: analysis:
image: alpine image: alpine
commands: | 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 \ imlib2-dev xorgproto \
libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null libxft-dev libexif-dev giflib-dev libwebp-dev >/dev/null
make config.h version.h make config.h version.h

View File

@ -5,7 +5,7 @@ pipeline:
build: build:
image: alpine image: alpine
environment: environment:
- TCC_SHA=027b8fb9b88fe137447fb8bb1b61079be9702472 - TCC_SHA=29ae3ed4d5b83eec43598d6cd7949bccb41c8083
commands: | commands: |
apk add --no-cache \ apk add --no-cache \
imlib2 imlib2-dev xorgproto \ imlib2 imlib2-dev xorgproto \

View File

@ -54,6 +54,10 @@ enum { DEF_GIF_DELAY = 75 };
enum { DEF_WEBP_DELAY = 75 }; enum { DEF_WEBP_DELAY = 75 };
#endif #endif
#if HAVE_IMLIB2_MULTI_FRAME
enum { DEF_ANIM_DELAY = 75 };
#endif
#define ZOOM_MIN (zoom_levels[0] / 100) #define ZOOM_MIN (zoom_levels[0] / 100)
#define ZOOM_MAX (zoom_levels[ARRLEN(zoom_levels) - 1] / 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_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); 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].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->length += m->frames[m->cnt].delay;
m->cnt++; m->cnt++;
imlib_context_set_image(frame); imlib_context_set_image(frame);

8
main.c
View File

@ -434,12 +434,12 @@ static void update_info(void)
r->p = r->buf; r->p = r->buf;
if (mode == MODE_THUMB) { if (mode == MODE_THUMB) {
if (tns.loadnext < tns.end) 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) else if (tns.initnext < filecnt)
bar_put(l, "Caching... %0*d", fw, tns.initnext + 1); bar_put(r, "Caching... %0*d | ", fw, tns.initnext + 1);
else if (info.ft.err)
strncpy(l->buf, files[fileidx].name, l->size);
bar_put(r, "%s%0*d/%d", mark, fw, fileidx + 1, filecnt); 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 { } else {
bar_put(r, "%s", mark); bar_put(r, "%s", mark);
if (img.ss.on) { if (img.ss.on) {

View File

@ -20,6 +20,10 @@
#ifndef NSXIV_H #ifndef NSXIV_H
#define NSXIV_H #define NSXIV_H
#if !defined(DEBUG) && !defined(NDEBUG)
#define NDEBUG
#endif
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>

View File

@ -141,20 +141,20 @@ void win_init(win_t *win)
res_man = XResourceManagerString(e->dpy); res_man = XResourceManagerString(e->dpy);
db = res_man == NULL ? NULL : XrmGetStringDatabase(res_man); db = res_man == NULL ? NULL : XrmGetStringDatabase(res_man);
win_bg = win_res(db, RES_CLASS ".window.background", DEFAULT_WIN_BG); win_bg = win_res(db, WIN_BG[0], WIN_BG[1] ? WIN_BG[1] : "white");
win_fg = win_res(db, RES_CLASS ".window.foreground", DEFAULT_WIN_FG); win_fg = win_res(db, WIN_FG[0], WIN_FG[1] ? WIN_FG[1] : "black");
mrk_fg = win_res(db, RES_CLASS ".mark.foreground", DEFAULT_MARK_COLOR ? DEFAULT_MARK_COLOR : win_fg); 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_bg, &win->win_bg);
win_alloc_color(e, win_fg, &win->win_fg); win_alloc_color(e, win_fg, &win->win_fg);
win_alloc_color(e, mrk_fg, &win->mrk_fg); win_alloc_color(e, mrk_fg, &win->mrk_fg);
#if HAVE_LIBFONTS #if HAVE_LIBFONTS
bar_bg = win_res(db, RES_CLASS ".bar.background", DEFAULT_BAR_BG ? DEFAULT_BAR_BG : win_bg); bar_bg = win_res(db, BAR_BG[0], BAR_BG[1] ? BAR_BG[1] : win_bg);
bar_fg = win_res(db, RES_CLASS ".bar.foreground", DEFAULT_BAR_FG ? DEFAULT_BAR_FG : win_fg); 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_bg, &win->bar_bg);
xft_alloc_color(e, bar_fg, &win->bar_fg); 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_init_font(e, f);
win->bar.l.buf = lbuf; win->bar.l.buf = lbuf;