Consistent approach to handle child windows.

When added, level of child window is reset to level of the parent.
A user may change it aftewards to the level that may even break
specified relative position.

E.g. if a child window is added below the parent (Normal)
and its level is set to Floating it will be ordered above.

Whenever you change level of the parent window, levels of the child
windows are reset as well ignoring all your changes.

According to the example, if you set level of the parent to Normal+1,
child window' level will also be set to Normal+1 and its relative
order to the parent (below) will be restored.
This commit is contained in:
Ilya Kulakov
2013-04-26 19:46:38 +07:00
parent d3a4ce4608
commit 7ccf7c731c
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -985,6 +985,7 @@ CPTexturedBackgroundWindowMask
[_platformWindow moveWindow:self fromLevel:_level toLevel:aLevel];
_level = aLevel;
[_childWindows makeObjectsPerformSelector:@selector(setLevel:) withObject:_level];
if ([self _sharesChromeWithPlatformWindow])
[_platformWindow setLevel:aLevel];
@@ -2530,6 +2531,7 @@ CPTexturedBackgroundWindowMask
[childWindow setParentWindow:self];
[childWindow _setChildOrdering:orderingMode];
[childWindow setLevel:[self level]];
if ([self isVisible] && ![childWindow isVisible])
[childWindow orderWindow:orderingMode relativeTo:_windowNumber];
+6 -1
View File
@@ -1490,7 +1490,8 @@ var resizeTimer = nil;
// relative to it or the furthest parent.
var children = [aWindow childWindows],
count = [children count],
parent = aWindow;
parent = aWindow,
parentLevel = [parent level];
for (var i = 0; i < count; ++i)
{
@@ -1501,6 +1502,10 @@ var resizeTimer = nil;
if (!childWasVisible && ![child _hasBeenOrderedIn])
continue;
// If a user moved level of the child window, we should respect that
if ([child level] !== parentLevel)
continue;
var ordering = [child _childOrdering];
if ((ordering === CPWindowAbove && furthestParent._index > parent._index) ||