gnome-panel r10820 - trunk/gnome-panel



Author: vuntz
Date: Mon Feb 11 15:38:35 2008
New Revision: 10820
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=10820&view=rev

Log:
2008-02-11  Vincent Untz  <vuntz gnome org>

	Improve startup animation by starting the toplevels totally hidden.

	* panel-toplevel.c: add a new initial_animation_done field
	(panel_toplevel_update_auto_hide_position): if we haven't done the
	startup animation, set the auto hide size to 0
	(panel_toplevel_animation_timeout): when finishing an animation, mark
	that we're done with the initial startup animation
	(panel_toplevel_auto_unhide_timeout_handler): disable startup
	animation if there's no animation, for auto-hiding toplevels, unhide
	and hide again the toplevel so we can animate to the autohide size
	(panel_toplevel_init): init new field


Modified:
   trunk/gnome-panel/ChangeLog
   trunk/gnome-panel/panel-toplevel.c

Modified: trunk/gnome-panel/panel-toplevel.c
==============================================================================
--- trunk/gnome-panel/panel-toplevel.c	(original)
+++ trunk/gnome-panel/panel-toplevel.c	Mon Feb 11 15:38:35 2008
@@ -188,6 +188,8 @@
 	/* flag to see if we have already done geometry updating,
 	   if not then we're still loading and can ignore many things */
 	guint                   updated_geometry_initial : 1;
+	/* flag to see if we have done the initial animation */
+	guint                   initial_animation_done : 1;
 };
 
 enum {
@@ -1811,16 +1813,21 @@
 	height = toplevel->priv->original_height;
 	snap_tolerance = toplevel->priv->snap_tolerance;
 
-	if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)
-		auto_hide_size = CLAMP (toplevel->priv->auto_hide_size,
-					1, height / 2);
-	else
-		auto_hide_size = CLAMP (toplevel->priv->auto_hide_size,
-					1, width / 2);
+	if (toplevel->priv->initial_animation_done) {
+		if (toplevel->priv->orientation & PANEL_HORIZONTAL_MASK)
+			auto_hide_size = CLAMP (toplevel->priv->auto_hide_size,
+						1, height / 2);
+		else
+			auto_hide_size = CLAMP (toplevel->priv->auto_hide_size,
+						1, width / 2);
 
-	/* paranoia */
-	if (auto_hide_size <= 0)
-		auto_hide_size = DEFAULT_AUTO_HIDE_SIZE;
+		/* paranoia */
+		if (auto_hide_size <= 0)
+			auto_hide_size = DEFAULT_AUTO_HIDE_SIZE;
+	} else {
+		/* when loading, we animate from outside the screen */
+		auto_hide_size = 0;
+	}
 
 	switch (toplevel->priv->orientation) {
 	case PANEL_ORIENTATION_TOP:
@@ -3267,6 +3274,7 @@
 		toplevel->priv->animation_end_time.tv_sec    = 0xdead;
 		toplevel->priv->animation_end_time.tv_usec   = 0xdead;
 		toplevel->priv->animation_timeout            = 0;
+		toplevel->priv->initial_animation_done       = TRUE;
 	}
 
 	return toplevel->priv->animating;
@@ -3528,6 +3536,20 @@
 	if (toplevel->priv->animating)
 		return TRUE;
 
+	if (!toplevel->priv->animate)
+		toplevel->priv->initial_animation_done = TRUE;
+
+	/* initial animation for auto-hidden panels: we need to unhide and hide
+	 * again to get at the right size */
+	if (!toplevel->priv->initial_animation_done &&
+	    toplevel->priv->auto_hide) {
+		toplevel->priv->unhide_timeout = 0;
+		panel_toplevel_unhide (toplevel);
+		toplevel->priv->initial_animation_done = TRUE;
+		panel_toplevel_hide (toplevel, TRUE, -1);
+		return FALSE;
+	}
+
 	if (!panel_toplevel_contains_pointer (toplevel) &&
 	    toplevel->priv->auto_hide) {
 		toplevel->priv->unhide_timeout = 0;
@@ -4444,6 +4466,7 @@
 	toplevel->priv->attached          = FALSE;
 	toplevel->priv->attach_hidden     = FALSE;
 	toplevel->priv->updated_geometry_initial = FALSE;
+	toplevel->priv->initial_animation_done   = FALSE;
 
 	gtk_widget_add_events (GTK_WIDGET (toplevel),
 			       GDK_BUTTON_PRESS_MASK |



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]