Opening a LWJGL window from a SWT app on Mac

Posted by TomA on Stack Overflow See other posts from Stack Overflow or by TomA
Published on 2010-03-05T13:05:49Z Indexed on 2010/03/08 13:21 UTC
Read the original article Hit count: 424

Filed under:
|
|
|

I have a SWT app that opens a OpenGL window (using the LWJGL library) after a button is pressed. Works fine on Windows. On Mac, I get this error:

2010-03-05 02:28:25.315 java[1315:a07] [Java CocoaComponent compatibility mode]: Enabled
2010-03-05 02:28:25.316 java[1315:a07] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
2010-03-05 02:28:25.317 java[1315:a07] Apple AWT Startup Exception : _createMenuRef called with existing principal MenuRef already associated with menu
2010-03-05 02:28:25.318 java[1315:a07] Apple AWT Restarting Native Event Thread

The SWT window closes and then the app hangs, with no windows open.

It looks like the SWT app doesn't shut down cleanly and leaves it's menu entries associated with it, which prevents the LWJGL window from opening. Mac OS X only wants one application menu. SWT doesn't free it's own menu and LWJGL wants to add another.

Facts:

  • A button in the SWT dialog is supposed to close the dialog and open a LWJGL window (org.lwjgl.opengl.Display).

  • The button sets a static variable in the app to tell it what to do next after the SWT window is closed, so the LWJGL window is NOT being opened from a SWT callback directly.

  • The button then closes the SWT window. I don't know the correct way of doing this but tried various combinations of shell.close, shell.dispose, display.close and display.dispose, none of them worked. They all close the window but the error occurs every time.

Does anyone know what could be done to make this work?

© Stack Overflow or respective owner

Related posts about java

Related posts about swt