summaryrefslogtreecommitdiff
path: root/gdk/broadway/broadway.js
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2011-04-11 17:48:21 +0200
committerAlexander Larsson <alexl@redhat.com>2011-04-12 11:12:39 +0200
commit4bbc45380b772aea148e81259dc5da9d778d2553 (patch)
tree93902e6b264efa62e6dfbe2cc9a4056fc1f5d303 /gdk/broadway/broadway.js
parent75dc3f3a07441a534f20be79a67675dce01bf0dd (diff)
downloadgtk+-4bbc45380b772aea148e81259dc5da9d778d2553.tar.gz
[broadway] More complete handling of transient parent
We now handle any order of transient being set and windows shown/created
Diffstat (limited to 'gdk/broadway/broadway.js')
-rw-r--r--gdk/broadway/broadway.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 97858fde0e..b75bcf606e 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -318,7 +318,7 @@ function unregisterWindow(win)
function getTransientToplevel(surface)
{
- while (surface.transientParent != 0) {
+ while (surface && surface.transientParent != 0) {
surface = surfaces[surface.transientParent];
if (surface && surface.window)
return surface;
@@ -522,8 +522,12 @@ function cmdSetTransientFor(id, parentId)
return;
surface.transientParent = parentId;
- if (surface.visible && surface.isTemp) {
- alert("TODO: move temps between transient parents when visible");
+ if (parentId != 0 && surfaces[parentId]) {
+ moveToHelper(surface, stackingOrder.indexOf(surfaces[parentId])+1);
+ }
+
+ if (surface.visible) {
+ restackWindows();
}
}
@@ -534,20 +538,23 @@ function restackWindows() {
}
}
-function moveToTopHelper(surface) {
+function moveToHelper(surface, position) {
var i = stackingOrder.indexOf(surface);
stackingOrder.splice(i, 1);
- stackingOrder.push(surface);
+ if (position != undefined)
+ stackingOrder.splice(position, 0, surface);
+ else
+ stackingOrder.push(surface);
for (var cid in surfaces) {
var child = surfaces[cid];
if (child.transientParent == surface.id)
- moveToTopHelper(child);
+ moveToHelper(child, stackingOrder.indexOf(surface) + 1);
}
}
function moveToTop(surface) {
- moveToTopHelper(surface);
+ moveToHelper(surface);
restackWindows();
}