summaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-05 22:31:51 +0100
committerSven Gothel <[email protected]>2019-12-05 22:31:51 +0100
commitc317985db39f840f6edf9860487c604e6e31c2ba (patch)
tree304486ec789d2aa91362c7d6d80681f33a3b8aa7 /src/newt/classes
parentd693425e2e74a5e4a80c3fde552ffc7d757330f1 (diff)
Bug 1409: GNU/Linux DRM Console: Clear stdin before exit and don't act on stdin in vsync-wait-loop
User input during test from the console will also end up in stdin of the console after the java application has been closed. This is not only annoying, but also a security concern, as the input gets executed if containing a CR. Further, the vsync-wait-loop shall ignore stdin.
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
index a7fa29170..335da25ca 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
@@ -35,6 +35,7 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.newt.Display;
import com.jogamp.opengl.GLProfile;
@@ -61,6 +62,11 @@ public class DisplayDriver extends DisplayImpl {
if (!WindowDriver.initIDs()) {
throw new NativeWindowException("Failed to initialize egl.gbm Window jmethodIDs");
}
+ NativeWindowFactory.addCustomShutdownHook(false /* head */, new Runnable() {
+ @Override
+ public void run() {
+ Shutdown0();
+ } });
PNGPixelRect image = null;
if( DisplayImpl.isPNGUtilAvailable() ) {
@@ -171,6 +177,7 @@ public class DisplayDriver extends DisplayImpl {
}
private static native boolean initIDs();
+ private static native void Shutdown0();
private static native void DispatchMessages0();