From: Jim Ingham <jingham@ap...> - 2001-10-22 21:40:41
On Monday, October 22, 2001, at 12:25 PM, Jack Jansen wrote:
> Recently, Jim Ingham <jingham@...> said:
>>> My guess is that the application indeed has to be a .app to be able to
>>> event input. When I tried to put up dialogs from a command-line Python
>>> I saw
>>> the same thing: the dialogs would show, but they would not react.
>> I don't think this is a correct guess. Most of the Carbon PEF
>> applications that run on X don't come in App packages. And there are
>> several command line utilities on X that use Carbon for UI, either to
>> put up warning dialogs (some of the installer stuff does this) or to
>> up Authorization panels.
>> My guess is you are being bitten by Carbon's not playing very nicely in
>> a threaded environment (IIRC, Python uses multiple threads).
> Ah, this is *very* useful information, it'll undoubtedly save me a lot
> of work in the future.
> But: I don't think this is the problem right now, at least, if I read
> your message correctly (only call RNE in the thread that loaded
> Carbon). First, Python isn't multithreaded internally, so if you don't
> start threads there's only the main thread. Second, Tony reported that
> a standalone
> cc tkMacOSXAppInit.c -o a.out
> exhibited the same problems.
Ah, I see. If you run this from the console, you will notice that you
get an error when you click to bring it to the foreground, which looks
-600 is supposed to mean "unrecognized drag recipient" but really
probably just means that we aren't registered as a real app with the
Window Server. You can do this either by having the appropriate MacOS
resource bits (kind, etc) or by being in an App package. I bet you can
even poke these bits in directly, but I don't know how.
So... if you were building as a classic Mac Application with a resource
fork, you can continue to build that way, and it will work (there are a
bunch of Carbon PEF applications, like NewsWatcher and GliderPro that do
it this way). Or you can be an app package. But if you don't make
yourself known somehow to the Window System, then it won't recognize
your existance. The app will still draw & update itself, it just can't
be foregrounded. Or at least that is what happened to Wish Shell if I
just drag it out of the App package and try to run it somewhere else.
Jim Ingham jingham@...
Developer Tools - gdb