-[NSWindow orderWindow:relativeTo:] NSWindowAbove/Below doesn't order window correctly

Originator:nriley
Number:rdar://22064080 Date Originated:29-Jul-2015 09:03 PM
Status:Duplicate/21690243 Resolved:
Product:OS X SDK Product Version:10.11/15A235d
Classification:Serious Bug Reproducible:Always
 
Summary:
-[NSWindow orderWindow:relativeTo:] NSWindowAbove/Below does not order the requested window immediately above or below the "relative to" window.  This method worked correctly from 10.10 at least back to 10.6, and given it's been around since 10.0, likely earlier.

Steps to Reproduce:
1. Launch TextEdit and Terminal (for example), such that one window is visible in each.
2. Build and run the attached project, a small variation of Apple's Son of Grab source code.  (Hide Xcode if necessary so you can see the other windows.)
3. Layer the windows as Terminal (on the bottom), then TextEdit, then SonOfGrab (on the top).
4. Click the TextEdit window in the window list, then click Order Below.  Or click the Terminal window, then click Order Above.

Expected Results:
The SonOfGrab Window List appears between the two windows (i.e., the layering from back to front is Terminal, then Son of Grab, then TextEdit).

Actual Results:
The SonOfGrab Window List appears underneath the Terminal window (for Order Below), or above the TextEdit window (for Order Above).

Version:
Xcode 7.0 beta 4 (7A165t)
OS X 10.11 (15A235d)

Notes:
I have been unable to find a workaround for this bug.  It completely cripples my application Shroud, which relies on this API to be functional.  (I've successfully worked around a number of race conditions related to window ordering in prior OS X versions, but I am not aware of another public API to place a window in this fashion.)

The relevant code is at the bottom of Controller.m.

Configuration:
This has been broken since at least OS X 10.11 developer beta 2.

Attachments:
'SonofGrab.zip' was successfully uploaded.

(http://sabi.net/temp/SonofGrab.zip)

Comments

The duplicate bug is now closed as of 2/15/2016 and seems to be fixed in 10.11.3 (perhaps earlier).


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!