2
0
Эх сурвалжийг харах

fix issues #1193 and #1558 for Linux/Windows (LWJGL v3 hangs) (#1690)

* This is a very simple addition. It allows a person to set 3 variables in AppSettings. ‘CenterWindow’, ‘WindowXPosition’ and ‘WindowYPosition’ variables. This way these variable will be saved in the profile when the profile is saved, and be reloaded. I added ‘CenterWindow’ to be added with a ‘true’ value for the default value so it will run just like it did before.

But if you set ‘CenterWindow’ to ‘false’ then inside LwjglWindow.java (lwjgl3 code) it will look at these new values, it will determine to center the window or use the position values to place the window back at the location the user last moved it to.

Of course, these values are only updated if the “program” updates this value. So if you want to save screen position, you can save them on closing to and on restart put the window back into the same location.

* formatting and comments changes.

* jme3test.app.TestApplication hangs with LWJGL3 #1193
LWJGL3-JME library would block the current thread when executing LWJGL3.    Instead of calling run() that is blocking,  made it work like LWJGL2-JME library when they start it as a thread so run gets called. I commented out the run() function and replaced it with Thread.start().

* removing unwanted changes, since you can't do multiple pull requests at once.

* formatting issues.

* changed parameter naming to be more consistency with other items.

* jme3test.app.TestApplication hangs with LWJGL3 #1193

LWJGL3-JME projects was doing a call that is blocking the current thread.  I changed it to match how LWJGL2-JME project launches the Context Window.

* jme3test.app.TestApplication hangs with LWJGL3 #1193 (#3)

LWJGL3-JME projects was doing a call that is blocking the current thread.  I changed it to match how LWJGL2-JME project launches the Context Window.

* removing unwanted changes.

* AppSettings:  enhance the new javadoc

* AppSettings:  capitalize Window{X/Y}Position consistent w/other settings

* LwjglWindow:  convert tabs to spaces

* AppSettings:  re-arrange @see tags in javadoc

* TestAWTPanels hangs with LWJGL v3 #1558 /  jme3test.app.TestApplication hangs with LWJGL3 #1193

Made LWJGL3-JME to launch in the same way the LWJGL2-JME launches.  This always Windows and Linux to run, still needs testing on Max OS X

* TestAWTPanels hangs with LWJGL v3 #1558 /  jme3test.app.TestApplication hangs with LWJGL3 #1193

Made LWJGL3-JME to launch in the same way the LWJGL2-JME launches.  This always Windows and Linux to run, still needs testing on Max OS X

* Removed the string compare to determine if it is a Mac OS.  Using LWJLG3 class that determines this instead.

* Making changes for Mac os.  The AWT examples will not work under Mac but the Linux and Windows version will start to work.

* added braces that are need for formatting.

* LwjglWindow:  copyright year, log message, correct indents and braces

Co-authored-by: Stephen Gold <[email protected]>
bob0bob 3 жил өмнө
parent
commit
38752eaf68

+ 18 - 5
jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2020 jMonkeyEngine
+ * Copyright (c) 2009-2021 jMonkeyEngine
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -57,6 +57,8 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import org.lwjgl.Version;
 import org.lwjgl.glfw.*;
+import org.lwjgl.system.Platform;
+
 import static org.lwjgl.glfw.GLFW.*;
 import static org.lwjgl.opengl.GL11.GL_FALSE;
 import static org.lwjgl.system.MemoryUtil.NULL;
@@ -477,10 +479,21 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
             return;
         }
 
-        // NOTE: this is required for Mac OS X!
-        mainThread = Thread.currentThread();
-        mainThread.setName("jME3 Main");
-        run();
+        if (Platform.get() == Platform.MACOSX) {
+            // NOTE: this is required for Mac OS X!
+            mainThread = Thread.currentThread();
+            mainThread.setName("jME3 Main");
+            if (waitFor) {
+                LOGGER.warning("create(true) is not supported for macOS!");
+            }
+            run();
+        } else {
+            new Thread(this, "jME3 Main").start();
+            if (waitFor) {
+                waitFor(true);
+            }
+        }
+
     }
 
     /**