Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package imv for openSUSE:Factory checked in at 2023-01-21 19:10:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/imv (Old) and /work/SRC/openSUSE:Factory/.imv.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "imv" Sat Jan 21 19:10:21 2023 rev:7 rq:1059489 version:4.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/imv/imv.changes 2022-03-11 11:44:26.854821683 +0100 +++ /work/SRC/openSUSE:Factory/.imv.new.32243/imv.changes 2023-01-21 19:10:26.968917666 +0100 @@ -1,0 +2,17 @@ +Thu Jan 19 01:59:20 UTC 2023 - llyyr <llyyr.pub...@gmail.com> + +- Update to 4.4.0: + * Fixed critical error "wl_window: fix buffer size not divisible by scale" + * Added libgrapheme 2.0.0 as an alternative to icu + * Added '-w' option to specify window title at startup + * Added background rectangle behind the (possibly multiline) overlay text + * Changed chequered pattern to only over the image area for transparent images not the whole viewport + * Renamed imv-folder to imv-dir + * Fixed slideshow not always pausing correctly + * Fixed imv-dir showing as a duplicate imv in its desktop file + * Fixed whitespace bug in expanded title text + * Made imv-dir fall back to imv behaviour when given too many arguments + * Improved handling of paths from stdin + * Minor documentation and changelog improvements + +------------------------------------------------------------------- Old: ---- v4.3.1.tar.gz New: ---- v4.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ imv.spec ++++++ --- /var/tmp/diff_new_pack.Z7XfpH/_old 2023-01-21 19:10:28.532926595 +0100 +++ /var/tmp/diff_new_pack.Z7XfpH/_new 2023-01-21 19:10:28.536926618 +0100 @@ -1,7 +1,7 @@ # # spec file for package imv # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: imv -Version: 4.3.1 +Version: 4.4.0 Release: 0 Summary: Image viewer for X11/Wayland License: GPL-2.0-or-later AND MIT @@ -64,7 +64,7 @@ %doc AUTHORS README.md %{_bindir}/%{name}* %{_datadir}/applications/%{name}.desktop -%{_datadir}/applications/%{name}-folder.desktop +%{_datadir}/applications/%{name}-dir.desktop %{_mandir}/man?/%{name}* %{_sysconfdir}/%{name}_config ++++++ v4.3.1.tar.gz -> v4.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/AUTHORS new/imv-v4.4.0/AUTHORS --- old/imv-v4.3.1/AUTHORS 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/AUTHORS 2023-01-18 23:20:52.000000000 +0100 @@ -1,5 +1,5 @@ Author and maintainer of imv: - * Harry Jeffery <ha...@exec64.co.uk> + * Harry Jeffery <m...@harry.pm> People who have contributed to imv: * Carlo Abelli @@ -14,5 +14,5 @@ * Sebastian Parborg --- -When submitting a patch or pull request to imv, feel free to add yourself to -this list, in alphabetical surname order. +When submitting a patch to imv, feel free to add yourself to this list, in +alphabetical surname order. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/CHANGELOG new/imv-v4.4.0/CHANGELOG --- old/imv-v4.3.1/CHANGELOG 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/CHANGELOG 2023-01-18 23:20:52.000000000 +0100 @@ -1,11 +1,29 @@ imv Changelog ============= +v4.4.0 - 2023-01-18 +------------------- + +* Fixed critical error "wl_window: fix buffer size not divisible by scale" +* Added libgrapheme 2.0.0 as an alternative to icu +* Added '-w' option to specify window title at startup +* Added background rectangle behind the (possibly multiline) overlay text +* Changed chequered pattern to only over the image area for transparent images not the whole viewport +* Renamed imv-folder to imv-dir +* Fixed slideshow not always pausing correctly +* Fixed imv-dir showing as a duplicate imv in its desktop file +* Fixed whitespace bug in expanded title text +* Made imv-dir fall back to imv behaviour when given too many arguments +* Improved handling of paths from stdin +* Minor documentation and changelog improvements + v4.3.1 - 2021-12-14 +------------------- * Fix segfault when used with latest wlroots v4.3.0 - 2021-08-05 +------------------- * Give freeimage backend preceedence over libjpeg * Fix lack of X11 window deletion event handling @@ -23,6 +41,7 @@ * Fix flickering bug in high-DPI wayland v4.2.0 - 2020-12-17 +------------------- * Switched to meson build system * Added HEIF backend @@ -36,6 +55,7 @@ * Fixed bug when selecting first/last image v4.1.0 - 2019-12-21 +------------------- * Added libsngif backend * Added command history to console @@ -50,6 +70,7 @@ * Fixed name of the LGPL v4.0.1 - 2019-08-28 +------------------- * Documented default binds in man page * Added icon to imv.desktop @@ -57,6 +78,7 @@ * Added warning when legacy bind syntax is detected v4.0.0 - 2019-08-27 +------------------- BREAKING CHANGES: * Fixed keyboard layout handling, changing bind syntax @@ -88,14 +110,17 @@ * Fixed several memory leaks v3.1.2 - 2019-06-24 +------------------- * Fix manpage packaging regression introduced in v3.1.1 v3.1.1 - 2019-06-22 +------------------- * Adjusted Makefile to improve packaging on BSDs v3.1.0 - 2019-06-17 +------------------- * Added support for multiple image loaders, allowing imv to use libraries other than FreeImage. This adds support for SVGs, and in the future, other formats @@ -112,6 +137,7 @@ * Miscellaneous code cleanup and documentation fixes v3.0.0 - 2018-05-08 +------------------- BREAKING CHANGES: * Change a,s,S flags to -s <mode> syntax @@ -129,6 +155,7 @@ * Fix bug where slideshow timer is not reset when an image is closed v2.1.3 - 2016-10-22 +------------------- * Fix various resource leaks * Fix a bug where imv would to try and catch up on long periods of lost gif @@ -158,7 +185,7 @@ * Fix fullscreen bug with i3 * Fix bug where gifs would sometimes not auto-scale when opened * Add commit hash to version string of non-release builds -* Fix bug where '+' did not work on foriegn keyboard layouts +* Fix bug where '+' did not work on foreign keyboard layouts v2.0.0 - 2016-02-08 ------------------- @@ -216,4 +243,4 @@ v1.0.0 - 2015-11-11 ------------------- -Intitial release +Initial release diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/CONTRIBUTING new/imv-v4.4.0/CONTRIBUTING --- old/imv-v4.3.1/CONTRIBUTING 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/CONTRIBUTING 2023-01-18 23:20:52.000000000 +0100 @@ -1,9 +1,10 @@ imv Contributing Guidelines =========================== -1) Please keep pull requests rebased onto the latest master. All merges should - be simple fast-forward merges. While rebasing, tidy up and merge your commits - as you think appropriate. +1) Please submit all patches to ~exec64/imv-de...@lists.sr.ht with + a subject line prefixed with [PATCH imv] or [PATCH imv v2] as + appropriate. This will help ensure that CI is run against your + patch automatically. 2) Please ensure that your changes fit with the existing coding style of imv. Strictly no tabs, and 2 spaces of indentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/README.md new/imv-v4.4.0/README.md --- old/imv-v4.3.1/README.md 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/README.md 2023-01-18 23:20:52.000000000 +0100 @@ -4,6 +4,10 @@ `imv` is a command line image viewer intended for use with tiling window managers. +[Project home](https://sr.ht/~exec64/imv/) + +imv is currently seeking a new maintainer to adopt it. Please email the author if interested. + Features -------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/contrib/imv-dir new/imv-v4.4.0/contrib/imv-dir --- old/imv-v4.3.1/contrib/imv-dir 1970-01-01 01:00:00.000000000 +0100 +++ new/imv-v4.4.0/contrib/imv-dir 2023-01-18 23:20:52.000000000 +0100 @@ -0,0 +1,6 @@ +#!/bin/sh -efu +if [ $# -ge 2 ]; then + exec imv "$@" +else + exec imv -n "$1" "$(dirname "$1")" +fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/contrib/imv-folder new/imv-v4.4.0/contrib/imv-folder --- old/imv-v4.3.1/contrib/imv-folder 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/contrib/imv-folder 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -#!/bin/bash -image="$1" -declare -a ARGS order -readarray -t -d '' order < <(printf '%s\0' "$(dirname "$image")"/* | sort -z --sort=version) -for a in "${order[@]}"; do - if [ -f "$a" ]; then - ARGS+=("$a") - fi -done -exec imv "${ARGS[@]}" -n "$image" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/doc/imv-dir.1.txt new/imv-v4.4.0/doc/imv-dir.1.txt --- old/imv-v4.3.1/doc/imv-dir.1.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/imv-v4.4.0/doc/imv-dir.1.txt 2023-01-18 23:20:52.000000000 +0100 @@ -0,0 +1,36 @@ +///// +vim:set ts=4 sw=4 tw=82 noet: +///// +:quotes.~: + +imv (1) +======= + +Name +---- +imv-dir - Open 'imv' for all images in a directory + +Description +----------- + +'imv-dir' is a wrapper for 'imv' that auto-selects the directory where the image is located, so that the *next* and *previous* commands function in the same way as other image viewers. + +Note that this wrapper supports only a single image. For opening multiple images, use plain `imv`. + +Synopsis +-------- +'imv-dir' path + +Authors +------- + +imv is written and maintained by Harry Jeffery <m...@harry.pm> +with contributions from other developers. + +Full source code and other information can be found at +<https://sr.ht/~exec64/imv>. + +See Also +-------- + +**imv**(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/doc/imv-folder.1.txt new/imv-v4.4.0/doc/imv-folder.1.txt --- old/imv-v4.3.1/doc/imv-folder.1.txt 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/doc/imv-folder.1.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -///// -vim:set ts=4 sw=4 tw=82 noet: -///// -:quotes.~: - -imv (1) -======= - -Name ----- -imv-folder - Open 'imv' for all images in a folder - -Description ------------ - -'imv-folder' is a wrapper for 'imv' that auto-selects the folder where the image is located, so that the *next* and *previous* commands function in the same way as other image viewers. - -Note that this wrapper supports only a single image. For opening multiple images, use plain `imv`. - -Synopsis --------- -'imv-folder' path - -Authors -------- - -imv is written and maintained by Harry Jeffery <m...@harry.pm> -with contributions from other developers. - -Full source code and other information can be found at -<https://github.com/eXeC64/imv>. - -See Also --------- - -**imv**(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/doc/imv-msg.1.txt new/imv-v4.4.0/doc/imv-msg.1.txt --- old/imv-v4.3.1/doc/imv-msg.1.txt 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/doc/imv-msg.1.txt 2023-01-18 23:20:52.000000000 +0100 @@ -27,7 +27,7 @@ imv-msg is written and maintained by Harry Jeffery <m...@harry.pm> Full source code and other information can be found at -<https://github.com/eXeC64/imv>. +<https://sr.ht/~exec64/imv>. See Also -------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/doc/imv.1.txt new/imv-v4.4.0/doc/imv.1.txt --- old/imv-v4.3.1/doc/imv.1.txt 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/doc/imv.1.txt 2023-01-18 23:20:52.000000000 +0100 @@ -70,6 +70,9 @@ *-u* <linear|nearest_neighbour>:: Set upscaling method used by imv. +*-w* <windowtitle>:: + Set window title when starting imv. + *-x*:: Disable looping of input paths. @@ -316,7 +319,7 @@ of imv will open a unix socket named '$XDG_RUNTIME_DIR/imv-$PID.sock'. If $XDG_RUNTIME_DIR is undefined, the socket is placed into '/tmp/' instead. -The **imv-msg**(1) utility is provided to simpliy this from shell scripts. +The **imv-msg**(1) utility is provided to simplify this from shell scripts. Authors ------- @@ -325,9 +328,9 @@ with contributions from other developers. Full source code and other information can be found at -<https://github.com/eXeC64/imv>. +<https://sr.ht/~exec64/imv>. See Also -------- -**imv**(5) **imv-msg**(1) **imv-folder**(1) +**imv**(5) **imv-msg**(1) **imv-dir**(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/doc/imv.5.txt new/imv-v4.4.0/doc/imv.5.txt --- old/imv-v4.3.1/doc/imv.5.txt 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/doc/imv.5.txt 2023-01-18 23:20:52.000000000 +0100 @@ -56,9 +56,10 @@ Use the specified font in the overlay. Defaults to 'Monospace:24'. *overlay_text* = <text>:: - Use the given text as the overlay's text. The provided text is shell - expanded, so the output of commands can be used: '$(ls)' as can environment - variables, including the ones accessible to imv's 'exec' command. + Use the given text as the overlay's text. The provided text is shell expanded, + so the output of commands can be used (for example, '$(ls)'). Environment + variables can also be used, including the ones accessible to imv's 'exec' + command. *overlay_text_color* = <hex-code>:: Set the color for the text in the overlay. Is a 6-digit hexadecimal color diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/files/imv-dir.desktop new/imv-v4.4.0/files/imv-dir.desktop --- old/imv-v4.3.1/files/imv-dir.desktop 1970-01-01 01:00:00.000000000 +0100 +++ new/imv-v4.4.0/files/imv-dir.desktop 2023-01-18 23:20:52.000000000 +0100 @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=imv-dir +Name[en_US]=imv-dir +GenericName=Image viewer +GenericName[en_US]=Image viewer +Comment=Fast freeimage-based Image Viewer | Open all images in a directory +Exec=imv-dir %F +NoDisplay=true +Terminal=false +Type=Application +Categories=Graphics;2DGraphics;Viewer; +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; +Icon=multimedia-photo-viewer +Keywords=photo;picture; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/files/imv-folder.desktop new/imv-v4.4.0/files/imv-folder.desktop --- old/imv-v4.3.1/files/imv-folder.desktop 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/files/imv-folder.desktop 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -[Desktop Entry] -Name=imv-folder -Name[en_US]=imv -GenericName=Image viewer -GenericName[en_US]=Image viewer -Comment=Fast freeimage-based Image Viewer | Open all images on a folder -Exec=imv-folder %f -NoDisplay=true -Terminal=false -Type=Application -Categories=Graphics;2DGraphics;Viewer; -MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; -Icon=multimedia-photo-viewer -Keywords=photo;picture; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/meson.build new/imv-v4.4.0/meson.build --- old/imv-v4.3.1/meson.build 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/meson.build 2023-01-18 23:20:52.000000000 +0100 @@ -1,7 +1,7 @@ project( 'imv', ['c'], - version: '4.3.1', + version: '4.4.0', license: 'MIT', meson_version: '>= 0.47', default_options: ['buildtype=debugoptimized', 'c_std=c99'], @@ -19,6 +19,8 @@ add_project_arguments('-D_XOPEN_SOURCE=700', language: 'c') +add_project_arguments('-DRSVG_DISABLE_DEPRECATION_WARNINGS', language: 'c') + cc = meson.get_compiler('c') dep_null = dependency('', required: false) m_dep = cc.find_library('m', required : false) @@ -38,6 +40,15 @@ target_single_ws = false endif +_unicode = get_option('unicode') +if _unicode == 'icu' + unicode_lib = dependency('icu-io') + add_project_arguments('-DIMV_USE_ICU', language: 'c') +elif _unicode == 'grapheme' + unicode_lib = cc.find_library('grapheme') + add_project_arguments('-DIMV_USE_GRAPHEME', language: 'c') +endif + gl_dep = dependency('gl', required: false) if not gl_dep.found() # libglvnd fallback for pure-wayland systems @@ -49,7 +60,7 @@ gl_dep, dependency('threads'), dependency('xkbcommon'), - dependency('icu-io'), + unicode_lib, dependency('inih', fallback : ['inih', 'inih_dep']), m_dep, ] @@ -159,7 +170,7 @@ if get_option('contrib-commands') install_data( - files('contrib/imv-folder'), + files('contrib/imv-dir'), install_dir: get_option('bindir'), install_mode: 'rwxr-xr-x', ) @@ -178,7 +189,7 @@ ] if get_option('contrib-commands') desktop_list += [ - 'imv-folder', + 'imv-dir', ] endif foreach desktop: desktop_list @@ -221,7 +232,7 @@ ] if get_option('contrib-commands') man_list += [ - [1, 'imv-folder'], + [1, 'imv-dir'], ] endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/meson_options.txt new/imv-v4.4.0/meson_options.txt --- old/imv-v4.3.1/meson_options.txt 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/meson_options.txt 2023-01-18 23:20:52.000000000 +0100 @@ -8,6 +8,14 @@ description : 'window system to use' ) +# Unicode backend - default is ICU +option('unicode', + type: 'combo', + value: 'icu', + choices : ['icu', 'grapheme'], + description : 'unicode library to use' +) + option('test', type : 'feature', description : 'enable tests' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/canvas.c new/imv-v4.4.0/src/canvas.c --- old/imv-v4.3.1/src/canvas.c 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/canvas.c 2023-01-18 23:20:52.000000000 +0100 @@ -5,7 +5,7 @@ #include <GL/gl.h> #include <assert.h> -#include <cairo/cairo.h> +#include <cairo.h> #include <pango/pangocairo.h> #include <stdarg.h> #include <stdbool.h> @@ -17,6 +17,11 @@ #include <librsvg/rsvg.h> #endif +// 16x16 chequerboard texture data +#define REPEAT8(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ +unsigned char checkers_data[] = { REPEAT8(REPEAT8(0xCC, 0xCC, 0xCC, 0xFF), REPEAT8(0x80, 0x80, 0x80, 0xFF)), + REPEAT8(REPEAT8(0x80, 0x80, 0x80, 0xFF), REPEAT8(0xCC, 0xCC, 0xCC, 0xFF)) }; + struct imv_canvas { cairo_surface_t *surface; cairo_t *cairo; @@ -28,6 +33,7 @@ struct imv_bitmap *bitmap; GLuint texture; } cache; + GLuint checkers_texture; }; struct imv_canvas *imv_canvas_create(int width, int height) @@ -45,6 +51,20 @@ glGenTextures(1, &canvas->texture); assert(canvas->texture); + glGenTextures(1, &canvas->checkers_texture); + assert(canvas->checkers_texture); + + glBindTexture(GL_TEXTURE_2D, canvas->checkers_texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 16); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 16, 16, 0, GL_RGBA, + GL_UNSIGNED_INT_8_8_8_8_REV, checkers_data); + canvas->width = width; canvas->height = height; @@ -66,6 +86,7 @@ if (canvas->cache.texture) { glDeleteTextures(1, &canvas->cache.texture); } + glDeleteTextures(1, &canvas->checkers_texture); free(canvas); } @@ -111,16 +132,45 @@ cairo_fill(canvas->cairo); } -void imv_canvas_fill_checkers(struct imv_canvas *canvas, int size) -{ - for (int x = 0; x < canvas->width; x += size) { - for (int y = 0; y < canvas->height; y += size) { - float color = ((x/size + y/size) % 2 == 0) ? 0.25 : 0.75; - cairo_set_source_rgba(canvas->cairo, color, color, color, 1); - cairo_rectangle(canvas->cairo, x, y, size, size); - cairo_fill(canvas->cairo); - } +void imv_canvas_fill_checkers(struct imv_canvas *canvas, struct imv_image *image, + int bx, int by, double scale, + double rotation, bool mirrored) +{ + GLint viewport[4]; + glGetIntegerv(GL_VIEWPORT, viewport); + + glPushMatrix(); + glOrtho(0.0, viewport[2], viewport[3], 0.0, 0.0, 10.0); + + glBindTexture(GL_TEXTURE_2D, canvas->checkers_texture); + glEnable(GL_TEXTURE_2D); + + const int left = bx; + const int top = by; + const int right = left + imv_image_width(image) * scale; + const int bottom = top + imv_image_height(image) * scale; + const int center_x = left + imv_image_width(image) * scale / 2; + const int center_y = top + imv_image_height(image) * scale / 2; + const float s = (right - left) / 16.0; + const float t = s * imv_image_height(image) / imv_image_width(image); + + glTranslated(center_x, center_y, 0); + if (mirrored) { + glScaled(-1, 1, 1); } + glRotated(rotation, 0, 0, 1); + glTranslated(-center_x, -center_y, 0); + + glBegin(GL_TRIANGLE_FAN); + glTexCoord2f(0, 0); glVertex2i(left, top); + glTexCoord2f(s, 0); glVertex2i(right, top); + glTexCoord2f(s, t); glVertex2i(right, bottom); + glTexCoord2f(0, t); glVertex2i(left, bottom); + glEnd(); + + glBindTexture(GL_TEXTURE_2D, 0); + glDisable(GL_TEXTURE_2D); + glPopMatrix(); } void imv_canvas_font(struct imv_canvas *canvas, const char *name, int size) @@ -130,6 +180,22 @@ pango_font_description_set_size(canvas->font, size * PANGO_SCALE); } +PangoLayout *imv_canvas_make_layout(struct imv_canvas *canvas, const char *line) +{ + PangoLayout *layout = pango_cairo_create_layout(canvas->cairo); + pango_layout_set_font_description(layout, canvas->font); + pango_layout_set_text(layout, line, -1); + + return layout; +} + +void imv_canvas_show_layout(struct imv_canvas *canvas, int x, int y, + PangoLayout *layout) +{ + cairo_move_to(canvas->cairo, x, y); + pango_cairo_show_layout(canvas->cairo, layout); +} + int imv_canvas_printf(struct imv_canvas *canvas, int x, int y, const char *fmt, ...) { char line[1024]; @@ -137,12 +203,9 @@ va_start(args, fmt); vsnprintf(line, sizeof line, fmt, args); - PangoLayout *layout = pango_cairo_create_layout(canvas->cairo); - pango_layout_set_font_description(layout, canvas->font); - pango_layout_set_text(layout, line, -1); + PangoLayout *layout = imv_canvas_make_layout(canvas, line); - cairo_move_to(canvas->cairo, x, y); - pango_cairo_show_layout(canvas->cairo, layout); + imv_canvas_show_layout(canvas, x, y, layout); PangoRectangle extents; pango_layout_get_pixel_extents(layout, NULL, &extents); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/canvas.h new/imv-v4.4.0/src/canvas.h --- old/imv-v4.3.1/src/canvas.h 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/canvas.h 2023-01-18 23:20:52.000000000 +0100 @@ -3,6 +3,8 @@ #include <stdbool.h> +#include <pango/pangocairo.h> + struct imv_canvas; struct imv_image; @@ -33,12 +35,23 @@ /* Fill the whole canvas with the current color */ void imv_canvas_fill(struct imv_canvas *canvas); -/* Fill the whole canvas with a chequerboard pattern */ -void imv_canvas_fill_checkers(struct imv_canvas *canvas, int size); +/* Blit the given image area with a chequerboard pattern to the current OpenGL framebuffer */ +void imv_canvas_fill_checkers(struct imv_canvas *canvas, struct imv_image *image, + int x, int y, double scale, + double rotation, bool mirrored); /* Select the font to draw text with */ void imv_canvas_font(struct imv_canvas *canvas, const char *name, int size); +/* Prepare layout containing the given string, ready for rendering on the given + * canvas. The caller is responsible for releasing it with a call to + * g_object_unref */ +PangoLayout *imv_canvas_make_layout(struct imv_canvas *canvas, const char *str); + +/* Shows layout with at the specified coordinates */ +void imv_canvas_show_layout(struct imv_canvas *canvas, int x, int y, + PangoLayout *layout); + /* Draw some text on the canvas, returns the width used in pixels */ int imv_canvas_printf(struct imv_canvas *canvas, int x, int y, const char *fmt, ...); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/console.c new/imv-v4.4.0/src/console.c --- old/imv-v4.3.1/src/console.c 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/console.c 2023-01-18 23:20:52.000000000 +0100 @@ -6,8 +6,15 @@ #include <ctype.h> #include <stdlib.h> #include <string.h> + +#ifdef IMV_USE_ICU #include <unicode/utext.h> #include <unicode/ubrk.h> +#endif + +#ifdef IMV_USE_GRAPHEME +#include <grapheme.h> +#endif struct imv_console { char *buffer; @@ -25,6 +32,7 @@ /* Iterates forwards over characters in a UTF-8 string */ static size_t next_char(char *buffer, size_t position) { + #if defined(IMV_USE_ICU) size_t result = position; UErrorCode status = U_ZERO_ERROR; UText *ut = utext_openUTF8(NULL, buffer, -1, &status); @@ -42,11 +50,19 @@ utext_close(ut); assert(U_SUCCESS(status)); return result; + #elif defined(IMV_USE_GRAPHEME) + if (buffer[position] != 0) { + return position + grapheme_next_character_break_utf8(buffer + position, SIZE_MAX); + } else { + return position; + } + #endif } /* Iterates backwards over characters in a UTF-8 string */ static size_t prev_char(char *buffer, size_t position) { + #if defined(IMV_USE_ICU) size_t result = position; UErrorCode status = U_ZERO_ERROR; UText *ut = utext_openUTF8(NULL, buffer, -1, &status); @@ -64,6 +80,18 @@ utext_close(ut); assert(U_SUCCESS(status)); return result; + + #elif defined(IMV_USE_GRAPHEME) + size_t result = 0; + size_t step; + do { + step = grapheme_next_character_break_utf8(buffer + result, SIZE_MAX); + if (result + step >= position) + break; + result += step; + } while (step > 0); + return result; + #endif } static void add_to_history(struct list *history, const char *line) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/imv.c new/imv-v4.4.0/src/imv.c --- old/imv-v4.3.1/src/imv.c 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/imv.c 2023-01-18 23:20:52.000000000 +0100 @@ -731,6 +731,17 @@ return false; } +static bool parse_window_title(struct imv *imv, const char *name) +{ + if (strcmp(name, "")) { + free(imv->title_text); + imv->title_text = strdup(name); + return true; + } + + return false; +} + static bool parse_initial_pan(struct imv *imv, const char *pan_params) { char *next_val; @@ -808,7 +819,7 @@ } puts("imv's full source code is published under the terms of the MIT\n" - "license, and can be found at https://github.com/eXeC64/imv\n" + "license, and can be found at https://sr.ht/~exec64/imv\n" "\n" "imv uses the inih library to parse ini files.\n" "See https://github.com/benhoyt/inih for details.\n" @@ -823,7 +834,7 @@ int o; /* TODO getopt_long */ - while ((o = getopt(argc, argv, "frdxhvlu:s:n:b:t:c:")) != -1) { + while ((o = getopt(argc, argv, "frdxhvlu:s:n:b:t:c:w:")) != -1) { switch(o) { case 'f': imv->start_fullscreen = true; break; case 'r': imv->recursive_load = true; break; @@ -864,6 +875,7 @@ } break; case 'c': list_append(imv->startup_commands, optarg); break; + case 'w': parse_window_title(imv, optarg); break; case '?': imv_log(IMV_ERROR, "Unknown argument '%c'. Aborting.\n", optopt); return false; @@ -939,22 +951,56 @@ } if (imv->starting_path) { - ssize_t index = imv_navigator_find_path(imv->navigator, imv->starting_path); - if (index == -1) { - index = (int) strtol(imv->starting_path, NULL, 10); - index -= 1; /* input is 1-indexed, internally we're 0 indexed */ - if (errno == EINVAL) { - index = -1; + if (imv->paths_from_stdin) { + int max_tries = 1000; + bool is_number = true; + for(int i=0; i<strlen(imv->starting_path); ++i) { + if (!isdigit(imv->starting_path[i])) { + is_number = false; + break; + } + } + ssize_t index = -1; + if (is_number) { + index = strtol(imv->starting_path, NULL, 10); + } + bool cont = true; + while (cont) { + if (max_tries <= 0) { + cont = false; + } + imv_window_pump_events(imv->window, event_handler, imv); + if (index == -1) { + ssize_t img_index = imv_navigator_find_path(imv->navigator, imv->starting_path); + if(img_index != -1) { + imv_navigator_select_abs(imv->navigator, img_index); + cont = false; + } + } else { + if(imv_navigator_length(imv->navigator) >= index) { + imv_navigator_select_abs(imv->navigator, index); + cont = false; + } + } + max_tries -= 1; } - } - - if (index >= 0) { - imv_navigator_select_abs(imv->navigator, index); } else { - imv_log(IMV_ERROR, "Invalid starting image: %s\n", imv->starting_path); + ssize_t index = imv_navigator_find_path(imv->navigator, imv->starting_path); + if (index == -1) { + index = (int) strtol(imv->starting_path, NULL, 10); + index -= 1; /* input is 1-indexed, internally we're 0 indexed */ + if (errno == EINVAL) { + index = -1; + } + } + + if (index >= 0) { + imv_navigator_select_abs(imv->navigator, index); + } else { + imv_log(IMV_ERROR, "Invalid starting image: %s\n", imv->starting_path); + } } } - /* Push any startup commands into the event queue */ for (size_t i = 0; i < imv->startup_commands->len; ++i) { command_callback(imv->startup_commands->items[i], imv); @@ -1084,7 +1130,7 @@ } /* handle slideshow */ - if (imv->slideshow.duration != 0.0) { + if (imv_viewport_is_playing(imv->view) && imv->slideshow.duration != 0.0) { double dt = current_time - last_time; imv->slideshow.elapsed += dt; @@ -1285,10 +1331,6 @@ 1.0); imv_canvas_fill(imv->canvas); imv_canvas_draw(imv->canvas); - } else { - /* chequered background */ - imv_canvas_fill_checkers(imv->canvas, 16); - imv_canvas_draw(imv->canvas); } /* draw our actual image */ @@ -1300,6 +1342,10 @@ imv_viewport_get_scale(imv->view, &scale); imv_viewport_get_rotation(imv->view, &rotation); imv_viewport_get_mirrored(imv->view, &mirrored); + if (imv->background.type == BACKGROUND_CHEQUERED) { + imv_canvas_fill_checkers(imv->canvas, imv->current_image, + x, y, scale, rotation, mirrored); + } imv_canvas_draw_image(imv->canvas, imv->current_image, x, y, scale, rotation, mirrored, imv->upscaling_method, imv->cache_invalidated); @@ -1309,27 +1355,35 @@ /* if the overlay needs to be drawn, draw that too */ if (imv->overlay.enabled) { - const int height = imv->overlay.font.size * 1.2; - imv_canvas_color(imv->canvas, - imv->overlay.background_color.r / 255.f, - imv->overlay.background_color.g / 255.f, - imv->overlay.background_color.b / 255.f, - imv->overlay.background_alpha / 255.f); - int y = 0 ; + char overlay_text[1024]; + generate_env_text(imv, overlay_text, sizeof overlay_text, imv->overlay.text); + PangoLayout *layout = imv_canvas_make_layout(imv->canvas, overlay_text); + + int width, height; + pango_layout_get_pixel_size(layout, &width, &height); + + int y = 0; const int bottom_offset = 5; if (imv->overlay.position_at_bottom) { y = wh - height - bottom_offset; } - imv_canvas_fill_rectangle(imv->canvas, 0, y, ww, height + bottom_offset); + + imv_canvas_color(imv->canvas, + imv->overlay.background_color.r / 255.f, + imv->overlay.background_color.g / 255.f, + imv->overlay.background_color.b / 255.f, + imv->overlay.background_alpha / 255.f); + imv_canvas_fill_rectangle(imv->canvas, 0, y, width, height + bottom_offset); + imv_canvas_color(imv->canvas, imv->overlay.text_color.r / 255.f, imv->overlay.text_color.g / 255.f, imv->overlay.text_color.b / 255.f, imv->overlay.text_alpha / 255.f); - char overlay_text[1024]; - generate_env_text(imv, overlay_text, sizeof overlay_text, imv->overlay.text); - imv_canvas_printf(imv->canvas, 0, y, "%s", overlay_text); + imv_canvas_show_layout(imv->canvas, 0, y, layout); + + g_object_unref(layout); } /* draw command entry bar if needed */ @@ -1945,14 +1999,16 @@ size_t len = 0; wordexp_t word; + setenv("IFS", "", 1); if (wordexp(format, &word, 0) == 0) { for (size_t i = 0; i < word.we_wordc; ++i) { - len += snprintf(buf + len, buf_len - len, "%s ", word.we_wordv[i]); + len += snprintf(buf + len, buf_len - len, (i ? " %s" : "%s"), word.we_wordv[i]); } wordfree(&word); } else { len += snprintf(buf, buf_len, "error expanding text"); } + unsetenv("IFS"); return len; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/wl_window.c new/imv-v4.4.0/src/wl_window.c --- old/imv-v4.3.1/src/wl_window.c 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/wl_window.c 2023-01-18 23:20:52.000000000 +0100 @@ -550,8 +550,6 @@ if (new_scale != window->scale) { window->scale = new_scale; wl_surface_set_buffer_scale(window->wl_surface, window->scale); - wl_surface_commit(window->wl_surface); - wl_display_roundtrip(window->wl_display); size_t buffer_width = window->width * window->scale; size_t buffer_height = window->height * window->scale; wl_egl_window_resize(window->egl_window, buffer_width, buffer_height, 0, 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/imv-v4.3.1/src/x11_window.c new/imv-v4.4.0/src/x11_window.c --- old/imv-v4.3.1/src/x11_window.c 2021-12-14 10:56:12.000000000 +0100 +++ new/imv-v4.4.0/src/x11_window.c 2023-01-18 23:20:52.000000000 +0100 @@ -419,7 +419,7 @@ handler(data, &e); } } else if (xev.type == ClientMessage) { - if (xev.xclient.message_type = window->wm_protocols && xev.xclient.data.l[0] == window->wm_delete_window) { + if (xev.xclient.message_type == window->wm_protocols && xev.xclient.data.l[0] == window->wm_delete_window) { struct imv_event e = { .type = IMV_EVENT_CLOSE };