Commit graph

43 commits

Author SHA1 Message Date
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 b42e3ef3d4 fix -Wstrict-prototype warning
looks like i missed one in ff88908
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
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
Bert Münnich 148026007c One header file for type definitions and function declarations 2017-10-16 21:10:35 +02:00
Bert Münnich 5dc7993478 Simplified command arguments 2015-01-11 11:39:38 +01:00
Bert Münnich 06164c29b7 Revised command structure and key and mouse button mappings 2014-07-23 21:50:31 +02:00
Bert Münnich e685859a30 Use a checkerboard background for alpha layer; fixes issue #138 2014-04-06 22:47:42 +02:00
Bert Münnich 524d9de877 Removed fit-win-to-img command 2014-02-04 22:38:24 +01:00
Bert Münnich f6510b0a04 Merged pull request #129 2014-01-31 13:21:23 +01:00
Bert Münnich e82397db15 Fixed handling of overloaded key mappings
Issue described here:
https://bbs.archlinux.org/viewtopic.php?pid=1117294#p1117294
2014-01-08 22:58:34 +01:00
Bert Münnich 6a0fa2507c Slideshow mode is back, in a simplified version 2014-01-04 19:07:15 +01:00
Bert Münnich f2e0c492bd Moved external shell commands into exec/key-handler script
Gets called on all unset key mappings. Arguments are: key combo and
current file. Thanks to Francesco Orsenigo (xarvh) for the idea.
2014-01-02 23:19:31 +01:00
Bert Münnich b2eae528ed Proper support for Ctrl/Shift/Alt modifiers in key & mouse mappings 2014-01-02 14:13:08 +01:00
Bert Münnich 091aacb462 Merge remote-tracking branch 'baskerville/reverse-marks' 2013-11-14 17:57:45 +01:00
Bastien Dejean 562197577b Add command to reverse marked images 2013-11-14 14:45:27 +01:00
András Mohari 0353e6eea2 Add support for changing the gamma value 2013-11-13 20:54:09 +01:00
Bert Münnich 7d878bd16d Added file marks; fixes issue #94
- Command it_toggle_image_mark (bound to 'm') toggles mark of current
  image
- Command it_navigate_marked (bound to 'N'/'P') can be used to go to
  the next/previous marked image
- When option -o is given, all marked files get printed
2013-08-10 21:18:53 +02:00
Bert Münnich 6d3bbc6d5e Updated/corrected license header 2013-02-08 21:52:41 +01:00
hut 3a0a1ae889 Removed old definitions from commands.h 2013-01-27 13:10:28 +01:00
Bert Münnich f2a3d73212 New command: i_alternate, go to last image, issue #65 2012-08-16 13:40:04 +02:00
Bert Münnich d1a1e0142b Simplified & sped up reloading of all thumbnails 2012-05-13 21:52:53 +02:00
baskerville de4e9fc83e Added a command to refresh the thumbnails 2012-05-08 16:30:56 +02:00
baskerville ba0a5b89fa Added horizontal and vertical flip commands 2012-05-06 09:39:45 +02:00
Bert Münnich c666d30eea Added it_toggle_bar command; default mapping: XK_b 2012-02-15 22:33:39 +01:00
Bert Münnich d407dd65d5 Already in the year 2012 2012-02-15 19:16:24 +01:00
Bert Münnich 1cdbeb972a Added screen-wise scrolling for thumbnail mode 2011-10-27 16:21:01 +02:00
Bert Münnich 4e8dabd6ac Added i_reset_slideshow: set slideshow delay to number prefix 2011-10-16 18:58:32 +02:00
Bert Münnich 4f5ce2e828 Added i_set_zoom command: set zoom to number prefix 2011-10-16 17:58:53 +02:00
Bert Münnich dc727b8dce Added support for number prefix for commands 2011-10-16 16:08:55 +02:00
Bert Münnich 36177fb180 Updated contact information 2011-10-14 10:40:49 +02:00
Bert b2a2a62b7b Added own bool type 2011-09-11 21:01:24 +02:00
Bert 510512714d Added slideshow support 2011-09-10 18:41:20 +02:00
Bert 26eae8be96 Made i(t)_toggle_alpha command work in thumbnail mode too 2011-09-04 13:29:17 +02:00
Bert d585b86354 Reformated license header 2011-09-03 23:11:45 +02:00
Bert bb577d274d Added command to toggle gif animations 2011-08-19 18:46:17 +02:00
Bert 86a6f00112 Added support for multi-frame images 2011-08-19 15:12:30 +02:00
Bert 1d749382f0 Put event handling back into main.c; events -> commands 2011-08-19 15:02:10 +02:00
Bert c58307ba38 Merged commands.h into config.h 2011-04-14 12:00:35 +02:00
Bert a82c45431b Use ctrl for ext cmds, disable them in config.h 2011-03-09 10:08:43 +01:00
Bert 00d4b0f7cf Use "/bin/sh -c" for external commands 2011-03-03 10:52:16 +01:00
Bert 50e8fbf7b3 Slightly refactored commands.h 2011-03-01 22:14:09 +01:00
Bert c05fd44bdd Support for external commands like mogrify & jpegtran 2011-03-01 18:49:02 +01:00