From 05f26f2638c2ac1cc8eab7a8b1c951020df03dd8 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 20 Jan 2023 05:34:32 +0100 Subject: Don't import conditional platform specific 'static' code but fully qualify names when in use, make Android d8 (Dex'ing) happy --- .../jogamp/nativewindow/NativeWindowFactory.java | 50 ++++++++-------------- 1 file changed, 18 insertions(+), 32 deletions(-) (limited to 'src/nativewindow/classes') diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java index 68ab36ed5..332854fcc 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java @@ -50,26 +50,12 @@ import jogamp.nativewindow.NativeWindowFactoryImpl; import jogamp.nativewindow.ResourceToolkitLock; import jogamp.nativewindow.ToolkitProperties; import jogamp.nativewindow.WrappedWindow; -import jogamp.nativewindow.ios.IOSUtil; -import jogamp.nativewindow.macosx.OSXUtil; -import jogamp.nativewindow.windows.GDIUtil; -import jogamp.nativewindow.x11.X11Lib; -import jogamp.nativewindow.x11.X11Util; import com.jogamp.common.os.Platform; import com.jogamp.common.util.InterruptSource; import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.common.util.SecurityUtil; -import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; -import com.jogamp.nativewindow.awt.AWTGraphicsDevice; -import com.jogamp.nativewindow.awt.AWTGraphicsScreen; -import com.jogamp.nativewindow.egl.EGLGraphicsDevice; -import com.jogamp.nativewindow.ios.IOSGraphicsDevice; -import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice; -import com.jogamp.nativewindow.windows.WindowsGraphicsDevice; -import com.jogamp.nativewindow.x11.X11GraphicsDevice; -import com.jogamp.nativewindow.x11.X11GraphicsScreen; /** Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the {@link NativeWindow} interface, @@ -580,18 +566,18 @@ public abstract class NativeWindowFactory { public static AbstractGraphicsScreen createScreen(final AbstractGraphicsDevice device, int screen) { final String type = device.getType(); if( TYPE_X11 == type ) { - final X11GraphicsDevice x11Device = (X11GraphicsDevice)device; + final com.jogamp.nativewindow.x11.X11GraphicsDevice x11Device = (com.jogamp.nativewindow.x11.X11GraphicsDevice)device; if(0 > screen) { screen = x11Device.getDefaultScreen(); } - return new X11GraphicsScreen(x11Device, screen); + return new com.jogamp.nativewindow.x11.X11GraphicsScreen(x11Device, screen); } if(0 > screen) { screen = 0; // FIXME: Needs native API utilization } if( TYPE_AWT == type ) { - final AWTGraphicsDevice awtDevice = (AWTGraphicsDevice) device; - return new AWTGraphicsScreen(awtDevice); + final com.jogamp.nativewindow.awt.AWTGraphicsDevice awtDevice = (com.jogamp.nativewindow.awt.AWTGraphicsDevice) device; + return new com.jogamp.nativewindow.awt.AWTGraphicsScreen(awtDevice); } return new DefaultGraphicsScreen(device, screen); } @@ -716,7 +702,7 @@ public abstract class NativeWindowFactory { } public static String getDefaultDisplayConnection(final String nwt) { if(NativeWindowFactory.TYPE_X11 == nwt) { - return X11Util.getNullDisplayName(); + return jogamp.nativewindow.x11.X11Util.getNullDisplayName(); } else { return AbstractGraphicsDevice.DEFAULT_CONNECTION; } @@ -743,18 +729,18 @@ public abstract class NativeWindowFactory { public static AbstractGraphicsDevice createDevice(final String nwt, final String displayConnection, final boolean own) { if( NativeWindowFactory.TYPE_X11 == nwt ) { if( own ) { - return new X11GraphicsDevice(displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT, null /* ToolkitLock */); + return new com.jogamp.nativewindow.x11.X11GraphicsDevice(displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT, null /* ToolkitLock */); } else { - return new X11GraphicsDevice(displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT); + return new com.jogamp.nativewindow.x11.X11GraphicsDevice(displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT); } } else if( NativeWindowFactory.TYPE_WINDOWS == nwt ) { - return new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + return new com.jogamp.nativewindow.windows.WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } else if( NativeWindowFactory.TYPE_MACOSX == nwt ) { - return new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + return new com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } else if( NativeWindowFactory.TYPE_IOS == nwt ) { - return new IOSGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + return new com.jogamp.nativewindow.ios.IOSGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } else if( NativeWindowFactory.TYPE_EGL == nwt ) { - final EGLGraphicsDevice device; + final com.jogamp.nativewindow.egl.EGLGraphicsDevice device; if( own ) { Object odev = null; try { @@ -766,14 +752,14 @@ public abstract class NativeWindowFactory { } catch (final Exception e) { throw new NativeWindowException("EGLDisplayUtil.eglCreateEGLGraphicsDevice failed", e); } - if( odev instanceof EGLGraphicsDevice ) { - device = (EGLGraphicsDevice)odev; + if( odev instanceof com.jogamp.nativewindow.egl.EGLGraphicsDevice ) { + device = (com.jogamp.nativewindow.egl.EGLGraphicsDevice)odev; device.open(); } else { throw new NativeWindowException("EGLDisplayUtil.eglCreateEGLGraphicsDevice failed"); } } else { - device = new EGLGraphicsDevice(0, 0 /* EGL.EGL_NO_DISPLAY */, displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT, null); + device = new com.jogamp.nativewindow.egl.EGLGraphicsDevice(0, 0 /* EGL.EGL_NO_DISPLAY */, displayConnection, AbstractGraphicsDevice.DEFAULT_UNIT, null); } return device; } else if( NativeWindowFactory.TYPE_AWT == nwt ) { @@ -813,13 +799,13 @@ public abstract class NativeWindowFactory { public static Point getLocationOnScreen(final NativeWindow nw) { final String nwt = NativeWindowFactory.getNativeWindowType(true); if( NativeWindowFactory.TYPE_X11 == nwt ) { - return X11Lib.GetRelativeLocation(nw.getDisplayHandle(), nw.getScreenIndex(), nw.getWindowHandle(), 0, 0, 0); + return jogamp.nativewindow.x11.X11Lib.GetRelativeLocation(nw.getDisplayHandle(), nw.getScreenIndex(), nw.getWindowHandle(), 0, 0, 0); } else if( NativeWindowFactory.TYPE_WINDOWS == nwt ) { - return GDIUtil.GetRelativeLocation(nw.getWindowHandle(), 0, 0, 0); + return jogamp.nativewindow.windows.GDIUtil.GetRelativeLocation(nw.getWindowHandle(), 0, 0, 0); } else if( NativeWindowFactory.TYPE_MACOSX == nwt ) { - return OSXUtil.GetLocationOnScreen(nw.getWindowHandle(), 0, 0); + return jogamp.nativewindow.macosx.OSXUtil.GetLocationOnScreen(nw.getWindowHandle(), 0, 0); } else if( NativeWindowFactory.TYPE_IOS == nwt ) { - return IOSUtil.GetLocationOnScreen(nw.getWindowHandle(), 0, 0); + return jogamp.nativewindow.ios.IOSUtil.GetLocationOnScreen(nw.getWindowHandle(), 0, 0); /** * FIXME: Needs service provider interface (SPI) for TK dependent implementation } else if( NativeWindowFactory.TYPE_BCM_VC_IV == nwt ) { -- cgit v1.2.3