[ease] [player] Use a window in the player.



commit 143bb0730b3c135cb5b1973f7707169be4a97e4c
Author: Nate Stedman <natesm gmail com>
Date:   Fri Jul 30 05:15:46 2010 -0400

    [player] Use a window in the player.
    
    Previously, it wasn't centered vertically and horizontally, which
    threw off a lot of transitions (anything involving rotation).
    ClutterStage also doesn't seem to provide anything to place the stage on a
    specific screen/display, which we'll need later.

 src/ease-editor-window.vala |    6 +++---
 src/ease-player.vala        |   33 ++++++++++++++++++++++++---------
 2 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/src/ease-editor-window.vala b/src/ease-editor-window.vala
index 6763c40..c135c33 100644
--- a/src/ease-editor-window.vala
+++ b/src/ease-editor-window.vala
@@ -353,9 +353,7 @@ internal class Ease.EditorWindow : Gtk.Window
 	
 	[CCode (instance_pos = -1)]
 	internal void play_handler(Gtk.Widget sender)
-	{
-		hide();
-		
+	{		
 		player = new Player(document);
 		
 		player.complete.connect(() => {
@@ -363,6 +361,8 @@ internal class Ease.EditorWindow : Gtk.Window
 			show();
 			present();
 		});
+		
+		hide();
 	}
 	
 	[CCode (instance_pos = -1)]
diff --git a/src/ease-player.vala b/src/ease-player.vala
index b38aa07..3905594 100644
--- a/src/ease-player.vala
+++ b/src/ease-player.vala
@@ -21,7 +21,7 @@
  * The Ease Player uses ClutterGtk to create a stage floated in the center
  * of a fullscreen Gtk.Window.
  */
-internal class Ease.Player : GLib.Object
+internal class Ease.Player : Gtk.Window
 {
 	internal Document document { get; set; }
 	internal int slide_index { get; set; }
@@ -60,7 +60,8 @@ internal class Ease.Player : GLib.Object
 		document = doc;
 		slide_index = -1;
 		
-		stage = new Clutter.Stage ();
+		var embed = new GtkClutter.Embed();
+		stage = embed.get_stage() as Clutter.Stage;
 		stage.width = document.width * scale;
 		stage.height = document.height * scale;
 		stage.title = _("Ease Presentation");
@@ -136,9 +137,22 @@ internal class Ease.Player : GLib.Object
 		container.scale_y = scale;
 		
 		// start the presentation
-		stage.show_all ();
-		stage.set_fullscreen (true);
-
+		stage.show_all();
+		
+		var align = new Gtk.Alignment(0.5f, 0.5f, 0, 0);
+		embed.set_size_request(document.width, document.height);
+		
+		// set background colors to black
+		align.modify_bg(Gtk.StateType.NORMAL, Color.black.gdk);
+		modify_bg(Gtk.StateType.NORMAL, Color.black.gdk);
+		
+		// build window
+		align.add(embed);
+		add(align);
+		fullscreen();
+		show_all();
+		present();
+		
 		can_animate = true;
 		advance();
 	}
@@ -199,13 +213,14 @@ internal class Ease.Player : GLib.Object
 			debug ("Quitting player.");
 			stage.hide ();
 			break;
-		case 0xff53:
+		case Key.RIGHT:
+		case Key.DOWN:
 			// Right arrow
 			debug ("Advancing to next slide.");
 			advance ();
 			break;
-		case 0xff51:
-			// Left arrow
+		case Key.LEFT:
+		case Key.UP:
 			debug ("Retreating to previous slide");
 			retreat ();
 			break;
@@ -233,8 +248,8 @@ internal class Ease.Player : GLib.Object
 		slide_index++;
 		if (slide_index == document.slides.size) // slideshow complete
 		{
-			stage.hide_all();
 			complete();
+			hide_all();
 			return;
 		}
 		



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