Commit graph

352 commits

Author SHA1 Message Date
Bert Münnich 1fb3ec576c Properly quit when window gets closed; fixes issue #27 2017-05-17 15:51:47 +02:00
Jakub Wilk c313edc0ad Fix typo 2017-02-15 20:20:41 +01:00
Bert Münnich 5c607ad495 Pass given file names to key-handler instead of real paths
Misbehaving command lines in the key-handler that rewrite the given files and
thus replace symbolic links instead of their targets shall call realpath(1).

Fixes issue #205 and reverts commit 92e3b578.
2017-01-07 14:44:33 +01:00
Bert Münnich ff2ce99bf7 Merge djhejna/floatdelay 2016-12-01 21:18:41 +01:00
Bert Münnich 9a85dd41d8 Ignore button and key events while key-handler is running
Related to issue #253, which originally asked for a non-blocking key-handler.
2016-11-30 20:48:32 +01:00
Don Hejna 27bbaab976 Support for DELAY as a floating point number including less than 1
second while maintaining backward compatibiitiy with integer
arguments.
2016-11-27 20:36:23 -08:00
Paride Legovini 86dc6860f9 Allow opening directories non-recursively 2016-09-28 19:27:48 +02:00
Bert Münnich c280129cef Use Xft for font loading and text drawing 2016-08-06 15:27:58 +02:00
Bert Münnich aabc2bddbd Provide image width and height to image-info script; fixes issue #159 2016-08-06 12:22:47 +02: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 851e4288c1 Prefix safe allocation functions with 'e' instead of 's_' 2015-10-28 22:29:01 +01:00
Bert Münnich b096cbd536 Removed unnecessary buffer size constants 2015-10-28 22:23:28 +01:00
Bert Münnich 9a7e97cd89 Use XSI realpath(3) 2015-10-28 21:52:41 +01:00
Bert Münnich 66c3c55759 Use POSIX.1-2008 getline(3) 2015-10-28 21:50:17 +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 e0e96977b3 Removed overcautious parameter checks 2015-10-28 21:01:24 +01:00
Bert Münnich a3838c1984 Always run image-info script after key-handler in image mode; fixes issue #213 2015-08-19 21:29:39 +02:00
Bert Münnich 92e3b57816 Pass real paths to key handler instead of the paths provided by the user
Programs called by the key handler might replace symlinks instead of their
targets.
2015-01-18 11:28:21 +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 6216bf6c2d Ignore SIGPIPE, caused by key handler exiting before all files got printed, fixes issue #188 2014-12-01 14:03:49 +01:00
Bert Münnich 216ad81b59 Pass file paths to key handler via stdin; fixes issue #187 2014-11-27 22:37:20 +01:00
Bert Münnich 51854c6148 Fixed leakage of pipe descriptors in case of failing fork 2014-11-27 22:25:27 +01:00
Bert Münnich 93e2a757d4 Do not print could-not-open-warnings for files found by directory traversal 2014-10-24 11:14:01 +02:00
Bert Münnich c33f2ad355 Corrected & refactored handling of window bar content...
Old snprintf calls could have overflowed the buffers.
2014-10-01 22:35:22 +02:00
Bert Münnich 8db3191f04 Fixed segfault on image removal with uninitialized thumbnails; fixes issue #177 2014-10-01 20:25:36 +02:00
Bert Münnich ddd028eb3e Unified file count variable for image & thumbnail mode 2014-09-30 21:54:17 +02:00
Bert Münnich b2dbd2fed3 Changed image mark in thumbnail view to small rectangle 2014-09-27 22:05:21 +02:00
Bert Münnich 5fce009b73 Refactored main loop; properly fixes startup issue 2014-09-26 22:47:28 +02:00
Bert Münnich c1e084357c Fixed startup in thumbnail mode with floating window 2014-09-26 20:45:15 +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 52e56c8924 Fixed segfault caused by image removal in thumbnail mode 2014-09-11 22:22:51 +02:00
Bert Münnich 2fbc21a205 Simplified img_frame_animate 2014-09-01 20:41:33 +02:00
Bert Münnich f478385d59 Corrected i_alternate, fixes issue #171 2014-08-29 20:16:24 +02:00
Markus Elfring 0f6cb93a09 Bug #165: Deletion of unnecessary null pointer checks
The function "free" performs input parameter validation.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html

It is therefore not needed to check a passed pointer before this function call.
A corresponding update suggestion was generated by the software "Coccinelle"
from the following semantic patch approach.
http://coccinelle.lip6.fr/

@Remove_unnecessary_pointer_checks1@
expression x;
@@
-if (x != \(0 \| NULL\))
    free(x);

@Remove_unnecessary_pointer_checks2@
expression x;
@@
-if (x != \(0 \| NULL\)) {
    free(x);
    x = \(0 \| NULL\);
-}

@Remove_unnecessary_pointer_checks3@
expression a, b;
@@
-if (a != \(0 \| NULL\) && b != \(0 \| NULL\))
+if (a)
    free(b);

@Remove_unnecessary_pointer_checks4@
expression a, b;
@@
-if (a != \(0 \| NULL\) && b != \(0 \| NULL\)) {
+if (a) {
    free(b);
    b = \(0 \| NULL\);
 }

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2014-08-22 19:24:08 +02:00
Bert Münnich fe3a1e326f Further simplified thumbnail marks 2014-08-18 12:45:32 +02:00
Bert Münnich 50652f63d9 Full redraw when removing files during thumbnail reloading; fixes issue #164 2014-08-17 16:31:16 +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
Bert Münnich 61f61cae5f Generalized thumbnail loading, allows easier reloading of thumbnails later on 2014-08-16 21:48:52 +02:00
Bert Münnich bb6721549b Overhauled window drawing, yet again; fixes issue #155
- Buffer for window content is bigger than the window, minimizes artifacts
  when window is resized
- Back to using XSetWindowBackgroundPixmap() instead of XCopyArea(),
  no need to handle exposure events; X server can show gray background directly
  after resize event before sxiv redraws the window contents
2014-07-28 20:36:32 +02:00
Bert Münnich 9c92de8584 Added support for multiple commands per key/button mapping; elegant fix for issue #150 2014-07-23 23:41:23 +02: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 5d0679b855 Show key handler status in bar while it is running 2014-06-15 14:15:48 +02:00
Miroslav Koskar 4cbc7346ff Timeout initial redraw 2014-05-24 10:07:14 +02:00
Bert Münnich 6d7acac3d1 Use real path of all files internally, requires _XOPEN_SOURCE>=500, fixes issue #137 2014-03-17 20:01:53 +01:00
Bert Münnich 653a6ee83b Warn once when external key combo is used and key-handler not installed 2014-02-18 21:10:44 +01:00
Bert Münnich e2fa49ecfe Unified X atom initialization 2014-02-02 14:36:10 +01:00
Bert Münnich f6510b0a04 Merged pull request #129 2014-01-31 13:21:23 +01:00
András Mohari 54d7b7f20f Use a prefix key to execute the key handler
The default prefix key is C-x, and can be changed in config.def.h. The
first key pressed after the prefix key will be passed the external key
handler, unless the key is Escape, which is used to cancel the prefix.
2014-01-31 14:17:52 +01:00
Bert Münnich ed69b483ed Double click on thumbnail to open image 2014-01-11 22:52:37 +01:00
Bert Münnich 304fd382db Adhere to XDG Base Directory Specification; fixes issue #124 2014-01-11 22:47:41 +01:00
Bert Münnich 48954a163a Allow config.h to use multimedia keys (XF86_XK_*); fixes issue #123 2014-01-09 20:38:46 +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 9632dd88b9 Fixup for 9574150 2014-01-08 21:14:01 +01:00
Bert Münnich 9574150f2d Check file modification time after key handler 2014-01-08 20:31:50 +01:00
Bert Münnich cd34aa2a6b Fixed slideshow delay corruption after GIF animation 2014-01-08 20:31:07 +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
Bastien Dejean 4780ec5463 Close info file descriptor after reading 2013-11-17 12:54:55 +01:00
Bert Münnich cc479ca5ac Fixed segfault when removing first image from file list, fixes issue #112 2013-11-16 20:19:55 +01:00
Bert Münnich 50f9ad14de Refactored remote changes 2013-11-14 17:06:20 +01:00
Bert Münnich 2737fc8b81 Merge remote-tracking branch 'ariand/gamma' 2013-11-14 14:47:36 +01:00
Bert Münnich 38bc23405d Highlight edges of marked images in thumbnail mode 2013-11-14 14:37:08 +01:00
András Mohari 0353e6eea2 Add support for changing the gamma value 2013-11-13 20:54:09 +01:00
Bert Münnich 450c1ed9b5 Fixed inconsistencies in navigation when removing invalid files 2013-10-21 21:57:21 +02: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 98972e98f9 Fixed segfault caused by FD_ISSET() on negative fd
Reported by Kris Siwiec
2013-04-02 19:32:59 +02:00
Bert Münnich 6f05e77728 New options: -[io], read/write files from/to stdin/out
Fixes issue #84
2013-03-19 21:14:58 +01:00
Bert Münnich 825c52c33f Made bar fields more distinguishable 2013-03-19 21:14:58 +01:00
Bert Münnich 38ecea3b4d Polished info script execution 2013-03-19 21:14:56 +01:00
Bert Münnich 30802cec0f Spawn info script & update bar contents only when needed 2013-03-19 21:14:32 +01:00
Bert Münnich f3298400e6 Spawn and read from info script without blocking 2013-03-19 21:13:44 +01:00
Bert Münnich bf41012493 Merge remote-tracking branch '4z3/set-user-specified-sizehints' into sizehints
Conflicts:
	window.c
2013-02-09 01:21:57 +01:00
Bert Münnich 08ae25da22 Refactored function definitions to use dangling brace 2013-02-08 22:05:31 +01:00
Bert Münnich 6d3bbc6d5e Updated/corrected license header 2013-02-08 21:52:41 +01:00
tv 3f25b907bd When using -g hint the WM that we've got user specified geometry
Without this some window managers (e.g. fvwm) will ignore the initial
window position and place it according to it's own rules.
2013-01-30 20:51:20 +01:00
muennich d6a475e4b1 Simplified status bar, filled by user script 2013-01-12 23:40:16 +01:00
Bert Münnich cd929eabfe Fixed issue #73 2012-12-27 16:34:51 +01:00
muennich 5106472d8b Fixed issue #72 2012-12-20 09:57:36 +01:00
Bert Münnich 0155223a1a Merge branch 'newdraw' 2012-12-01 18:50:10 +01:00
Bert Münnich 1ae06ffd09 Next try to fix issue #71 2012-10-31 23:24:21 +01:00
Bert Münnich 4a5d5d26aa Overhauled window drawing
- Draw onto pixmap as before, but use the same size for the pixmap as
  for the window, allocate new pixmap after configure requests
- Use XCopyArea() instead of XSetWindowBackgroundPixmap(), which now
  requires handling of Expose events
2012-10-29 18:36:48 +01:00
Bert Münnich fd519ffc40 Disregard obsolete events, fixed issue #64 2012-08-17 16:54:29 +02: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 d7ff54bb6e Optimized redraw timeout after window resize for tiling window managers; related to issue #44 2012-03-13 21:58:48 +01:00
Bert Münnich 751ebb3b29 Fixed issue #39: missing include of <sys/select.h> 2012-02-27 19:22:05 +01:00
Bert Münnich ed2c9f7caa Display full name in info bar, if there is enough space 2012-02-21 12:49:29 +01:00
Bert Münnich a329615c68 Show info message in bar while loading thumbnails 2012-02-15 19:29:56 +01:00
Bert Münnich d407dd65d5 Already in the year 2012 2012-02-15 19:16:24 +01:00
Bert Münnich b752d5c594 Added symbol BAR_SEPARATOR 2012-02-15 18:25:45 +01:00
Bert Münnich b8458271fb Added text bar on bottom of window 2012-02-12 19:00:41 +01:00
Bert Münnich 8fc7cb73b3 Nicer window title 2012-02-11 03:36:15 +01:00
Bert Münnich c3c95ab218 Removed slideshow support 2012-02-11 02:34:18 +01:00
Bert Münnich 71a7940d74 Better fix for issue #25 2011-11-01 08:36:20 +01:00
Bert Münnich 1cdbeb972a Added screen-wise scrolling for thumbnail mode 2011-10-27 16:21:01 +02:00
Bert Münnich 867940ea85 Pan by pixel count, if number prefix given 2011-10-16 17:39:22 +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 Münnich 4383a651c7 Strictly adhere to ANSI-C standard 2011-10-13 16:50:06 +02:00
Bert Münnich a09b20c5e6 Use void for empty argument lists 2011-10-12 18:38:29 +02:00
Bert Münnich 8dcf682de9 Made all conditionals more precise 2011-09-29 12:43:36 +02:00
Bert Münnich 22d4e991d5 Transformed function macros in util.h to inline functions 2011-09-29 10:16:13 +02:00
Bert Münnich d08408e942 Make use of EXIT_* macros (2) 2011-09-26 21:28:27 +02:00
rck 3a81af41ac make use of EXIT_ macros 2011-09-26 15:40:07 +02:00
Bert Münnich 515e410451 Use win_t member in img_t & tns_t instead of parameters 2011-09-17 17:23:51 +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 6e575b0f72 Strict conformance to IEEE Std 1003.1-2001 2011-09-08 20:54:24 +02:00
Bert 8f34b7e95c Load as much of a corrupted gif file as possible 2011-09-06 11:55:31 +02:00
Bert 711494ad36 Avoid conflicting macros 2011-09-06 09:11:03 +02:00
Bert 2bbdd2f5b9 Fixed title-update in thumb mode 2011-09-04 20:14:38 +02:00
Bert d585b86354 Reformated license header 2011-09-03 23:11:45 +02:00
Bert c2320a2f49 Fixed remove_file() 2011-09-03 19:08:49 +02:00
Bert a7a849761f Simplified cursor resetting 2011-09-03 17:01:39 +02:00
Bert abb5feeb78 Corrected timeout handling 2011-09-02 18:54:41 +02:00
Bert dcd04e526d Corrected thumbnail loading and timeout handling 2011-09-02 15:56:03 +02:00
Bert 1e84773276 Data driven timeout handling 2011-09-02 04:33:44 +02:00
Bert bb577d274d Added command to toggle gif animations 2011-08-19 18:46:17 +02:00
Bert 8b3ae5027e Added support for gif animation 2011-08-19 15:22:16 +02:00
Bert 79bd86defb Refactored img_load_gif()
- Corrected handling of transparency settings for individual frames
- Corrected handling of different frame dimensions & offsets
2011-08-19 15:12:30 +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 1d7849efc1 Added force parameter to tns_load() to disregard cache 2011-08-19 13:26:58 +02:00
Bert 421f012022 Renamed application modes 2011-08-19 13:09:22 +02:00
Bert 8763f6930f Corrected FSF address in license headers 2011-08-18 01:18:26 +02:00
Bert ff013dd009 Revised handling of file names & paths 2011-08-18 00:38:55 +02:00
Bert b8ff1677b1 Major code refactoring
- Configurable key and mouse mappings in config.h
- Put event handling code from main.c into events.[ch]
2011-07-26 18:01:29 +02:00
Bert a271e16744 Reduced usage of preprocessor macros 2011-07-22 14:49:06 +02:00
Bert dde2d9d023 Support XK_KP_{Add,Subtract} for zooming 2011-06-28 15:47:48 +02:00
Bert bd87ae9346 All timeouts in milliseconds 2011-06-28 13:45:57 +02:00
Bert f52603b31a Small refactoring 2011-06-24 13:28:25 +02:00
Bert a6100373c1 New mappings: ctrl-[hjkl], pan image one window width/height 2011-06-03 23:39:22 +02:00
Bert ea23115af4 Use getline instead of readline 2011-05-29 11:45:58 +02:00
Bert 2252a0148d New option: -n, start at given picture 2011-05-25 09:23:23 +02:00
Bert 00e6cd2bd1 Show image dimension in window title 2011-05-22 19:42:33 +02:00
Bert 485e6c863a H/J/K/L mappings to pan to edges 2011-05-16 15:54:09 +02:00
Bert d54e64faae Fixed background color for non-EWMH-compliant WMs 2011-04-19 14:25:43 +02:00
Bert ba293b09df Center zoomed area 2011-04-19 13:27:20 +02:00
Bert 548b383f0b Fixed mouse cursor 2011-04-15 11:23:58 +02:00
Bert c58307ba38 Merged commands.h into config.h 2011-04-14 12:00:35 +02:00
Bert 5f8201110e Slightly changed introductory text 2011-04-11 20:42:08 +02:00
Bert d15264ea32 Remove invalid images when loading them; refactorings 2011-04-11 16:58:38 +02:00
Bert 5cb6d12a94 Refactored main.c 2011-04-11 11:53:00 +02:00
Bert bac610ddc4 Merge branch 'tcache'
Conflicts:
	main.c
2011-04-11 08:52:07 +02:00
Bert dc54981a68 New option: -C, clean thumbnail cache 2011-04-08 14:44:00 +02:00
Bert a90bd1c833 Refactored recursive directory util functions 2011-04-08 10:23:42 +02:00