| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -479,9 +479,22 @@ public: | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    void toFront (bool makeActiveWindow) override
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        if (isSharedWindow)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            [[view superview] addSubview: view
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                              positioned: NSWindowAbove
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                              relativeTo: nil];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            NSView* superview = [view superview];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            NSMutableArray* subviews = [NSMutableArray arrayWithArray: [superview subviews]];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            const auto isFrontmost = [[subviews lastObject] isEqual: view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            if (! isFrontmost)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [view retain];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [subviews removeObject: view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [subviews addObject: view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [superview setSubviews: subviews];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [view release];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        if (window != nil && component.isVisible())
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        {
 | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -508,9 +521,26 @@ public: | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            if (isSharedWindow)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                [[view superview] addSubview: view
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                  positioned: NSWindowBelow
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                  relativeTo: otherPeer->view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                NSView* superview = [view superview];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                NSMutableArray* subviews = [NSMutableArray arrayWithArray: [superview subviews]];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                const auto otherViewIndex = [subviews indexOfObject: otherPeer->view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                if (otherViewIndex == NSNotFound)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    return;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                const auto isBehind = [subviews indexOfObject: view] < otherViewIndex;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                if (! isBehind)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    [view retain];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    [subviews removeObject: view];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    [subviews insertObject: view
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                   atIndex: otherViewIndex];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    [superview setSubviews: subviews];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                    [view release];
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            else if (component.isVisible())
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            {
 | 
		
		
	
	
		
			
				| 
				
					
				
				
				
				 | 
			
			 | 
			
  |