Commit graph

772 commits

Author SHA1 Message Date
Harry Jeffery 885e17397a Release v4.4.0 2023-01-18 22:20:52 +00:00
Cem Keylan 2de91b2f48 console: update libgrapheme API to version 2.0.0
libgrapheme recently saw its second major version which was "refactored
for correctness and conformance"[1].

[1]: http://lists.suckless.org/news/2210/0036.html
2023-01-18 21:54:48 +00:00
Edward Betts 9d224adffe Correct spelling mistakes 2023-01-18 21:53:28 +00:00
tmpod c65fb124b2 Replace old GitHub links for sourcehut ones 2023-01-18 21:52:07 +00:00
Ivan Oleynikov 0c3ec9212f Remove trailing whitespace from wordexp-ed strings
Previous implementation was always leaving a trailing whitespace at the
end of the expanded string (used in window title, description text,
etc.). Now it doesn't happen.
2023-01-18 21:50:47 +00:00
Ivan Oleynikov a1ee2e69a5 Make sure imv and imv-dir have different names in .desktop
It might be different in other file managers, but in Thunar both imv and
imv-dir are currently displayed as "imv" in the "open with" menu. This
makes them indisutinguishable and impossible to choose the one user
wants. This commit ensures that they have different names in the desktop
files.
2023-01-18 21:50:35 +00:00
Robert Guenzler 50343ba7ce Pause slideshow when view->playing is false
Signed-off-by: Robert Günzler <r@gnzler.io>
2023-01-18 21:50:35 +00:00
Ivan Oleynikov 6776568b6c Make imv-dir act like imv when called with multiple arguments
This commit allows user to select a few files and open only them using
imv-dir. When user opens just one file (typically by double-clicking on
it in a file manager), imv-dir will behave like it used to and open
open the whole directory.

I think this behavior is more reasonable doesn't add much complexity to
imv-dir. Now imv-dir conveniently accomodates the three use-cases which
I think must be quite common:

1. If user wants to cycle through all files in current directory, they
   can just double click on one of them.

2. If the user wants to cycle through just a few specific files (say,
   if they have many files in this directory and don't want to see them
   all), they select them and hit Enter.

3. If the user wants to see just one file and doesn't care about cycling
   through them, they just click on one file. The cycling is available,
   but they don't have to use it.

For me, 1 and 2 were the main use-cases and to accomodate them I had to
switch between imv and imv-dir as default image viewers, which is rather
suboptimal. Now both are cheaply accomodated by imv-dir.
2023-01-18 21:39:49 +00:00
Simon Ser 1817ef3df1 wl_window: fix buffer size not divisible by scale
Do not commit the surface with the new scale and the old buffer.
Leave it to the next rendering pass to commit the surface.

Fixes the following protocol error:

    wl_surface@10: error 2: Buffer size (717x795) is not divisible by scale (2)

Closes: https://todo.sr.ht/~exec64/imv/20
2023-01-18 21:37:38 +00:00
Cem Keylan 4448fb6104 console: update libgrapheme API to version 1 2021-12-22 18:23:07 +00:00
Harry Jeffery c7306a6325 wl_window: Fix segfault with latest wlroots
imv is currently binding to the latest version of all the interfaces,
but should instead bind the latest version that it supports. imv is not
compatible with wl_output v4 and so was crashing when the latest wlroots
offered it.

This patch pins a maximum version for each wayland interface that is
bound.

https://todo.sr.ht/~exec64/imv/1
2021-12-14 09:48:45 +00:00
Harry Jeffery 7bf30e6c92 rsvg: Suppress deprecation warnings
Newer APIs will be used when necessary, to maintain compatibility with
older versions of rsvg. In the mean time, disable the noisy warnings.
2021-12-08 22:03:29 +00:00
Harry Jeffery 3b5a4d8cb7 x11_window: Fix typo in if statement 2021-12-08 22:03:26 +00:00
Cem Keylan a83304d4d6 Add support for libgrapheme as an icu replacement 2021-12-08 21:12:20 +00:00
aeghn 9ce7c5de6d Add '-w' option to specify window title at startup 2021-12-08 21:12:20 +00:00
Harry Jeffery 9acf93c356 Update contributing guidelines 2021-12-08 01:36:51 +00:00
Ivan Oleynikov 5e36d10afc Draw background rectangle behind the (possibly multiline) overlay text
Before this commit, the background rectangle was drawn to cover only one line
of text (which was ok since multiline overlay text was not supported). Now
the code correctly calculates the dimensions on the rendered text and put the
rectangle of the right size under it.
2021-11-30 18:14:43 +00:00
Ivan Oleynikov a810b71f14 Move Cairo layout creation and display code to two separate functions
This effectively splits the imv_canvas_printf function into two separate
functions, one to create a layout containing given text and the other one
to show it on the canvas. These functions can be useful for the future code
I will add to display text with a background rectangle behind it. Existing
imv_canvas_printf function does not allow this
2021-11-30 18:14:43 +00:00
Ivan Oleynikov 4690692154 Set IFS env variable to "" for overlay_text shell expansion
This prevents wordexp function from splitting the output of shell expansion
into “words” and, as a consequence, removing the newlines from it. With this
commit applied, setting

  overlay_text = $(echo -e 'hello\nworld!')

displays

  hello
  world!

in Imv window. Without this commit, the same overlay_text setting would display

  hello world!

since wordexp splits the string "hello\nworld!" into two words and connects
them with a space.

This should not break any of the commands executed in $(), because the IFS
variable is *not* inherited by their shell. The commands don't see this change
and run with the default IFS value.
2021-11-30 18:14:43 +00:00
Tuomas Siipola 9ae3ee1da1 Show chequered pattern on image instead of viewport
OpenGL is used for rendering because `cairo_rectangle` and
`cairo_pattern_t` had performance problems on zoomed and rotated images.

The size and contrast of the chequered pattern is also reduces to match
other image viewers and editors.

Closes #253
2021-11-30 18:13:24 +00:00
Brett Cornwall 1bb925e1d5 doc: simpliy → simplify 2021-11-30 18:10:12 +00:00
Brett Cornwall da0e6bc212 doc: Fix awkward run-on sentence in overlay_text 2021-11-30 18:10:12 +00:00
n3f4s 8935fafb40 Add limit for looking through STDIN 2021-11-30 18:09:29 +00:00
n3f4s 72bda973f4 Pull path from pipe when -n given 2021-11-30 18:09:29 +00:00
Maxim Karasev f58e81288b Rename imv-folder to imv-dir
There is no such thing as 'folder' in Unix. We only have directories
(also sometimes called 'catalogs').
2021-09-29 21:17:05 +00:00
Maxim Karasev daea88c572 Simplify imv-folder script
This changes make it more portable by removing bash dependency and not
using GNU-specific 'sort' syntax. Also this fixes issue with selected
image not being displayed first.
2021-09-29 21:17:05 +00:00
Issam E. Maghni ac30f34bd3 cairo: Replace <cairo/cairo.h> by <cairo.h>
See https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/doc/tutorial/src/include/cairo-tutorial.h
2021-09-05 17:59:51 +00:00
Harry Jeffery 6fffe14458 Release v4.3.0 2021-08-05 22:20:41 +01:00
Ivan Oleynikov f71548ce45 Make freeimage backend have preceedence over libjpeg
The current implementation of freeimage backend automatically rotates the
images based on EXIF info. Libjpeg backed doesn't do that (although libjpeg
itself may be able to, I didn't check). This commit makes Imv use freeimage for
jpeg files when both backends are available to enable automatic image rotation
when possible.

A cleaner solution could be to add automatic rotaiton functionality to libjpeg
backend as well, but this quick hack is better than nothing ☺
2021-08-05 21:01:30 +00:00
kat witch b194997c20 Fix lack of X11 window deletion event handling 2021-07-29 17:02:35 +00:00
Ivan Oleynikov 33560e8e2e WIP: Use set_size instead of set_absolute_size for font
This seems to have a better behavior, this way, the fonts in Imv seem to have
the same size as the fonts in other programs (Sway, Waybar) when configured in
the same way.
2021-07-29 17:01:31 +00:00
Ivan Oleynikov 3c1d27d885 Scale fonts when Wayland updates scaling factor
Before this commit, the code in src/wl_window.c seemed to handle the Wayland
scaling [1] correctly, it was sending resize events to imv to update the buffer
size accordingly. One thing it didn't update is the scaling of fonts that Pango
renders on Cairo.

This commit simply forwards the scaling factor (computed as [1] requests)
together with updated buffer dimentions in resize event, and when the resize
event is handled it calls cairo_surface_set_device_scale to notify Pango/Cairo
of the scaling.

For X11, I simply assume the scaline factor is always 1. This seems to be what
the old code did: `grep scale src/x11_window.c` gives no matches. AFAIK, X11
does not have an established way of telling clients what scaling factor to use
(and never updates it at runtime).

[1]: https://wayland-book.com/surfaces-in-depth/hidpi.html
2021-07-29 17:01:31 +00:00
Harry Jeffery eeaf5e3cb9 Also suppress TIFF errors from stdin 2021-07-09 00:18:47 +01:00
Harry Jeffery e7c564f051 Fix missing m dependency for imv-msg
Fixes #328
2021-07-09 00:07:08 +01:00
Harry Jeffery 8d91875207 Suppress annoying TIFF errors
Fixes #252
2021-07-09 00:00:44 +01:00
Harry Jeffery 27df0fb8fe Fix image skipping when reading slow filesystems
Fixes #201
2021-07-08 23:46:16 +01:00
somini ebef68aece Add a contrib-commands option
This includes the commands available in contrib/. It's enabled by
default.

I moved the manpage and desktop file to their regular locations to avoid
complicating the meson file too much. They won't be installed when you
disable the contrib commands.
2021-07-08 23:30:24 +01:00
somini 9557a4b112 Move imv-folder files to contrib
See #261
2021-07-08 23:30:24 +01:00
somini b557c56d44 Tweak imv-folder file sorting
Make sure to version-sort the files. Requires a non-POSIX `sort`, which
should be a mild requirement.

See
d12470375a (commitcomment-44048679)
2021-07-08 23:30:24 +01:00
somini c415c456ea Fix imv-folder usage with sub-folders with images
See https://github.com/eXeC64/imv/pull/225#discussion_r494270357
2021-07-08 23:30:24 +01:00
somini 673e54710a Keep the folder order when using imv-folder
Guaranteed-ish by most shells, see https://unix.stackexchange.com/a/368507.

See #229
2021-07-08 23:30:24 +01:00
somini 38eee61beb Include support for imv-folder
This is a wrapper to open all images in a folder.

Includes:
- Script itself
- Man page
- Desktop file
- Necessary Makefile changes

Fix #223
2021-07-08 23:30:24 +01:00
Ronan Dalton eccd3cf912 Fix zoom speed dependence on buffer/image width 2021-07-08 23:17:35 +01:00
n3f4s 22cd0b3813 Don't stop listing files in dir when stat fail
Check errno when stat fail during traversal of a directory: doesn't stop
traversing for all stat errors
2021-07-08 23:16:08 +01:00
mx deb8b5a864 fix double-free when backend libjpeg is used 2021-06-24 21:22:13 +01:00
Aleksander Szczygieł ff0b802c03 Resolve path in imv_navigator_find_path()
All items' pathes are resolved in add_item() so path used in imv_navigator_find_path() should be resolved too. This patch fixes #308
2021-04-14 15:33:32 +01:00
Hugo Barrera 478310d0c6 List image/heif as a supported mime type
`imv` now supports HEIC, but other applications (e.g.: file managers) cannot determine this, since it's not listed as a supported mime type.

Adding this entry allows such applications to determine that `imv` can handle HEIC files.
2021-04-14 15:32:01 +01:00
Haelwenn (lanodan) Monnier 70a70727b7 Fallback to 'opengl' when dependency('gl') fails
This allows for imv to work on a system where libX11 is fully removed
2021-04-14 15:31:37 +01:00
Pascal Sommer 8e46aa0238 use exponential increments for zooming 2021-04-14 15:29:38 +01:00
Matthias Coppens 2c0f10a91b Include string header 2021-04-14 15:28:52 +01:00