From aee3a75ad87ef3da0652c6b917ccdfda63a1230d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 25 Feb 2012 19:21:43 +0100 Subject: X11: Fix unavailable GLX (Server): Use fallback GraphicsConfigurationFactory (X11GLX -> X11) - GraphicsConfigurationFactory.registerFactory(..) returns previous mapped GraphicsConfigurationFactory. This allows daisy chaining of GraphicsConfigurationFactory, in case one is not suitable. - X11GLXGraphicsConfigurationFactory: - Store the previously mapped factory as fallback - choose*Impl(): If GLX is not available, use fallback --- .../javax/media/nativewindow/GraphicsConfigurationFactory.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nativewindow') diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java index 259644467..8570794d8 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java @@ -154,18 +154,21 @@ public abstract class GraphicsConfigurationFactory { * called by end users, only implementors of new * GraphicsConfigurationFactory subclasses. * + * @return the previous registered factory, or null if none * @throws IllegalArgumentException if the given class does not implement AbstractGraphicsDevice */ - protected static void registerFactory(Class abstractGraphicsDeviceImplementor, GraphicsConfigurationFactory factory) + protected static GraphicsConfigurationFactory registerFactory(Class abstractGraphicsDeviceImplementor, GraphicsConfigurationFactory factory) throws IllegalArgumentException { if (!(abstractGraphicsDeviceClass.isAssignableFrom(abstractGraphicsDeviceImplementor))) { throw new IllegalArgumentException("Given class must implement AbstractGraphicsDevice"); } + GraphicsConfigurationFactory prevFactory = registeredFactories.put(abstractGraphicsDeviceImplementor, factory); if(DEBUG) { - System.err.println("GraphicsConfigurationFactory.registerFactory() "+abstractGraphicsDeviceImplementor+" -> "+factory); + System.err.println("GraphicsConfigurationFactory.registerFactory() "+abstractGraphicsDeviceImplementor+" -> "+factory+ + ", overridding: "+prevFactory); } - registeredFactories.put(abstractGraphicsDeviceImplementor, factory); + return prevFactory; } /** -- cgit v1.2.3