Commit graph

326 commits

Author SHA1 Message Date
Dmitrij D. Czarkoff 311c35e3b9 Enable tests
Once cmocka is built, it is cached, so that subsequent builds only need to
install it and update linker configuration.
2016-10-22 12:37:43 +02:00
Harry Jeffery b510b04f07 Fix leak of images awaiting collection in loader 2016-10-21 20:46:41 +01:00
Harry Jeffery e594926d09 Rework thread resource leak 2016-10-21 20:37:09 +01:00
Harry Jeffery 04fb5d1083 Cap playback delta-time to 100 ms
This prevents imv from trying to "catch up" on the time that it was
asleep for by playing the gif back at high speed.
2016-10-20 21:18:57 +01:00
Dmitrij D. Czarkoff f33b1a4a96 Be more correct in read_from_stdin()
From read(2) manual page on OpenBSD:

     Error checks should explicitly test for -1.  Code such as

           while ((nr = read(fd, buf, sizeof(buf))) > 0)

     is not maximally portable, as some platforms allow for nbytes to range
     between SSIZE_MAX and SIZE_MAX - 2, in which case the return value of an
     error-free read() may appear as a negative number distinct from -1.
     Proper loops should use

           while ((nr = read(fd, buf, sizeof(buf))) != -1 && nr != 0)

Distingushing between error and eof would also help for debugging.
2016-10-09 03:14:37 +02:00
Harry Jeffery e4ded04c39 Fix thread resource leak in loader 2016-09-28 00:14:45 +01:00
Harry Jeffery 10e71e07e4 Fix minor memory leak in load_font() 2016-09-27 23:55:08 +01:00
Harry Jeffery b697fcd58a Fix GetWidth/GetHeight typo in main.c 2016-09-27 23:45:07 +01:00
Harry Jeffery 8323eb1dbe Merge pull request #96 from gktrk/test-linking-fix
Fix the linking order of tests in the Makefile for --as-needed
2016-05-27 15:27:04 +01:00
Göktürk Yüksek 07f61719e7
Fix the linking order of tests in the Makefile for --as-needed
When '--as-needed' linker flag is added to LDFLAGS, linker strips out
the symbols from the libraries needed for the tests due to the order
in which the libraries appear on the command line. List the source
files before the libraries to fix the linking issue.

For more information, see:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Importance_of_linking_order

Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org>
2016-05-25 08:31:55 -04:00
Harry Jeffery 3e6402456b Release v2.1.2 2016-05-15 23:36:46 +01:00
Dmitrij D. Czarkoff 8e9c6f5e57 Fix build of imv on GNU libc
Previously imv used -std=gnu11 flag which activated GNU "extensions" of C11
standard.  This masked a portability issue in imv: strduo(3) should not have
been visible in `src/loader.c` without inclusion of `<string.h>` header.  This
have been fixed.  To remidy GNU libc's stange choice to hide X/Open interfaces
in C99 code by default _XOPEN_SOURCE macro was also set.  (This should have no
effect on most other platforms.)
2016-05-13 06:30:52 +02:00
Dmitrij D. Czarkoff aac1d79e77 Remove "-std=gnu11" from .travis.yml
This reverts commit 9e3db8bdaa.  The effort was
futile.
2016-05-13 06:30:51 +02:00
Dmitrij D. Czarkoff 9e3db8bdaa Continue to use -std=gnu11 for Travis
This way we may continue using strict flags for detecting issues while still
allowing old compiler versions elsewhere.
2016-05-13 01:00:30 +02:00
Dmitrij D. Czarkoff 7353178d6d Release v2.1.1 2016-05-13 00:43:36 +02:00
Dmitrij D. Czarkoff 6dad3c7bbf Fix compatibility with older gcc versions 2016-05-12 14:27:17 +02:00
Dmitrij D. Czarkoff 0e1d18a2d0 Make imv_navigator_add() return an integer value
In case of error return non-zero value instead of cleaning up navigator.  This
way main loop may do some more cleanup, or maybe even act differently.
2016-05-01 14:40:54 +02:00
Dmitrij D. Czarkoff aaab6d54a4 Remove buf_size from struct imv_navigator
Implementation details should not leak to other parts of the code.

While at it, clean up initialization and destruction of navigator.
2016-05-01 14:37:16 +02:00
Dmitrij D. Czarkoff 30db614d32 Fix uninitialized use of "last_time"
Set "last_time" to current time at declaration time, so that it holds at least
something by the time it is used.
2016-04-29 16:31:49 +02:00
Dmitrij D. Czarkoff ff5029b867 Remember files' modification times, not their directories' 2016-04-29 16:31:40 +02:00
Dmitrij D. Czarkoff 70a5b9aa6f Use single buffer for title and overlay
This allows to drop extra printing steps and memory allocations.
2016-04-29 16:31:40 +02:00
Harry Jeffery 0e8205237e Release v2.1.0 2016-04-27 12:08:01 +01:00
Dmitrij D. Czarkoff fe10d9d38f Reimplement '-x' flag
This change effectively backs out f1737ddd06,
implementing the same functionality in a simpler and more correct way.

Implementation details:

 * imv_navigator.wrapped - a new field that has value "0" by default; once
   navigator wraps around the list, this field recieves value "1".
 * imv_navigator_wrapped(&nav) - a new function that returns non-zero value iff
   navigator wrapped around the list.  Currently just returns value of
   imv_navigator.wrapped.

While at it, expanded "test_navigator_remove" and merged it with
"test_navigator_add".  Resulting test is called "test_navigator_add_remove".

Fixes #94.
2016-04-26 22:07:02 +02:00
Dmitrij D. Czarkoff 4d2f36a98b Fix segmentation violation
When non-cycling mode prevents navigator from wrapping to the other end of list,
undo change to nav->cur_path.  Otherwise it will remain out-of-bounds, so that
subsequent calls to navigator functions may produce unexpected results, up to
segmentation violation.

Fixes #93
2016-04-26 20:30:58 +02:00
Dmitrij D. Czarkoff 42fe047e73 Testcase for removal from navigator
Test that removing items leads to predictable results.  Right now test is fairly
incomplete, because it does not cover moving in reversed direction.
2016-04-26 19:27:18 +02:00
Dmitrij D. Czarkoff 34a37303bf Fix reporting image change
Apparently bg_next_frame() functions marked first frames of gifs old before
imv_loader_get_image() had a chance to report them to the main loop.  Move
unsetting of ldr->out_is_new_image to imv_loader_get_image().

Fixes #81.
2016-04-26 18:04:15 +02:00
Dmitrij D. Czarkoff b4c14b1932 Indent fix 2016-04-26 16:09:04 +02:00
Dmitrij D. Czarkoff 98ca878b7e Add vim modelines 2016-04-26 14:19:59 +02:00
Dmitrij D. Czarkoff 9d50ed2333 Conditionally ignore key repeat
For the following actions:

 * reset scaling ('s'),
 * redraw ('r'),
 * scale to actual size ('a'),
 * center image ('c'),
 * remove selection ('x'),
 * toggle fullscreen ('f'),
 * toggle playing (space),
 * print selection ('p'),
 * toggle overlay ('d')

repeating action when key is held does not make sense.  After acting upon these
events ignore them until key is released or another key is pressed.
2016-04-26 13:02:44 +02:00
Dmitrij D. Czarkoff 9ecdf4d258 Include git commit hash in version number
When operating in git repo, build system will include abbreviated git hash in
imv version number.  If there is no git repo around (eg. building from tarball),
fall back to version number in Makefile.

Fixes #90
2016-04-25 21:13:50 +02:00
Harry Jeffery 7e6a8d4db1 Merge pull request #89 from czarkoff/plus
Make '+' work on all layouts
2016-04-25 12:41:36 +01:00
Dmitrij D. Czarkoff b0af8b3d25 Make '+' work on all layouts
Key handling code obuses the fact that plus sign is shifted key for equals sign
on US keyboard.  Add '+' as a control for layouts where this is not the case.
2016-04-25 12:53:02 +02:00
Harry Jeffery 080104cbc0 Merge pull request #86 from ShanaXXII/master
fixed comment typo in loader.h
2016-04-23 16:01:36 +01:00
ShanaXXII 98543fecfb fixed comment typo in loader.h 2016-04-22 18:02:29 -04:00
Harry Jeffery 7febfc4676 Merge pull request #85 from whatevsz/wip-cycle
Add -x switch to exit imv when reaching end of file list.
2016-04-03 14:16:35 +01:00
Hannes Koerber f1737ddd06 Add -x switch to exit imv when reaching end of file list. 2016-04-02 12:12:12 +02:00
Harry Jeffery 75dbf29e3f Merge pull request #83 from czarkoff/rapid_fire
Read file list from standard input continuosly
2016-03-08 23:27:13 +00:00
Dmitrij D. Czarkoff 8a4f62af0a Forgot "imv" in example 2016-03-06 03:49:47 +01:00
Dmitrij D. Czarkoff 01f9532d18 Note command for viewing images from the web 2016-03-06 03:45:21 +01:00
Dmitrij D. Czarkoff d000d3d464 Read file list from standard input continuosly
This reduces delay before initial draw in case of slow input, opening
possibilities for use cases like:

  $ curl -Osw "%{filename_effective}\n" "http://www.example.com/[1-10].jpg"

which will download all images and start showing them once first arrives.
2016-03-06 03:24:05 +01:00
Harry Jeffery 809aa390bf Merge pull request #82 from czarkoff/exif
Use Exif rotation for JPEG images
2016-02-25 10:46:21 +00:00
Dmitrij D. Czarkoff 66de2c49e5 Remove duplicated "-g" flag 2016-02-25 01:27:22 +01:00
Dmitrij D. Czarkoff 24f8b8a2c4 Honour EXIF orientation tag 2016-02-21 14:57:32 +01:00
Dmitrij D. Czarkoff 9cdab1b173 Add test to check for EXIF rotation of JPEG images 2016-02-21 16:35:36 +01:00
Dmitrij D. Czarkoff b4dfe40a57 Fix "check" target
for i in "..."; do ...; done ideom guarantees single iteration with $i set to
everything between "in" and ';'.
2016-02-21 15:03:21 +01:00
Dmitrij D. Czarkoff 1efd760b8d Force "-g" flag for tests 2016-02-21 15:07:13 +01:00
Harry Jeffery bc90a0adcc Release imv v2.0.0 2016-02-08 11:02:29 +00:00
Harry Jeffery b7e12de490 Remove tabs 2016-02-08 10:46:41 +00:00
Harry Jeffery 36569715f1 Fix #78
If the gif disposal method is unspecified, default to compositing
instead of full disposal.
2016-02-08 10:43:56 +00:00
Harry Jeffery 7e1e553ba9 Fix bug in slideshow timing 2016-01-24 23:04:52 +00:00