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
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>
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.
* 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>
by default imlib2 uses a 4mb cache, which is quite small. this allows
users who have more memory to spare to set a bigger cache size and avoid
reloading an already viewed image if it fits into the cache.
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
with the exception of arrays, all other var names in config.h are in ALL
CAPS. since keyhandler_abort is an unreleased feature, it should be okay
to rename it for consistency.
though.. in the future we should be more careful about naming when
adding new vars to config.h (or the codebase in general.)
this allows users to configure navigation width from config.h. it also
allows disabling the navigation function entirely by using a 0 width.
one extra functionality this adds is being able to define an absolute
width (in pixels) instead of just percentage via `NAV_IS_REL`.
Co-authored-by: NRK <nrk@disroot.org>
Adds a set of config vars to control window fg/bg, bar fg/bg, mark
color and bar font. This allows everything that can be done from
.Xresources to be configurable from config.h.
Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
Ctrl-Button1 now has a relative drag using the XC_fleur cursor.
XC_fleur is normally the cursor for "size all" action, which has 4
arrows pointing to 4 directions.
Co-authored-by: NRK <nrk@disroot.org>
Previously, the value of imgcursor was determined by where a pointer
binding was set to a ci_cursor_navigate. If it was then the pointer
would change to left/right arrows depending on the position relative to
the window. Now the user has full control of over it which also allows
them to preserve the behavior in case they wrap the function.
* remove duplicate comment
* remove empty tabs and blank lines
* move macros and globals ontop
* comment to seprate function implementation
* fix alignment
* switch to *argv[] similar to other suckless code
* kill all empty last lines
* append comment to endif
* reuse existing ARRLEN macro
* comment fall through
* use while (true) everywhere
Co-authored-by: NRK <nrk@disroot.org>
Previous the code only allowed ShiftMask,ControlMask or Mod1Mask to be
used in keybindings and the presence of any others modifiers would be
ignored. Most problems generally allow certain modifiers to be be
ignored but not most and certainly don't allow Super-A to be treated
like A.
Now users can use any modifiers they want in keybindings and can also
ignore any modifiers they want. By default only ModMask2 (commonly
numlock is ignored)
Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
* add new keybind, Ctrl-a to toggle animation
Closes: https://github.com/nsxiv/nsxiv/issues/27
* Format consistency
This keeps in line with other actions that have multiple keybinds
Co-authored-by: eylles <ed.ylles1997@gmail.com>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
None of the mouse mappings uses a keyboard modifier, making it possible to
access the most basic features by only using the mouse.
Next/previous image with left button depending on cursor position, middle
button for dragging, right button for switching to thumnail mode and wheel for
zooming.
Users can keep the old behaviour by simply not adapting the changes to the
buttons array in config.def.h to their config.h file.