Opening the LWJGL window from the SWT application on Mac

I have a SWT application that opens an OpenGL window (using the LWJGL library) after clicking a button. It is intended to close this main SWT window and open a new one with OpenGL context. Works great 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 application freezes without opening the windows.

It seems that the SWT application does not close cleanly and leaves related menu entries, which prevents the LWJGL window from opening. Mac OS X requires only one application. SWT does not free its own menu, but LWJGL wants to add another.

Facts:

  • The button in the SWT dialog box should close the dialog box and open the LWJGL window (org.lwjgl.opengl.Display).

  • The button sets a static variable in the application to tell it what to do next after closing the SWT window, so the LWJGL window does NOT open directly from the SWT callback.

  • Then the button closes the SWT window. I don't know the right way to do this, but I tried various combinations of shell.close, shell.dispose, display.close and display.dispose, none of them worked. All of them close the window, but an error occurs every time.

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

UPDATE . It just doesn't work, and it seems that Apple will not be able to fix it. The only way is to start a new instance of the application and pass it a parameter that tells it to open a second window.

2: , SWT Windows Mac, Cocoa , JVM LWJGL, . .

+3
1

, SWT , LWJGL. , , Mac, , .

:

  • , LWJGL, SWT?
  • , LWJGL SWT, LWJGL?

, SWT, , , Shell:

shell.dispose();
+1

Source: https://habr.com/ru/post/1735595/


All Articles