Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Matching Cocoa Window Levels in Carbon



On Nov 2, 2003, at 6:40 AM, Nick Nallick wrote:

I'm trying to integrate some Cocoa windows into my Carbon application. I find that there is some kind of window level mismatch between floating windows in the two environments. For example by default, floating Cocoa windows appear above modal Carbon windows. I've been playing with the window level features of window groups but all window levels appear to be zero. For example, if I call DebugPrintAllWindowGroups() I get the following:

Window group tree
----------------------------------------------------------------------- --------
1 level 0 group 0x7610C03F "com.apple.hitoolbox.windowgroups.root"
2 level 0 group 0x7610C60F "com.apple.HIToolbox.windowgroups.floating"
3 level 0 group 0x72C345BF "com.apple.HIToolbox.windowgroups.document"

That's correct; Carbon uses window level 0 for all of its window classes except kUtilityWindowClass. Cocoa uses non-zero window levels for floating and modal windows, I believe (while the application is active; windows with non-zero window levels are moved to window level zero when the app is deactivated).

I could set the window levels of the standard window groups during initialization and set the level of Cocoa windows as I create them. For example:

SetWindowGroupLevel(GetWindowGroupOfClass(kDocumentWindowClass), kCGNormalWindowLevel); SetWindowGroupLevel(GetWindowGroupOfClass(kFloatingWindowClass), kCGFloatingWindowLevel); SetWindowGroupLevel(GetWindowGroupOfClass(kModalWindowClass), kCGModalPanelWindowLevelKey);

and

[myWindow setLevel:NSNormalWindowLevel];
[myWindow setLevel:NSFloatingWindowLevel];

Is this a reasonable thing to do or will this bite me somewhere down the road?

It's hard for me to entirely predict how this will interact with future versions of the toolbox, since we haven't gotten there yet. We have considered making Carbon use non-zero window levels for floating and modal windows; we may still do that in the future.

Is there a specific problem that you're trying to solve by doing this?

-eric
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Matching Cocoa Window Levels in Carbon (From: Nick Nallick <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.