Commit Graph

136 Commits

Author SHA1 Message Date
Bert Münnich
28868767e6 Use normal win colors in fullscreen mode
Fixes issues #361 and #367
2019-07-16 19:18:13 +02:00
Bert Münnich
7b813ea06d Fix comparison broken by signedness
Warning generated on MacOS, reported in issue #350.
2019-03-15 13:04:15 +01:00
Bert Münnich
919ada1123 Align compile-time color options with X resource colors
Two colors are more than enough!
2019-01-23 21:21:15 +01:00
Kacper Gutowski
e648c11899 Respect updated path format when cleaning cache
Since d8114e8 the file name is used for caching as-is without adding
.jpg at the end, but sxiv -c still expected old format causing it to
remove all fresh thumbnails.
2018-07-30 10:33:23 +02:00
Kacper Gutowski
e6c9218319 Don't skip dot files when cleaning cache 2018-07-30 10:28:35 +02:00
Bert Münnich
f02661879f Reject text files resembling TGA images
Fixes issue #295

The imlib2 TGA loader returns an imlib image handle without any actual data
when given a text file like this:

    T
    Content-Type: application/javascript
    Content-Length: 3836
    Last-Modified: Wed, 23 Sep 2015 12:25:47 GMT
    Etag: "56029a4b-efc"
    Expires: Sat, 20 Aug 2016 15:14:33 GMT
    Cache-Control: max-age=604800, public
    Accept-Ranges: bytes

Fortunately, `imlib_image_get_data()` returns NULL in this case, so that we can
use it as an additional check when opening files.
2017-11-23 14:35:34 +01:00
Bert Münnich
148026007c One header file for type definitions and function declarations 2017-10-16 21:10:35 +02:00
Antti Korpi
ecc363ec10 Add -p flag to disable writing of cache and temporary files
Closes #285.
2017-09-08 22:04:44 +02:00
Bert Münnich
1c260e701b Fix unused-variable warnings in conditionally compiled code 2016-12-28 19:18:16 +01:00
Bert Münnich
878d97068c Only open regular files; fixes issue #252 2016-10-20 10:21:55 +02: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
de4649fc28 Build-time option for default thumbnail size; fixes issue #207 2015-12-20 13:10:39 +01:00
Bert Münnich
a7d39b0ab8 Simplified r_mkdir() 2015-10-28 23:21:12 +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
851e4288c1 Prefix safe allocation functions with 'e' instead of 's_' 2015-10-28 22:29:01 +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
d8114e841c Thumbnail cache file format depending on existance of alpha layer
Use PNG if image has alpha layer, JPG if not. Fixes issue #209
2015-07-22 21:08:00 +02: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
ed030fe4d3 Enforced thumbnail reloading after key handler 2014-11-27 22:24:18 +01:00
Bert Münnich
728a2d931f Limit thumbnail selection border width to 4px 2014-11-27 22:23:14 +01:00
Bert Münnich
d154b9826f Do not cache thumbnails, which are smaller than the maximum size 2014-10-31 10:41:33 +01:00
Bert Münnich
eb5feb4585 Discard cached & EXIF thumbnails, which are smaller than the configured maximum size 2014-10-31 10:41:30 +01:00
Bert Münnich
f5f49e7a9d Fixed leakage of resources allocated by EXIF library 2014-10-31 10:37:35 +01:00
Bert Münnich
25077ac764 Fixed segfault when run with -c 2014-10-29 14:20:54 +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
ddd028eb3e Unified file count variable for image & thumbnail mode 2014-09-30 21:54:17 +02:00
Bert Münnich
b4096c59e4 Set JPEG quality for thumbnail cache files 2014-09-29 14:06:24 +02:00
Bert Münnich
390d771e70 Fixed thumbnail creation for files with big aspect ratio factor; fixes issue #175 2014-09-29 14:05:04 +02:00
Bert Münnich
0e4db69ff5 Scale thumbnail selection border width with thumbnail size 2014-09-29 09:36:43 +02:00
Bert Münnich
39671a149c Moved thumbnail sizes array to config.def.h 2014-09-29 09:02:29 +02:00
Bert Münnich
8fa7247f69 Refactored thumbnail size dependent calculations 2014-09-29 08:47:01 +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
b2dbd2fed3 Changed image mark in thumbnail view to small rectangle 2014-09-27 22:05:21 +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
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
056624548a Beautified thumbnail marks and selection border 2014-08-18 15:42:10 +02:00
Bert Münnich
fe3a1e326f Further simplified thumbnail marks 2014-08-18 12:45:32 +02:00
Bert Münnich
d0ba2c585d Simplified thumbnail selection and marks 2014-08-17 23:01:39 +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
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
5cfae63620 Create thumbnail cache dir automatically 2014-06-10 23:15:04 +02:00
Bert Münnich
cd02f2dd86 Small fix for thumbnail cropping 2014-06-10 21:28:10 +02:00
Bert Münnich
d26f39914e Use thumbnails in EXIF tags; requirement for libexif is back 2014-06-09 22:59:49 +02:00
Bert Münnich
e685859a30 Use a checkerboard background for alpha layer; fixes issue #138 2014-04-06 22:47:42 +02:00