[gnome-boxes] Remove display from Clutter stage
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Remove display from Clutter stage
- Date: Thu, 20 Oct 2011 10:06:17 +0000 (UTC)
commit 45d3233c961f4909b31cca46f07ecdb22aad5f7c
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Thu Oct 20 01:43:50 2011 +0200
Remove display from Clutter stage
For performance and for future gl-backend compatibility.
src/app.vala | 35 ++++++++++++++++++++++++++++++++---
src/machine.vala | 13 ++-----------
src/spice-display.vala | 1 +
3 files changed, 35 insertions(+), 14 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index d074248..3f247e4 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -19,9 +19,16 @@ private errordomain Boxes.Error {
INVALID
}
+private enum Boxes.AppPage {
+ MAIN,
+ DISPLAY
+}
+
private class Boxes.App: Boxes.UI {
public override Clutter.Actor actor { get { return stage; } }
public Gtk.Window window;
+ public Gtk.Notebook notebook;
+ public Gtk.Bin display_bin;
public GtkClutter.Embed embed;
public Clutter.Stage stage;
public Clutter.State state;
@@ -58,6 +65,19 @@ private class Boxes.App: Boxes.UI {
topbar.label.set_text (category.name);
}
+ public void show_display (Gtk.Widget display) {
+ remove_display ();
+
+ display_bin.add (display);
+ display_bin.show_all ();
+ notebook.page = Boxes.AppPage.DISPLAY;
+ }
+
+ public void remove_display () {
+ if (display_bin.get_child () != null)
+ display_bin.remove (display_bin.get_child ());
+ }
+
private async void setup_broker (string uri) {
var connection = new GVir.Connection (uri);
@@ -83,9 +103,15 @@ private class Boxes.App: Boxes.UI {
private void setup_ui () {
window = new Gtk.Window ();
window.set_default_size (640, 480);
+ notebook = new Gtk.Notebook ();
+ notebook.show_tabs = false;
+ window.add (notebook);
embed = new GtkClutter.Embed ();
- embed.show ();
- window.add (embed);
+ notebook.append_page (embed, null);
+
+ display_bin = new Gtk.Alignment (1, 1, 1, 1);
+ notebook.append_page (display_bin, null);
+
stage = embed.get_stage () as Clutter.Stage;
stage.set_color (gdk_rgba_to_clutter_color (get_boxes_bg_color ()));
@@ -108,7 +134,7 @@ private class Boxes.App: Boxes.UI {
size_group.add_widget (topbar.corner);
size_group.add_widget (sidebar.notebook);
- window.show ();
+ window.show_all ();
wizard = new Wizard (this);
ui_state = UIState.COLLECTION;
@@ -136,14 +162,17 @@ private class Boxes.App: Boxes.UI {
state.set_state ("display");
break;
case UIState.CREDS:
+ notebook.page = Boxes.AppPage.MAIN;
box.set_layout_manager (box_table);
state.set_state ("creds");
break;
case UIState.COLLECTION:
+ notebook.page = Boxes.AppPage.MAIN;
box.set_layout_manager (box_table);
state.set_state ("collection");
break;
case UIState.WIZARD:
+ notebook.page = Boxes.AppPage.MAIN;
box.set_layout_manager (box_table);
break;
default:
diff --git a/src/machine.vala b/src/machine.vala
index a811e4d..4debe4e 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -290,7 +290,6 @@ private class Boxes.MachineActor: Boxes.UI {
private GtkClutter.Texture screenshot;
public GtkClutter.Actor gtk_vbox;
- public GtkClutter.Actor gtk_display;
private Gtk.Label label;
private Gtk.VBox vbox; // and the vbox under it
private Gtk.Entry password_entry;
@@ -356,27 +355,19 @@ private class Boxes.MachineActor: Boxes.UI {
/* before display was in the vbox, but there are scaling issues, so now on stage */
this.display = display;
- gtk_display = new GtkClutter.Actor.with_contents (display);
- gtk_display.add_constraint_with_name ("display-fs", new Clutter.BindConstraint (machine.app.stage, BindCoordinate.SIZE, 0));
- display.show ();
// FIXME: there is flickering if we show it without delay
// where does this rendering delay come from?
Timeout.add (Boxes.App.duration, () => {
- machine.app.stage.add (gtk_display);
- gtk_display.grab_key_focus ();
+ machine.app.show_display (display);
display.grab_focus ();
return false;
});
}
public void hide_display () {
- if (display == null)
- return;
-
- actor_remove (gtk_display);
+ machine.app.remove_display ();
display = null;
- gtk_display = null;
}
public void set_password_needed (bool needed) {
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 4a5ba1f..83220ca 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -18,6 +18,7 @@ private class Boxes.SpiceDisplay: Boxes.Display {
if (display == null) {
display = new Spice.Display (session, n);
+ display.resize_guest = true;
display.scaling = true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]