[f-spot/FSPOT_0_6_0_STABLE] don't expect Expose event on Fader
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [f-spot/FSPOT_0_6_0_STABLE] don't expect Expose event on Fader
- Date: Mon, 24 Aug 2009 15:11:20 +0000 (UTC)
commit c4ed3c95020968a54f95723875cf7a32b96c513f
Author: Stephane Delcroix <stephane delcroix org>
Date: Mon Aug 24 17:05:55 2009 +0200
don't expect Expose event on Fader
with gtk+ 2.17.3, exposeevents for toplevel are no longer fired. This rely on a Doubleanimation for changing the windows opacity instead of exposeevents
src/Fader.cs | 40 ++++++++--------------------------------
1 files changed, 8 insertions(+), 32 deletions(-)
---
diff --git a/src/Fader.cs b/src/Fader.cs
index f494088..057813e 100644
--- a/src/Fader.cs
+++ b/src/Fader.cs
@@ -12,24 +12,23 @@
using System;
using Gtk;
using FSpot.Widgets;
+using FSpot.Bling;
namespace FSpot {
public class Fader {
bool composited;
- Delay fade_delay;
- TimeSpan duration;
- DateTime start;
Gtk.Window win;
double target_opacity;
-
+ DoubleAnimation fadin;
+
public Fader (Gtk.Window win, double target, int sec)
{
this.win = win;
win.Mapped += HandleMapped;
win.Unmapped += HandleUnmapped;
- win.ExposeEvent += HandleExposeEvent;
- duration = new TimeSpan (0, 0, sec);
- target_opacity = target;
+ fadin = new DoubleAnimation (0.0, target, new TimeSpan (0, 0, sec), delegate (double opacity) {
+ CompositeUtils.SetWinOpacity (win, opacity);
+ });
}
[GLib.ConnectBefore]
@@ -40,35 +39,12 @@ namespace FSpot {
return;
CompositeUtils.SetWinOpacity (win, 0.0);
- }
-
- public void HandleExposeEvent (object sender, ExposeEventArgs args)
- {
- if (fade_delay == null) {
- fade_delay = new Delay (50, new GLib.IdleHandler (Update));
- start = DateTime.Now;
- fade_delay.Start ();
- }
+ fadin.Start ();
}
public void HandleUnmapped (object sender, EventArgs args)
{
- if (fade_delay != null)
- fade_delay.Stop ();
- }
-
- public bool Update ()
- {
- double percent = Math.Min ((DateTime.Now - start).Ticks / (double) duration.Ticks, 1.0);
- double opacity = Math.Sin (percent * Math.PI * 0.5) * target_opacity;
- CompositeUtils.SetWinOpacity (win, opacity);
-
- bool stop = opacity >= target_opacity;
-
- if (stop)
- fade_delay.Stop ();
-
- return !stop;
+ fadin.Stop ();
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]