41a42,43
> #include <math.h>
> #include <time.h>
84a87,91
> // Distance the cursor needs to be moved for the controls to pop up
> #define FULLSCREEN_POPUP_MOVEMENT_REQUIRED 30  // percentage of screen width
> // Not moving the mouse in this amount of time resets the movement counter
> #define FULLSCREEN_POPUP_MOVEMENT_TIMEOUT 3     // seconds
> 
2283a2291,2295
> 	gboolean show_controls = FALSE;
> 	int movement_required;
> 	static int last_x=0, last_y=0, total_movement=0;
> 	static time_t last_movement_time = 0;
> 	
2291a2304,2324
> 	
> 	
> 	// Wheel events propagate here with a NULL event variable
> 	if(event == NULL)
> 		show_controls = TRUE;
> 	else
> 	{
> 		time_t now = time(NULL);
> 		// Timeout? Then reset the distance moved...
> 		if (difftime(now, last_movement_time) > FULLSCREEN_POPUP_MOVEMENT_TIMEOUT)
> 		{
> 	 		total_movement = 0;	 	
> 			last_x = event->x;
> 			last_y = event->y;
> 		}
> 		// Calculate cursors distance since last event
> 		total_movement += (int) sqrt( pow(event->x - last_x, 2) + pow(event->y - last_y,2));
> 		
> 		movement_required = (int)(totem->fullscreen_rect.width * (FULLSCREEN_POPUP_MOVEMENT_REQUIRED / (double)100));
> 		if(total_movement > movement_required)
> 			show_controls = TRUE;
2293c2326,2329
< 	popup_timeout_remove (totem);
---
> 		last_movement_time = now;
> 		last_x = event->x;
> 		last_y = event->y;
> 	}
2295,2297c2331,2333
< 	item = glade_xml_get_widget (totem->xml, "tcw_hbox");
< 	gtk_widget_show_all (item);
< 	gdk_flush ();
---
> 	if(show_controls == TRUE)
> 	{
> 		popup_timeout_remove (totem);
2299c2335,2337
< 	move_popups (totem);
---
> 		item = glade_xml_get_widget (totem->xml, "tcw_hbox");
> 		gtk_widget_show_all (item);
> 		gdk_flush ();
2301,2303c2339,2346
< 	gtk_widget_show_all (totem->exit_popup);
< 	gtk_widget_show_all (totem->control_popup);
< 	totem_action_set_cursor (totem, TRUE);
---
> 		move_popups (totem);
> 
> 		gtk_widget_show_all (totem->exit_popup);
> 		gtk_widget_show_all (totem->control_popup);
> 		totem_action_set_cursor (totem, TRUE);
> 
> 		popup_timeout_add (totem);
> 	}
2305d2347
< 	popup_timeout_add (totem);
