diff options
author | Sven Gothel <[email protected]> | 2023-01-20 05:34:32 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-20 05:34:32 +0100 |
commit | 05f26f2638c2ac1cc8eab7a8b1c951020df03dd8 (patch) | |
tree | 853b5617e5939a5d1ab643a149dd9e9ec7585a17 | |
parent | 7f820007531da1d44c8016dbba1e2f8ade17f0e5 (diff) |
Don't import conditional platform specific 'static' code but fully qualify names when in use, make Android d8 (Dex'ing) happy
-rw-r--r-- | src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java | 16 | ||||
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java | 50 |
2 files changed, 23 insertions, 43 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index b0c5d1928..afe6a3e5a 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -49,13 +49,10 @@ import com.jogamp.nativewindow.AbstractGraphicsScreen; import com.jogamp.nativewindow.DefaultGraphicsScreen; import com.jogamp.nativewindow.MutableSurface; import com.jogamp.nativewindow.NativeSurface; -import com.jogamp.nativewindow.NativeWindowException; import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; -import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; import com.jogamp.nativewindow.VisualIDHolder; -import com.jogamp.nativewindow.VisualIDHolder.VIDType; import com.jogamp.opengl.GL; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilitiesChooser; @@ -67,9 +64,6 @@ import com.jogamp.opengl.GLException; import com.jogamp.opengl.GLProfile; import jogamp.common.os.PlatformPropsImpl; -import jogamp.nativewindow.drm.DRMLib; -import jogamp.nativewindow.drm.DRMUtil; -import jogamp.nativewindow.drm.GBMDummyUpstreamSurfaceHook; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLContextImpl.MappedGLVersion; @@ -90,7 +84,6 @@ import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; import com.jogamp.opengl.egl.EGL; -import com.jogamp.opengl.egl.EGLExt; public class EGLDrawableFactory extends GLDrawableFactoryImpl { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access @@ -180,6 +173,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } } + @Override public final String toString() { return "EGLFeatures[vendor "+vendor+", version "+version+ ", has[GL-API "+hasGLAPI+", KHR[CreateContext "+hasKHRCreateContext+", Surfaceless "+hasKHRSurfaceless+"]]]"; @@ -380,7 +374,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { // Hence opening will happen later, eventually final long nativeDisplayID; if( isDRM_GBM ) { // Bug 1402 related and in case surfaceless is n/a - nativeDisplayID = DRMLib.gbm_create_device(DRMUtil.getDrmFd()); + nativeDisplayID = jogamp.nativewindow.drm.DRMLib.gbm_create_device(jogamp.nativewindow.drm.DRMUtil.getDrmFd()); } else { nativeDisplayID = EGL.EGL_DEFAULT_DISPLAY; } @@ -418,7 +412,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(null != defaultDevice) { if( isDRM_GBM ) { // Bug 1402 related and in case surfaceless is n/a - DRMLib.gbm_device_destroy(defaultDevice.getNativeDisplayID()); + jogamp.nativewindow.drm.DRMLib.gbm_device_destroy(defaultDevice.getNativeDisplayID()); } defaultDevice.close(); defaultDevice = null; @@ -1148,8 +1142,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { final UpstreamSurfaceHook ush; final int nativeVisualID; if( isDRM_GBM ) { - ush = new GBMDummyUpstreamSurfaceHook(width, height); - nativeVisualID = DRMUtil.GBM_FORMAT_XRGB8888; + ush = new jogamp.nativewindow.drm.GBMDummyUpstreamSurfaceHook(width, height); + nativeVisualID = jogamp.nativewindow.drm.DRMUtil.GBM_FORMAT_XRGB8888; } else { ush = new EGLDummyUpstreamSurfaceHook(width, height); chosenCaps = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above 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 ) { |