commit 44737e9a98aea9525be8160e39af6142ec678bdc
Author: Robin Stocker <robin@nibor.org>
Date:   Mon Jul 27 12:58:56 2009 +0200

    Bug 589856 – Add key for displaying controls
    
    Make it possible to briefly display the controls in full screen mode
    by pressing D, using the command-line argument --display-controls or
    a LIRC key. (Closes: #589856)

diff --git a/src/plugins/lirc/totem-lirc.c b/src/plugins/lirc/totem-lirc.c
index d0de550..e461324 100644
--- a/src/plugins/lirc/totem-lirc.c
+++ b/src/plugins/lirc/totem-lirc.c
@@ -88,6 +88,7 @@ typedef struct
 #define TOTEM_IR_COMMAND_EJECT "eject"
 #define TOTEM_IR_COMMAND_PLAY_DVD "play_dvd"
 #define TOTEM_IR_COMMAND_MUTE "mute"
+#define TOTEM_IR_COMMAND_DISPLAY_CONTROLS "display_controls"
 #define TOTEM_IR_COMMAND_TOGGLE_ASPECT "toggle_aspect"
 
 #define TOTEM_IR_SETTING "setting_"
@@ -202,6 +203,8 @@ totem_lirc_to_command (const gchar *str, char **url)
 		return TOTEM_REMOTE_COMMAND_PLAY_DVD;
 	else if (strcmp (str, TOTEM_IR_COMMAND_MUTE) == 0)
 		return TOTEM_REMOTE_COMMAND_MUTE;
+	else if (strcmp (str, TOTEM_IR_COMMAND_DISPLAY_CONTROLS) == 0)
+		return TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS;
 	else if (strcmp (str, TOTEM_IR_COMMAND_TOGGLE_ASPECT) == 0)
 		return TOTEM_REMOTE_COMMAND_TOGGLE_ASPECT;
 	else
diff --git a/src/plugins/lirc/totem_lirc_default b/src/plugins/lirc/totem_lirc_default
index 1a6eebc..554dc0a 100644
--- a/src/plugins/lirc/totem_lirc_default
+++ b/src/plugins/lirc/totem_lirc_default
@@ -234,3 +234,11 @@ begin
 	config = zoom_down
 end
 
+begin
+	prog = Totem
+	remote = *
+	button = KEY_DISPLAY
+	repeat = 1
+	config = display_controls
+end
+
diff --git a/src/totem-object.c b/src/totem-object.c
index 2635654..e9d4f2c 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -704,6 +704,7 @@ totem_remote_command_get_type (void)
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_REPLACE, "Replace"),
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_SHOW, "Show"),
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS, "Toggle controls"),
+			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS, "Display controls"),
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_UP, "Up"),
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_DOWN, "Down"),
 			ENUM_ENTRY (TOTEM_REMOTE_COMMAND_LEFT, "Left"),
@@ -2853,6 +2854,20 @@ totem_action_toggle_controls (Totem *totem)
 }
 
 /**
+ * totem_action_display_controls:
+ * @totem: a #TotemObject
+ *
+ * If Totem is fullscreened, display the controls for a short time, the same
+ * as when the mouse is moved in fullscreen.
+ **/
+void
+totem_action_display_controls (Totem *totem)
+{
+	if (totem_fullscreen_is_fullscreen (totem->fs) != FALSE)
+		totem_fullscreen_show_popups (totem->fs, FALSE);
+}
+
+/**
  * totem_action_next_angle:
  * @totem: a #TotemObject
  *
@@ -3013,6 +3028,9 @@ totem_action_remote (Totem *totem, TotemRemoteCommand cmd, const char *url)
 			gtk_toggle_action_set_active (action, !state);
 		}
 		break;
+	case TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS:
+		totem_action_display_controls (totem);
+		break;
 	case TOTEM_REMOTE_COMMAND_UP:
 		bacon_video_widget_dvd_event (totem->bvw,
 				BVW_DVD_ROOT_MENU_UP);
@@ -3062,9 +3080,8 @@ totem_action_remote (Totem *totem, TotemRemoteCommand cmd, const char *url)
 	}
 
 	if (handled != FALSE
-			&& gtk_window_is_active (GTK_WINDOW (totem->win))
-			&& totem_fullscreen_is_fullscreen (totem->fs) != FALSE) {
-		totem_fullscreen_show_popups (totem->fs, TRUE);
+			&& gtk_window_is_active (GTK_WINDOW (totem->win))) {
+		totem_action_display_controls (totem);
 	}
 }
 
@@ -3421,6 +3438,10 @@ totem_action_handle_key_press (Totem *totem, GdkEventKey *event)
 		bacon_video_widget_dvd_event (totem->bvw,
 				BVW_DVD_CHAPTER_MENU);
 		break;
+	case GDK_D:
+	case GDK_d:
+		totem_action_display_controls (totem);
+		break;
 	case GDK_F11:
 	case GDK_f:
 	case GDK_F:
@@ -3541,8 +3562,7 @@ totem_action_handle_key_press (Totem *totem, GdkEventKey *event)
 		if (bacon_video_widget_has_menus (totem->bvw) == FALSE) {
 			gboolean is_forward;
 
-			if (totem_is_fullscreen (totem) != FALSE)
-				totem_fullscreen_show_popups (totem->fs, FALSE);
+			totem_action_display_controls (totem);
 
 			is_forward = (event->keyval == GDK_Right);
 			/* Switch direction in RTL environment */
@@ -3644,8 +3664,7 @@ totem_action_handle_scroll (Totem *totem, GdkScrollDirection direction)
 {
 	gboolean retval = TRUE;
 
-	if (totem_fullscreen_is_fullscreen (totem->fs) != FALSE)
-		totem_fullscreen_show_popups (totem->fs, TRUE);
+	totem_action_display_controls (totem);
 
 	switch (direction) {
 	case GDK_SCROLL_UP:
diff --git a/src/totem-options.c b/src/totem-options.c
index b5a5f00..79062e3 100644
--- a/src/totem-options.c
+++ b/src/totem-options.c
@@ -58,6 +58,7 @@ const GOptionEntry all_options[] = {
 	{"mute", '\0', 0, G_OPTION_ARG_NONE, &optionstate.mute, N_("Mute sound"), NULL},
 	{"fullscreen", '\0', 0, G_OPTION_ARG_NONE, &optionstate.fullscreen, N_("Toggle Fullscreen"), NULL},
 	{"toggle-controls", '\0', 0, G_OPTION_ARG_NONE, &optionstate.togglecontrols, N_("Show/Hide Controls"), NULL},
+	{"display-controls", '\0', 0, G_OPTION_ARG_NONE, &optionstate.displaycontrols, N_("Briefly Display Controls"), NULL},
 	{"quit", '\0', 0, G_OPTION_ARG_NONE, &optionstate.quit, N_("Quit"), NULL},
 	{"enqueue", '\0', 0, G_OPTION_ARG_NONE, &optionstate.enqueue, N_("Enqueue"), NULL},
 	{"replace", '\0', 0, G_OPTION_ARG_NONE, &optionstate.replace, N_("Replace"), NULL},
@@ -215,6 +216,11 @@ totem_options_process_for_server (UniqueApp *app,
 					  (TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS));
 	}
 
+	if (options->displaycontrols) {
+		commands = g_list_append (commands, GINT_TO_POINTER
+		                          (TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS));
+	}
+
 	/* No commands, no files, show ourselves */
 	if (commands == NULL && options->filenames == NULL) {
 		unique_app_send_message (app, TOTEM_REMOTE_COMMAND_SHOW, NULL);
diff --git a/src/totem-options.h b/src/totem-options.h
index 185eec9..986ad38 100644
--- a/src/totem-options.h
+++ b/src/totem-options.h
@@ -45,6 +45,7 @@ typedef struct {
 	gboolean mute;
 	gboolean fullscreen;
 	gboolean togglecontrols;
+	gboolean displaycontrols;
 	gboolean quit;
 	gboolean enqueue;
 	gboolean replace;
diff --git a/src/totem.h b/src/totem.h
index e6a84b9..890271e 100644
--- a/src/totem.h
+++ b/src/totem.h
@@ -61,6 +61,7 @@ G_BEGIN_DECLS
  * @TOTEM_REMOTE_COMMAND_REPLACE: replace an item in the playlist
  * @TOTEM_REMOTE_COMMAND_SHOW: show the Totem instance
  * @TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS: toggle the control visibility
+ * @TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS: briefly display controls
  * @TOTEM_REMOTE_COMMAND_UP: go up (DVD controls)
  * @TOTEM_REMOTE_COMMAND_DOWN: go down (DVD controls)
  * @TOTEM_REMOTE_COMMAND_LEFT: go left (DVD controls)
@@ -94,6 +95,7 @@ typedef enum {
 	TOTEM_REMOTE_COMMAND_REPLACE,
 	TOTEM_REMOTE_COMMAND_SHOW,
 	TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS,
+	TOTEM_REMOTE_COMMAND_DISPLAY_CONTROLS,
 	TOTEM_REMOTE_COMMAND_UP,
 	TOTEM_REMOTE_COMMAND_DOWN,
 	TOTEM_REMOTE_COMMAND_LEFT,
