Hi folks, I am having Carbon/PowerPlant and Cocoa integration issue. I was hoping someone might have an insight into this problem. Any feedback would be greatly appreciated. A reproducer program that shows the problem can be found at:
http://ericgorr.net/cocoadev/BorderlessWindow.zip My application is a PowerPlant/Carbon application and I would like to use Cocoa in parts of the application. The program is simple, I have a PowerPlant/Carbon Window and a Cocoa Panel. The PowerPlant/Carbon Window has an ³ON² button, when the user clicks on that button the Cocoa Panel becomes the key window. When the user click back to the PowerPlant/Carbon Window, the Cocoa Panel resigns key window. The issue I¹m facing is that the behavior of this simple application is different if I set the window mask to NSBorderlessWindowMask (that is, if I have a borderless Panel). In the code example, I overrode the PowerPlant/Carbon Window¹s Deactivate method to print ³DEACTIVATING POWERPLANT WINDOW² whenever the PowerPlant/Carbon Window is deactivated. When the Cocoa Panel has a border, I get the below. The Cocoa Window has the title ³Window². Notice that the Cocoa window type is com.apple.HIToolbox.windowgroups.floating and also notice that my PowerPlant/Carbon window never gets deactivated when the ON button is clicked (that is, when the Cocoa Panel becomes key window). This is the behavior I was expecting. ------------ (gdb) call (void)DebugPrintWindowList() Flags: V:visible H:highlighted A:active F:user focus S:hide on suspend Avail: T:transient S:stationary A:all spaces M:move to active space Window Class WID Flags Level Avail Title Group ---------- ------------- ---- ----- ----- ----- ------------------------- ---------------------------- 0x416840 MenuBar 7 24 S 0x417bc0 "com.apple.HIToolbox.windowgroups.menubar" 0x52a440 Floating 26E2 H S 3 T Window 0x52b2b0 "com.apple.HIToolbox.windowgroups.floating" 0x40dde0 Floating 26E3 S 0 T 0x52b2b0 "com.apple.HIToolbox.windowgroups.floating" 0x502af0 Document 26E1 V 0 0x509d80 "com.apple.HIToolbox.windowgroups.document" ON 2010-09-16 09:51:53.564 testPP[96414:a0f] Panel becomeKeyWindow <Panel: 0x519bd0> 2010-09-16 09:51:54.603 testPP[96414:a0f] Panel resignKeyWindow (null) ON 2010-09-16 09:51:54.740 testPP[96414:a0f] Panel becomeKeyWindow <Panel: 0x519bd0> 2010-09-16 09:51:55.612 testPP[96414:a0f] Panel resignKeyWindow (null) ON 2010-09-16 09:51:55.740 testPP[96414:a0f] Panel becomeKeyWindow <Panel: 0x519bd0> 2010-09-16 09:51:56.652 testPP[96414:a0f] Panel resignKeyWindow (null) ON 2010-09-16 09:51:56.788 testPP[96414:a0f] Panel becomeKeyWindow <Panel: 0x519bd0> 2010-09-16 09:52:01.997 testPP[96414:a0f] Panel resignKeyWindow (null) ------------ When the Cocoa Panel does not have border (that is, when we use NSBorderlessWindowMask), I get the below. The Cocoa Window has the title ³Window². Notice that the Cocoa window type is com.apple.HIToolbox.windowgroups.document and also notice that my PowerPlant/Carbon window now gets deactivated when the ON button is clicked (that is, when the Cocoa Panel becomes key window). This is not the behavior I was expecting. ------------ (gdb) call (void)DebugPrintWindowList() Flags: V:visible H:highlighted A:active F:user focus S:hide on suspend Avail: T:transient S:stationary A:all spaces M:move to active space Window Class WID Flags Level Avail Title Group ---------- ------------- ---- ----- ----- ----- ------------------------- ---------------------------- 0x415cd0 MenuBar 7 24 S 0x417130 "com.apple.HIToolbox.windowgroups.menubar" 0x1809ea0 Floating 26C9 S 0 T 0x1824470 "com.apple.HIToolbox.windowgroups.floating" 0x181f620 Document 26C8 V 0 Window 0x607ef0 "com.apple.HIToolbox.windowgroups.document" 0x1d02df0 Document 26C7 V 0 0x607ef0 "com.apple.HIToolbox.windowgroups.document" ON 2010-09-16 09:49:58.119 testPP[96360:a0f] Panel becomeKeyWindow <Panel: 0x180ced0> 2010-09-16 09:49:58.125 testPP[96360:a0f] DEACTIVATING POWERPLANT WINDOW 2010-09-16 09:49:59.159 testPP[96360:a0f] Panel resignKeyWindow (null) ON 2010-09-16 09:50:02.519 testPP[96360:a0f] Panel becomeKeyWindow <Panel: 0x180ced0> 2010-09-16 09:50:02.525 testPP[96360:a0f] DEACTIVATING POWERPLANT WINDOW 2010-09-16 09:50:03.752 testPP[96360:a0f] Panel resignKeyWindow (null) ON 2010-09-16 09:50:04.839 testPP[96360:a0f] Panel becomeKeyWindow <Panel: 0x180ced0> 2010-09-16 09:50:04.844 testPP[96360:a0f] DEACTIVATING POWERPLANT WINDOW 2010-09-16 09:50:06.376 testPP[96360:a0f] Panel resignKeyWindow (null) ------------------------------------------------------------------------ To summarize: When Cocoa Panel has a border, the Cocoa Panel is considered a ³Floating² Window. When Cocoa Panel does not have a border, the Cocoa Panel is considered a ³Document² Window. When a ³Floating² Cocoa Window becomes Key Window, the PowerPlant/Carbon Window DOES NOT get deactivated. When a ³Document² Cocoa Window becomes Key Window, the PowerPlant/Carbon Window DOES get deactivated. The difference in behavior is causing me problems in my application. What I would like is to have a Borderless Panel that DOES NOT deactivate the PowerPlant/Carbon Window. Again, any feedback would be greatly appreciated. Thanks, Abdul _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com