Compare commits
No commits in common. "99f685df84039484b4d4fcd7dfe09ecdb4e2fc06" and "add12ecdfd0f5afea56c76532ba563599a620368" have entirely different histories.
99f685df84
...
add12ecdfd
|
@ -47,11 +47,7 @@ jobs:
|
|||
- name: build
|
||||
run: |
|
||||
# libinotify-kqueue isn't available on homebrew
|
||||
make clean && make -s OPT_DEP_DEFAULT=1 HAVE_INOTIFY=0 \
|
||||
CPPFLAGS="-I/opt/homebrew/include -I/opt/homebrew/include/freetype2" \
|
||||
LDLIBS="-L/opt/homebrew/lib"
|
||||
make clean && make -s OPT_DEP_DEFAULT=1 HAVE_INOTIFY=0
|
||||
# force uninstallation with --ignore-dependencies
|
||||
brew uninstall --ignore-dependencies libxft libexif
|
||||
make clean && make -s OPT_DEP_DEFAULT=0 \
|
||||
CPPFLAGS="-I/opt/homebrew/include" \
|
||||
LDLIBS="-L/opt/homebrew/lib"
|
||||
make clean && make -s OPT_DEP_DEFAULT=0
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
*.o
|
||||
*.orig
|
||||
*.rej
|
||||
nsxiv
|
||||
config.h
|
||||
version.h
|
||||
*.d
|
||||
*.o
|
||||
nsxiv
|
||||
icon/img2data
|
||||
|
|
10
config.def.h
10
config.def.h
|
@ -11,9 +11,9 @@ 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 *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" };
|
||||
static const char *BAR_BG[] = { "Nsxiv.bar.background", NULL };
|
||||
static const char *BAR_FG[] = { "Nsxiv.bar.foreground", NULL };
|
||||
static const char *BAR_FONT[] = { "Nsxiv.bar.font", "monospace-8" };
|
||||
|
||||
/* if true, statusbar appears on top of the window */
|
||||
static const bool TOP_STATUSBAR = false;
|
||||
|
@ -74,10 +74,10 @@ static const bool ALPHA_LAYER = false;
|
|||
#ifdef INCLUDE_THUMBS_CONFIG
|
||||
|
||||
/* thumbnail sizes in pixels (width == height): */
|
||||
static const int thumb_sizes[] = { 32, 64, 96, 128, 160, 256, 512, 800, 1024 };
|
||||
static const int thumb_sizes[] = { 32, 64, 96, 128, 160 };
|
||||
|
||||
/* thumbnail size at startup, index into thumb_sizes[]: */
|
||||
static const int THUMB_SIZE = 7;
|
||||
static const int THUMB_SIZE = 3;
|
||||
|
||||
#endif
|
||||
#ifdef INCLUDE_MAPPINGS_CONFIG
|
||||
|
|
|
@ -440,9 +440,7 @@ Zoom in.
|
|||
.B Button5
|
||||
Zoom out.
|
||||
.SH CONFIGURATION
|
||||
The following X resources are supported under "Nsxiv" (e.g.
|
||||
.B Nsxiv.bar.font
|
||||
):
|
||||
The following X resources are supported:
|
||||
.TP
|
||||
.B window.background
|
||||
Color of the window background
|
||||
|
|
|
@ -4,13 +4,13 @@ misc-*,android-cloexec-*,llvm-include-order
|
|||
-readability-*,readability-duplicate-include,readability-misleading-indentation
|
||||
|
||||
# silence
|
||||
-misc-unused-parameters,-misc-include-cleaner,-misc-no-recursion
|
||||
-misc-unused-parameters
|
||||
-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-bugprone-incorrect-roundings
|
||||
-bugprone-implicit-widening-of-multiplication-result,-bugprone-integer-division
|
||||
-android-cloexec-fopen,-android-cloexec-pipe,-cert-err33-c
|
||||
-bugprone-assignment-in-if-condition
|
||||
-bugprone-suspicious-realloc-usage
|
||||
-bugprone-switch-missing-default-case
|
||||
|
||||
# false positive warnings
|
||||
-clang-analyzer-valist.Uninitialized
|
||||
-misc-no-recursion
|
||||
|
|
4
image.c
4
image.c
|
@ -676,8 +676,8 @@ void img_rotate(img_t *img, degree_t d)
|
|||
ox = d == DEGREE_90 ? img->x : img->win->w - img->x - img->w * img->zoom;
|
||||
oy = d == DEGREE_270 ? img->y : img->win->h - img->y - img->h * img->zoom;
|
||||
|
||||
img->x = oy + (int)(img->win->w - img->win->h) / 2;
|
||||
img->y = ox + (int)(img->win->h - img->win->w) / 2;
|
||||
img->x = oy + (img->win->w - img->win->h) / 2;
|
||||
img->y = ox + (img->win->h - img->win->w) / 2;
|
||||
|
||||
tmp = img->w;
|
||||
img->w = img->h;
|
||||
|
|
41
main.c
41
main.c
|
@ -25,7 +25,6 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
|
@ -250,10 +249,10 @@ void reset_timeout(timeout_f handler)
|
|||
|
||||
static bool check_timeouts(int *t)
|
||||
{
|
||||
int i = 0, tdiff, tmin;
|
||||
int i = 0, tdiff, tmin = -1;
|
||||
struct timeval now;
|
||||
|
||||
for (i = 0; i < (int)ARRLEN(timeouts); ++i) {
|
||||
while (i < (int)ARRLEN(timeouts)) {
|
||||
if (timeouts[i].active) {
|
||||
gettimeofday(&now, 0);
|
||||
tdiff = TV_DIFF(&timeouts[i].when, &now);
|
||||
|
@ -261,22 +260,16 @@ static bool check_timeouts(int *t)
|
|||
timeouts[i].active = false;
|
||||
if (timeouts[i].handler != NULL)
|
||||
timeouts[i].handler();
|
||||
i = tmin = -1;
|
||||
} else if (tmin < 0 || tdiff < tmin) {
|
||||
tmin = tdiff;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
tmin = INT_MAX;
|
||||
gettimeofday(&now, 0);
|
||||
for (i = 0; i < (int)ARRLEN(timeouts); ++i) {
|
||||
if (timeouts[i].active) {
|
||||
tdiff = TV_DIFF(&timeouts[i].when, &now);
|
||||
tmin = MIN(tmin, tdiff);
|
||||
}
|
||||
}
|
||||
|
||||
if (tmin != INT_MAX && t != NULL)
|
||||
*t = MAX(tmin, 0);
|
||||
return tmin != INT_MAX;
|
||||
if (tmin > 0 && t != NULL)
|
||||
*t = tmin;
|
||||
return tmin > 0;
|
||||
}
|
||||
|
||||
static void autoreload(void)
|
||||
|
@ -335,7 +328,8 @@ static void open_title(void)
|
|||
snprintf(fcnt, ARRLEN(fcnt), "%d", filecnt);
|
||||
construct_argv(argv, ARRLEN(argv), wintitle.f.cmd, files[fileidx].path,
|
||||
fidx, fcnt, w, h, z, NULL);
|
||||
wintitle.pid = spawn(&wintitle.fd, NULL, O_NONBLOCK, argv);
|
||||
if ((wintitle.pid = spawn(&wintitle.fd, NULL, argv)) > 0)
|
||||
fcntl(wintitle.fd, F_SETFL, O_NONBLOCK);
|
||||
}
|
||||
|
||||
void close_info(void)
|
||||
|
@ -358,7 +352,8 @@ void open_info(void)
|
|||
}
|
||||
construct_argv(argv, ARRLEN(argv), cmd, files[fileidx].name, w, h,
|
||||
files[fileidx].path, NULL);
|
||||
info.pid = spawn(&info.fd, NULL, O_NONBLOCK, argv);
|
||||
if ((info.pid = spawn(&info.fd, NULL, argv)) > 0)
|
||||
fcntl(info.fd, F_SETFL, O_NONBLOCK);
|
||||
}
|
||||
|
||||
static void read_info(void)
|
||||
|
@ -648,7 +643,7 @@ static bool run_key_handler(const char *key, unsigned int mask)
|
|||
mask & Mod1Mask ? "M-" : "",
|
||||
mask & ShiftMask ? "S-" : "", key);
|
||||
construct_argv(argv, ARRLEN(argv), keyhandler.f.cmd, kstr, NULL);
|
||||
if ((pid = spawn(NULL, &writefd, 0x0, argv)) < 0)
|
||||
if ((pid = spawn(NULL, &writefd, argv)) < 0)
|
||||
return false;
|
||||
if ((pfs = fdopen(writefd, "w")) == NULL) {
|
||||
error(0, errno, "open pipe");
|
||||
|
@ -805,15 +800,13 @@ static void run(void)
|
|||
pfd[FD_INFO].fd = info.fd;
|
||||
pfd[FD_TITLE].fd = wintitle.fd;
|
||||
pfd[FD_ARL].fd = arl.fd;
|
||||
|
||||
pfd[FD_X].events = pfd[FD_ARL].events = POLLIN;
|
||||
pfd[FD_INFO].events = pfd[FD_TITLE].events = 0;
|
||||
pfd[FD_X].events = pfd[FD_INFO].events = pfd[FD_TITLE].events = pfd[FD_ARL].events = POLLIN;
|
||||
|
||||
if (poll(pfd, ARRLEN(pfd), to_set ? timeout : -1) < 0)
|
||||
continue;
|
||||
if (pfd[FD_INFO].revents & POLLHUP)
|
||||
if (pfd[FD_INFO].revents & POLLIN)
|
||||
read_info();
|
||||
if (pfd[FD_TITLE].revents & POLLHUP)
|
||||
if (pfd[FD_TITLE].revents & POLLIN)
|
||||
read_title();
|
||||
if ((pfd[FD_ARL].revents & POLLIN) && arl_handle(&arl)) {
|
||||
img.autoreload_pending = true;
|
||||
|
|
2
nsxiv.h
2
nsxiv.h
|
@ -356,7 +356,7 @@ int r_closedir(r_dir_t*);
|
|||
char* r_readdir(r_dir_t*, bool);
|
||||
int r_mkdir(char*);
|
||||
void construct_argv(char**, unsigned int, ...);
|
||||
pid_t spawn(int*, int*, int, char *const []);
|
||||
pid_t spawn(int*, int*, char *const []);
|
||||
|
||||
|
||||
/* window.c */
|
||||
|
|
2
thumbs.c
2
thumbs.c
|
@ -198,8 +198,6 @@ CLEANUP void tns_free(tns_t *tns)
|
|||
|
||||
free(cache_dir);
|
||||
cache_dir = NULL;
|
||||
free(cache_tmpfile);
|
||||
cache_tmpfile = cache_tmpfile_base = NULL;
|
||||
}
|
||||
|
||||
static Imlib_Image tns_scale_down(Imlib_Image im, int dim)
|
||||
|
|
17
util.c
17
util.c
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <spawn.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -231,27 +230,25 @@ void construct_argv(char **argv, unsigned int len, ...)
|
|||
assert(argv[len - 1] == NULL && "argv should be NULL terminated");
|
||||
}
|
||||
|
||||
static int mkspawn_pipe(posix_spawn_file_actions_t *fa, const char *cmd, int *pfd, int dupidx, int pipeflags)
|
||||
static int mkspawn_pipe(posix_spawn_file_actions_t *fa, const char *cmd, int *pfd, int dupidx)
|
||||
{
|
||||
int err = 0;
|
||||
int err;
|
||||
if (pipe(pfd) < 0) {
|
||||
error(0, errno, "pipe: %s", cmd);
|
||||
return -1;
|
||||
}
|
||||
if (pipeflags && (fcntl(pfd[0], F_SETFL, pipeflags) < 0 || fcntl(pfd[1], F_SETFL, pipeflags) < 0))
|
||||
err = errno;
|
||||
err = err ? err : posix_spawn_file_actions_adddup2(fa, pfd[dupidx], dupidx);
|
||||
err = posix_spawn_file_actions_adddup2(fa, pfd[dupidx], dupidx);
|
||||
err = err ? err : posix_spawn_file_actions_addclose(fa, pfd[0]);
|
||||
err = err ? err : posix_spawn_file_actions_addclose(fa, pfd[1]);
|
||||
if (err) {
|
||||
error(0, err, "mkspawn_pipe: %s", cmd);
|
||||
error(0, err, "posix_spawn_file_actions: %s", cmd);
|
||||
close(pfd[0]);
|
||||
close(pfd[1]);
|
||||
}
|
||||
return err ? -1 : 0;
|
||||
}
|
||||
|
||||
pid_t spawn(int *readfd, int *writefd, int pipeflags, char *const argv[])
|
||||
pid_t spawn(int *readfd, int *writefd, char *const argv[])
|
||||
{
|
||||
pid_t pid = -1;
|
||||
const char *cmd;
|
||||
|
@ -266,9 +263,9 @@ pid_t spawn(int *readfd, int *writefd, int pipeflags, char *const argv[])
|
|||
return pid;
|
||||
}
|
||||
|
||||
if (readfd != NULL && mkspawn_pipe(&fa, cmd, pfd_read, 1, pipeflags) < 0)
|
||||
if (readfd != NULL && mkspawn_pipe(&fa, cmd, pfd_read, 1) < 0)
|
||||
goto err_destroy_fa;
|
||||
if (writefd != NULL && mkspawn_pipe(&fa, cmd, pfd_write, 0, pipeflags) < 0)
|
||||
if (writefd != NULL && mkspawn_pipe(&fa, cmd, pfd_write, 0) < 0)
|
||||
goto err_close_readfd;
|
||||
|
||||
if ((err = posix_spawnp(&pid, cmd, &fa, NULL, argv, environ)) != 0) {
|
||||
|
|
Loading…
Reference in New Issue