From 7ec068e0c95a230101450cc80031f76770a0cd49 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 19 Aug 2019 13:14:24 +0200 Subject: Bug 1363: Java 11: Resolve unsupported JAWTUtil.getMonitorDisplayID(..) Previous commits removed access to OSX's GraphicsDevice.getCGDisplayID() on Java9+, avoiding illegal reflective access. Here we JAWTUtil.getMonitorDisplayID(..) simply returns null if Java9 or !OSX, so the sole NewtFactory caller falls back to the alternative working solution. Orig patch Wade Walker: This was used on Mac OS only to create a MonitorDevice in NewtFactoryAWT. But there was a fallback method for creating MonitorDevice, and testing with TestGearsES2GLJPanelAWT shows that the fallback method seems to give identical results on Mac, so changed to just use the fallback method (which is now the only method) everywhere. This gets rid of an illegal reflective access. --- src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/newt') diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java index 4e9273e83..97625c8aa 100644 --- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java +++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java @@ -170,12 +170,12 @@ public class NewtFactoryAWT extends NewtFactory { */ public static MonitorDevice getMonitorDevice(final Screen screen, final java.awt.Component awtComp) throws IllegalArgumentException { final java.awt.GraphicsConfiguration gc = checkComponentValid(awtComp); - final String nwt = NativeWindowFactory.getNativeWindowType(true); MonitorDevice res = null; screen.addReference(); try { - if( NativeWindowFactory.TYPE_MACOSX == nwt ) { - res = screen.getMonitor( JAWTUtil.getMonitorDisplayID( gc.getDevice() ) ); + final Integer dispID = JAWTUtil.getMonitorDisplayID( gc.getDevice() ); + if( null != dispID ) { + res = screen.getMonitor( dispID.intValue() ); } if( null == res ) { // Fallback, use AWT component coverage -- cgit v1.2.3