SDL raise window
If I start my SDL app via the command line like
it starts with the window behind every other window, which is kind of annoying. However, if I open it with the command
then it starts as the topmost window. Does anyone know if there is a programmatic way of bringing the window to the top via SDL or native mac functions?
Code:
./foo.app/Contents/MacOS/fooCode:
open foo.app
I'm sure it'd be pretty easy to bring the application to the front after it finishes launching. If there isn't a way to do it in SDL, you could presumably use Cocoa in SDLMain.m.
But I wouldn't do that in a released application; Mac apps are meant to launch in the background if the user switches application while they're starting.
But I wouldn't do that in a released application; Mac apps are meant to launch in the background if the user switches application while they're starting.
Though it does end up being a problem when you get the "are you sure you want to open this app downloaded from the interwebs" dialog in the Finder. If you have a lot of Finder windows open, it will open the app underneath all of them. Very annoying, but I don't in general see a way to fix it without making it equally annoying by stealing focus.
Eclipse steals focus not once, but twice during it's lengthy startup so it can display a splash screen and then again to display the splash screen progress bar. I think without that simple but obnoxious flaw, I would hate Eclipse half as much as I do. As it is, it acts as a nice daily poke in the eye to remind me.
So it's annoying that the programs open underneath, but many users find the alternative much more frustrating.
Eclipse steals focus not once, but twice during it's lengthy startup so it can display a splash screen and then again to display the splash screen progress bar. I think without that simple but obnoxious flaw, I would hate Eclipse half as much as I do. As it is, it acts as a nice daily poke in the eye to remind me.
So it's annoying that the programs open underneath, but many users find the alternative much more frustrating.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Code:
[NSApp activateIgnoringOtherApps:YES];To avoid stealing focus from a double-clicking user I don't call this unless the environment variable FOREGROUND is set, so in the terminal I can go
Code:
make && FOREGROUND=1 ./Mechanical.app/Contents/MacOS/MechanicalYou could also check whether stdin is a tty, for example.

