[missing-sync-palmos-dev-talk] Using Cocoa in a Carbon conduit
Stuart A. Malone
samalone at llamagraphics.com
Wed May 17 05:05:55 PDT 2006
> Is it possible to use Cocoa functionality within a Carbon conduit,
> that is targeted for both Missing Sync and HotSync Manager?
Our main application and our conduit are both mainly Carbon code with
a little Cocoa mixed in, and both use libMissingSyncBridge.a. So far
everything is working pretty smoothly under both Missing Sync and the
HotSync Manager. We're using NSImage, NSBundle, NSWorkspace, NSSound
and NSAutoreleasePool and so far have not had any problems with them.
There are just a few tricks that we have discovered, though they
don't really have anything to do with Cocoa:
For conduits:
1. For the conduit to show up under Palm Desktop, the bundle bit has
to be set. The sample projects from Mark/Space do this, but be aware
that there are several tools (such a the Copy Files build phase in
Xcode) that do not preserve this bit.
2. When displaying a conduit settings sheet using Carbon's
RunAppModalLoopForWindow function, we discovered that mouse clicks in
our sheet would not bring the Missing Sync application to the front.
We fixed the problem by adding a kEventClassMouse/kEventMouseDown
Carbon event handler to our window that does:
ProcessSerialNumber me = { 0, kCurrentProcess };
SetFrontProcess(&me);
return eventNotHandledErr;
3. Although I don't remember it being documented for Palm Desktop,
both Palm Desktop and Missing Sync are able to use conduits located
in ~/Library/Application Support/Palm HotSync/Conduits. If you have
an installer, it's nice to offer users the option of installing into
this directory because it does not require administrative rights.
For applications:
1. When linking an application with libMissingSyncBridge.a, you also
need to weak link with Missing Sync using "OTHER_LDFLAGS = -
weak_framework MissingSync".
2. A universal application running natively on Intel works with
Missing Sync 5.1 (which is also native), but not with Palm Desktop
4.2.1 (which is in emulation under Rosetta). A workaround is to tell
users to turn on the "Open using Rosetta" checkbox in the Get Info
window for your application. However, for this to work your
application must NOT have an "LSPrefersCarbon" key in its Info.plist
file.
I hope these tips save you a little trouble.
Best wishes,
--Stuart A. Malone
Llamagraphics, Inc.
Makers of Life Balance personal coaching software
http://www.llamagraphics.com/
More information about the missing-sync-palmos-dev-talk
mailing list