[cheese/f20] Improve flash opacity calculation (#981066)
David King
amigadave at fedoraproject.org
Mon Sep 29 17:27:47 UTC 2014
commit 6139cf04ae7ca07e437ebfed72b29e726697ddc9
Author: David King <amigadave at amigadave.com>
Date: Mon Sep 29 18:03:23 2014 +0100
Improve flash opacity calculation (#981066)
cheese-3.10.2-track-flash-opacity-explicitly.patch | 95 ++++++++++++++++++++
cheese.spec | 14 ++-
2 files changed, 105 insertions(+), 4 deletions(-)
---
diff --git a/cheese-3.10.2-track-flash-opacity-explicitly.patch b/cheese-3.10.2-track-flash-opacity-explicitly.patch
new file mode 100644
index 0000000..b075ce6
--- /dev/null
+++ b/cheese-3.10.2-track-flash-opacity-explicitly.patch
@@ -0,0 +1,95 @@
+From 409bc356e6a7856795826c1e83b5b390e3183566 Mon Sep 17 00:00:00 2001
+From: Benjamin Herr <ben at 0x539.de>
+Date: Sun, 20 Jul 2014 02:30:46 +0200
+Subject: [PATCH] Track flash opacity explicitly
+
+Retrieving the opacity of the flash, reducing it by an exponentially
+small step, and setting it again does not always actually decrease the
+widget's opacity, and so the fading does not actually terminate.
+
+Incidentally, also unset the flash timeout tags to avoid calling
+g_source_remove() spuriously.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=733433
+---
+ libcheese/cheese-flash.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/libcheese/cheese-flash.c b/libcheese/cheese-flash.c
+index 3ea9848..7970b71 100644
+--- a/libcheese/cheese-flash.c
++++ b/libcheese/cheese-flash.c
+@@ -74,6 +74,7 @@ struct _CheeseFlashPrivate
+ GtkWidget *parent;
+ guint flash_timeout_tag;
+ guint fade_timeout_tag;
++ gdouble opacity;
+ };
+
+ static void
+@@ -86,6 +87,7 @@ cheese_flash_init (CheeseFlash *self)
+
+ priv->flash_timeout_tag = 0;
+ priv->fade_timeout_tag = 0;
++ priv->opacity = 1.0;
+
+ /* make it so it doesn't look like a window on the desktop (+fullscreen) */
+ gtk_window_set_decorated (window, FALSE);
+@@ -191,17 +193,24 @@ static gboolean
+ cheese_flash_opacity_fade (gpointer data)
+ {
+ GtkWindow *flash_window = GTK_WINDOW (data);
+- gdouble opacity = gtk_window_get_opacity (flash_window);
++ CheeseFlashPrivate *flash_priv;
++
++ flash_priv = CHEESE_FLASH (data)->priv;
+
+ /* exponentially decrease */
+- gtk_window_set_opacity (flash_window, opacity * FLASH_FADE_FACTOR);
++ flash_priv->opacity *= FLASH_FADE_FACTOR;
+
+- if (opacity <= FLASH_LOW_THRESHOLD)
++ if (flash_priv->opacity <= FLASH_LOW_THRESHOLD)
+ {
+ /* the flasher has finished when we reach the quit value */
+ gtk_widget_hide (GTK_WIDGET (flash_window));
++ flash_priv->fade_timeout_tag = 0;
+ return G_SOURCE_REMOVE;
+ }
++ else
++ {
++ gtk_window_set_opacity (flash_window, flash_priv->opacity);
++ }
+
+ return G_SOURCE_CONTINUE;
+ }
+@@ -229,6 +238,7 @@ cheese_flash_start_fade (gpointer data)
+ }
+
+ flash_priv->fade_timeout_tag = g_timeout_add (1000.0 / FLASH_ANIMATION_RATE, cheese_flash_opacity_fade, data);
++ flash_priv->flash_timeout_tag = 0;
+ return G_SOURCE_REMOVE;
+ }
+
+@@ -257,9 +267,18 @@ cheese_flash_fire (CheeseFlash *flash)
+ flash_window = GTK_WINDOW (flash);
+
+ if (flash_priv->flash_timeout_tag > 0)
++ {
+ g_source_remove (flash_priv->flash_timeout_tag);
++ flash_priv->flash_timeout_tag = 0;
++ }
++
+ if (flash_priv->fade_timeout_tag > 0)
++ {
+ g_source_remove (flash_priv->fade_timeout_tag);
++ flash_priv->fade_timeout_tag = 0;
++ }
++
++ flash_priv->opacity = 1.0;
+
+ parent = gtk_widget_get_toplevel (flash_priv->parent);
+ screen = gtk_widget_get_screen (parent);
+--
+2.1.0
+
diff --git a/cheese.spec b/cheese.spec
index cb82af5..ff98983 100644
--- a/cheese.spec
+++ b/cheese.spec
@@ -1,14 +1,14 @@
Name: cheese
Epoch: 2
Version: 3.10.2
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Application for taking pictures and movies from a webcam
Group: Amusements/Graphics
License: GPLv2+
-URL: http://projects.gnome.org/cheese/
+URL: https://wiki.gnome.org/Apps/Cheese
#VCS: git:git://git.gnome.org/cheese
-Source0: http://download.gnome.org/sources/cheese/3.10/%{name}-%{version}.tar.xz
+Source0: https://download.gnome.org/sources/cheese/3.10/%{name}-%{version}.tar.xz
# https://bugzilla.gnome.org/show_bug.cgi?id=678447
# Patch2: 0002-Setup-vp8enc-in-a-way-suitable-for-realtime-encoding.patch
@@ -25,6 +25,8 @@ Patch8: 0008-on_camera_update_num_camera_devices-Remove-unnecessa.patch
Patch9: 0009-cheese-preferences-Simplify-remove_camera_device.patch
Patch10: 0010-cheese-preferences-Cleanly-handle-going-from-1-0-dev.patch
Patch11: 0011-cheese-window-Disable-effect-switching-buttons-on-we.patch
+# Backported from https://bugzilla.gnome.org/show_bug.cgi?id=733433
+Patch12: cheese-3.10.2-track-flash-opacity-explicitly.patch
BuildRequires: gtk3-devel >= 3.0.0
BuildRequires: gstreamer1-devel
@@ -92,6 +94,7 @@ for writing applications that require a webcam display widget.
%patch9 -p1
%patch10 -p1
%patch11 -p1
+%patch12 -p1
%build
@@ -100,7 +103,7 @@ make %{?_smp_mflags}
%install
-make install DESTDIR=$RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
rm -f $RPM_BUILD_ROOT%{_libdir}/libcheese.{a,la}
rm -f $RPM_BUILD_ROOT%{_libdir}/libcheese-gtk.{a,la}
@@ -165,6 +168,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gir-1.0/Cheese-3.0.gir
%changelog
+* Fri Sep 12 2014 David King <amigadave at amigadave.com> - 2:3.10.2-2
+- Apply upstream patch to improve flash opacity calculation (#981066)
+
* Mon Nov 11 2013 Richard Hughes <rhughes at redhat.com> - 2:3.10.2-1
- Update to 3.10.2
More information about the scm-commits
mailing list