> On 10. Aug 2019, at 08:24, Kurt Bigler via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> As part of a process of porting an app from Carbon to Cocoa I'm needing to 
> have Carbon and Cocoa windows present at the same time.  The Carbon event 
> loop is therefore still in place.

The Cocoa event handling code uses CarbonEvents under the hood. AFAIR, you can 
switch to the Cocoa event loop right away, and Carbon windows will just keep 
working.

> I've just started implementing the Cocoa windows.  The NSView subclasses 
> involved are receiving drawRect: messages but are not receiving mouseDown:.
> 
> Incidentally Cocoa menus and modal dialogs are already working, so that is a 
> sign that Cocoa events are to some degree alive and well.

 Modal Cocoa dialogs run their own Cocoa event loop, that's why they work 🙂 
It's also the most tested part of Carbon/Cocoa mixing, as that's what Apple 
used for NSOpenPanel & Co. Cocoa menus are Carbon menus under the hood as well, 
NeXT had no Mac-style menu bar (they had windows containing the deprecated 
NSMenuView), so that was based on the Carbon code from the start. There's even 
a private _NSGetCarbonMenu() call that Apple uses internally to get at the 
MenuRef backing an NSMenu.

 Just be aware that there are various small bugs and issues that make it 
impractical to ship an application that mixes modeless Carbon and Cocoa 
windows, mainly to do with window activation/ordering and application 
activation/ordering. What works (since that is what AppKit used itself) is 
modal Cocoa windows in an otherwise Carbon app. HICocoaView worked for some 
views, but not for all of them. Modeless windows will randomly re-order, 
sometimes causing the current modal window to end up behind another window and 
blocking the user from interacting with it.

 So this mixing is an ideal approach for slowly porting, but will not get you 
anything shippable until your UI is fully Carbon.

Cheers,
-- Uli Kusterer
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to