[Swingwt-developers] MacOS X
Status: Beta
Brought to you by:
bobintetley
From: Robin Rawson-T. <bob...@us...> - 2004-06-23 12:46:24
|
After much pain, I've finally got SwingWT working with MacOSX. The libs and start scripts are all in CVS (as is the updated code) and from 0.84, MacOSX gets to be a first class citizen for SwingWT :-) There's still an issue to work out with SwingSet (which seems to hang on startup), but all the other demos and everything else I threw at it worked so I guess it must be an event pump related issue. Here's what I learnt (in case anyone finds this stuff interesting): 1. Regular old "java" in MacOSX is incompatible with SWT applications, due to the fact that normally the java main thread is what the=20 application starts with, where OSX spawns a new thread and kills off the java launcher (must be something to do with their shared VM). You have to get round this by using the "java_swt" launcher included with SWT for MacOSX. 2. The java_swt kludge relies on you running your SWT event pump on the main thread (at least, the thread that runs the entry point to your program). SwingWT hasn't done this since 0.76, when we used the AWT model (spawn a new thread to manage the event pump) - this caused SwingWT apps to bomb nastily. I added some code to SwingWTUtils to use the calling thread and block for MacOSX. I also added a new routine called "initialiseMacOSX(Runnable)" which you need to call from the main method of your app if it is intended to run on MacOSX. I could have found alternatives, but they would have caused SwingWT to become inconsistent across platforms. At least this way, we are just saying "If we're on MacOSX, use the main thread for the event pump and spawn a new one for the application", instead of the usual "Spawn a new thread for the event pump and use the main thread for the application". This way, other platforms are unaffected. If you are writing Eclipse plugins with SwingWT that may be deployed to MacOSX, they're unaffected too (since SwingWT recycles Eclipse's event pump for Eclipse plugins rather than trying to create it's own). Feel free to get the latest from CVS and give it a go. Let me know what you think. Oh, and thanks to Dan and Dan for the useful info and helping me get this far. Cheers, Rob --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Robin Rawson-Tetley Animal Shelter Manager (http://sheltermanager.sf.net) SwingWT (http://swingwt.sf.net) I prefer encrypted email. Download my public key at: http://rawsontetley.ath.cx/sfpk.asc |