[sushi] window: make setParent() work properly
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] window: make setParent() work properly
- Date: Thu, 21 Apr 2011 20:48:32 +0000 (UTC)
commit cbff83c86dd23cd47cba7041c2cc7fcebb23f392
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Apr 21 16:46:27 2011 -0400
window: make setParent() work properly
src/js/ui/application.js | 9 +++++----
src/js/ui/mainWindow.js | 13 ++++++++++---
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index 0fe2746..7016228 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -85,11 +85,12 @@ Application.prototype = {
activate : function() {
},
- showFile : function(uri, xid) {
- this._mainWindow.setFile(Gio.file_new_for_uri(uri));
-
+ ShowFile : function(uri, xid, x, y) {
if (xid)
- this._mainWindow.setParent(xid);
+ this._mainWindow.setParent(xid, x, y);
+ this._mainWindow.showAll();
+
+ this._mainWindow.setFile(Gio.file_new_for_uri(uri));
},
quit : function() {
diff --git a/src/js/ui/mainWindow.js b/src/js/ui/mainWindow.js
index 8d0f584..57b85b1 100644
--- a/src/js/ui/mainWindow.js
+++ b/src/js/ui/mainWindow.js
@@ -487,10 +487,17 @@ MainWindow.prototype = {
/**************************************************************************
************************ public methods **********************************
**************************************************************************/
- setParent : function(xid) {
- let parent = GdkX11.X11Window.foreign_new_for_display(this._gtkWindow.get_display(),
- xid);
+ setParent : function(xid, x, y) {
+ let parent = Sushi.create_foreign_window(xid);
+ let root_x, root_y;
+ [ root_x, root_y ] = parent.get_root_origin();
+
+ if (!this._gtkWindow.get_realized())
+ this._gtkWindow.realize();
+
this._gtkWindow.get_window().set_transient_for(parent);
+ this._gtkWindow.move(root_x + x,
+ root_y + y);
},
showAll : function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]