From 36e9671177c690ebd71d93021b8f797487785dda Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Mon, 10 Aug 2015 18:28:42 +0200 Subject: Bug 1178: Fix cc10 regression caused by the fix for cc7. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 1178 cc10: We no longer throw an ExceptionInInitializerError when X11 is not available. Fix 1178 cc10: We need to use an X11 resource in the constructor in order to throw an ExceptionInInitializerError if X11 is not available. We can resolve this by query for the X11 display and screen inside the constructor. Signed-off-by: Xerxes Rånby --- .../jogamp/newt/driver/x11/X11UnderlayTracker.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java index 523899abe..6e64e7025 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java +++ b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java @@ -67,6 +67,8 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis private volatile MouseEvent lastMouse; private volatile static ArrayHashMap underlayWindowMap = new ArrayHashMap(false, ArrayHashMap.DEFAULT_INITIAL_CAPACITY, ArrayHashMap.DEFAULT_LOAD_FACTOR); private volatile static ArrayHashMap overlayWindowMap = new ArrayHashMap(false, ArrayHashMap.DEFAULT_INITIAL_CAPACITY, ArrayHashMap.DEFAULT_LOAD_FACTOR); + private final Display display; + private final Screen screen; static { /* @@ -91,6 +93,20 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis return tracker; } + private X11UnderlayTracker() { + /* 1178 cc10: Fix regression caused by the fix for cc7. + * We no longer throw an ExceptionInInitializerError + * when X11 is not available. + * + * Fix 1178 cc10: We need to use an X11 resource in the constructor + * in order to throw an ExceptionInInitializerError if X11 is not available. + * We can resolve this by query for the + * X11 display and screen inside the constructor. + */ + display = NewtFactory.createDisplay(NativeWindowFactory.TYPE_X11, null, false); + screen = NewtFactory.createScreen(display, 0); + } + @Override public void windowResized(final WindowEvent e) { final Object s = e.getSource(); @@ -187,8 +203,6 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis */ caps.setBackgroundOpaque(false); - final Display display = NewtFactory.createDisplay(NativeWindowFactory.TYPE_X11, null, false); - final Screen screen = NewtFactory.createScreen(display, 0); WindowImpl underlayWindow = WindowImpl.create(null, 0, screen, caps); /* -- cgit v1.2.3