Make "Toggle fullscreen mode" shortcut work



Heya,

Another patch for today, fixing
http://bugzilla.gnome.org/show_bug.cgi?id=302592

The patch looks big, but the only real change is making all the
fullscreen changes (hiding and/or showing widgets, etc.) in the
window-state-event handler.

Cheers

-- 
Bastien Nocera <hadess hadess net>
Index: src/totem.c
===================================================================
RCS file: /cvs/gnome/totem/src/totem.c,v
retrieving revision 1.458
diff -u -p -u -r1.458 totem.c
--- src/totem.c	25 Aug 2005 15:43:36 -0000	1.458
+++ src/totem.c	2 Sep 2005 15:34:15 -0000
@@ -518,22 +518,34 @@ totem_action_pause (Totem *totem)
 	}
 }
 
-void
-totem_action_fullscreen_toggle (Totem *totem)
+static gboolean
+window_state_event_cb (GtkWidget *window, GdkEventWindowState *event,
+		Totem *totem)
 {
-	if (totem_is_fullscreen (totem) != FALSE)
-	{
+	if (event->changed_mask != GDK_WINDOW_STATE_FULLSCREEN) {
+		return FALSE;
+	}
+
+	if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) {
+		totem_action_save_size (totem);
+		update_fullscreen_size (totem);
+		bacon_video_widget_set_fullscreen (totem->bvw, TRUE);
+		bacon_video_widget_set_show_cursor (totem->bvw, FALSE);
+
+		if (bacon_video_widget_is_playing (totem->bvw) != FALSE)
+			totem_scrsaver_disable (totem->scr);
+
+		totem->controls_visibility = TOTEM_CONTROLS_FULLSCREEN;
+		show_controls (totem, FALSE);
+	} else {
 		GtkWidget *item;
 
 		popup_hide (totem);
 		bacon_video_widget_set_fullscreen (totem->bvw, FALSE);
-		gtk_window_unfullscreen (GTK_WINDOW(totem->win));
 		bacon_video_widget_set_show_cursor (totem->bvw, TRUE);
 
 		totem_scrsaver_enable (totem->scr);
 
-		totem->controls_visibility = TOTEM_CONTROLS_VISIBLE;
-
 		item = glade_xml_get_widget
 			(totem->xml, "tmw_show_controls_menu_item");
 
@@ -546,18 +558,18 @@ totem_action_fullscreen_toggle (Totem *t
 			totem->controls_visibility = TOTEM_CONTROLS_HIDDEN;
 			show_controls (totem, TRUE);
 		}
-	} else {
-		totem_action_save_size (totem);
-		update_fullscreen_size (totem);
-		bacon_video_widget_set_fullscreen (totem->bvw, TRUE);
-		bacon_video_widget_set_show_cursor (totem->bvw, FALSE);
-		gtk_window_fullscreen (GTK_WINDOW(totem->win));
+	}
 
-		if (bacon_video_widget_is_playing (totem->bvw) != FALSE)
-			totem_scrsaver_disable (totem->scr);
+	return FALSE;
+}
 
-		totem->controls_visibility = TOTEM_CONTROLS_FULLSCREEN;
-		show_controls (totem, FALSE);
+void
+totem_action_fullscreen_toggle (Totem *totem)
+{
+	if (totem_is_fullscreen (totem) != FALSE) {
+		gtk_window_unfullscreen (GTK_WINDOW (totem->win));
+	} else {
+		gtk_window_fullscreen (GTK_WINDOW (totem->win));
 	}
 }
 
@@ -3029,6 +3041,8 @@ totem_callback_connect (Totem *totem)
 	g_object_notify (G_OBJECT (totem->win), "is-active");
 	g_signal_connect_swapped (G_OBJECT (totem->win), "notify",
 			G_CALLBACK (popup_hide), totem);
+	g_signal_connect (G_OBJECT (totem->win), "window-state-event",
+			G_CALLBACK (window_state_event_cb), totem);
 
 	/* Screen size and Theme changes */
 	g_signal_connect (G_OBJECT (gdk_screen_get_default ()),
Index: src/backend/bacon-video-widget-xine.c
===================================================================
RCS file: /cvs/gnome/totem/src/backend/bacon-video-widget-xine.c,v
retrieving revision 1.205
diff -u -p -u -r1.205 bacon-video-widget-xine.c
--- src/backend/bacon-video-widget-xine.c	2 Sep 2005 11:22:01 -0000	1.205
+++ src/backend/bacon-video-widget-xine.c	2 Sep 2005 15:34:15 -0000
@@ -2537,7 +2537,6 @@ bacon_video_widget_set_show_cursor (Baco
 {
 	g_return_if_fail (bvw != NULL);
 	g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
-	g_return_if_fail (bvw->priv->xine != NULL);
 
 	if (show_cursor == FALSE)
 	{


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