mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
[broadway] More complete handling of transient parent
We now handle any order of transient being set and windows shown/created
This commit is contained in:
parent
75dc3f3a07
commit
4bbc45380b
@ -318,7 +318,7 @@ function unregisterWindow(win)
|
|||||||
|
|
||||||
function getTransientToplevel(surface)
|
function getTransientToplevel(surface)
|
||||||
{
|
{
|
||||||
while (surface.transientParent != 0) {
|
while (surface && surface.transientParent != 0) {
|
||||||
surface = surfaces[surface.transientParent];
|
surface = surfaces[surface.transientParent];
|
||||||
if (surface && surface.window)
|
if (surface && surface.window)
|
||||||
return surface;
|
return surface;
|
||||||
@ -522,8 +522,12 @@ function cmdSetTransientFor(id, parentId)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
surface.transientParent = parentId;
|
surface.transientParent = parentId;
|
||||||
if (surface.visible && surface.isTemp) {
|
if (parentId != 0 && surfaces[parentId]) {
|
||||||
alert("TODO: move temps between transient parents when visible");
|
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);
|
var i = stackingOrder.indexOf(surface);
|
||||||
stackingOrder.splice(i, 1);
|
stackingOrder.splice(i, 1);
|
||||||
stackingOrder.push(surface);
|
if (position != undefined)
|
||||||
|
stackingOrder.splice(position, 0, surface);
|
||||||
|
else
|
||||||
|
stackingOrder.push(surface);
|
||||||
|
|
||||||
for (var cid in surfaces) {
|
for (var cid in surfaces) {
|
||||||
var child = surfaces[cid];
|
var child = surfaces[cid];
|
||||||
if (child.transientParent == surface.id)
|
if (child.transientParent == surface.id)
|
||||||
moveToTopHelper(child);
|
moveToHelper(child, stackingOrder.indexOf(surface) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveToTop(surface) {
|
function moveToTop(surface) {
|
||||||
moveToTopHelper(surface);
|
moveToHelper(surface);
|
||||||
restackWindows();
|
restackWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user