aboutsummaryrefslogtreecommitdiff
path: root/commands.c
Commit message (Collapse)AuthorAgeFilesLines
* sort and group includesNRK2022-06-281-4/+4
| | | | | | | | | | | | | * includes are sorted alphabetically * their grouping and layout is the following: - nsxiv.h will be the first include - followed by any internal headers (e.g "commands.h" "config.h") - followed by system headers (<stdlib.h> etc) - followed by third party headers (X.h libwebp etc) * also add `llvm-include-order` check to clang-tidy so that it can catch unsorted includes during CI.
* code-style: cleanup includesNRK2022-06-281-0/+1
| | | | | | | | * rm unused include <sys/types.h> * move <sys/time.h> to main.c, it's the only file that needs it. * move TV_* macros to main.c * let *.c files explicitly include what they need instead of including them at nsxiv.h
* reduce calls to win-titleNRK2022-06-021-0/+1
| | | | | | | | | rather than calling the script unconditionally per redraw, we now have a `title_dirty` flag and keep track of when any of the relavent information changes. Co-authored-by: Arthur Williams <taaparthur@gmail.com> Partially fixes: https://github.com/nsxiv/nsxiv/issues/258
* Declare every extern function/variable in `nsxiv.h` (#268)N-R-K2022-05-031-25/+2
| | | | | | | | with a couple exceptions as they cause too many -Wshadow warnings. also moves the `extcmd_t` typedef on top for cosmetic purposes. also enable `-Wmissing-prototypes` in the ci
* Add thumb-info (#265)N-R-K2022-05-031-1/+8
| | | | Closes: https://github.com/nsxiv/nsxiv/issues/88 Closes: https://github.com/nsxiv/nsxiv/pull/253
* code-style: reduce some unnecessary if-elses (#261)N-R-K2022-04-271-4/+1
| | | | also change the condition inside img_frame_animate() to check for positive value rather than comparing against 0.
* update copyright yearNRK2022-02-131-1/+1
|
* Add keybind to scroll to image center (#203)Nick Hanley2022-01-151-0/+5
| | | 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.
* make thumbnail bindings configureable via config.h (#167)N-R-K2022-01-101-0/+55
| | | | | | | | | | | | | | 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
* fix tcc warningNRK2022-01-061-0/+1
|
* fix -Wshadow related warningsNRK2022-01-061-3/+3
| | | | | | | | 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.
* specify func argument and related cleanup (#183)N-R-K2021-12-191-2/+2
| | | | | | | | | | | | * 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>
* make width of navigation area configurable (#155)LuXu2021-11-041-2/+2
| | | | | | | | | 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>
* -0 sends NULL separated file-list to key-handlerNRK2021-10-291-1/+1
| | | | | | | | with this change `-0` is turned into a more generic switch which can be used to send NULL-separated file-list to the key-handler as well. this also means `-0` no longer implicitly enables `-o` Closes: https://github.com/nsxiv/nsxiv/issues/140
* code-style: general cleanups (#137)N-R-K2021-10-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops <uidops@protonmail.com> Co-authored-by: Arthur Williams <taaparthur@gmail.com>
* update copyright notice (#139)eylles2021-10-281-1/+2
|
* Add default key-binding for DRAG_RELATIVE (#117)LuXu2021-10-271-1/+1
| | | | | | | | 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>
* Add ability to bind arbitrary functions.Arthur Williams2021-10-131-12/+0
| | | | | | | | | | | | | | | | | | | | | | | Before all the predated commands where kept in an array and their indexes were used in bindings. This meant that users couldn't add their own functions from the config file. Now key/mouse bindings have been changed to to store the function ptr (wrapped in a cmd_t struct to also store the mode) directly instead. General cleanup done in this commit: Defined `MODE_ALL` instead of using magic number. For example, suppose one had bindings like: { 0, XK_q, g_quit, None }, { ShitMask, XK_q, {quit_err}, None } { ControlMask, XK_q, {quit_err, .mode=MODE_IMAGE}, None } The existing binding `q` has been left unchanged and is defined the same way. However, the new hypothetical binding `Shift-q` can be used to call the custom function quit_err in any mode (default). `Ctrl-q` on the other hand will be called only on image mode. Closes #50
* code-style: fix consistency issues all over the codebase (#94)Berke Kocaoğlu2021-10-111-5/+3
| | | | | | | | | | | | | | | * 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>
* add statusbar message upon key-hander activation (#98)N-R-K2021-10-071-1/+2
| | | | | | | | | Currently when running the key-handler the statusbar shows a "Running key-handler..." message, but there's no indication of the prefix key being pressed. There's a slight functional benefit of this patch in the sense that users can visually tell if the key-handler is listening on input or if the key-handler has been aborted or not.
* Use zoom steps instead of hard-coding levels (#92)Lu Xu2021-09-251-6/+2
| | | | | Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* add -0 for outputting null-terminated list (#68)N-R-K2021-09-201-1/+1
| | | | | | | | | | | | * add -0 for outputting null-terminated list this doesn't add much, if any, additional complexity to the codebase and can be quite handy for scripting purposes. Closes: https://github.com/nsxiv/nsxiv/issues/67 * Fix typo Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
* Rename, Update Docs and Prepare for Release (#9)Berke Kocaoğlu2021-09-161-5/+5
| | | | | | | Co-authored-by: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com> Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Arthur Williams <taaparthur@gmail.com> Co-authored-by: eylles <ed.ylles1997@gmail.com>
* Simplify cg_mark_range furtherBert Münnich2018-06-101-5/+3
|
* Set global markidx whenever a single img is (un)markedBert Münnich2018-06-091-4/+3
| | | | This also sets *markidx* when using the right mouse button in thumbnail mode.
* (Un)mark single image through generic functionBert Münnich2018-06-091-14/+6
|
* Simplify cg_mark_rangeBert Münnich2018-06-091-22/+11
|
* Rename variable toggledidx to markidxBert Münnich2018-06-091-6/+6
|
* Remove unnecessary special cases in cg_mark_rangeBert Münnich2018-06-091-5/+0
|
* Add mark range functionDaniel Lublin2018-06-091-0/+35
| | | | | Sets the marked state of all images ranging from the latest marked/unmarked image to the current image, to the state of that latest toggled image.
* Close image-info explicitlyBert Münnich2018-02-181-1/+4
|
* Use argument to select between two drag methodsphi2018-01-221-6/+15
|
* One header file for type definitions and function declarationsBert Münnich2017-10-161-9/+4
|
* Improve mouse supportBert Münnich2017-10-061-0/+6
| | | | | | | | | | | | 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.
* Simplify cursor reset in image modeBert Münnich2017-10-051-1/+1
| | | | | No need to give cursor name. reset_cursor() is now the only place to decide what cursor to fall back to.
* Own win method for mouse cursor locationBert Münnich2017-10-051-6/+4
|
* Mouse drag translates pointer position to image areaBert Münnich2017-10-041-54/+23
| | | | This makes mouse panning more direct and faster.
* Merge djhejna/floatdelayBert Münnich2016-12-011-2/+2
|
* Make navigate_frame command respect a count prefixBert Münnich2015-12-261-0/+2
|
* Revised error handlingBert Münnich2015-10-281-2/+0
| | | | | | | - Functions warn() and die() replaced by GNU-like error(3) function - Register cleanup() with atexit(3) - Functions called by cleanup() are marked with CLEANUP and are not allowed to call exit(3)
* Removed feature test macro definitions from source filesBert Münnich2015-10-281-3/+2
|
* Simplified command argumentsBert Münnich2015-01-111-54/+35
|
* Apply gamma value on thumbnails too; fixes issue #193Bert Münnich2015-01-051-5/+11
|
* Cache out of view thumbnails in the backgroundBert Münnich2015-01-041-1/+1
|
* Use bit-field for boolean flags in fileinfo structBert Münnich2015-01-041-8/+8
|
* Removed obsolete ss_delays array, fixes issue #191Bert Münnich2014-12-221-4/+0
|
* Unified file count variable for image & thumbnail modeBert Münnich2014-09-301-14/+9
|
* Added thumbnail zooming...Bert Münnich2014-09-281-12/+14
| | | | | | - Key mappings +/- are now general commands - Use JPG as thumbnail cache file format instead of PNG - Fixes issue #161
* Revised thumbnail loading...Bert Münnich2014-09-261-1/+2
| | | | | | | - Only load the thumbnails that are currently visible in the window - Unload thumbnails that are leaving the visible area - Much less memory needed, but scrolling is now slower - This also unintentionally fixes issue #86
* Simplified img_frame_animateBert Münnich2014-09-011-1/+1
|