Index: src/totem-fullscreen.c
===================================================================
--- src/totem-fullscreen.c	(revision 4707)
+++ src/totem-fullscreen.c	(working copy)
@@ -36,6 +36,7 @@
 #include "bacon-video-widget.h"
 
 #define FULLSCREEN_POPUP_TIMEOUT 5 * 1000
+#define FULLSCREEN_CURSOR_TIMEOUT 2 * 1000
 
 static GObjectClass *parent_class = NULL;
 
@@ -58,10 +59,15 @@
 	GtkWidget        *exit_popup;
 	GtkWidget        *control_popup;
 
+	 /* The rectangle within which the popups should be hidden */
+	GdkRectangle	 popup_hide_rect;
+	gboolean	 popups_visible;
+
 	/* Locks for keeping the popups during adjustments */
 	gboolean          seek_lock;
 	gboolean          vol_lock;
 
+	guint		  cursor_timeout;
 	guint             popup_timeout;
 	gboolean          popup_in_progress;
 
@@ -78,6 +84,39 @@
 	return (fs->is_fullscreen != FALSE);
 }
 
+
+void 
+totem_fullscreen_get_control_placements (TotemFullscreen *fs)
+{
+
+	gint exit_width,    exit_height;
+	gint control_width, control_height;
+	
+	GdkScreen              *screen;
+	GdkRectangle            fullscreen_rect;
+	TotemFullscreenPrivate *priv = fs->priv;
+
+	/* Obtain the screen rectangle */
+	screen = gtk_window_get_screen (GTK_WINDOW (fs->priv->parent_window));
+	gdk_screen_get_monitor_geometry (screen,
+					 gdk_screen_get_monitor_at_window (screen, fs->priv->parent_window->window),
+					 &fullscreen_rect);
+
+	/* Get the popup window sizes */
+	gtk_window_get_size (GTK_WINDOW (priv->exit_popup),
+			     &exit_width, &exit_height);
+
+
+	gtk_window_get_size (GTK_WINDOW (priv->control_popup),
+			     &control_width, &control_height);
+
+	priv->popup_hide_rect.x      = fullscreen_rect.x;
+	priv->popup_hide_rect.y      = fullscreen_rect.y + exit_height;
+	priv->popup_hide_rect.width  = fullscreen_rect.width;
+	priv->popup_hide_rect.height = fullscreen_rect.height - control_height;
+}
+
+
 static void
 totem_fullscreen_move_popups (TotemFullscreen *fs)
 {
@@ -97,6 +136,8 @@
 	/* Get the popup window sizes */
 	gtk_window_get_size (GTK_WINDOW (priv->exit_popup),
 			     &exit_width, &exit_height);
+
+
 	gtk_window_get_size (GTK_WINDOW (priv->control_popup),
 			     &control_width, &control_height);
 
@@ -122,6 +163,10 @@
 				 fullscreen_rect.height + fullscreen_rect.y -
 				 control_height);
 	}
+
+	/* Find the size and placements of the popup controls */
+	totem_fullscreen_get_control_placements (fs);
+	
 }
 
 static void
@@ -228,21 +273,56 @@
 	if (fs->priv->seek_lock != FALSE || fs->priv->vol_lock != FALSE)
 		return TRUE;
 
+	totem_fullscreen_popup_timeout_remove (fs);
+	fs->priv->popups_visible = FALSE;
+	
 	gtk_widget_hide (fs->priv->exit_popup);
 	gtk_widget_hide (fs->priv->control_popup);
 
-	totem_fullscreen_popup_timeout_remove (fs);
+	return FALSE;
+}
 
+
+void
+totem_fullscreen_cursor_timeout_remove (TotemFullscreen *fs)
+{
+	if (fs->priv->cursor_timeout != 0) {
+		g_source_remove (fs->priv->cursor_timeout);
+		fs->priv->cursor_timeout = 0;
+	}
+}
+
+gboolean
+totem_fullscreen_cursor_hide (TotemFullscreen *fs)
+{
 	totem_fullscreen_set_cursor (fs, FALSE);
+	totem_fullscreen_cursor_timeout_remove (fs);	
+}
 
-	return FALSE;
+void
+totem_fullscreen_cursor_timeout_add (TotemFullscreen *fs)
+{
+	if (fs->priv->cursor_timeout != 0)
+		totem_fullscreen_cursor_timeout_remove (fs);
+		
+	fs->priv->cursor_timeout = g_timeout_add (FULLSCREEN_CURSOR_TIMEOUT,
+						 (GSourceFunc) totem_fullscreen_cursor_hide, fs);
 }
 
 gboolean
+totem_fullscreen_cursor_show (TotemFullscreen *fs)
+{
+	totem_fullscreen_set_cursor (fs, TRUE);
+	if (totem_fullscreen_is_fullscreen (fs) == TRUE)
+		totem_fullscreen_cursor_timeout_add (fs);	
+}
+
+gboolean
 totem_fullscreen_motion_notify (GtkWidget *widget, GdkEventMotion *event,
 				TotemFullscreen *fs)
 {
 	GtkWidget * item;
+	gboolean show_popups;
 
 	if (totem_fullscreen_is_fullscreen (fs) == FALSE) 
 		return FALSE;
@@ -252,22 +332,51 @@
 
 	fs->priv->popup_in_progress = TRUE;
 
-	totem_fullscreen_popup_timeout_remove (fs);
+	totem_fullscreen_cursor_show (fs);
 
-	/* FIXME: is this really required while we are anyway going 
-	   to do a show_all on its parent control_popup? */
-	item = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_hbox"));
-	gtk_widget_show_all (item);
-	gdk_flush ();
+	if (event == NULL)
+		show_popups = TRUE;
+	else
+	{
+		gint cursor_x = (gint)event->x_root;
+		gint cursor_y = (gint)event->y_root;
+		gint hide_region_left = fs->priv->popup_hide_rect.x;
+		gint hide_region_right = fs->priv->popup_hide_rect.x + fs->priv->popup_hide_rect.width;
+		gint hide_region_top = fs->priv->popup_hide_rect.y;
+		gint hide_region_bottom = fs->priv->popup_hide_rect.height;
 
-	/* Show the popup widgets */
-	totem_fullscreen_move_popups (fs);
-	gtk_widget_show_all (fs->priv->exit_popup);
-	gtk_widget_show_all (fs->priv->control_popup);
+		/* Check to see if movement is within top or bottom popup area */
+		show_popups = 	(cursor_x < hide_region_left)  || 
+				(cursor_x > hide_region_right) ||
+				(cursor_y < hide_region_top)   ||
+				(cursor_y > hide_region_bottom);
+	}
+	
+	if (show_popups == FALSE)
+	{
+		totem_fullscreen_popup_hide (fs);		
+		fs->priv->popup_in_progress = FALSE;
 
-	/* Show the mouse cursor */
-	totem_fullscreen_set_cursor (fs, TRUE);
+		return FALSE;	
+	}
 
+	totem_fullscreen_popup_timeout_remove (fs);
+	if( fs->priv->popups_visible == FALSE)
+	{
+		/* FIXME: is this really required while we are anyway going 
+		   to do a show_all on its parent control_popup? */
+		item = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_hbox"));
+		gtk_widget_show_all (item);
+		gdk_flush ();
+
+		/* Show the popup widgets */
+		totem_fullscreen_move_popups (fs);
+		gtk_widget_show_all (fs->priv->exit_popup);
+		gtk_widget_show_all (fs->priv->control_popup);
+
+		fs->priv->popups_visible = TRUE;
+	}
+	
 	/* Reset the popup timeout */
 	totem_fullscreen_popup_timeout_add (fs);
 
@@ -285,11 +394,21 @@
 	totem_fullscreen_popup_hide (fs);
 
 	bacon_video_widget_set_fullscreen (fs->priv->bvw, fullscreen);
-	totem_fullscreen_set_cursor (fs, !fullscreen);
+	if (fullscreen == TRUE)
+		totem_fullscreen_cursor_hide (fs);
+	else
+	{
+		totem_fullscreen_set_cursor (fs, TRUE);
+		totem_fullscreen_cursor_timeout_remove (fs);
+	}
 
 	fs->is_fullscreen = fullscreen;
+	
+	/* Find the size and placements of the popup controls */
+	totem_fullscreen_get_control_placements (fs);
 }
 
+
 static void
 totem_fullscreen_parent_window_notify (GtkWidget *parent_window,
 				       GParamSpec *property,
@@ -368,6 +487,7 @@
 totem_fullscreen_init (TotemFullscreen *fs)
 {
         fs->priv = g_new0 (TotemFullscreenPrivate, 1);
+
 }
 
 static void
@@ -376,7 +496,8 @@
         TotemFullscreen *fs = TOTEM_FULLSCREEN (object);
 
 	totem_fullscreen_popup_timeout_remove (fs);
-
+	totem_fullscreen_cursor_timeout_remove (fs);
+	
         g_free (fs->priv);
 
 	(* G_OBJECT_CLASS (parent_class)->finalize) (object);
