summaryrefslogtreecommitdiffstats
path: root/commands.c
AgeCommit message (Collapse)Author
2022-06-02reduce calls to win-titleNRK
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
2022-05-03Declare every extern function/variable in `nsxiv.h` (#268)N-R-K
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
2022-05-03Add thumb-info (#265)N-R-K
Closes: https://github.com/nsxiv/nsxiv/issues/88 Closes: https://github.com/nsxiv/nsxiv/pull/253
2022-04-27code-style: reduce some unnecessary if-elses (#261)N-R-K
also change the condition inside img_frame_animate() to check for positive value rather than comparing against 0.
2022-02-13update copyright yearNRK
2022-01-15Add keybind to scroll to image center (#203)Nick Hanley
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-10make thumbnail bindings configureable via config.h (#167)N-R-K
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-06fix tcc warningNRK
2022-01-06fix -Wshadow related warningsNRK
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.
2021-12-19specify func argument and related cleanup (#183)N-R-K
* 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-11-04make width of navigation area configurable (#155)LuXu
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>
2021-10-30-0 sends NULL separated file-list to key-handlerNRK
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
2021-10-28code-style: general cleanups (#137)N-R-K
* 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>
2021-10-28update copyright notice (#139)eylles
2021-10-27Add default key-binding for DRAG_RELATIVE (#117)LuXu
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>
2021-10-13Add ability to bind arbitrary functions.Arthur Williams
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
2021-10-11code-style: fix consistency issues all over the codebase (#94)Berke Kocaoğlu
* 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>
2021-10-07add statusbar message upon key-hander activation (#98)N-R-K
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.
2021-09-25Use zoom steps instead of hard-coding levels (#92)Lu Xu
Co-authored-by: NRK <nrk@disroot.org> Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-09-21add -0 for outputting null-terminated list (#68)N-R-K
* 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>
2021-09-16Rename, Update Docs and Prepare for Release (#9)Berke Kocaoğlu
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>
2018-06-10Simplify cg_mark_range furtherBert Münnich
2018-06-09Set global markidx whenever a single img is (un)markedBert Münnich
This also sets *markidx* when using the right mouse button in thumbnail mode.
2018-06-09(Un)mark single image through generic functionBert Münnich
2018-06-09Simplify cg_mark_rangeBert Münnich
2018-06-09Rename variable toggledidx to markidxBert Münnich
2018-06-09Remove unnecessary special cases in cg_mark_rangeBert Münnich
2018-06-09Add mark range functionDaniel Lublin
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.
2018-02-18Close image-info explicitlyBert Münnich
2018-01-22Use argument to select between two drag methodsphi
2017-10-16One header file for type definitions and function declarationsBert Münnich
2017-10-06Improve mouse supportBert Münnich
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.
2017-10-05Simplify cursor reset in image modeBert Münnich
No need to give cursor name. reset_cursor() is now the only place to decide what cursor to fall back to.
2017-10-05Own win method for mouse cursor locationBert Münnich
2017-10-04Mouse drag translates pointer position to image areaBert Münnich
This makes mouse panning more direct and faster.
2016-12-01Merge djhejna/floatdelayBert Münnich
2015-12-26Make navigate_frame command respect a count prefixBert Münnich
2015-10-28Revised error handlingBert Münnich
- 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)
2015-10-28Removed feature test macro definitions from source filesBert Münnich
2015-01-11Simplified command argumentsBert Münnich
2015-01-05Apply gamma value on thumbnails too; fixes issue #193Bert Münnich
2015-01-04Cache out of view thumbnails in the backgroundBert Münnich
2015-01-04Use bit-field for boolean flags in fileinfo structBert Münnich
2014-12-22Removed obsolete ss_delays array, fixes issue #191Bert Münnich
2014-09-30Unified file count variable for image & thumbnail modeBert Münnich
2014-09-28Added thumbnail zooming...Bert Münnich
- Key mappings +/- are now general commands - Use JPG as thumbnail cache file format instead of PNG - Fixes issue #161
2014-09-26Revised thumbnail loading...Bert Münnich
- 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
2014-09-01Simplified img_frame_animateBert Münnich
2014-09-01Fixed segfault in ci_toggle_animation, fixes issue #173Bert Münnich
2014-08-17Added command to remove all image marks, bound to Ctrl-m; fixes issue #163Bert Münnich