site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com My suggestion would be to get a copy of: GCC: The Complete Reference Arthur Griffith McGraw-Hill Osborne Media ISBN 978-0072224054 -- Terry Hi, Terry, Best regards, Calvin
You would probably need to create a C or C++ language binding to the Launch Services framework to be able to do it "beautiful". I don't know how interested in that you would be.
-- Terry
On Dec 20, 2007, at 12:03 AM, Calvin Liu wrote:
Hi, Terry,
Thanks for the feedback.
Actually I'm working on a Firefox addon which provide user the feature to switch among existing profiles. So I can use a Firefox method to start another independent Firefox process. But the new Firefox is always behind the previous one. I got the idea to use "open" from mozilla community, so I did some trick like this:
1. write a shell script to start Firefox in a new process 2. create a fake.app folder which contains necessary folder structure/files to make it looks like an application to "open" 3. write another shell script to "open" this fake.app 4. call the 2nd script from my addon.
It works but seems not to be a "beautiful" solution. So I'm wondering if there's any other way to solve it. If you have any idea about that, could you please let me know? Thanks a lot!
Sincerely yours, Calvin
Terry Lambert wrote:
On Dec 18, 2007, at 8:06 AM, Calvin Liu wrote:
Hi, there,
On Mac, if I run a command in terminal and start a GUI application, the new window is always hide behind the current window. So does start apps from other application like firefox. But noticed that double click an icon in "Finder" can start it correctly. So I did some test and found that if I wrap the command into a fake ".app" folder and use "open -a fake.app", it'll show the new window in the front. It's not good solution and I'm sure I haven't got the root reason.
I suppose there is an option in the configuration file of window manager for MacOS to control this behavior. Am I right? Anyone has any idea on what that option is and how to change it? I'm going mad with this problem.
It is an effect of using LaunchServices, rather than vanilla fork/ exec or posix_spawn to start the process.
If you want this behaviour, use LaunchServices (which is what the command line tool "open" does). This will have the side effect of running the correct slice of the application, for example if you checked the "Run under Rosetta" checkbox in finder for Safari to ensure you will be able to continue to use your PPC plugins on an Intel machine.
-- Terry
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This is discussed in the chapter on "Using the Compiler Collection". It basically tells you how you have to define Objective C wrappers for the Objective C code you want to call from C so that it can be lined with the C to provide C wrappers. On Dec 21, 2007, at 1:55 PM, Calvin Liu wrote: I'm interested in writing such a binding. Definitely it'll be the first binding that I write for Mac! :) But don't know if it's also useful in other cases or for somebody else. And I need to learn how to do it... OK, what I need to write a C/C++ binding? I have a powerbook g4, with tiger and xcode installed, and firefox for sure. What else? ----- Original Message ----- From: Terry Lambert <tlambert@apple.com> Date: Thursday, December 20, 2007 1:51 am Subject: Re: How does 'Finder' open an application and bring the window to the front? To: Calvin Liu <koifans@shaw.ca> Cc: darwin-dev@lists.apple.com This email sent to site_archiver@lists.apple.com