Re: [Geeqie-devel] Animaed GIF (Was: Version 1.2.1)

2015-09-10 Thread Christian Heckendorf
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

* Klaus Ethgen  [10.09.2015. @16:56:30 +0100]:
> Am Do den 10. Sep 2015 um 16:27 schrieb John Stoffel:
> > When will geeqie (if ever) support animated gifs?  I've been forced to
> > use ristretto lately, and I don't like it nearly as much.
>
> I would like to see that too from time to time. The only problem is that
> there is not enough man power currently doing it. There are several
> problems that would be more important.
>
> I currently do not know any image viewer that support animated GIFs. I
> always use firefox or gimp for this purpose. On the other hand, I do not
> have that need too often.
>
> But if you have a working patch, I would be grateful uploading it. :-)
>

I wrote a patch for this over 5 years ago and never got around to
cleaning it up and sharing it. I'll dig around my backups when I get
home in a few hours to see if I still have it.

If I recall, the animation functions already exist in the graphics
libraries geeqie uses. The animation parts of the patch were only
10-20 lines of code so it shouldn't be very hard to reproduce if I
can't find it in my backups. I'll check in again after I've taken a
look.

Thanks,
Christian
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQEcBAEBCAAGBQJV8be0AAoJEDDuvWqdEJdR1u8H/3eeblbdGXbc12wRJCL77ch1
0C7xIStMPN1sCPKVsp3hYUTKQhvmJnQPJjFdAXmGLTe0OSxa0pFIrfG/0yFmgXF7
eZlB8DnGlXrkhKObzsTawBSHhDADyxlfHDAqgA+FFY6NVASizsRlji7UcFUYjxNK
wiFOc3yvocoD4duxWrgnEeCL8ubPI8SyhTs1KF1lrsgt9IKM3qIgtxfYkGKa4NoR
1k8X5c4sIAQn+4mYUOLqn6icS8a8yVhkFyqtPVI05ojrkL4G4OffUOBl5AT0cQOc
WLntW315UEwxr4wNt3yfZad0ZGIJ8jdNtGwzzk+QHt3PVw+qE4UXLNqG5OmeGYk=
=VJ/3
-END PGP SIGNATURE-

--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel


Re: [Geeqie-devel] Version 1.2.2

2015-09-10 Thread Greg Troxel

I have updated pkgsrc to 1.2.2 (and not quite committed it yet).  The
only problem I had was that configure uses == with test, and that's a
bash extension not specified by POSIX.   This patch is against configure
(because that's what I had to patch to build the tarball).


--- configure.orig  2015-09-10 14:28:36.0 +
+++ configure
@@ -9146,7 +9146,7 @@ else
 fi
 
 
-if test x$gtk3 == xyes; then
+if test x$gtk3 = xyes; then
 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Gtk3 enabled\"" >&5
 $as_echo "$as_me: WARNING: \"Gtk3 enabled\"" >&2;}
 
@@ -9158,7 +9158,7 @@ $as_echo "$as_me: WARNING: \"Gtk3 is pre
 fi
 fi
 
-if test x$gtk3 == xno; then
+if test x$gtk3 = xno; then
 # Check whether --enable-gtktest was given.
 if test "${enable_gtktest+set}" = set; then :
   enableval=$enable_gtktest;


pgpHt1IRIdpj0.pgp
Description: PGP signature
--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel


Re: [Geeqie-devel] Animaed GIF (Was: Version 1.2.1)

2015-09-10 Thread Christian Heckendorf
* Christian Heckendorf  [10.09.2015. @13:02:44 -0400]:
> * Klaus Ethgen  [10.09.2015. @16:56:30 +0100]:
> > Am Do den 10. Sep 2015 um 16:27 schrieb John Stoffel:
> > > When will geeqie (if ever) support animated gifs?  I've been forced to
> > > use ristretto lately, and I don't like it nearly as much.
> >
> > I would like to see that too from time to time. The only problem is that
> > there is not enough man power currently doing it. There are several
> > problems that would be more important.
> >
> > I currently do not know any image viewer that support animated GIFs. I
> > always use firefox or gimp for this purpose. On the other hand, I do not
> > have that need too often.
> >
> > But if you have a working patch, I would be grateful uploading it. :-)
> >
> 
> I wrote a patch for this over 5 years ago and never got around to
> cleaning it up and sharing it. I'll dig around my backups when I get
> home in a few hours to see if I still have it.
> 

I found the patch and updated it against the current master. Happy to
see it still works without any modifications needed. I implemented it as
a pop-up/right-click option called "Animate" because it's pretty slow to
start animating. Feel free to switch to some other concept, but this
might be a useful starting point.

In case the patch attachment gets stripped from the list, you can
also find it on my server:
http://ulmus.me/other/patch/geeqie-gif.patch
http://ulmus.me/other/patch/geeqie-gif.patch.asc

Thanks,
Christian
diff --git a/src/layout_image.c b/src/layout_image.c
index b59eaa6..4e2e6b3 100644
--- a/src/layout_image.c
+++ b/src/layout_image.c
@@ -256,6 +256,106 @@ static gboolean layout_image_slideshow_continue_check(LayoutWindow *lw)
 
 /*
  *
+ * Animation
+ *
+ */
+
+struct image_animation_data
+{
+	ImageWindow *iw;
+	GdkPixbufAnimation *gpa;
+	GdkPixbufAnimationIter *iter;
+	GdkPixbuf *gpb;
+	FileData *data_adr;
+	volatile FileData **cur_data_adr;
+	guint delay;
+};
+
+static void image_animation_data_free(struct image_animation_data *fd)
+{
+	g_object_unref(fd->iter);
+	g_object_unref(fd->gpa);
+	free(fd);
+}
+
+static gboolean animation_should_continue(struct image_animation_data *fd)
+{
+	/* Check if a new image has been loaded. */
+	if (fd->data_adr != *fd->cur_data_adr)
+		return FALSE;
+
+	return TRUE;
+}
+
+static gboolean show_next_frame(gpointer data)
+{
+	struct image_animation_data *fd = (struct image_animation_data*)data;
+	int delay;
+	PixbufRenderer *pr = (PixbufRenderer*)fd->iw->pr;
+
+	if (animation_should_continue(fd)==FALSE)
+		{
+		image_animation_data_free(fd);
+		return FALSE;
+		}
+
+	if (gdk_pixbuf_animation_iter_advance(fd->iter,NULL)==FALSE)
+		{
+		/* This indicates the animation is complete.
+		   Return FALSE here to disable looping. */
+		}
+
+	fd->gpb = gdk_pixbuf_animation_iter_get_pixbuf(fd->iter);
+	image_change_pixbuf(fd->iw,fd->gpb,pr->zoom,FALSE);
+
+	if (fd->iw->func_update)
+		fd->iw->func_update(fd->iw, fd->iw->data_update);
+
+	delay = gdk_pixbuf_animation_iter_get_delay_time(fd->iter);
+	if (delay!=fd->delay)
+		{
+		if (delay>0) /* Current frame not static. */
+			{
+			fd->delay=delay;
+			g_timeout_add(delay,show_next_frame,fd);
+			}
+		else
+			{
+			image_animation_data_free(fd);
+			}
+		return FALSE;
+		}
+
+	return TRUE;
+}
+
+void layout_image_animate_toggle(LayoutWindow *lw)
+{
+	GError *err=NULL;
+	GdkPixbufAnimation *gpa;
+	GdkPixbufAnimationIter *iter;
+	ImageWindow *iw;
+	struct image_animation_data *fd;
+
+	if (!lw || !(iw=lw->image) ||
+		!(gpa = gdk_pixbuf_animation_new_from_file(iw->image_fd->path,)) || err ||
+		gdk_pixbuf_animation_is_static_image(gpa) ||
+		!(iter = gdk_pixbuf_animation_get_iter(gpa,NULL)))
+		return;
+	
+	fd=malloc(sizeof(struct image_animation_data));
+	fd->iw = iw;
+	fd->gpa = gpa;
+	fd->iter = iter;
+	fd->data_adr = iw->image_fd;
+	fd->cur_data_adr = (volatile FileData**) >image_fd;
+	fd->delay =gdk_pixbuf_animation_iter_get_delay_time(iter);
+
+	g_timeout_add(fd->delay, show_next_frame, fd);
+}
+
+/*
+ *
  * pop-up menus
  *
  */
@@ -411,6 +511,13 @@ static void li_pop_menu_full_screen_cb(GtkWidget *widget, gpointer data)
 	layout_image_full_screen_toggle(lw);
 }
 
+static void li_pop_menu_animate_cb(GtkWidget *widget, gpointer data)
+{
+	LayoutWindow *lw = data;
+
+	layout_image_animate_toggle(lw);
+}
+
 static void li_pop_menu_hide_cb(GtkWidget *widget, gpointer data)
 {
 	LayoutWindow *lw = data;
@@ -548,6 +655,8 @@ static GtkWidget *layout_image_pop_menu(LayoutWindow *lw)
 		menu_item_add(menu, _("Exit _full screen"), G_CALLBACK(li_pop_menu_full_screen_cb), lw);
 		}
 
+	menu_item_add(menu, _("_Animate"), 

[Geeqie-devel] [PATCH] Use POSIX-specified = in test, not ==.

2015-09-10 Thread Greg Troxel
---
 configure.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index c5b726c..7a75ad2 100644
--- a/configure.in
+++ b/configure.in
@@ -192,7 +192,7 @@ fi
 AM_PATH_GLIB_2_0(2.24.0,,AC_MSG_ERROR(GLIB >= 2.24.0 not installed.))
 AC_ARG_ENABLE([gtk3], AC_HELP_STRING([--disable-gtk3], [use gtk2 instead of 
gtk3]),[gtk3="${enableval}"], [gtk3=m4_ifdef([AM_PATH_GTK_3_0], [auto], [no])])
 
-if test x$gtk3 == xyes; then
+if test x$gtk3 = xyes; then
 AC_MSG_WARN("Gtk3 enabled")
 m4_ifdef([AM_PATH_GTK_3_0], [AM_PATH_GTK_3_0(3.0.0,,AC_MSG_ERROR(GTK+ >= 
3.0.0 not installed.))])
 else
@@ -202,7 +202,7 @@ else
 fi
 fi
 
-if test x$gtk3 == xno; then
+if test x$gtk3 = xno; then
 m4_ifdef([AM_PATH_GTK_2_0], [AM_PATH_GTK_2_0(2.20.0,,AC_MSG_ERROR(GTK+ >= 
2.20.0 not installed.))])
 true
 fi
-- 
2.5.1


--
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991=/4140
___
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel