Commit Graph

257 Commits (ee908ca0a197ac579ab8abc5695c9ce421a96a21)

Author SHA1 Message Date
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.
7 years ago
Bert Münnich e310136e02 Mouse drag translates pointer position to image area
This makes mouse panning more direct and faster.
7 years ago
Bert Münnich a20173a42d Detect all file overwrites in autoreload_inotify
mv(1) inside the same filesystem was not detected.

Supporting this case made it necessary to always watch the directory. Turns out
the logic and state keeping between arl_setup() and arl_handle() is easier,
when using different watch descriptors for the file and the directory and not
using a oneshot descriptor for the file.

Requiring an absolute canonical path for arl_setup() simplifies dir and base
name splitting. No need for dirname(3) and basename(3) anymore.
7 years ago
Bert Münnich 3724d3fc17 Revised autoreload interface
Make the header only contain the public interface and nothing from the
implementation. All functions get a handle to their self object, like the img_
and tns_ and win_ functions. All necessary data (file path) is also passed as
an argument, so that no extern redeclarations are needed.

Make arl_setup_dir() private, it's not called outside the module.

Make arl_handle() return true if the file has changed, so that the reloading of
the file can be done by the caller.
7 years ago
Max Voit edb117e3bd Add autoreload support by inotify (and dummy backend nop) 7 years ago
Bert Münnich 1fb3ec576c Properly quit when window gets closed; fixes issue #27 7 years ago
Jakub Wilk c313edc0ad Fix typo 7 years ago
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.
8 years ago
Bert Münnich ff2ce99bf7 Merge djhejna/floatdelay 8 years ago
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.
8 years ago
Don Hejna 27bbaab976 Support for DELAY as a floating point number including less than 1
second while maintaining backward compatibiitiy with integer
arguments.
8 years ago
Paride Legovini 86dc6860f9 Allow opening directories non-recursively 8 years ago
Bert Münnich c280129cef Use Xft for font loading and text drawing 8 years ago
Bert Münnich aabc2bddbd Provide image width and height to image-info script; fixes issue #159 8 years ago
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)
9 years ago
Bert Münnich 851e4288c1 Prefix safe allocation functions with 'e' instead of 's_' 9 years ago
Bert Münnich b096cbd536 Removed unnecessary buffer size constants 9 years ago
Bert Münnich 9a7e97cd89 Use XSI realpath(3) 9 years ago
Bert Münnich 66c3c55759 Use POSIX.1-2008 getline(3) 9 years ago
Bert Münnich e574a6d0dd Removed feature test macro definitions from source files 9 years ago
Bert Münnich e0e96977b3 Removed overcautious parameter checks 9 years ago
Bert Münnich a3838c1984 Always run image-info script after key-handler in image mode; fixes issue #213 9 years ago
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.
10 years ago
Bert Münnich 47af0dd7b5 Cache out of view thumbnails in the background 10 years ago
Bert Münnich 9b9294bae6 Use bit-field for boolean flags in fileinfo struct 10 years ago
Bert Münnich 6216bf6c2d Ignore SIGPIPE, caused by key handler exiting before all files got printed, fixes issue #188 10 years ago
Bert Münnich 216ad81b59 Pass file paths to key handler via stdin; fixes issue #187 10 years ago
Bert Münnich 51854c6148 Fixed leakage of pipe descriptors in case of failing fork 10 years ago
Bert Münnich 93e2a757d4 Do not print could-not-open-warnings for files found by directory traversal 10 years ago
Bert Münnich c33f2ad355 Corrected & refactored handling of window bar content...
Old snprintf calls could have overflowed the buffers.
10 years ago
Bert Münnich 8db3191f04 Fixed segfault on image removal with uninitialized thumbnails; fixes issue #177 10 years ago
Bert Münnich ddd028eb3e Unified file count variable for image & thumbnail mode 10 years ago
Bert Münnich b2dbd2fed3 Changed image mark in thumbnail view to small rectangle 10 years ago
Bert Münnich 5fce009b73 Refactored main loop; properly fixes startup issue 10 years ago
Bert Münnich c1e084357c Fixed startup in thumbnail mode with floating window 10 years ago
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
10 years ago
Bert Münnich 52e56c8924 Fixed segfault caused by image removal in thumbnail mode 10 years ago
Bert Münnich 2fbc21a205 Simplified img_frame_animate 10 years ago
Bert Münnich f478385d59 Corrected i_alternate, fixes issue #171 10 years ago
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>
10 years ago
Bert Münnich fe3a1e326f Further simplified thumbnail marks 10 years ago
Bert Münnich 50652f63d9 Full redraw when removing files during thumbnail reloading; fixes issue #164 10 years ago
Bert Münnich e49d38d6f9 Fixed wrong thumbnail-to-file mappings caused by file deletions 10 years ago
Bert Münnich e267dc7793 Pass marked files to external key handler in thumbnail mode; fixes issue #135 10 years ago
Bert Münnich 284be74927 Count number of marked files 10 years ago
Bert Münnich 5b01c15176 Unified file index variable for image & thumbnail mode 10 years ago
Bert Münnich 61f61cae5f Generalized thumbnail loading, allows easier reloading of thumbnails later on 10 years ago
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
10 years ago
Bert Münnich 9c92de8584 Added support for multiple commands per key/button mapping; elegant fix for issue #150 10 years ago
Bert Münnich 06164c29b7 Revised command structure and key and mouse button mappings 10 years ago