Last (and most important) - Supposedly I use your nice category
like this:
WindowRef frontWin = ::FrontWindow(); // get Carbon application
front window. Actually, any carbon window.
NSWindow *cocoaFromCarbonWin = [[NSWindow alloc]
initWithWindowRef:frontWin];
NSSavePanel *navPanel = [NSSavePanel savePanel];
[navPanel runModalForDirectory:nil file:nil types:nil
relativeToWindow: cocoaFromCarbonWin];
Then I'm seeing a host of strange and bogus behaviors.
1. The most severe is that the sheet opens BEHIND the application
window, BUT is still the key window. So, the application is dead
--- I can't click on the sheet (it's not front, and not active,
does not respond to clicks). However, the main application window
is blocked for events too! (I have blocked it via
runModalForWindow!). so, I'm dead. User must force-quit the
application.
2. The sheet opens in the wrong place -- just somewhere on the
screen - not always the same place, but "favorably" when a centered
dialog would appear. If then I try to drag the parent carbon window
by its title, the sheet would "jump into place" and be dragged
right. Events seem to be OK.
3. The sheet is invisible --- Although I get no errors from the
application. However, the debugger console would (sometimes!)
contain lines like this:
[Session started at 2009-10-21 11:01:52 +0200.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18
20:40:51 UTC 2009)
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 1835
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to
catch errors as they are logged.
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: CGSOrderWindowListWithGroups:
invalid window ID (1835)
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: CGSOrderWindowList: NULL list
pointer or empty list
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID 1836
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: CGSOrderWindowListWithGroups:
invalid window ID (1836)
Wed Oct 21 12:11:53 Moti-Schneors-Mac-Pro.local NavTester[4398]
<Error>: kCGErrorIllegalArgument: CGSOrderWindowList: NULL list
pointer or empty list
Any ideas? something I forgot to do? What in general is the state
of opening cocoa-sheets over Carbon-windows? When do I need to
release this NSWindow? I don't wish to close the Carbon window, as
it is coming from my host application!