Commit Graph

116 Commits (master)

Author SHA1 Message Date
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
NRK 80ada33c66 fix tcc warning 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 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
LuXu 36f42081d0
make width of navigation area configurable (#155)
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-11-04 04:20:28 +00:00
NRK d0b5005a02 -0 sends NULL separated file-list to key-handler
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-29 17:45:55 -06:00
N-R-K 850bc788c3
code-style: general cleanups (#137)
* 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-29 02:00:53 +06:00
eylles 5b3221cfa6
update copyright notice (#139) 2021-10-28 16:41:16 +06:00
LuXu 57754572bc Add default key-binding for DRAG_RELATIVE (#117)
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-27 09:02:07 +06:00
Arthur Williams 12efa0e3b4 Add ability to bind arbitrary functions.
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-13 06:05:00 +06:00
Berke Kocaoğlu 1449bfc5e9
code-style: fix consistency issues all over the codebase (#94)
* 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-11 09:07:18 +06:00
N-R-K 6ce94e3e3b
add statusbar message upon key-hander activation (#98)
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-10-07 00:37:34 +00:00
Lu Xu a2339e70fd Use zoom steps instead of hard-coding levels (#92)
Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
2021-09-25 11:11:21 +06:00
N-R-K 63972db743
add -0 for outputting null-terminated list (#68)
* 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-20 23:11:47 +00:00
Berke Kocaoğlu 7cce7ea857 Rename, Update Docs and Prepare for Release (#9)
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>
2021-09-16 22:55:31 +03:00
Bert Münnich 1613b42411 Simplify cg_mark_range further 2018-06-10 12:39:23 +02:00
Bert Münnich 1de5f06f83 Set global markidx whenever a single img is (un)marked
This also sets *markidx* when using the right mouse button in thumbnail mode.
2018-06-09 14:07:13 +02:00
Bert Münnich 87a1ace8a1 (Un)mark single image through generic function 2018-06-09 13:12:46 +02:00
Bert Münnich 1892ed9fd7 Simplify cg_mark_range 2018-06-09 12:17:03 +02:00
Bert Münnich a1165df878 Rename variable toggledidx to markidx 2018-06-09 11:57:42 +02:00
Bert Münnich cc476be7cc Remove unnecessary special cases in cg_mark_range 2018-06-09 11:52:48 +02:00
Daniel Lublin 6e696ba98c Add mark range function
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-06-09 11:44:47 +02:00
Bert Münnich 762420cdf1 Close image-info explicitly 2018-02-18 14:12:41 +01:00
phi d5c5708110 Use argument to select between two drag methods 2018-01-22 09:46:38 +01:00
Bert Münnich 148026007c One header file for type definitions and function declarations 2017-10-16 21:10:35 +02:00
Bert Münnich 8081cbebf3 Improve mouse support
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-06 10:15:43 +02:00
Bert Münnich ee908ca0a1 Simplify cursor reset in image mode
No need to give cursor name. reset_cursor() is now the only place to decide
what cursor to fall back to.
2017-10-05 13:49:11 +02:00
Bert Münnich d81442f55d Own win method for mouse cursor location 2017-10-05 13:47:02 +02:00
Bert Münnich e310136e02 Mouse drag translates pointer position to image area
This makes mouse panning more direct and faster.
2017-10-04 18:22:43 +02:00
Bert Münnich ff2ce99bf7 Merge djhejna/floatdelay 2016-12-01 21:18:41 +01:00
Bert Münnich f75fa78eca Make navigate_frame command respect a count prefix 2015-12-26 15:24:08 +01:00
Bert Münnich d3a70a285d Revised error handling
- 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-28 23:03:37 +01:00
Bert Münnich e574a6d0dd Removed feature test macro definitions from source files 2015-10-28 21:37:45 +01:00
Bert Münnich 5dc7993478 Simplified command arguments 2015-01-11 11:39:38 +01:00
Bert Münnich 47e6cd0669 Apply gamma value on thumbnails too; fixes issue #193 2015-01-05 20:53:04 +01:00
Bert Münnich 47af0dd7b5 Cache out of view thumbnails in the background 2015-01-04 21:24:43 +01:00
Bert Münnich 9b9294bae6 Use bit-field for boolean flags in fileinfo struct 2015-01-04 21:24:43 +01:00
Bert Münnich 0cb1d11305 Removed obsolete ss_delays array, fixes issue #191 2014-12-22 09:00:36 +01:00
Bert Münnich ddd028eb3e Unified file count variable for image & thumbnail mode 2014-09-30 21:54:17 +02:00
Bert Münnich 7b91e10f22 Added thumbnail zooming...
- Key mappings +/- are now general commands
- Use JPG as thumbnail cache file format instead of PNG
- Fixes issue #161
2014-09-28 00:28:50 +02:00
Bert Münnich eaa269b6cb Revised thumbnail loading...
- 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-26 10:31:03 +02:00
Bert Münnich 2fbc21a205 Simplified img_frame_animate 2014-09-01 20:41:33 +02:00
Bert Münnich 95a7496edc Fixed segfault in ci_toggle_animation, fixes issue #173 2014-09-01 20:40:17 +02:00
Bert Münnich 1094def183 Added command to remove all image marks, bound to Ctrl-m; fixes issue #163 2014-08-17 20:27:01 +02:00
Bert Münnich e49d38d6f9 Fixed wrong thumbnail-to-file mappings caused by file deletions 2014-08-16 22:21:51 +02:00
Bert Münnich e267dc7793 Pass marked files to external key handler in thumbnail mode; fixes issue #135 2014-08-16 21:49:46 +02:00
Bert Münnich 284be74927 Count number of marked files 2014-08-16 21:49:46 +02:00
Bert Münnich 5b01c15176 Unified file index variable for image & thumbnail mode 2014-08-16 21:49:45 +02:00