Commit Graph

896 Commits (master)

Author SHA1 Message Date
gianmarco 00ab60f26c Updated the README.md 2022-05-10 22:45:00 +02:00
gianmarco 73d521e73a First commit from myself, changed the config and the icons 2022-05-10 22:25:45 +02:00
N-R-K ec5a51d798
fix: correctly close the font (#250)
currently we immediately close the font on win_init_font(), which was
introduced in 0d8dcfd. this was probably not correct since we use `font`
later in win_draw_text().

instead, the font should be closed at exit/cleanup.
2022-04-10 12:36:09 +00:00
Kim Woelders 14e9c34ecc Improve starting in fullscreen mode
Instead of effectively first mapping the window at regular size and then
fullscreening it, tell the WM to map the window at fullscreen size by
setting _NET_WM_STATE_FULLSCREEN before mapping the window.
2022-03-31 14:52:50 +00:00
Kim Woelders e9468d3d36 Correct setting of _NET_WM_PID
The property _NET_WM_PID is a CARDINAL which per definition has format
32, whatever the size of pid_t may be.
CARDINALS (and other format 32 items) must always be passed to Xlib in
long's, whatever the size of long may be.
2022-03-31 14:52:50 +00:00
N-R-K bf6c062779
fix: thumbnail memory leak when removing file (#247) 2022-03-27 09:34:44 +00:00
Nick Morrott 590d9fe0a9
Fix typo and manpage improvement (#249)
* Fixes some typo and adds some consistency to the manpage

Typo detected automatically whilst packaging nsxiv for Debian

Co-authored-by: NRK <nrk@disroot.org>
2022-03-26 10:02:22 +00:00
N-R-K 1ef0c1f152
fix: close the file descriptor in get_win_title() (#245)
this would eventually end up opening too many fds and erroring out with
"too many open files".
2022-03-17 19:18:22 +00:00
Berke Kocaoğlu 7f71ddf4fc
Export known issues in readme to GitHub issues (#243)
Export known issues in readme to GitHub issues and link the issue
2022-03-08 10:23:35 +03:00
N-R-K 231b317578
Release version 29 2022-03-03 12:31:33 +00:00
NRK 700d9f46c7 fix: window title not working on certain WMs
not all WMs support `_NET_WM_NAME` and `_NET_WM_ICON_NAME`
this patch sets `WM_NAME` and `WM_ICON_NAME` inside win_set_title()

Closes: https://github.com/nsxiv/nsxiv/issues/233
2022-03-02 09:32:35 +00:00
NRK ad571e7448 always initialize window title
before if exec/win-title didn't exist then window title wouldn't be set.
this patch makes it so window title is always set to something.
2022-03-02 09:32:35 +00:00
NRK bdd9521bf3 code-style: slight cleanups
* put TOP_STATUSBAR under the HAVE_LIBFONTS guard
* change get_win_title param to take unsigned char ptr
* init UTF8_STRING like other atoms
2022-03-02 09:32:35 +00:00
N-R-K d9db7d76b4
Makefile: cleanup non-posix stuff (#225)
remove some non-posix extensions which slipped through and adjust ci to
new Makefile changes

users can still overwrite the variables explicitly by using
`make VAR=VALUE`

packagers can also add extra libs to LDLIBS, we're internally using
NSXIV_LDLIBS now.
2022-02-27 14:47:06 +00:00
N-R-K bda70867ac
add config.h option for top statusbar (#231)
Closes: https://github.com/nsxiv/nsxiv/issues/230
Co-authored-by: mamg22 <45301823+mamg22@users.noreply.github.com>
2022-02-26 16:38:53 +00:00
Berke Kocaoğlu 9f12c79d1b
Add libXft-bgra to FAQ in readme (#229)
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: eylles <ed.ylles1997@gmail.com>
Co-authored-by: explosion-mental <explosion0mental@gmail.com>
Co-authored-by: mamg22 <marcomonizg@gmail.com>
2022-02-25 01:36:58 +03:00
N-R-K e26c81fe9a
use win-title script for customizing window title (#213)
this removes the cli flag `-T` as well as related config.h options.

Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2022-02-23 09:23:22 +00:00
N-R-K ad95012be9
Add reuseable abstraction over fork/exec/dup2 (#211) 2022-02-20 15:54:29 +00:00
N-R-K 3cf4fc5e81
Fix broken ci and enable higher level optimization (#220)
* [ci] fix broken ci

* [ci] enable higher optimization level and lto

higher optimization levels enable more warnings and deeper analysis.
likewise, lto can catch a couple errors which typically goes unnoticed
without it.
2022-02-20 13:55:17 +06:00
NRK 79556e9b02 declare internal variables as static 2022-02-17 06:16:19 +00:00
NRK 48343e99b8 code-style: prefer calloc over malloc+memset 2022-02-17 06:16:19 +00:00
NRK 9cdeeab9b8 update copyright year 2022-02-13 19:35:58 +03:00
Nick Hanley 2ac44709bd
Add keybind to scroll to image center (#203)
There are keybinds for scrolling to the edges of an image but there's no way back to the center. This is particularly annoying while zooming.
2022-01-15 18:51:31 -04:00
N-R-K 7a75c42b37
make thumbnail bindings configureable via config.h (#167)
this allows for configuring thumbnail mode mouse bindings similar to
image mode bindings.

however we can't put the thumbnails bindings into the existing buttons[]
array due to fallthrough. For example M3 would switch mode and then end
up selecting an image.

which is why thumbnail bindings have been put into it's own array
`buttons_tns[]` and `buttons[]` has been renamed to `buttons_img[]` for
consistency.

Closes: https://github.com/nsxiv/nsxiv/issues/131
2022-01-10 16:52:06 +00:00
mamg22 157cda5b31
Document development workflow for maintainers (#202)
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2022-01-08 15:09:38 +00:00
NRK a9c6cbcd20 [ci] separate dep from build
removes /dev/null redirections from the dep step so in case some dep
fails to install/compile we will have the log.
2022-01-06 17:53:02 +00:00
NRK 35a9ca33d6 [ci] fetch tcc from a known working commit
avoids our ci failing in case there's a faulty new commit on tcc.
2022-01-06 17:53:02 +00:00
NRK 598f4c7855 add additional warning and -Werror to github workflow 2022-01-06 17:53:02 +00:00
NRK 8cc5cee08f fix -Wwrite-strings related warnings 2022-01-06 17:53:02 +00:00
NRK 80ada33c66 fix tcc warning 2022-01-06 17:53:02 +00:00
NRK 5a3fb3b812 fix -Wmaybe-uninitialized warning 2022-01-06 17:53:02 +00:00
NRK b42e3ef3d4 fix -Wstrict-prototype warning
looks like i missed one in ff88908
2022-01-06 17:53:02 +00:00
NRK 90bec70e7f fix -Wshadow related warnings
fixes all -Wshadow related warnings (on gcc). this would allow us to use
`-Wshadow` in github workflow (https://github.com/nsxiv/nsxiv/pull/195).

i've thought about adding `-Wshadow` to our Makefile as well, but
decided against it to keep the Makefile CFLAGS barebore/minimal.
2022-01-06 17:53:02 +00:00
N-R-K 1a18523772
fix: reset statusbar after failed keyhandler (#191)
currently if the keyhandler invocation fails, for example due to it not
being present, the statusbar does not reset and stays on "getting
keyhandler input" message.

now the return value from run_key_handler() is used to determine if the
function was successful or not. and if the function failed, we call
handle_key_handler() with false which resets the statusbar.

we also no longer call redraw() within run_key_handler() and instead assign
it's return value to dirty which does a redraw if true.
2022-01-03 09:24:26 +00:00
N-R-K f7145db7f8
remove unused function and typedef (#199)
byteorder_t and size_readable is not used anywhere within the code.

byteorder_t seems to be a remain from some time sxiv handled exif data itself instead of relying on a library, introduced in 691c6d7, and probably became irrelevant when libexif was added as dependency again. And size_readable from some time it displayed the file size in the window title, introduced in bad9a70.
2022-01-02 23:13:23 +03:00
N-R-K 0f3766eaab
fix: animation slowdown when zoomed in (#200)
rendering is a pretty expensive operation, especially when scaling with
anti-aliasing. by waiting for the image to render before setting
timeout, the actual timeout ends up being (render time + actual delay).

this pretty much fixes the slowdown entirely on all the images i've
tested. it should also improve things noticeably even in cases where
the delay between frames is shorter than how fast we can render.
although on such images, the issue may not be fixed entirely.

Closes: https://github.com/nsxiv/nsxiv/issues/70
2022-01-03 02:07:43 +06:00
N-R-K e839638156
fix: jpeg exif orientation on Imlib2 v1.7.5 (#188)
since Imlib2 v1.7.5, it is capable of parsing exif data on jpeg files
and auto orienting them. this caused nsxiv to rotate the image twice.

Closes: https://github.com/nsxiv/nsxiv/issues/187
2022-01-02 02:28:19 +06:00
MahouShoujoMivutilde e777adf985
Allow setting cache size based on memory percentage (#184)
The problem:

1. For the most people imlib2's default 4MiB is unreasonably low;

2. Hardcoding cache size to ~256MiB has performance benefits and doesn't
   increase RAM usage too much on relatively modern systems;

3. But we can't do that, because that would be detrimental to low spec systems
   that (apparently) not (?) building nsxiv from source, as been discussed
   #171

Solution:

Calculate cache size based on total memory.

Default is set as 3%, which means:
* ~245MiB for 8GiB
* ~30MiB for 1GiB
* and so on

CACHE_SIZE_LIMIT (256MiB by default) sets the highest possible value. And in
case we cannot determine the total memory (e.g since _SC_PHYS_PAGES isn't
POSIX) use CACHE_SIZE_FALLBACK (32MiB by default) instead.

Co-authored-by: NRK <nrk@disroot.org>
2022-01-01 14:55:59 +06:00
N-R-K 1a691d42f6
fix: broken compilation when using HAVE_LIBFONTS=0 (#194)
compilation currently fails with `make HAVE_LIBFONTS=0` due to
`EXIT_SUCCESS` not being defined. I assume Xft.h includes stdlib.h which
is why compilation works with HAVE_LIBFONTS=1

this switches to using 0 as cg_quit argument in keybindings. if my
interpretation of the C99 standard is correct, then 0 and EXIT_SUCCESS
means the same thing.

> If the value of status is zero or EXIT_SUCCESS, an
> implementation-defined form of the status successful termination is
> returned.
2021-12-29 22:21:59 -04:00
NRK 1c8ea413f3 add github actions (#195)
this runs both default and minimal build with gcc, clang and tcc.
2021-12-29 17:16:24 +06:00
mamg22 2e2942d926
Cleanup manpage (#186)
* Move `-T` option in manpage

The `-T` option breaks the alphabetical order of options in both the
SYNOPSIS and OPTION sections

* Reword "on bottom of" in manpage

* Pluralize "count pixel"

* Fix typos

* Reword `M` keyboard binding description

* rename info bar -> statusbar for consistency

* document all the thumbnail bindings

* Add website to HOMEPAGE section

* Add missing maintainers

* Sort maintainers by activity

Co-authored-by: NRK <nrk@disroot.org>
2021-12-24 05:25:49 +06:00
N-R-K ff88908531
specify func argument and related cleanup (#183)
* specifies the function argument type in commands.h compared to leaving
  it unspecified. all the functions in cmd_t must have arg_t as it's
  argument.
* changes to commands.h will now trigger a rebuild - this restores old
  behavior prior to 12efa0e
* cg_quit now uses it's argument as exit status
* DestroyNotify invokes cg_quit rather than calling exit directly.
* Explicitly pass EXIT_SUCCESS to cgquit in keybinding

Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-12-19 23:05:35 +06:00
Sanjay Pavan 494578cebb
README: Fix version badge (#185) 2021-12-12 12:14:33 +00:00
NRK 61da0a8ca9 refactor: move shared code into a function 2021-12-12 17:58:17 +06:00
NRK b0b16f1d0f img_load_webp: close the file handler and use errno 2021-12-12 17:58:17 +06:00
NRK 22ca3b567d img_load_webp: simplify multi-frame allocation
C89 standard specifies:
If ptr is a null pointer, the realloc function behaves like the malloc
function for the specified size.
2021-12-12 17:58:17 +06:00
NRK 3b6db44267 img_load_webp: remove unnecessary casting 2021-12-12 17:58:17 +06:00
NRK eccd7de532 remove unneeded animated-webp hacks
now that imlib2 (v1.7.5) is able to load the first frame of an
animated-webp file, we no longer need the `is_webp` check to bypass
imlib2.

ref: https://phab.enlightenment.org/T8964
2021-12-12 17:58:17 +06:00
N-R-K 7a94a5ecc6
Release version 28
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-12-12 08:03:12 +00:00
N-R-K 36a4847bcf
fix: compile error (#182)
* fix compile error

* use variable instead of macro

* Revert "use variable instead of macro"

This reverts commit a14ef0b231c50e49906761010a4d4231ce4e3e36.

* use local variable instead of macro

* Revert "use local variable instead of macro"

This reverts commit 7e049d55d94f5c003d90e1a10187356f6a7f54b2.
2021-12-09 22:03:18 +03:00