From 8dd330396c7be887e439dffd64e4fefcbfe9dd83 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 17 Mar 2009 19:46:15 +0000 Subject: Start moving javax.media.nwi -> javax.media.nativewindow git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1879 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../classes/com/sun/nwi/impl/Debug.java | 93 ++++++ .../classes/com/sun/nwi/impl/NWReflection.java | 149 +++++++++ .../com/sun/nwi/impl/NativeLibLoaderBase.java | 115 +++++++ .../com/sun/nwi/impl/NativeWindowFactoryImpl.java | 121 +++++++ .../classes/com/sun/nwi/impl/NullWindow.java | 128 +++++++ .../com/sun/nwi/impl/jawt/JAWTNativeLibLoader.java | 71 ++++ .../classes/com/sun/nwi/impl/jawt/JAWTUtil.java | 94 ++++++ .../classes/com/sun/nwi/impl/jawt/JAWTWindow.java | 157 +++++++++ .../com/sun/nwi/impl/jawt/JAWT_PlatformInfo.java | 47 +++ .../sun/nwi/impl/jawt/macosx/MacOSXJAWTWindow.java | 151 +++++++++ .../nwi/impl/jawt/windows/WindowsJAWTWindow.java | 161 +++++++++ .../com/sun/nwi/impl/jawt/x11/X11JAWTWindow.java | 133 ++++++++ .../sun/nwi/impl/jawt/x11/X11SunJDKReflection.java | 103 ++++++ .../classes/com/sun/nwi/impl/x11/X11Util.java | 75 +++++ .../impl/x11/awt/X11AWTNativeWindowFactory.java | 86 +++++ .../media/nwi/AbstractGraphicsConfiguration.java | 46 +++ .../javax/media/nwi/AbstractGraphicsDevice.java | 46 +++ .../media/nwi/DefaultNWCapabilitiesChooser.java | 233 +++++++++++++ .../classes/javax/media/nwi/NWCapabilities.java | 368 +++++++++++++++++++++ .../javax/media/nwi/NWCapabilitiesChooser.java | 67 ++++ .../classes/javax/media/nwi/NWException.java | 68 ++++ .../classes/javax/media/nwi/NativeWindow.java | 120 +++++++ .../javax/media/nwi/NativeWindowException.java | 68 ++++ .../javax/media/nwi/NativeWindowFactory.java | 218 ++++++++++++ .../classes/javax/media/nwi/ToolkitLock.java | 48 +++ .../media/nwi/awt/AWTGraphicsConfiguration.java | 58 ++++ .../javax/media/nwi/awt/AWTGraphicsDevice.java | 58 ++++ .../media/nwi/x11/X11GraphicsConfiguration.java | 55 +++ .../javax/media/nwi/x11/X11GraphicsDevice.java | 55 +++ src/nativewindow/native/JAWT_DrawingSurfaceInfo.c | 65 ++++ src/nativewindow/native/x11/Xinerama.c | 316 ++++++++++++++++++ src/nativewindow/native/x11/Xinerama.h | 76 +++++ src/nativewindow/native/x11/XineramaHelper.c | 126 +++++++ src/nativewindow/native/x11/extutil.h | 222 +++++++++++++ src/nativewindow/native/x11/panoramiXext.h | 54 +++ src/nativewindow/native/x11/panoramiXproto.h | 196 +++++++++++ src/nwi/classes/com/sun/nwi/impl/Debug.java | 93 ------ src/nwi/classes/com/sun/nwi/impl/NWReflection.java | 149 --------- .../com/sun/nwi/impl/NativeLibLoaderBase.java | 115 ------- .../com/sun/nwi/impl/NativeWindowFactoryImpl.java | 121 ------- src/nwi/classes/com/sun/nwi/impl/NullWindow.java | 128 ------- .../com/sun/nwi/impl/jawt/JAWTNativeLibLoader.java | 71 ---- .../classes/com/sun/nwi/impl/jawt/JAWTUtil.java | 94 ------ .../classes/com/sun/nwi/impl/jawt/JAWTWindow.java | 157 --------- .../com/sun/nwi/impl/jawt/JAWT_PlatformInfo.java | 47 --- .../sun/nwi/impl/jawt/macosx/MacOSXJAWTWindow.java | 151 --------- .../nwi/impl/jawt/windows/WindowsJAWTWindow.java | 161 --------- .../com/sun/nwi/impl/jawt/x11/X11JAWTWindow.java | 133 -------- .../sun/nwi/impl/jawt/x11/X11SunJDKReflection.java | 103 ------ src/nwi/classes/com/sun/nwi/impl/x11/X11Util.java | 75 ----- .../impl/x11/awt/X11AWTNativeWindowFactory.java | 86 ----- .../media/nwi/AbstractGraphicsConfiguration.java | 46 --- .../javax/media/nwi/AbstractGraphicsDevice.java | 46 --- .../media/nwi/DefaultNWCapabilitiesChooser.java | 233 ------------- .../classes/javax/media/nwi/NWCapabilities.java | 368 --------------------- .../javax/media/nwi/NWCapabilitiesChooser.java | 67 ---- src/nwi/classes/javax/media/nwi/NWException.java | 68 ---- src/nwi/classes/javax/media/nwi/NativeWindow.java | 120 ------- .../javax/media/nwi/NativeWindowException.java | 68 ---- .../javax/media/nwi/NativeWindowFactory.java | 218 ------------ src/nwi/classes/javax/media/nwi/ToolkitLock.java | 48 --- .../media/nwi/awt/AWTGraphicsConfiguration.java | 58 ---- .../javax/media/nwi/awt/AWTGraphicsDevice.java | 58 ---- .../media/nwi/x11/X11GraphicsConfiguration.java | 55 --- .../javax/media/nwi/x11/X11GraphicsDevice.java | 55 --- src/nwi/native/JAWT_DrawingSurfaceInfo.c | 65 ---- src/nwi/native/x11/Xinerama.c | 316 ------------------ src/nwi/native/x11/Xinerama.h | 76 ----- src/nwi/native/x11/XineramaHelper.c | 126 ------- src/nwi/native/x11/extutil.h | 222 ------------- src/nwi/native/x11/panoramiXext.h | 54 --- src/nwi/native/x11/panoramiXproto.h | 196 ----------- 72 files changed, 4247 insertions(+), 4247 deletions(-) create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/Debug.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/NWReflection.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/NativeLibLoaderBase.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/NativeWindowFactoryImpl.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/NullWindow.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/JAWTNativeLibLoader.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/JAWTUtil.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/JAWTWindow.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/JAWT_PlatformInfo.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/macosx/MacOSXJAWTWindow.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/windows/WindowsJAWTWindow.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/x11/X11JAWTWindow.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/jawt/x11/X11SunJDKReflection.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/x11/X11Util.java create mode 100644 src/nativewindow/classes/com/sun/nwi/impl/x11/awt/X11AWTNativeWindowFactory.java create mode 100644 src/nativewindow/classes/javax/media/nwi/AbstractGraphicsConfiguration.java create mode 100644 src/nativewindow/classes/javax/media/nwi/AbstractGraphicsDevice.java create mode 100644 src/nativewindow/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NWCapabilities.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NWCapabilitiesChooser.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NWException.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NativeWindow.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NativeWindowException.java create mode 100644 src/nativewindow/classes/javax/media/nwi/NativeWindowFactory.java create mode 100644 src/nativewindow/classes/javax/media/nwi/ToolkitLock.java create mode 100644 src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java create mode 100644 src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsDevice.java create mode 100644 src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java create mode 100644 src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsDevice.java create mode 100644 src/nativewindow/native/JAWT_DrawingSurfaceInfo.c create mode 100644 src/nativewindow/native/x11/Xinerama.c create mode 100644 src/nativewindow/native/x11/Xinerama.h create mode 100644 src/nativewindow/native/x11/XineramaHelper.c create mode 100644 src/nativewindow/native/x11/extutil.h create mode 100644 src/nativewindow/native/x11/panoramiXext.h create mode 100644 src/nativewindow/native/x11/panoramiXproto.h delete mode 100644 src/nwi/classes/com/sun/nwi/impl/Debug.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/NWReflection.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/NativeLibLoaderBase.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/NativeWindowFactoryImpl.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/NullWindow.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/JAWTNativeLibLoader.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/JAWTUtil.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/JAWTWindow.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/JAWT_PlatformInfo.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/macosx/MacOSXJAWTWindow.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/windows/WindowsJAWTWindow.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/x11/X11JAWTWindow.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/jawt/x11/X11SunJDKReflection.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/x11/X11Util.java delete mode 100644 src/nwi/classes/com/sun/nwi/impl/x11/awt/X11AWTNativeWindowFactory.java delete mode 100644 src/nwi/classes/javax/media/nwi/AbstractGraphicsConfiguration.java delete mode 100644 src/nwi/classes/javax/media/nwi/AbstractGraphicsDevice.java delete mode 100644 src/nwi/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java delete mode 100644 src/nwi/classes/javax/media/nwi/NWCapabilities.java delete mode 100644 src/nwi/classes/javax/media/nwi/NWCapabilitiesChooser.java delete mode 100644 src/nwi/classes/javax/media/nwi/NWException.java delete mode 100644 src/nwi/classes/javax/media/nwi/NativeWindow.java delete mode 100644 src/nwi/classes/javax/media/nwi/NativeWindowException.java delete mode 100644 src/nwi/classes/javax/media/nwi/NativeWindowFactory.java delete mode 100644 src/nwi/classes/javax/media/nwi/ToolkitLock.java delete mode 100644 src/nwi/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java delete mode 100644 src/nwi/classes/javax/media/nwi/awt/AWTGraphicsDevice.java delete mode 100644 src/nwi/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java delete mode 100644 src/nwi/classes/javax/media/nwi/x11/X11GraphicsDevice.java delete mode 100644 src/nwi/native/JAWT_DrawingSurfaceInfo.c delete mode 100644 src/nwi/native/x11/Xinerama.c delete mode 100644 src/nwi/native/x11/Xinerama.h delete mode 100644 src/nwi/native/x11/XineramaHelper.c delete mode 100644 src/nwi/native/x11/extutil.h delete mode 100644 src/nwi/native/x11/panoramiXext.h delete mode 100644 src/nwi/native/x11/panoramiXproto.h diff --git a/src/nativewindow/classes/com/sun/nwi/impl/Debug.java b/src/nativewindow/classes/com/sun/nwi/impl/Debug.java new file mode 100644 index 000000000..73379e87b --- /dev/null +++ b/src/nativewindow/classes/com/sun/nwi/impl/Debug.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.nwi.impl; + +import java.security.*; + +/** Helper routines for logging and debugging. */ + +public class Debug { + // Some common properties + private static boolean verbose; + private static boolean debugAll; + + static { + verbose = isPropertyDefined("nwi.verbose"); + debugAll = isPropertyDefined("nwi.debug"); + if (verbose) { + Package p = Package.getPackage("javax.media.nwi"); + System.err.println("NWI specification version " + p.getSpecificationVersion()); + System.err.println("NWI implementation version " + p.getImplementationVersion()); + System.err.println("NWI implementation vendor " + p.getImplementationVendor()); + } + } + + public static boolean getBooleanProperty(final String property) { + Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + boolean val = Boolean.getBoolean(property); + return (val ? Boolean.TRUE : Boolean.FALSE); + } + }); + return b.booleanValue(); + } + + public static boolean isPropertyDefined(final String property) { + Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + String val = System.getProperty(property); + return (val != null ? Boolean.TRUE : Boolean.FALSE); + } + }); + return b.booleanValue(); + } + + public static boolean verbose() { + return verbose; + } + + public static boolean debugAll() { + return debugAll; + } + + public static boolean debug(String subcomponent) { + return debugAll() || isPropertyDefined("nwi.debug." + subcomponent); + } +} diff --git a/src/nativewindow/classes/com/sun/nwi/impl/NWReflection.java b/src/nativewindow/classes/com/sun/nwi/impl/NWReflection.java new file mode 100644 index 000000000..51037af28 --- /dev/null +++ b/src/nativewindow/classes/com/sun/nwi/impl/NWReflection.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + */ + +package com.sun.nwi.impl; + +import java.lang.reflect.*; +import javax.media.nwi.*; + +public final class NWReflection { + public static final boolean DEBUG = Debug.debug("NWReflection"); + + public static final boolean isClassAvailable(String clazzName) { + try { + Class clazz = Class.forName(clazzName); + return null!=clazz; + } catch (Throwable e) { } + return false; + } + + public static final Class getClass(String clazzName) { + try { + return Class.forName(clazzName); + } catch (Throwable e) { } + return null; + } + + public static final Constructor getConstructor(String clazzName, Class[] cstrArgTypes) { + Class factoryClass = null; + Constructor factory = null; + + try { + factoryClass = Class.forName(clazzName); + if (factoryClass == null) { + throw new NWException(clazzName + " not available"); + } + try { + factory = factoryClass.getDeclaredConstructor( cstrArgTypes ); + } catch(NoSuchMethodException nsme) { + throw new NWException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); + } + return factory; + } catch (Throwable e) { + if (DEBUG) { + e.printStackTrace(); + } + throw new NWException(e); + } + } + + public static final Constructor getConstructor(String clazzName) { + return getConstructor(clazzName, new Class[0]); + } + + public static final Object createInstance(String clazzName, Class[] cstrArgTypes, Object[] cstrArgs) { + Constructor factory = null; + + try { + factory = getConstructor(clazzName, cstrArgTypes); + return factory.newInstance( cstrArgs ) ; + } catch (Exception e) { + throw new NWException(e); + } + } + + public static final Object createInstance(String clazzName, Object[] cstrArgs) { + Class[] cstrArgTypes = new Class[cstrArgs.length]; + for(int i=0; i=0; i--) { + Class face = clazzes[i]; + if(face.getName().equals(faceName)) { + return true; + } + } + clazz = clazz.getSuperclass(); + } while (clazz!=null); + return false; + } + + public static boolean isAWTComponent(Object target) { + return instanceOf(target, "java.awt.Component"); + } + + public static boolean isAWTComponent(Class clazz) { + return instanceOf(clazz, "java.awt.Component"); + } + +} + diff --git a/src/nativewindow/classes/com/sun/nwi/impl/NativeLibLoaderBase.java b/src/nativewindow/classes/com/sun/nwi/impl/NativeLibLoaderBase.java new file mode 100644 index 000000000..9e072fec0 --- /dev/null +++ b/src/nativewindow/classes/com/sun/nwi/impl/NativeLibLoaderBase.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package com.sun.nwi.impl; + +// FIXME: refactor Java SE dependencies +//import java.awt.Toolkit; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.HashSet; + +public class NativeLibLoaderBase { + public interface LoaderAction { + /** + * Loads the library specified by libname. Optionally preloads the libraries specified by + * preload. The implementation should ignore, if the preload-libraries have already been + * loaded. + * @param libname the library to load + * @param preload the libraries to load before loading the main library if not null + * @param preloadIgnoreError true, if errors during loading the preload-libraries should be ignored + */ + void loadLibrary(String libname, String[] preload, + boolean preloadIgnoreError); + } + + private static class DefaultAction implements LoaderAction { + public void loadLibrary(String libname, String[] preload, + boolean preloadIgnoreError) { + if (null!=preload) { + for (int i=0; i 0) { + --recursionCount; + return; + } + owner = null; + JAWTUtil.unlockToolkit(); + } + }; + + public ToolkitLock getToolkitLock() { + return toolkitLock; + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsConfiguration.java new file mode 100644 index 000000000..a85aca41c --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsConfiguration.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** A marker interface describing a graphics configuration, visual, or + pixel format in a toolkit-independent manner. */ + +public interface AbstractGraphicsConfiguration { +} diff --git a/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsDevice.java new file mode 100644 index 000000000..743210273 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/AbstractGraphicsDevice.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** A marker interface describing a graphics device in a + toolkit-independent manner. */ + +public interface AbstractGraphicsDevice { +} diff --git a/src/nativewindow/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java new file mode 100644 index 000000000..1318ea419 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/**

The default implementation of the {@link + NWCapabilitiesChooser} interface, which provides consistent visual + selection behavior across platforms. The precise algorithm is + deliberately left loosely specified. Some properties are:

+ +
    + +
  • As long as there is at least one available non-null + NWCapabilities which matches the "stereo" option, will return a + valid index. + +
  • Attempts to match as closely as possible the given + NWCapabilities, but will select one with fewer capabilities (i.e., + lower color depth) if necessary. + +
  • Prefers hardware-accelerated visuals to + non-hardware-accelerated. + +
  • If there is no exact match, prefers a more-capable visual to + a less-capable one. + +
  • If there is more than one exact match, chooses an arbitrary + one. + +
  • May select the opposite of a double- or single-buffered + visual (based on the user's request) in dire situations. + +
  • Color depth (including alpha) mismatches are weighted higher + than depth buffer mismatches, which are in turn weighted higher + than accumulation buffer (including alpha) and stencil buffer + depth mismatches. + +
  • If a valid windowSystemRecommendedChoice parameter is + supplied, chooses that instead of using the cross-platform code. + +
+*/ + +public class DefaultNWCapabilitiesChooser implements NWCapabilitiesChooser { + private static final boolean DEBUG = false; // FIXME: Debug.debug("DefaultNWCapabilitiesChooser"); + + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, + int windowSystemRecommendedChoice) { + if (DEBUG) { + System.err.println("Desired: " + desired); + for (int i = 0; i < available.length; i++) { + System.err.println("Available " + i + ": " + available[i]); + } + System.err.println("Window system's recommended choice: " + windowSystemRecommendedChoice); + } + + if (windowSystemRecommendedChoice >= 0 && + windowSystemRecommendedChoice < available.length && + available[windowSystemRecommendedChoice] != null) { + if (DEBUG) { + System.err.println("Choosing window system's recommended choice of " + windowSystemRecommendedChoice); + System.err.println(available[windowSystemRecommendedChoice]); + } + return windowSystemRecommendedChoice; + } + + // Create score array + int[] scores = new int[available.length]; + int NO_SCORE = -9999999; + int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; + int STENCIL_MISMATCH_PENALTY = 500; + // Pseudo attempt to keep equal rank penalties scale-equivalent + // (e.g., stencil mismatch is 3 * accum because there are 3 accum + // components) + int COLOR_MISMATCH_PENALTY_SCALE = 36; + int DEPTH_MISMATCH_PENALTY_SCALE = 6; + int ACCUM_MISMATCH_PENALTY_SCALE = 1; + int STENCIL_MISMATCH_PENALTY_SCALE = 3; + for (int i = 0; i < scores.length; i++) { + scores[i] = NO_SCORE; + } + // Compute score for each + for (int i = 0; i < scores.length; i++) { + NWCapabilities cur = available[i]; + if (cur == null) { + continue; + } + if (desired.getStereo() != cur.getStereo()) { + continue; + } + int score = 0; + // Compute difference in color depth + // (Note that this decides the direction of all other penalties) + score += (COLOR_MISMATCH_PENALTY_SCALE * + ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - + (desired.getRedBits() + desired.getGreenBits() + desired.getBlueBits() + desired.getAlphaBits()))); + // Compute difference in depth buffer depth + score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * + Math.abs(cur.getDepthBits() - desired.getDepthBits())); + // Compute difference in accumulation buffer depth + score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * + Math.abs((cur.getAccumRedBits() + cur.getAccumGreenBits() + cur.getAccumBlueBits() + cur.getAccumAlphaBits()) - + (desired.getAccumRedBits() + desired.getAccumGreenBits() + desired.getAccumBlueBits() + desired.getAccumAlphaBits()))); + // Compute difference in stencil bits + score += STENCIL_MISMATCH_PENALTY_SCALE * sign(score) * (cur.getStencilBits() - desired.getStencilBits()); + if (cur.getDoubleBuffered() != desired.getDoubleBuffered()) { + score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY; + } + if ((desired.getStencilBits() > 0) && (cur.getStencilBits() == 0)) { + score += sign(score) * STENCIL_MISMATCH_PENALTY; + } + scores[i] = score; + } + // Now prefer hardware-accelerated visuals by pushing scores of + // non-hardware-accelerated visuals out + boolean gotHW = false; + int maxAbsoluteHWScore = 0; + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + NWCapabilities cur = available[i]; + if (cur.getHardwareAccelerated()) { + int absScore = Math.abs(score); + if (!gotHW || + (absScore > maxAbsoluteHWScore)) { + gotHW = true; + maxAbsoluteHWScore = absScore; + } + } + } + if (gotHW) { + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + NWCapabilities cur = available[i]; + if (!cur.getHardwareAccelerated()) { + if (score <= 0) { + score -= maxAbsoluteHWScore; + } else if (score > 0) { + score += maxAbsoluteHWScore; + } + scores[i] = score; + } + } + } + + if (DEBUG) { + System.err.print("Scores: ["); + for (int i = 0; i < available.length; i++) { + if (i > 0) { + System.err.print(","); + } + System.err.print(" " + scores[i]); + } + System.err.println(" ]"); + } + + // Ready to select. Choose score closest to 0. + int scoreClosestToZero = NO_SCORE; + int chosenIndex = -1; + for (int i = 0; i < scores.length; i++) { + int score = scores[i]; + if (score == NO_SCORE) { + continue; + } + // Don't substitute a positive score for a smaller negative score + if ((scoreClosestToZero == NO_SCORE) || + (Math.abs(score) < Math.abs(scoreClosestToZero) && + ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { + scoreClosestToZero = score; + chosenIndex = i; + } + } + if (chosenIndex < 0) { + throw new NativeWindowException("Unable to select one of the provided NWCapabilities"); + } + if (DEBUG) { + System.err.println("Chosen index: " + chosenIndex); + System.err.println("Chosen capabilities:"); + System.err.println(available[chosenIndex]); + } + + return chosenIndex; + } + + private static int sign(int score) { + if (score < 0) { + return -1; + } + return 1; + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/NWCapabilities.java b/src/nativewindow/classes/javax/media/nwi/NWCapabilities.java new file mode 100644 index 000000000..cc3ebb77c --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NWCapabilities.java @@ -0,0 +1,368 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** Specifies a set of OpenGL capabilities that a rendering context + must support, such as color depth and whether stereo is enabled. + It currently contains the minimal number of routines which allow + configuration on all supported window systems. */ + +public class NWCapabilities implements Cloneable { + private boolean doubleBuffered = true; + private boolean stereo = false; + private boolean hardwareAccelerated = true; + private int depthBits = 24; + private int stencilBits = 0; + private int redBits = 8; + private int greenBits = 8; + private int blueBits = 8; + private int alphaBits = 0; + private int accumRedBits = 0; + private int accumGreenBits = 0; + private int accumBlueBits = 0; + private int accumAlphaBits = 0; + // Shift bits from PIXELFORMATDESCRIPTOR not present because they + // are unlikely to be supported on Windows anyway + + // Support for full-scene antialiasing (FSAA) + private boolean sampleBuffers = false; + private int numSamples = 2; + + // Support for transparent windows containing OpenGL content + // (currently only has an effect on Mac OS X) + private boolean backgroundOpaque = true; + + // Bits for pbuffer creation + private boolean pbufferFloatingPointBuffers; + private boolean pbufferRenderToTexture; + private boolean pbufferRenderToTextureRectangle; + + /** Creates a NWCapabilities object. All attributes are in a default + state. + */ + public NWCapabilities() {} + + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + throw new NativeWindowException(e); + } + } + + /** Indicates whether double-buffering is enabled. */ + public boolean getDoubleBuffered() { + return doubleBuffered; + } + + /** Enables or disables double buffering. */ + public void setDoubleBuffered(boolean onOrOff) { + doubleBuffered = onOrOff; + } + + /** Indicates whether stereo is enabled. */ + public boolean getStereo() { + return stereo; + } + + /** Enables or disables stereo viewing. */ + public void setStereo(boolean onOrOff) { + stereo = onOrOff; + } + + /** Indicates whether hardware acceleration is enabled. */ + public boolean getHardwareAccelerated() { + return hardwareAccelerated; + } + + /** Enables or disables hardware acceleration. */ + public void setHardwareAccelerated(boolean onOrOff) { + hardwareAccelerated = onOrOff; + } + + /** Returns the number of bits requested for the depth buffer. */ + public int getDepthBits() { + return depthBits; + } + + /** Sets the number of bits requested for the depth buffer. */ + public void setDepthBits(int depthBits) { + this.depthBits = depthBits; + } + + /** Returns the number of bits requested for the stencil buffer. */ + public int getStencilBits() { + return stencilBits; + } + + /** Sets the number of bits requested for the stencil buffer. */ + public void setStencilBits(int stencilBits) { + this.stencilBits = stencilBits; + } + + /** Returns the number of bits requested for the color buffer's red + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public int getRedBits() { + return redBits; + } + + /** Sets the number of bits requested for the color buffer's red + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setRedBits(int redBits) { + this.redBits = redBits; + } + + /** Returns the number of bits requested for the color buffer's + green component. On some systems only the color depth, which is + the sum of the red, green, and blue bits, is considered. */ + public int getGreenBits() { + return greenBits; + } + + /** Sets the number of bits requested for the color buffer's green + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setGreenBits(int greenBits) { + this.greenBits = greenBits; + } + + /** Returns the number of bits requested for the color buffer's blue + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public int getBlueBits() { + return blueBits; + } + + /** Sets the number of bits requested for the color buffer's blue + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setBlueBits(int blueBits) { + this.blueBits = blueBits; + } + + /** Returns the number of bits requested for the color buffer's + alpha component. On some systems only the color depth, which is + the sum of the red, green, and blue bits, is considered. */ + public int getAlphaBits() { + return alphaBits; + } + + /** Sets the number of bits requested for the color buffer's alpha + component. On some systems only the color depth, which is the + sum of the red, green, and blue bits, is considered. */ + public void setAlphaBits(int alphaBits) { + this.alphaBits = alphaBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's red component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumRedBits() { + return accumRedBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + red component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumRedBits(int accumRedBits) { + this.accumRedBits = accumRedBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's green component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumGreenBits() { + return accumGreenBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + green component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumGreenBits(int accumGreenBits) { + this.accumGreenBits = accumGreenBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's blue component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumBlueBits() { + return accumBlueBits; + } + + /** Sets the number of bits requested for the accumulation buffer's + blue component. On some systems only the accumulation buffer + depth, which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumBlueBits(int accumBlueBits) { + this.accumBlueBits = accumBlueBits; + } + + /** Returns the number of bits requested for the accumulation + buffer's alpha component. On some systems only the accumulation + buffer depth, which is the sum of the red, green, and blue bits, + is considered. */ + public int getAccumAlphaBits() { + return accumAlphaBits; + } + + /** Sets number of bits requested for accumulation buffer's alpha + component. On some systems only the accumulation buffer depth, + which is the sum of the red, green, and blue bits, is + considered. */ + public void setAccumAlphaBits(int accumAlphaBits) { + this.accumAlphaBits = accumAlphaBits; + } + + /** Indicates whether sample buffers for full-scene antialiasing + (FSAA) should be allocated for this drawable. Defaults to + false. */ + public void setSampleBuffers(boolean onOrOff) { + sampleBuffers = onOrOff; + } + + /** Returns whether sample buffers for full-scene antialiasing + (FSAA) should be allocated for this drawable. Defaults to + false. */ + public boolean getSampleBuffers() { + return sampleBuffers; + } + + /** If sample buffers are enabled, indicates the number of buffers + to be allocated. Defaults to 2. */ + public void setNumSamples(int numSamples) { + this.numSamples = numSamples; + } + + /** Returns the number of sample buffers to be allocated if sample + buffers are enabled. Defaults to 2. */ + public int getNumSamples() { + return numSamples; + } + + /** For pbuffers only, indicates whether floating-point buffers + should be used if available. Defaults to false. */ + public void setPbufferFloatingPointBuffers(boolean onOrOff) { + pbufferFloatingPointBuffers = onOrOff; + } + + /** For pbuffers only, returns whether floating-point buffers should + be used if available. Defaults to false. */ + public boolean getPbufferFloatingPointBuffers() { + return pbufferFloatingPointBuffers; + } + + /** For pbuffers only, indicates whether the render-to-texture + extension should be used if available. Defaults to false. */ + public void setPbufferRenderToTexture(boolean onOrOff) { + pbufferRenderToTexture = onOrOff; + } + + /** For pbuffers only, returns whether the render-to-texture + extension should be used if available. Defaults to false. */ + public boolean getPbufferRenderToTexture() { + return pbufferRenderToTexture; + } + + /** For pbuffers only, indicates whether the + render-to-texture-rectangle extension should be used if + available. Defaults to false. */ + public void setPbufferRenderToTextureRectangle(boolean onOrOff) { + pbufferRenderToTextureRectangle = onOrOff; + } + + /** For pbuffers only, returns whether the render-to-texture + extension should be used. Defaults to false. */ + public boolean getPbufferRenderToTextureRectangle() { + return pbufferRenderToTextureRectangle; + } + + /** For on-screen OpenGL contexts on some platforms, sets whether + the background of the context should be considered opaque. On + supported platforms, setting this to false, in conjunction with + other changes at the window toolkit level, can allow + hardware-accelerated OpenGL content inside of windows of + arbitrary shape. To achieve this effect it is necessary to use + an OpenGL clear color with an alpha less than 1.0. The default + value for this flag is true; setting it to false + may incur a certain performance penalty, so it is not + recommended to arbitrarily set it to false. */ + public void setBackgroundOpaque(boolean opaque) { + backgroundOpaque = opaque; + } + + /** Indicates whether the background of this OpenGL context should + be considered opaque. Defaults to true. + + @see #setBackgroundOpaque + */ + public boolean isBackgroundOpaque() { + return backgroundOpaque; + } + + /** Returns a textual representation of this NWCapabilities + object. */ + public String toString() { + return ("NWCapabilities [" + + "DoubleBuffered: " + doubleBuffered + + ", Stereo: " + stereo + + ", HardwareAccelerated: " + hardwareAccelerated + + ", DepthBits: " + depthBits + + ", StencilBits: " + stencilBits + + ", Red: " + redBits + + ", Green: " + greenBits + + ", Blue: " + blueBits + + ", Alpha: " + alphaBits + + ", Red Accum: " + accumRedBits + + ", Green Accum: " + accumGreenBits + + ", Blue Accum: " + accumBlueBits + + ", Alpha Accum: " + accumAlphaBits + + ", Multisample: " + sampleBuffers + + (sampleBuffers ? ", Num samples: " + numSamples : "") + + ", Opaque: " + backgroundOpaque + + " ]"); + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/NWCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nwi/NWCapabilitiesChooser.java new file mode 100644 index 000000000..12884c5e2 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NWCapabilitiesChooser.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** Provides a mechanism by which applications can customize the + window type selection for a given {@link NWCapabilities}. + Developers can implement this interface and pass an instance into + the appropriate method of {@link GLDrawableFactory}; the chooser + will be called during the OpenGL context creation process. */ + +public interface NWCapabilitiesChooser { + /** Chooses the index (0..available.length - 1) of the {@link + NWCapabilities} most closely matching the desired one from the + list of all supported. Some of the entries in the + available array may be null; the chooser must + ignore these. The windowSystemRecommendedChoice + parameter may be provided to the chooser by the underlying + window system; if this index is valid, it is recommended, but + not necessarily required, that the chooser select that entry. + +

Note: this method is called automatically by the + {@link GLDrawableFactory} when an instance of this class is + passed in to one of its factory methods. It should generally not + be invoked by users directly, unless it is desired to delegate + the choice to some other NWCapabilitiesChooser object. + */ + public int chooseCapabilities(NWCapabilities desired, + NWCapabilities[] available, + int windowSystemRecommendedChoice); +} diff --git a/src/nativewindow/classes/javax/media/nwi/NWException.java b/src/nativewindow/classes/javax/media/nwi/NWException.java new file mode 100644 index 000000000..a9e5b054d --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NWException.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** A generic exception for NWI errors used throughout the binding + as a substitute for {@link RuntimeException}. */ + +public class NWException extends RuntimeException { + /** Constructs a NWException object. */ + public NWException() { + super(); + } + + /** Constructs a NWException object with the specified detail + message. */ + public NWException(String message) { + super(message); + } + + /** Constructs a NWException object with the specified detail + message and root cause. */ + public NWException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a NWException object with the specified root + cause. */ + public NWException(Throwable cause) { + super(cause); + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/NativeWindow.java b/src/nativewindow/classes/javax/media/nwi/NativeWindow.java new file mode 100644 index 000000000..f992c2231 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NativeWindow.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** Provides the mechanism by which the Java / OpenGL binding + interacts with windows. A window toolkit such as the AWT may + either implement this interface directly with one of its + components, or provide and register an implementation of {@link + NativeWindowFactory NativeWindowFactory} which can create + NativeWindow objects for its components.

+ + A NativeWindow created for a particular on-screen component is + expected to have the same lifetime as that component. As long as + the component is alive, the NativeWindow must be able to control + it, and any time it is visible and locked, provide information + such as the window handle to the Java / OpenGL binding so that + GLDrawables and GLContexts may be created for the window. +*/ + +public interface NativeWindow { + public static final int LOCK_NOT_SUPPORTED = 0; + public static final int LOCK_SURFACE_NOT_READY = 1; + public static final int LOCK_SURFACE_CHANGED = 2; + public static final int LOCK_SUCCESS = 3; + + /** + * Lock this surface + */ + public int lockSurface() throws NativeWindowException ; + + /** + * Unlock this surface + */ + public void unlockSurface(); + public boolean isSurfaceLocked(); + + /** + * render all native window information invalid, + * as if the native window was destroyed + */ + public void invalidate(); + + /** + * Lifetime: locked state + */ + public long getDisplayHandle(); + public long getScreenHandle(); + + /** + * Returns the window handle for this NativeWindow.

+ * + * The window handle shall reflect the platform one + * for all window related operations, e.g. open, close, resize.

+ * + * On X11 this returns an entity of type Window.
+ * On Microsoft Windows this returns an entity of type HWND. + */ + public long getWindowHandle(); + + /** + * Returns the handle to the surface for this NativeWindow.

+ * + * The surface handle shall reflect the platform one + * for all drawable surface operations, e.g. opengl, swap-buffer.

+ * + * On X11 this returns an entity of type Window, + * since there is no differentiation of surface and window there.
+ * On Microsoft Windows this returns an entity of type HDC. + */ + public long getSurfaceHandle(); + + /** + * Lifetime: after 1st lock, until invalidation + */ + public long getVisualID(); + public int getScreenIndex(); + + /** Returns the current width of this window. */ + public int getWidth(); + + /** Returns the current height of this window. */ + public int getHeight(); +} diff --git a/src/nativewindow/classes/javax/media/nwi/NativeWindowException.java b/src/nativewindow/classes/javax/media/nwi/NativeWindowException.java new file mode 100644 index 000000000..bc1a8ddef --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NativeWindowException.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi; + +/** A generic exception for OpenGL errors used throughout the binding + as a substitute for {@link RuntimeException}. */ + +public class NativeWindowException extends RuntimeException { + /** Constructs a NativeWindowException object. */ + public NativeWindowException() { + super(); + } + + /** Constructs a NativeWindowException object with the specified detail + message. */ + public NativeWindowException(String message) { + super(message); + } + + /** Constructs a NativeWindowException object with the specified detail + message and root cause. */ + public NativeWindowException(String message, Throwable cause) { + super(message, cause); + } + + /** Constructs a NativeWindowException object with the specified root + cause. */ + public NativeWindowException(Throwable cause) { + super(cause); + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nwi/NativeWindowFactory.java new file mode 100644 index 000000000..622dfc3a7 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/NativeWindowFactory.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +package javax.media.nwi; + +import javax.media.nwi.*; +import java.lang.reflect.*; +import java.security.*; +import java.util.*; + +import com.sun.nwi.impl.*; + +/** Provides the link between the window toolkit and the Java binding + to the OpenGL API. The NativeWindowFactory, and NativeWindow + instances it creates, encompass all of the toolkit-specific + functionality, leaving the GLDrawableFactory independent of any + particular toolkit. */ + +public abstract class NativeWindowFactory { + private static NativeWindowFactory defaultFactory; + private static HashMap/**/ registeredFactories = + new HashMap(); + private static Class nativeWindowClass; + + /** Creates a new NativeWindowFactory instance. End users do not + need to call this method. */ + protected NativeWindowFactory() { + } + + static { + initialize(); + } + + private static void initialize() { + String osName = System.getProperty("os.name"); + String osNameLowerCase = osName.toLowerCase(); + String factoryClassName = null; + + // We break compile-time dependencies on the AWT here to + // make it easier to run this code on mobile devices + + NativeWindowFactory factory = new NativeWindowFactoryImpl(); + nativeWindowClass = javax.media.nwi.NativeWindow.class; + registerFactory(nativeWindowClass, factory); + defaultFactory = factory; + + Class componentClass = null; + try { + componentClass = Class.forName("java.awt.Component"); + } catch (Exception e) { + } + if (componentClass != null) { + if (!osNameLowerCase.startsWith("wind") && + !osNameLowerCase.startsWith("mac os x")) { + // Assume X11 platform -- should probably test for these explicitly + try { + Constructor factoryConstructor = + NWReflection.getConstructor("com.sun.nwi.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {}); + factory = (NativeWindowFactory) factoryConstructor.newInstance(null); + } catch (Exception e) { } + } + registerFactory(componentClass, factory); + defaultFactory = factory; + } + } + + /** Sets the default NativeWindowFactory. Certain operations on + X11 platforms require synchronization, and the implementation + of this synchronization may be specific to the window toolkit + in use. It is impractical to require that all of the APIs that + might require synchronization receive a {@link ToolkitLock + ToolkitLock} as argument. For this reason the concept of a + default NativeWindowFactory is introduced. The toolkit lock + provided via {@link #getToolkitLock getToolkitLock} from this + default NativeWindowFactory will be used for synchronization + within the Java binding to OpenGL. By default, if the AWT is + available, the default toolkit will support the AWT. */ + public static void setDefaultFactory(NativeWindowFactory factory) { + defaultFactory = factory; + } + + /** Gets the default NativeWindowFactory. Certain operations on + X11 platforms require synchronization, and the implementation + of this synchronization may be specific to the window toolkit + in use. It is impractical to require that all of the APIs that + might require synchronization receive a {@link ToolkitLock + ToolkitLock} as argument. For this reason the concept of a + default NativeWindowFactory is introduced. The toolkit lock + provided via {@link #getToolkitLock getToolkitLock} from this + default NativeWindowFactory will be used for synchronization + within the Java binding to OpenGL. By default, if the AWT is + available, the default toolkit will support the AWT. */ + public static NativeWindowFactory getDefaultFactory() { + return defaultFactory; + } + + /** Returns the appropriate NativeWindowFactory to handle window + objects of the given type. The windowClass might be {@link + NativeWindow NativeWindow}, in which case the client has + already assumed the responsibility of creating a compatible + NativeWindow implementation, or it might be that of a toolkit + class like {@link java.awt.Component Component}. */ + public static NativeWindowFactory getFactory(Class windowClass) throws IllegalArgumentException { + if (nativeWindowClass.isAssignableFrom(windowClass)) { + return (NativeWindowFactory) registeredFactories.get(nativeWindowClass); + } + Class clazz = windowClass; + while (clazz != null) { + NativeWindowFactory factory = (NativeWindowFactory) registeredFactories.get(clazz); + if (factory != null) { + return factory; + } + clazz = clazz.getSuperclass(); + } + throw new IllegalArgumentException("No registered NativeWindowFactory for class " + windowClass.getName()); + } + + /** Registers a NativeWindowFactory handling window objects of the + given class. This does not need to be called by end users, + only implementors of new NativeWindowFactory subclasses, .. */ + protected static void registerFactory(Class windowClass, NativeWindowFactory factory) { + registeredFactories.put(windowClass, factory); + } + + /** Converts the given window object into a {@link NativeWindow + NativeWindow} which can be operated upon by the {@link + GLDrawableFactory GLDrawableFactory}. The object may be a + component for a particular window toolkit, such as an AWT + Canvas. It may also be a NativeWindow object, in which no + conversion is necessary. The particular implementation of the + NativeWindowFactory is responsible for handling objects from a + particular window toolkit. The built-in NativeWindowFactory + handles NativeWindow instances as well as AWT Components. + + @throws IllegalArgumentException if the given window object + could not be handled by any of the registered + NativeWindowFactory instances + */ + public static NativeWindow getNativeWindow(Object winObj) throws IllegalArgumentException, NativeWindowException { + if (winObj == null) { + throw new IllegalArgumentException("Null window object"); + } + + return getFactory(winObj.getClass()).getNativeWindowImpl(winObj); + } + + /** + *

Selects a graphics configuration on the specified graphics + * device compatible with the supplied NWCapabilities. This method + * is intended to be used by applications which do not use the + * supplied GLCanvas class but instead wrap their own Canvas or + * other window toolkit-specific object with a GLDrawable. Some + * platforms (specifically X11) require the graphics configuration + * to be specified when the window toolkit object is created. This + * method may return null on platforms on which the OpenGL pixel + * format selection process is performed later.

+ * + *

The concrete data type of the passed graphics device and + * returned graphics configuration must be specified in the + * documentation binding this particular API to the underlying + * window toolkit. The Reference Implementation accepts {@link + * AWTGraphicsDevice AWTGraphicsDevice} objects and returns {@link + * AWTGraphicsConfiguration AWTGraphicsConfiguration} objects.

+ * + * @see java.awt.Canvas#Canvas(java.awt.GraphicsConfiguration) + * + * @throws IllegalArgumentException if the data type of the passed + * AbstractGraphicsDevice is not supported by this + * NativeWindowFactory. + * @throws NWException if any window system-specific errors caused + * the selection of the graphics configuration to fail. + */ + public abstract AbstractGraphicsConfiguration + chooseGraphicsConfiguration(NWCapabilities capabilities, + NWCapabilitiesChooser chooser, + AbstractGraphicsDevice device) + throws IllegalArgumentException, NWException; + + /** Performs the conversion from a toolkit's window object to a + NativeWindow. Implementors of concrete NativeWindowFactory + subclasses should override this method. */ + protected abstract NativeWindow getNativeWindowImpl(Object winObj) throws IllegalArgumentException; + + /** Returns the object which provides support for synchronizing + with the underlying window toolkit. On most platforms the + returned object does nothing; currently it only has effects on + X11 platforms. */ + public abstract ToolkitLock getToolkitLock(); +} diff --git a/src/nativewindow/classes/javax/media/nwi/ToolkitLock.java b/src/nativewindow/classes/javax/media/nwi/ToolkitLock.java new file mode 100644 index 000000000..c9e2b4170 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/ToolkitLock.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +package javax.media.nwi; + +/** Provides an interface for locking and unlocking the underlying + window toolkit, where this is necessary in the OpenGL + implementation. This mechanism is generally only needed on X11 + platforms. Currently it is only used when the AWT is in use. + Implementations of this lock, if they are not no-ops, must support + reentrant locking and unlocking. */ + +public interface ToolkitLock { + /** Locks the toolkit. */ + public void lock(); + + /** Unlocks the toolkit. */ + public void unlock(); +} diff --git a/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java new file mode 100644 index 000000000..313654c05 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi.awt; + +import java.awt.GraphicsConfiguration; +import javax.media.nwi.AbstractGraphicsConfiguration; + +/** A wrapper for an AWT GraphicsConfiguration allowing it to be + handled in a toolkit-independent manner. */ + +public class AWTGraphicsConfiguration implements AbstractGraphicsConfiguration { + private GraphicsConfiguration config; + + public AWTGraphicsConfiguration(GraphicsConfiguration config) { + this.config = config; + } + + public GraphicsConfiguration getGraphicsConfiguration() { + return config; + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsDevice.java new file mode 100644 index 000000000..f6da16176 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/awt/AWTGraphicsDevice.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +package javax.media.nwi.awt; + +import java.awt.GraphicsDevice; +import javax.media.nwi.AbstractGraphicsDevice; + +/** A wrapper for an AWT GraphicsDevice allowing it to be + handled in a toolkit-independent manner. */ + +public class AWTGraphicsDevice implements AbstractGraphicsDevice { + private GraphicsDevice device; + + public AWTGraphicsDevice(GraphicsDevice device) { + this.device = device; + } + + public GraphicsDevice getGraphicsDevice() { + return device; + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java new file mode 100644 index 000000000..f18185fa7 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +package javax.media.nwi.x11; + +import javax.media.nwi.*; + +/** Encapsulates a graphics configuration, or OpenGL pixel format, on + X11 platforms. Objects of this type are returned from {@link + NativeWindowFactory#chooseGraphicsConfiguration + NativeWindowFactory.chooseGraphicsConfiguration()} on X11 + platforms when toolkits other than the AWT are being used. */ + +public class X11GraphicsConfiguration implements AbstractGraphicsConfiguration { + private long visualID; + + /** Constructs a new X11GraphicsConfiguration corresponding to the given visual ID. */ + public X11GraphicsConfiguration(long visualID) { + this.visualID = visualID; + } + + /** Returns the visual ID that this graphics configuration object represents. */ + public long getVisualID() { + return visualID; + } +} diff --git a/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsDevice.java b/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsDevice.java new file mode 100644 index 000000000..3288447d9 --- /dev/null +++ b/src/nativewindow/classes/javax/media/nwi/x11/X11GraphicsDevice.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +package javax.media.nwi.x11; + +import javax.media.nwi.*; + +/** Encapsulates a graphics device, or screen, on X11 + platforms. Objects of this type are passed to {@link + NativeWindowFactory#chooseGraphicsConfiguration + NativeWindowFactory.chooseGraphicsConfiguration()} on X11 + platforms when toolkits other than the AWT are being used. */ + +public class X11GraphicsDevice implements AbstractGraphicsDevice { + private int screen; + + /** Constructs a new X11GraphicsDevice corresponding to the given screen. */ + public X11GraphicsDevice(int screen) { + this.screen = screen; + } + + /** Returns the screen that this graphics device object represents. */ + public int getScreen() { + return screen; + } +} diff --git a/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c new file mode 100644 index 000000000..0a6daace0 --- /dev/null +++ b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + * Sun gratefully acknowledges that this software was originally authored + * and developed by Kenneth Bradley Russell and Christopher John Kline. + */ + +#include + +#ifdef WIN32 + #define PLATFORM_DSI_SIZE sizeof(JAWT_Win32DrawingSurfaceInfo) +#elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX) + #define PLATFORM_DSI_SIZE sizeof(JAWT_X11DrawingSurfaceInfo) +#elif defined(macosx) + #define PLATFORM_DSI_SIZE sizeof(JAWT_MacOSXDrawingSurfaceInfo) +#else + ERROR: port JAWT_DrawingSurfaceInfo.c to your platform +#endif + +JNIEXPORT jobject JNICALL +Java_com_sun_nwi_impl_jawt_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) { + JAWT_DrawingSurfaceInfo* dsi; + dsi = (*env)->GetDirectBufferAddress(env, jthis0); + if (dsi == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), + "Argument \"jthis0\" was not a direct buffer"); + return NULL; + } + if (dsi->platformInfo == NULL) { + return NULL; + } + return (*env)->NewDirectByteBuffer(env, dsi->platformInfo, PLATFORM_DSI_SIZE); +} diff --git a/src/nativewindow/native/x11/Xinerama.c b/src/nativewindow/native/x11/Xinerama.c new file mode 100644 index 000000000..98dcfe095 --- /dev/null +++ b/src/nativewindow/native/x11/Xinerama.c @@ -0,0 +1,316 @@ +/* $TOG: XPanoramiX.c /main/2 1997/11/16 08:45:41 kaleb $ */ +/**************************************************************** +* * +* Copyright (c) Digital Equipment Corporation, 1991, 1997 * +* * +* All Rights Reserved. Unpublished rights reserved under * +* the copyright laws of the United States. * +* * +* The software contained on this media is proprietary to * +* and embodies the confidential technology of Digital * +* Equipment Corporation. Possession, use, duplication or * +* dissemination of the software and media is authorized only * +* pursuant to a valid written license from Digital Equipment * +* Corporation. * +* * +* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure * +* by the U.S. Government is subject to restrictions as set * +* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, * +* or in FAR 52.227-19, as applicable. * +* * +*****************************************************************/ +/* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.1 2000/02/27 23:10:04 mvojkovi Exp $ */ + +#ifndef __linux__ + #error This file should only be built under Linux +#endif + +#define NEED_EVENTS +#define NEED_REPLIES +#include +#include +/* #include "Xext.h" */ /* in ../include */ +#include "extutil.h" /* in ../include */ +#include "panoramiXext.h" +#include "panoramiXproto.h" /* in ../include */ +#include "Xinerama.h" + + +static XExtensionInfo _panoramiX_ext_info_data; +static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data; +static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME; + +#define PanoramiXCheckExtension(dpy,i,val) \ + XextCheckExtension (dpy, i, panoramiX_extension_name, val) +#define PanoramiXSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension (dpy, i, panoramiX_extension_name) + +static int close_display(); +static /* const */ XExtensionHooks panoramiX_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + NULL, /* wire_to_event */ + NULL, /* event_to_wire */ + NULL, /* error */ + NULL, /* error_string */ +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info, + panoramiX_extension_name, + &panoramiX_extension_hooks, + 0, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info) + + + +/**************************************************************************** + * * + * PanoramiX public interfaces * + * * + ****************************************************************************/ + +Bool XPanoramiXQueryExtension ( + Display *dpy, + int *event_basep, + int *error_basep +) +{ + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension(info)) { + *event_basep = info->codes->first_event; + *error_basep = info->codes->first_error; + return True; + } else { + return False; + } +} + + +Status XPanoramiXQueryVersion( + Display *dpy, + int *major_versionp, + int *minor_versionp +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXQueryVersionReply rep; + register xPanoramiXQueryVersionReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXQueryVersion, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXQueryVersion; + req->clientMajor = PANORAMIX_MAJOR_VERSION; + req->clientMinor = PANORAMIX_MINOR_VERSION; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + *major_versionp = rep.majorVersion; + *minor_versionp = rep.minorVersion; + UnlockDisplay (dpy); + SyncHandle (); + return 1; +} + +XPanoramiXInfo *XPanoramiXAllocInfo(void) +{ + return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo)); +} + +Status XPanoramiXGetState ( + Display *dpy, + Drawable drawable, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetStateReply rep; + register xPanoramiXGetStateReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetState, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetState; + req->window = drawable; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->State = rep.state; + return 1; +} + +Status XPanoramiXGetScreenCount ( + Display *dpy, + Drawable drawable, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetScreenCountReply rep; + register xPanoramiXGetScreenCountReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetScreenCount, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetScreenCount; + req->window = drawable; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->ScreenCount = rep.ScreenCount; + return 1; +} + +Status XPanoramiXGetScreenSize ( + Display *dpy, + Drawable drawable, + int screen_num, + XPanoramiXInfo *panoramiX_info +) +{ + XExtDisplayInfo *info = find_display (dpy); + xPanoramiXGetScreenSizeReply rep; + register xPanoramiXGetScreenSizeReq *req; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (PanoramiXGetScreenSize, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_PanoramiXGetScreenSize; + req->window = drawable; + req->screen = screen_num; /* need to define */ + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return 0; + } + UnlockDisplay (dpy); + SyncHandle (); + panoramiX_info->window = rep.window; + panoramiX_info->screen = rep.screen; + panoramiX_info->width = rep.width; + panoramiX_info->height = rep.height; + return 1; +} + +/*******************************************************************\ + Alternate interface to make up for shortcomings in the original, + namely, the omission of the screen origin. The new interface is + in the "Xinerama" namespace instead of "PanoramiX". +\*******************************************************************/ + +Bool XineramaQueryExtension ( + Display *dpy, + int *event_base, + int *error_base +) +{ + return XPanoramiXQueryExtension(dpy, event_base, error_base); +} + +Status XineramaQueryVersion( + Display *dpy, + int *major, + int *minor +) +{ + return XPanoramiXQueryVersion(dpy, major, minor); +} + +Bool XineramaIsActive(Display *dpy) +{ + xXineramaIsActiveReply rep; + xXineramaIsActiveReq *req; + XExtDisplayInfo *info = find_display (dpy); + + if(!XextHasExtension(info)) + return False; /* server doesn't even have the extension */ + + LockDisplay (dpy); + GetReq (XineramaIsActive, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_XineramaIsActive; + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay (dpy); + SyncHandle (); + return False; + } + UnlockDisplay (dpy); + SyncHandle (); + return rep.state; +} + +#include + +XineramaScreenInfo * +XineramaQueryScreens( + Display *dpy, + int *number +) +{ + XExtDisplayInfo *info = find_display (dpy); + xXineramaQueryScreensReply rep; + xXineramaQueryScreensReq *req; + XineramaScreenInfo *scrnInfo = NULL; + + PanoramiXCheckExtension (dpy, info, 0); + + LockDisplay (dpy); + GetReq (XineramaQueryScreens, req); + req->reqType = info->codes->major_opcode; + req->panoramiXReqType = X_XineramaQueryScreens; + if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay (dpy); + SyncHandle (); + return NULL; + } + + if(rep.number) { + if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) { + xXineramaScreenInfo scratch; + CARD32 i; + + for(i = 0; i < rep.number; i++) { + _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo); + scrnInfo[i].screen_number = i; + scrnInfo[i].x_org = scratch.x_org; + scrnInfo[i].y_org = scratch.y_org; + scrnInfo[i].width = scratch.width; + scrnInfo[i].height = scratch.height; + } + + *number = rep.number; + } else + _XEatData(dpy, rep.length << 2); + } + + UnlockDisplay (dpy); + SyncHandle (); + return scrnInfo; +} diff --git a/src/nativewindow/native/x11/Xinerama.h b/src/nativewindow/native/x11/Xinerama.h new file mode 100644 index 000000000..7177f5131 --- /dev/null +++ b/src/nativewindow/native/x11/Xinerama.h @@ -0,0 +1,76 @@ +/* +Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Soft- +ware"), to deal in the Software without restriction, including without +limitation the rights to use, copy, modify, merge, publish, distribute, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, provided that the above copyright +notice(s) and this permission notice appear in all copies of the Soft- +ware and that both the above copyright notice(s) and this permission +notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- +ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY +RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN +THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- +QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- +MANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization of +the copyright holder. +*/ + +/* $XFree86: xc/include/extensions/Xinerama.h,v 3.2 2000/03/01 01:04:20 dawes Exp $ */ + +#ifdef __linux__ + +#ifndef _Xinerama_h +#define _Xinerama_h + +typedef struct { + int screen_number; + short x_org; + short y_org; + short width; + short height; +} XineramaScreenInfo; + +Bool XineramaQueryExtension ( + Display *dpy, + int *event_base, + int *error_base +); + +Status XineramaQueryVersion( + Display *dpy, + int *major, + int *minor +); + +Bool XineramaIsActive(Display *dpy); + + +/* + Returns the number of heads and a pointer to an array of + structures describing the position and size of the individual + heads. Returns NULL and number = 0 if Xinerama is not active. + + Returned array should be freed with XFree(). +*/ + +XineramaScreenInfo * +XineramaQueryScreens( + Display *dpy, + int *number +); + +#endif /* _Xinerama_h */ + +#endif /* __linux__ */ diff --git a/src/nativewindow/native/x11/XineramaHelper.c b/src/nativewindow/native/x11/XineramaHelper.c new file mode 100644 index 000000000..09ad0b706 --- /dev/null +++ b/src/nativewindow/native/x11/XineramaHelper.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistribution of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistribution in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * This software is provided "AS IS," without a warranty of any kind. ALL + * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, + * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN + * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR + * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR + * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR + * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR + * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE + * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, + * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF + * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use + * in the design, construction, operation or maintenance of any nuclear + * facility. + * + */ + +/* This file contains a helper routine to be called by Java code to + determine whether the Xinerama extension is in use and therefore to + treat the multiple AWT screens as one large screen. */ + +#include +#include + +#ifdef __sun + +typedef Status XineramaGetInfoFunc(Display* display, int screen_number, + XRectangle* framebuffer_rects, unsigned char* framebuffer_hints, + int* num_framebuffers); +typedef Status XineramaGetCenterHintFunc(Display* display, int screen_number, + int* x, int* y); + +XineramaGetCenterHintFunc* XineramaSolarisCenterFunc = NULL; +#include + +#elif defined(__linux__) + +#include "Xinerama.h" + +#endif + +Bool XineramaEnabled(Display* display) { +#ifdef __sun + +#define MAXFRAMEBUFFERS 16 + char* XinExtName = "XINERAMA"; + int32_t major_opcode, first_event, first_error; + Bool gotXinExt = False; + void* libHandle = 0; + unsigned char fbhints[MAXFRAMEBUFFERS]; + XRectangle fbrects[MAXFRAMEBUFFERS]; + int locNumScr = 0; + Bool usingXinerama = False; + + char* XineramaLibName= "libXext.so"; + char* XineramaGetInfoName = "XineramaGetInfo"; + char* XineramaGetCenterHintName = "XineramaGetCenterHint"; + XineramaGetInfoFunc* XineramaSolarisFunc = NULL; + + gotXinExt = XQueryExtension(display, XinExtName, &major_opcode, + &first_event, &first_error); + + if (gotXinExt) { + /* load library, load and run XineramaGetInfo */ + libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL); + if (libHandle != 0) { + XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName); + XineramaSolarisCenterFunc = + (XineramaGetCenterHintFunc*)dlsym(libHandle, + XineramaGetCenterHintName); + if (XineramaSolarisFunc != NULL) { + if ((*XineramaSolarisFunc)(display, 0, &fbrects[0], + &fbhints[0], &locNumScr) != 0) { + + usingXinerama = True; + } + } + dlclose(libHandle); + } + } + return usingXinerama; + +#elif defined(__linux__) + + char* XinExtName = "XINERAMA"; + int32_t major_opcode, first_event, first_error; + Bool gotXinExt = False; + int32_t locNumScr = 0; + + XineramaScreenInfo *xinInfo; + + gotXinExt = XQueryExtension(display, XinExtName, &major_opcode, + &first_event, &first_error); + + if (gotXinExt) { + xinInfo = XineramaQueryScreens(display, &locNumScr); + if (xinInfo != NULL) { + return True; + } + } + return False; + +#else + return False; +#endif +} diff --git a/src/nativewindow/native/x11/extutil.h b/src/nativewindow/native/x11/extutil.h new file mode 100644 index 000000000..f0d3b59c3 --- /dev/null +++ b/src/nativewindow/native/x11/extutil.h @@ -0,0 +1,222 @@ +/* + * $Xorg: extutil.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ + * +Copyright 1989, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + * + * Author: Jim Fulton, MIT The Open Group + * + * Xlib Extension-Writing Utilities + * + * This package contains utilities for writing the client API for various + * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND + * ARE SUBJECT TO CHANGE! + */ +/* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */ + +#ifdef __linux__ + +#ifndef _EXTUTIL_H_ +#define _EXTUTIL_H_ + +/* + * We need to keep a list of open displays since the Xlib display list isn't + * public. We also have to per-display info in a separate block since it isn't + * stored directly in the Display structure. + */ +typedef struct _XExtDisplayInfo { + struct _XExtDisplayInfo *next; /* keep a linked list */ + Display *display; /* which display this is */ + XExtCodes *codes; /* the extension protocol codes */ + XPointer data; /* extra data for extension to use */ +} XExtDisplayInfo; + +typedef struct _XExtensionInfo { + XExtDisplayInfo *head; /* start of list */ + XExtDisplayInfo *cur; /* most recently used */ + int ndisplays; /* number of displays */ +} XExtensionInfo; + +typedef struct _XExtensionHooks { + int (*create_gc)( +#if NeedNestedPrototypes + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +#endif +); + int (*copy_gc)( +#if NeedNestedPrototypes + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +#endif +); + int (*flush_gc)( +#if NeedNestedPrototypes + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +#endif +); + int (*free_gc)( +#if NeedNestedPrototypes + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +#endif +); + int (*create_font)( +#if NeedNestedPrototypes + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +#endif +); + int (*free_font)( +#if NeedNestedPrototypes + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +#endif +); + int (*close_display)( +#if NeedNestedPrototypes + Display* /* display */, + XExtCodes* /* codes */ +#endif +); + Bool (*wire_to_event)( +#if NeedNestedPrototypes + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +#endif +); + Status (*event_to_wire)( +#if NeedNestedPrototypes + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +#endif +); + int (*error)( +#if NeedNestedPrototypes + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ +#endif +); + char *(*error_string)( +#if NeedNestedPrototypes + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ +#endif +); +} XExtensionHooks; + +extern XExtensionInfo *XextCreateExtension( +#if NeedFunctionPrototypes + void +#endif +); +extern void XextDestroyExtension( +#if NeedFunctionPrototypes + XExtensionInfo* /* info */ +#endif +); +extern XExtDisplayInfo *XextAddDisplay( +#if NeedFunctionPrototypes + XExtensionInfo* /* extinfo */, + Display* /* dpy */, + char* /* ext_name */, + XExtensionHooks* /* hooks */, + int /* nevents */, + XPointer /* data */ +#endif +); +extern int XextRemoveDisplay( +#if NeedFunctionPrototypes + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +#endif +); +extern XExtDisplayInfo *XextFindDisplay( +#if NeedFunctionPrototypes + XExtensionInfo* /* extinfo */, + Display* /* dpy */ +#endif +); + +#define XextHasExtension(i) ((i) && ((i)->codes)) +#define XextCheckExtension(dpy,i,name,val) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } +#define XextSimpleCheckExtension(dpy,i,name) \ + if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } + + +/* + * helper macros to generate code that is common to all extensions; caller + * should prefix it with static if extension source is in one file; this + * could be a utility function, but have to stack 6 unused arguments for + * something that is called many, many times would be bad. + */ +#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ +XExtDisplayInfo *proc (Display *dpy) \ +{ \ + XExtDisplayInfo *dpyinfo; \ + if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ + if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ + dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ + return dpyinfo; \ +} + +#define XEXT_FIND_DISPLAY_PROTO(proc) \ + XExtDisplayInfo *proc(Display *dpy) + +#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ +int proc (Display *dpy, XExtCodes *codes) \ +{ \ + return XextRemoveDisplay (extinfo, dpy); \ +} + +#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ + int proc(Display *dpy, XExtCodes *codes) + +#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ +char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ +{ \ + code -= codes->first_error; \ + if (code >= 0 && code < nerr) { \ + char tmp[256]; \ + sprintf (tmp, "%s.%d", extname, code); \ + XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ + return buf; \ + } \ + return (char *)0; \ +} + +#define XEXT_ERROR_STRING_PROTO(proc) \ + char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) +#endif + +#endif /* __linux__ */ diff --git a/src/nativewindow/native/x11/panoramiXext.h b/src/nativewindow/native/x11/panoramiXext.h new file mode 100644 index 000000000..11267d0c1 --- /dev/null +++ b/src/nativewindow/native/x11/panoramiXext.h @@ -0,0 +1,54 @@ +/* $Xorg: panoramiXext.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ +/***************************************************************** +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. +******************************************************************/ +/* + * PanoramiX definitions + */ +/* $XFree86: xc/include/extensions/panoramiXext.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ + +#ifdef __linux__ + +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ + +#define PANORAMIX_MAJOR_VERSION 1 /* current version number */ +#define PANORAMIX_MINOR_VERSION 1 + +typedef struct { + Window window; /* PanoramiX window - may not exist */ + int screen; + int State; /* PanroamiXOff, PanoramiXOn */ + int width; /* width of this screen */ + int height; /* height of this screen */ + int ScreenCount; /* real physical number of screens */ + XID eventMask; /* selected events for this client */ +} XPanoramiXInfo; + +extern XPanoramiXInfo *XPanoramiXAllocInfo ( +#if NeedFunctionPrototypes + void +#endif +); + +#endif /* __linux__*/ diff --git a/src/nativewindow/native/x11/panoramiXproto.h b/src/nativewindow/native/x11/panoramiXproto.h new file mode 100644 index 000000000..1a66940f7 --- /dev/null +++ b/src/nativewindow/native/x11/panoramiXproto.h @@ -0,0 +1,196 @@ +/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ +/***************************************************************** +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. +******************************************************************/ +/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ + +#ifdef __linux__ + +/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ + +#ifndef _PANORAMIXPROTO_H_ +#define _PANORAMIXPROTO_H_ + +#define PANORAMIX_PROTOCOL_NAME "XINERAMA" + +#define X_PanoramiXQueryVersion 0 +#define X_PanoramiXGetState 1 +#define X_PanoramiXGetScreenCount 2 +#define X_PanoramiXGetScreenSize 3 + +#define X_XineramaIsActive 4 +#define X_XineramaQueryScreens 5 + +typedef struct _PanoramiXQueryVersion { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ + CARD16 length B16; + CARD8 clientMajor; + CARD8 clientMinor; + CARD16 unused B16; +} xPanoramiXQueryVersionReq; + +#define sz_xPanoramiXQueryVersionReq 8 + +typedef struct { + CARD8 type; /* must be X_Reply */ + CARD8 pad1; /* unused */ + CARD16 sequenceNumber B16; /* last sequence number */ + CARD32 length B32; /* 0 */ + CARD16 majorVersion B16; + CARD16 minorVersion B16; + CARD32 pad2 B32; /* unused */ + CARD32 pad3 B32; /* unused */ + CARD32 pad4 B32; /* unused */ + CARD32 pad5 B32; /* unused */ + CARD32 pad6 B32; /* unused */ +} xPanoramiXQueryVersionReply; + +#define sz_xPanoramiXQueryVersionReply 32 + + +typedef struct _PanoramiXGetState { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ + CARD16 length B16; + CARD32 window B32; +} xPanoramiXGetStateReq; +#define sz_xPanoramiXGetStateReq 8 + +typedef struct { + BYTE type; + BYTE state; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 window B32; + CARD32 pad1 B32; /* unused */ + CARD32 pad2 B32; /* unused */ + CARD32 pad3 B32; /* unused */ + CARD32 pad4 B32; /* unused */ + CARD32 pad5 B32; /* unused */ +} xPanoramiXGetStateReply; + +#define sz_panoramiXGetStateReply 32 + +typedef struct _PanoramiXGetScreenCount { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ + CARD16 length B16; + CARD32 window B32; +} xPanoramiXGetScreenCountReq; +#define sz_xPanoramiXGetScreenCountReq 8 + +typedef struct { + BYTE type; + BYTE ScreenCount; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 window B32; + CARD32 pad1 B32; /* unused */ + CARD32 pad2 B32; /* unused */ + CARD32 pad3 B32; /* unused */ + CARD32 pad4 B32; /* unused */ + CARD32 pad5 B32; /* unused */ +} xPanoramiXGetScreenCountReply; +#define sz_panoramiXGetScreenCountReply 32 + +typedef struct _PanoramiXGetScreenSize { + CARD8 reqType; /* always PanoramiXReqCode */ + CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ + CARD16 length B16; + CARD32 window B32; + CARD32 screen B32; +} xPanoramiXGetScreenSizeReq; +#define sz_xPanoramiXGetScreenSizeReq 12 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 width B32; + CARD32 height B32; + CARD32 window B32; + CARD32 screen B32; + CARD32 pad2 B32; /* unused */ + CARD32 pad3 B32; /* unused */ +} xPanoramiXGetScreenSizeReply; +#define sz_panoramiXGetScreenSizeReply 32 + +/************ Alternate protocol ******************/ + +typedef struct { + CARD8 reqType; + CARD8 panoramiXReqType; + CARD16 length B16; +} xXineramaIsActiveReq; +#define sz_xXineramaIsActiveReq 4 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 state B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXineramaIsActiveReply; +#define sz_XineramaIsActiveReply 32 + + +typedef struct { + CARD8 reqType; + CARD8 panoramiXReqType; + CARD16 length B16; +} xXineramaQueryScreensReq; +#define sz_xXineramaQueryScreensReq 4 + +typedef struct { + BYTE type; + CARD8 pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 number B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXineramaQueryScreensReply; +#define sz_XineramaQueryScreensReply 32 + +typedef struct { + INT16 x_org B16; + INT16 y_org B16; + CARD16 width B16; + CARD16 height B16; +} xXineramaScreenInfo; +#define sz_XineramaScreenInfo 8 + +#endif + +#endif /* __linux__ */ diff --git a/src/nwi/classes/com/sun/nwi/impl/Debug.java b/src/nwi/classes/com/sun/nwi/impl/Debug.java deleted file mode 100644 index 73379e87b..000000000 --- a/src/nwi/classes/com/sun/nwi/impl/Debug.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package com.sun.nwi.impl; - -import java.security.*; - -/** Helper routines for logging and debugging. */ - -public class Debug { - // Some common properties - private static boolean verbose; - private static boolean debugAll; - - static { - verbose = isPropertyDefined("nwi.verbose"); - debugAll = isPropertyDefined("nwi.debug"); - if (verbose) { - Package p = Package.getPackage("javax.media.nwi"); - System.err.println("NWI specification version " + p.getSpecificationVersion()); - System.err.println("NWI implementation version " + p.getImplementationVersion()); - System.err.println("NWI implementation vendor " + p.getImplementationVendor()); - } - } - - public static boolean getBooleanProperty(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - boolean val = Boolean.getBoolean(property); - return (val ? Boolean.TRUE : Boolean.FALSE); - } - }); - return b.booleanValue(); - } - - public static boolean isPropertyDefined(final String property) { - Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String val = System.getProperty(property); - return (val != null ? Boolean.TRUE : Boolean.FALSE); - } - }); - return b.booleanValue(); - } - - public static boolean verbose() { - return verbose; - } - - public static boolean debugAll() { - return debugAll; - } - - public static boolean debug(String subcomponent) { - return debugAll() || isPropertyDefined("nwi.debug." + subcomponent); - } -} diff --git a/src/nwi/classes/com/sun/nwi/impl/NWReflection.java b/src/nwi/classes/com/sun/nwi/impl/NWReflection.java deleted file mode 100644 index 51037af28..000000000 --- a/src/nwi/classes/com/sun/nwi/impl/NWReflection.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - */ - -package com.sun.nwi.impl; - -import java.lang.reflect.*; -import javax.media.nwi.*; - -public final class NWReflection { - public static final boolean DEBUG = Debug.debug("NWReflection"); - - public static final boolean isClassAvailable(String clazzName) { - try { - Class clazz = Class.forName(clazzName); - return null!=clazz; - } catch (Throwable e) { } - return false; - } - - public static final Class getClass(String clazzName) { - try { - return Class.forName(clazzName); - } catch (Throwable e) { } - return null; - } - - public static final Constructor getConstructor(String clazzName, Class[] cstrArgTypes) { - Class factoryClass = null; - Constructor factory = null; - - try { - factoryClass = Class.forName(clazzName); - if (factoryClass == null) { - throw new NWException(clazzName + " not available"); - } - try { - factory = factoryClass.getDeclaredConstructor( cstrArgTypes ); - } catch(NoSuchMethodException nsme) { - throw new NWException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found"); - } - return factory; - } catch (Throwable e) { - if (DEBUG) { - e.printStackTrace(); - } - throw new NWException(e); - } - } - - public static final Constructor getConstructor(String clazzName) { - return getConstructor(clazzName, new Class[0]); - } - - public static final Object createInstance(String clazzName, Class[] cstrArgTypes, Object[] cstrArgs) { - Constructor factory = null; - - try { - factory = getConstructor(clazzName, cstrArgTypes); - return factory.newInstance( cstrArgs ) ; - } catch (Exception e) { - throw new NWException(e); - } - } - - public static final Object createInstance(String clazzName, Object[] cstrArgs) { - Class[] cstrArgTypes = new Class[cstrArgs.length]; - for(int i=0; i=0; i--) { - Class face = clazzes[i]; - if(face.getName().equals(faceName)) { - return true; - } - } - clazz = clazz.getSuperclass(); - } while (clazz!=null); - return false; - } - - public static boolean isAWTComponent(Object target) { - return instanceOf(target, "java.awt.Component"); - } - - public static boolean isAWTComponent(Class clazz) { - return instanceOf(clazz, "java.awt.Component"); - } - -} - diff --git a/src/nwi/classes/com/sun/nwi/impl/NativeLibLoaderBase.java b/src/nwi/classes/com/sun/nwi/impl/NativeLibLoaderBase.java deleted file mode 100644 index 9e072fec0..000000000 --- a/src/nwi/classes/com/sun/nwi/impl/NativeLibLoaderBase.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package com.sun.nwi.impl; - -// FIXME: refactor Java SE dependencies -//import java.awt.Toolkit; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.HashSet; - -public class NativeLibLoaderBase { - public interface LoaderAction { - /** - * Loads the library specified by libname. Optionally preloads the libraries specified by - * preload. The implementation should ignore, if the preload-libraries have already been - * loaded. - * @param libname the library to load - * @param preload the libraries to load before loading the main library if not null - * @param preloadIgnoreError true, if errors during loading the preload-libraries should be ignored - */ - void loadLibrary(String libname, String[] preload, - boolean preloadIgnoreError); - } - - private static class DefaultAction implements LoaderAction { - public void loadLibrary(String libname, String[] preload, - boolean preloadIgnoreError) { - if (null!=preload) { - for (int i=0; i 0) { - --recursionCount; - return; - } - owner = null; - JAWTUtil.unlockToolkit(); - } - }; - - public ToolkitLock getToolkitLock() { - return toolkitLock; - } -} diff --git a/src/nwi/classes/javax/media/nwi/AbstractGraphicsConfiguration.java b/src/nwi/classes/javax/media/nwi/AbstractGraphicsConfiguration.java deleted file mode 100644 index a85aca41c..000000000 --- a/src/nwi/classes/javax/media/nwi/AbstractGraphicsConfiguration.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** A marker interface describing a graphics configuration, visual, or - pixel format in a toolkit-independent manner. */ - -public interface AbstractGraphicsConfiguration { -} diff --git a/src/nwi/classes/javax/media/nwi/AbstractGraphicsDevice.java b/src/nwi/classes/javax/media/nwi/AbstractGraphicsDevice.java deleted file mode 100644 index 743210273..000000000 --- a/src/nwi/classes/javax/media/nwi/AbstractGraphicsDevice.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** A marker interface describing a graphics device in a - toolkit-independent manner. */ - -public interface AbstractGraphicsDevice { -} diff --git a/src/nwi/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java b/src/nwi/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java deleted file mode 100644 index 1318ea419..000000000 --- a/src/nwi/classes/javax/media/nwi/DefaultNWCapabilitiesChooser.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/**

The default implementation of the {@link - NWCapabilitiesChooser} interface, which provides consistent visual - selection behavior across platforms. The precise algorithm is - deliberately left loosely specified. Some properties are:

- -
    - -
  • As long as there is at least one available non-null - NWCapabilities which matches the "stereo" option, will return a - valid index. - -
  • Attempts to match as closely as possible the given - NWCapabilities, but will select one with fewer capabilities (i.e., - lower color depth) if necessary. - -
  • Prefers hardware-accelerated visuals to - non-hardware-accelerated. - -
  • If there is no exact match, prefers a more-capable visual to - a less-capable one. - -
  • If there is more than one exact match, chooses an arbitrary - one. - -
  • May select the opposite of a double- or single-buffered - visual (based on the user's request) in dire situations. - -
  • Color depth (including alpha) mismatches are weighted higher - than depth buffer mismatches, which are in turn weighted higher - than accumulation buffer (including alpha) and stencil buffer - depth mismatches. - -
  • If a valid windowSystemRecommendedChoice parameter is - supplied, chooses that instead of using the cross-platform code. - -
-*/ - -public class DefaultNWCapabilitiesChooser implements NWCapabilitiesChooser { - private static final boolean DEBUG = false; // FIXME: Debug.debug("DefaultNWCapabilitiesChooser"); - - public int chooseCapabilities(NWCapabilities desired, - NWCapabilities[] available, - int windowSystemRecommendedChoice) { - if (DEBUG) { - System.err.println("Desired: " + desired); - for (int i = 0; i < available.length; i++) { - System.err.println("Available " + i + ": " + available[i]); - } - System.err.println("Window system's recommended choice: " + windowSystemRecommendedChoice); - } - - if (windowSystemRecommendedChoice >= 0 && - windowSystemRecommendedChoice < available.length && - available[windowSystemRecommendedChoice] != null) { - if (DEBUG) { - System.err.println("Choosing window system's recommended choice of " + windowSystemRecommendedChoice); - System.err.println(available[windowSystemRecommendedChoice]); - } - return windowSystemRecommendedChoice; - } - - // Create score array - int[] scores = new int[available.length]; - int NO_SCORE = -9999999; - int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; - int STENCIL_MISMATCH_PENALTY = 500; - // Pseudo attempt to keep equal rank penalties scale-equivalent - // (e.g., stencil mismatch is 3 * accum because there are 3 accum - // components) - int COLOR_MISMATCH_PENALTY_SCALE = 36; - int DEPTH_MISMATCH_PENALTY_SCALE = 6; - int ACCUM_MISMATCH_PENALTY_SCALE = 1; - int STENCIL_MISMATCH_PENALTY_SCALE = 3; - for (int i = 0; i < scores.length; i++) { - scores[i] = NO_SCORE; - } - // Compute score for each - for (int i = 0; i < scores.length; i++) { - NWCapabilities cur = available[i]; - if (cur == null) { - continue; - } - if (desired.getStereo() != cur.getStereo()) { - continue; - } - int score = 0; - // Compute difference in color depth - // (Note that this decides the direction of all other penalties) - score += (COLOR_MISMATCH_PENALTY_SCALE * - ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - - (desired.getRedBits() + desired.getGreenBits() + desired.getBlueBits() + desired.getAlphaBits()))); - // Compute difference in depth buffer depth - score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs(cur.getDepthBits() - desired.getDepthBits())); - // Compute difference in accumulation buffer depth - score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs((cur.getAccumRedBits() + cur.getAccumGreenBits() + cur.getAccumBlueBits() + cur.getAccumAlphaBits()) - - (desired.getAccumRedBits() + desired.getAccumGreenBits() + desired.getAccumBlueBits() + desired.getAccumAlphaBits()))); - // Compute difference in stencil bits - score += STENCIL_MISMATCH_PENALTY_SCALE * sign(score) * (cur.getStencilBits() - desired.getStencilBits()); - if (cur.getDoubleBuffered() != desired.getDoubleBuffered()) { - score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY; - } - if ((desired.getStencilBits() > 0) && (cur.getStencilBits() == 0)) { - score += sign(score) * STENCIL_MISMATCH_PENALTY; - } - scores[i] = score; - } - // Now prefer hardware-accelerated visuals by pushing scores of - // non-hardware-accelerated visuals out - boolean gotHW = false; - int maxAbsoluteHWScore = 0; - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - NWCapabilities cur = available[i]; - if (cur.getHardwareAccelerated()) { - int absScore = Math.abs(score); - if (!gotHW || - (absScore > maxAbsoluteHWScore)) { - gotHW = true; - maxAbsoluteHWScore = absScore; - } - } - } - if (gotHW) { - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - NWCapabilities cur = available[i]; - if (!cur.getHardwareAccelerated()) { - if (score <= 0) { - score -= maxAbsoluteHWScore; - } else if (score > 0) { - score += maxAbsoluteHWScore; - } - scores[i] = score; - } - } - } - - if (DEBUG) { - System.err.print("Scores: ["); - for (int i = 0; i < available.length; i++) { - if (i > 0) { - System.err.print(","); - } - System.err.print(" " + scores[i]); - } - System.err.println(" ]"); - } - - // Ready to select. Choose score closest to 0. - int scoreClosestToZero = NO_SCORE; - int chosenIndex = -1; - for (int i = 0; i < scores.length; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - // Don't substitute a positive score for a smaller negative score - if ((scoreClosestToZero == NO_SCORE) || - (Math.abs(score) < Math.abs(scoreClosestToZero) && - ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { - scoreClosestToZero = score; - chosenIndex = i; - } - } - if (chosenIndex < 0) { - throw new NativeWindowException("Unable to select one of the provided NWCapabilities"); - } - if (DEBUG) { - System.err.println("Chosen index: " + chosenIndex); - System.err.println("Chosen capabilities:"); - System.err.println(available[chosenIndex]); - } - - return chosenIndex; - } - - private static int sign(int score) { - if (score < 0) { - return -1; - } - return 1; - } -} diff --git a/src/nwi/classes/javax/media/nwi/NWCapabilities.java b/src/nwi/classes/javax/media/nwi/NWCapabilities.java deleted file mode 100644 index cc3ebb77c..000000000 --- a/src/nwi/classes/javax/media/nwi/NWCapabilities.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** Specifies a set of OpenGL capabilities that a rendering context - must support, such as color depth and whether stereo is enabled. - It currently contains the minimal number of routines which allow - configuration on all supported window systems. */ - -public class NWCapabilities implements Cloneable { - private boolean doubleBuffered = true; - private boolean stereo = false; - private boolean hardwareAccelerated = true; - private int depthBits = 24; - private int stencilBits = 0; - private int redBits = 8; - private int greenBits = 8; - private int blueBits = 8; - private int alphaBits = 0; - private int accumRedBits = 0; - private int accumGreenBits = 0; - private int accumBlueBits = 0; - private int accumAlphaBits = 0; - // Shift bits from PIXELFORMATDESCRIPTOR not present because they - // are unlikely to be supported on Windows anyway - - // Support for full-scene antialiasing (FSAA) - private boolean sampleBuffers = false; - private int numSamples = 2; - - // Support for transparent windows containing OpenGL content - // (currently only has an effect on Mac OS X) - private boolean backgroundOpaque = true; - - // Bits for pbuffer creation - private boolean pbufferFloatingPointBuffers; - private boolean pbufferRenderToTexture; - private boolean pbufferRenderToTextureRectangle; - - /** Creates a NWCapabilities object. All attributes are in a default - state. - */ - public NWCapabilities() {} - - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - throw new NativeWindowException(e); - } - } - - /** Indicates whether double-buffering is enabled. */ - public boolean getDoubleBuffered() { - return doubleBuffered; - } - - /** Enables or disables double buffering. */ - public void setDoubleBuffered(boolean onOrOff) { - doubleBuffered = onOrOff; - } - - /** Indicates whether stereo is enabled. */ - public boolean getStereo() { - return stereo; - } - - /** Enables or disables stereo viewing. */ - public void setStereo(boolean onOrOff) { - stereo = onOrOff; - } - - /** Indicates whether hardware acceleration is enabled. */ - public boolean getHardwareAccelerated() { - return hardwareAccelerated; - } - - /** Enables or disables hardware acceleration. */ - public void setHardwareAccelerated(boolean onOrOff) { - hardwareAccelerated = onOrOff; - } - - /** Returns the number of bits requested for the depth buffer. */ - public int getDepthBits() { - return depthBits; - } - - /** Sets the number of bits requested for the depth buffer. */ - public void setDepthBits(int depthBits) { - this.depthBits = depthBits; - } - - /** Returns the number of bits requested for the stencil buffer. */ - public int getStencilBits() { - return stencilBits; - } - - /** Sets the number of bits requested for the stencil buffer. */ - public void setStencilBits(int stencilBits) { - this.stencilBits = stencilBits; - } - - /** Returns the number of bits requested for the color buffer's red - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public int getRedBits() { - return redBits; - } - - /** Sets the number of bits requested for the color buffer's red - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setRedBits(int redBits) { - this.redBits = redBits; - } - - /** Returns the number of bits requested for the color buffer's - green component. On some systems only the color depth, which is - the sum of the red, green, and blue bits, is considered. */ - public int getGreenBits() { - return greenBits; - } - - /** Sets the number of bits requested for the color buffer's green - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setGreenBits(int greenBits) { - this.greenBits = greenBits; - } - - /** Returns the number of bits requested for the color buffer's blue - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public int getBlueBits() { - return blueBits; - } - - /** Sets the number of bits requested for the color buffer's blue - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setBlueBits(int blueBits) { - this.blueBits = blueBits; - } - - /** Returns the number of bits requested for the color buffer's - alpha component. On some systems only the color depth, which is - the sum of the red, green, and blue bits, is considered. */ - public int getAlphaBits() { - return alphaBits; - } - - /** Sets the number of bits requested for the color buffer's alpha - component. On some systems only the color depth, which is the - sum of the red, green, and blue bits, is considered. */ - public void setAlphaBits(int alphaBits) { - this.alphaBits = alphaBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's red component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumRedBits() { - return accumRedBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - red component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumRedBits(int accumRedBits) { - this.accumRedBits = accumRedBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's green component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumGreenBits() { - return accumGreenBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - green component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumGreenBits(int accumGreenBits) { - this.accumGreenBits = accumGreenBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's blue component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumBlueBits() { - return accumBlueBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - blue component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumBlueBits(int accumBlueBits) { - this.accumBlueBits = accumBlueBits; - } - - /** Returns the number of bits requested for the accumulation - buffer's alpha component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ - public int getAccumAlphaBits() { - return accumAlphaBits; - } - - /** Sets number of bits requested for accumulation buffer's alpha - component. On some systems only the accumulation buffer depth, - which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumAlphaBits(int accumAlphaBits) { - this.accumAlphaBits = accumAlphaBits; - } - - /** Indicates whether sample buffers for full-scene antialiasing - (FSAA) should be allocated for this drawable. Defaults to - false. */ - public void setSampleBuffers(boolean onOrOff) { - sampleBuffers = onOrOff; - } - - /** Returns whether sample buffers for full-scene antialiasing - (FSAA) should be allocated for this drawable. Defaults to - false. */ - public boolean getSampleBuffers() { - return sampleBuffers; - } - - /** If sample buffers are enabled, indicates the number of buffers - to be allocated. Defaults to 2. */ - public void setNumSamples(int numSamples) { - this.numSamples = numSamples; - } - - /** Returns the number of sample buffers to be allocated if sample - buffers are enabled. Defaults to 2. */ - public int getNumSamples() { - return numSamples; - } - - /** For pbuffers only, indicates whether floating-point buffers - should be used if available. Defaults to false. */ - public void setPbufferFloatingPointBuffers(boolean onOrOff) { - pbufferFloatingPointBuffers = onOrOff; - } - - /** For pbuffers only, returns whether floating-point buffers should - be used if available. Defaults to false. */ - public boolean getPbufferFloatingPointBuffers() { - return pbufferFloatingPointBuffers; - } - - /** For pbuffers only, indicates whether the render-to-texture - extension should be used if available. Defaults to false. */ - public void setPbufferRenderToTexture(boolean onOrOff) { - pbufferRenderToTexture = onOrOff; - } - - /** For pbuffers only, returns whether the render-to-texture - extension should be used if available. Defaults to false. */ - public boolean getPbufferRenderToTexture() { - return pbufferRenderToTexture; - } - - /** For pbuffers only, indicates whether the - render-to-texture-rectangle extension should be used if - available. Defaults to false. */ - public void setPbufferRenderToTextureRectangle(boolean onOrOff) { - pbufferRenderToTextureRectangle = onOrOff; - } - - /** For pbuffers only, returns whether the render-to-texture - extension should be used. Defaults to false. */ - public boolean getPbufferRenderToTextureRectangle() { - return pbufferRenderToTextureRectangle; - } - - /** For on-screen OpenGL contexts on some platforms, sets whether - the background of the context should be considered opaque. On - supported platforms, setting this to false, in conjunction with - other changes at the window toolkit level, can allow - hardware-accelerated OpenGL content inside of windows of - arbitrary shape. To achieve this effect it is necessary to use - an OpenGL clear color with an alpha less than 1.0. The default - value for this flag is true; setting it to false - may incur a certain performance penalty, so it is not - recommended to arbitrarily set it to false. */ - public void setBackgroundOpaque(boolean opaque) { - backgroundOpaque = opaque; - } - - /** Indicates whether the background of this OpenGL context should - be considered opaque. Defaults to true. - - @see #setBackgroundOpaque - */ - public boolean isBackgroundOpaque() { - return backgroundOpaque; - } - - /** Returns a textual representation of this NWCapabilities - object. */ - public String toString() { - return ("NWCapabilities [" + - "DoubleBuffered: " + doubleBuffered + - ", Stereo: " + stereo + - ", HardwareAccelerated: " + hardwareAccelerated + - ", DepthBits: " + depthBits + - ", StencilBits: " + stencilBits + - ", Red: " + redBits + - ", Green: " + greenBits + - ", Blue: " + blueBits + - ", Alpha: " + alphaBits + - ", Red Accum: " + accumRedBits + - ", Green Accum: " + accumGreenBits + - ", Blue Accum: " + accumBlueBits + - ", Alpha Accum: " + accumAlphaBits + - ", Multisample: " + sampleBuffers + - (sampleBuffers ? ", Num samples: " + numSamples : "") + - ", Opaque: " + backgroundOpaque + - " ]"); - } -} diff --git a/src/nwi/classes/javax/media/nwi/NWCapabilitiesChooser.java b/src/nwi/classes/javax/media/nwi/NWCapabilitiesChooser.java deleted file mode 100644 index 12884c5e2..000000000 --- a/src/nwi/classes/javax/media/nwi/NWCapabilitiesChooser.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** Provides a mechanism by which applications can customize the - window type selection for a given {@link NWCapabilities}. - Developers can implement this interface and pass an instance into - the appropriate method of {@link GLDrawableFactory}; the chooser - will be called during the OpenGL context creation process. */ - -public interface NWCapabilitiesChooser { - /** Chooses the index (0..available.length - 1) of the {@link - NWCapabilities} most closely matching the desired one from the - list of all supported. Some of the entries in the - available array may be null; the chooser must - ignore these. The windowSystemRecommendedChoice - parameter may be provided to the chooser by the underlying - window system; if this index is valid, it is recommended, but - not necessarily required, that the chooser select that entry. - -

Note: this method is called automatically by the - {@link GLDrawableFactory} when an instance of this class is - passed in to one of its factory methods. It should generally not - be invoked by users directly, unless it is desired to delegate - the choice to some other NWCapabilitiesChooser object. - */ - public int chooseCapabilities(NWCapabilities desired, - NWCapabilities[] available, - int windowSystemRecommendedChoice); -} diff --git a/src/nwi/classes/javax/media/nwi/NWException.java b/src/nwi/classes/javax/media/nwi/NWException.java deleted file mode 100644 index a9e5b054d..000000000 --- a/src/nwi/classes/javax/media/nwi/NWException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** A generic exception for NWI errors used throughout the binding - as a substitute for {@link RuntimeException}. */ - -public class NWException extends RuntimeException { - /** Constructs a NWException object. */ - public NWException() { - super(); - } - - /** Constructs a NWException object with the specified detail - message. */ - public NWException(String message) { - super(message); - } - - /** Constructs a NWException object with the specified detail - message and root cause. */ - public NWException(String message, Throwable cause) { - super(message, cause); - } - - /** Constructs a NWException object with the specified root - cause. */ - public NWException(Throwable cause) { - super(cause); - } -} diff --git a/src/nwi/classes/javax/media/nwi/NativeWindow.java b/src/nwi/classes/javax/media/nwi/NativeWindow.java deleted file mode 100644 index f992c2231..000000000 --- a/src/nwi/classes/javax/media/nwi/NativeWindow.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** Provides the mechanism by which the Java / OpenGL binding - interacts with windows. A window toolkit such as the AWT may - either implement this interface directly with one of its - components, or provide and register an implementation of {@link - NativeWindowFactory NativeWindowFactory} which can create - NativeWindow objects for its components.

- - A NativeWindow created for a particular on-screen component is - expected to have the same lifetime as that component. As long as - the component is alive, the NativeWindow must be able to control - it, and any time it is visible and locked, provide information - such as the window handle to the Java / OpenGL binding so that - GLDrawables and GLContexts may be created for the window. -*/ - -public interface NativeWindow { - public static final int LOCK_NOT_SUPPORTED = 0; - public static final int LOCK_SURFACE_NOT_READY = 1; - public static final int LOCK_SURFACE_CHANGED = 2; - public static final int LOCK_SUCCESS = 3; - - /** - * Lock this surface - */ - public int lockSurface() throws NativeWindowException ; - - /** - * Unlock this surface - */ - public void unlockSurface(); - public boolean isSurfaceLocked(); - - /** - * render all native window information invalid, - * as if the native window was destroyed - */ - public void invalidate(); - - /** - * Lifetime: locked state - */ - public long getDisplayHandle(); - public long getScreenHandle(); - - /** - * Returns the window handle for this NativeWindow.

- * - * The window handle shall reflect the platform one - * for all window related operations, e.g. open, close, resize.

- * - * On X11 this returns an entity of type Window.
- * On Microsoft Windows this returns an entity of type HWND. - */ - public long getWindowHandle(); - - /** - * Returns the handle to the surface for this NativeWindow.

- * - * The surface handle shall reflect the platform one - * for all drawable surface operations, e.g. opengl, swap-buffer.

- * - * On X11 this returns an entity of type Window, - * since there is no differentiation of surface and window there.
- * On Microsoft Windows this returns an entity of type HDC. - */ - public long getSurfaceHandle(); - - /** - * Lifetime: after 1st lock, until invalidation - */ - public long getVisualID(); - public int getScreenIndex(); - - /** Returns the current width of this window. */ - public int getWidth(); - - /** Returns the current height of this window. */ - public int getHeight(); -} diff --git a/src/nwi/classes/javax/media/nwi/NativeWindowException.java b/src/nwi/classes/javax/media/nwi/NativeWindowException.java deleted file mode 100644 index bc1a8ddef..000000000 --- a/src/nwi/classes/javax/media/nwi/NativeWindowException.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi; - -/** A generic exception for OpenGL errors used throughout the binding - as a substitute for {@link RuntimeException}. */ - -public class NativeWindowException extends RuntimeException { - /** Constructs a NativeWindowException object. */ - public NativeWindowException() { - super(); - } - - /** Constructs a NativeWindowException object with the specified detail - message. */ - public NativeWindowException(String message) { - super(message); - } - - /** Constructs a NativeWindowException object with the specified detail - message and root cause. */ - public NativeWindowException(String message, Throwable cause) { - super(message, cause); - } - - /** Constructs a NativeWindowException object with the specified root - cause. */ - public NativeWindowException(Throwable cause) { - super(cause); - } -} diff --git a/src/nwi/classes/javax/media/nwi/NativeWindowFactory.java b/src/nwi/classes/javax/media/nwi/NativeWindowFactory.java deleted file mode 100644 index 622dfc3a7..000000000 --- a/src/nwi/classes/javax/media/nwi/NativeWindowFactory.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -package javax.media.nwi; - -import javax.media.nwi.*; -import java.lang.reflect.*; -import java.security.*; -import java.util.*; - -import com.sun.nwi.impl.*; - -/** Provides the link between the window toolkit and the Java binding - to the OpenGL API. The NativeWindowFactory, and NativeWindow - instances it creates, encompass all of the toolkit-specific - functionality, leaving the GLDrawableFactory independent of any - particular toolkit. */ - -public abstract class NativeWindowFactory { - private static NativeWindowFactory defaultFactory; - private static HashMap/**/ registeredFactories = - new HashMap(); - private static Class nativeWindowClass; - - /** Creates a new NativeWindowFactory instance. End users do not - need to call this method. */ - protected NativeWindowFactory() { - } - - static { - initialize(); - } - - private static void initialize() { - String osName = System.getProperty("os.name"); - String osNameLowerCase = osName.toLowerCase(); - String factoryClassName = null; - - // We break compile-time dependencies on the AWT here to - // make it easier to run this code on mobile devices - - NativeWindowFactory factory = new NativeWindowFactoryImpl(); - nativeWindowClass = javax.media.nwi.NativeWindow.class; - registerFactory(nativeWindowClass, factory); - defaultFactory = factory; - - Class componentClass = null; - try { - componentClass = Class.forName("java.awt.Component"); - } catch (Exception e) { - } - if (componentClass != null) { - if (!osNameLowerCase.startsWith("wind") && - !osNameLowerCase.startsWith("mac os x")) { - // Assume X11 platform -- should probably test for these explicitly - try { - Constructor factoryConstructor = - NWReflection.getConstructor("com.sun.nwi.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {}); - factory = (NativeWindowFactory) factoryConstructor.newInstance(null); - } catch (Exception e) { } - } - registerFactory(componentClass, factory); - defaultFactory = factory; - } - } - - /** Sets the default NativeWindowFactory. Certain operations on - X11 platforms require synchronization, and the implementation - of this synchronization may be specific to the window toolkit - in use. It is impractical to require that all of the APIs that - might require synchronization receive a {@link ToolkitLock - ToolkitLock} as argument. For this reason the concept of a - default NativeWindowFactory is introduced. The toolkit lock - provided via {@link #getToolkitLock getToolkitLock} from this - default NativeWindowFactory will be used for synchronization - within the Java binding to OpenGL. By default, if the AWT is - available, the default toolkit will support the AWT. */ - public static void setDefaultFactory(NativeWindowFactory factory) { - defaultFactory = factory; - } - - /** Gets the default NativeWindowFactory. Certain operations on - X11 platforms require synchronization, and the implementation - of this synchronization may be specific to the window toolkit - in use. It is impractical to require that all of the APIs that - might require synchronization receive a {@link ToolkitLock - ToolkitLock} as argument. For this reason the concept of a - default NativeWindowFactory is introduced. The toolkit lock - provided via {@link #getToolkitLock getToolkitLock} from this - default NativeWindowFactory will be used for synchronization - within the Java binding to OpenGL. By default, if the AWT is - available, the default toolkit will support the AWT. */ - public static NativeWindowFactory getDefaultFactory() { - return defaultFactory; - } - - /** Returns the appropriate NativeWindowFactory to handle window - objects of the given type. The windowClass might be {@link - NativeWindow NativeWindow}, in which case the client has - already assumed the responsibility of creating a compatible - NativeWindow implementation, or it might be that of a toolkit - class like {@link java.awt.Component Component}. */ - public static NativeWindowFactory getFactory(Class windowClass) throws IllegalArgumentException { - if (nativeWindowClass.isAssignableFrom(windowClass)) { - return (NativeWindowFactory) registeredFactories.get(nativeWindowClass); - } - Class clazz = windowClass; - while (clazz != null) { - NativeWindowFactory factory = (NativeWindowFactory) registeredFactories.get(clazz); - if (factory != null) { - return factory; - } - clazz = clazz.getSuperclass(); - } - throw new IllegalArgumentException("No registered NativeWindowFactory for class " + windowClass.getName()); - } - - /** Registers a NativeWindowFactory handling window objects of the - given class. This does not need to be called by end users, - only implementors of new NativeWindowFactory subclasses, .. */ - protected static void registerFactory(Class windowClass, NativeWindowFactory factory) { - registeredFactories.put(windowClass, factory); - } - - /** Converts the given window object into a {@link NativeWindow - NativeWindow} which can be operated upon by the {@link - GLDrawableFactory GLDrawableFactory}. The object may be a - component for a particular window toolkit, such as an AWT - Canvas. It may also be a NativeWindow object, in which no - conversion is necessary. The particular implementation of the - NativeWindowFactory is responsible for handling objects from a - particular window toolkit. The built-in NativeWindowFactory - handles NativeWindow instances as well as AWT Components. - - @throws IllegalArgumentException if the given window object - could not be handled by any of the registered - NativeWindowFactory instances - */ - public static NativeWindow getNativeWindow(Object winObj) throws IllegalArgumentException, NativeWindowException { - if (winObj == null) { - throw new IllegalArgumentException("Null window object"); - } - - return getFactory(winObj.getClass()).getNativeWindowImpl(winObj); - } - - /** - *

Selects a graphics configuration on the specified graphics - * device compatible with the supplied NWCapabilities. This method - * is intended to be used by applications which do not use the - * supplied GLCanvas class but instead wrap their own Canvas or - * other window toolkit-specific object with a GLDrawable. Some - * platforms (specifically X11) require the graphics configuration - * to be specified when the window toolkit object is created. This - * method may return null on platforms on which the OpenGL pixel - * format selection process is performed later.

- * - *

The concrete data type of the passed graphics device and - * returned graphics configuration must be specified in the - * documentation binding this particular API to the underlying - * window toolkit. The Reference Implementation accepts {@link - * AWTGraphicsDevice AWTGraphicsDevice} objects and returns {@link - * AWTGraphicsConfiguration AWTGraphicsConfiguration} objects.

- * - * @see java.awt.Canvas#Canvas(java.awt.GraphicsConfiguration) - * - * @throws IllegalArgumentException if the data type of the passed - * AbstractGraphicsDevice is not supported by this - * NativeWindowFactory. - * @throws NWException if any window system-specific errors caused - * the selection of the graphics configuration to fail. - */ - public abstract AbstractGraphicsConfiguration - chooseGraphicsConfiguration(NWCapabilities capabilities, - NWCapabilitiesChooser chooser, - AbstractGraphicsDevice device) - throws IllegalArgumentException, NWException; - - /** Performs the conversion from a toolkit's window object to a - NativeWindow. Implementors of concrete NativeWindowFactory - subclasses should override this method. */ - protected abstract NativeWindow getNativeWindowImpl(Object winObj) throws IllegalArgumentException; - - /** Returns the object which provides support for synchronizing - with the underlying window toolkit. On most platforms the - returned object does nothing; currently it only has effects on - X11 platforms. */ - public abstract ToolkitLock getToolkitLock(); -} diff --git a/src/nwi/classes/javax/media/nwi/ToolkitLock.java b/src/nwi/classes/javax/media/nwi/ToolkitLock.java deleted file mode 100644 index c9e2b4170..000000000 --- a/src/nwi/classes/javax/media/nwi/ToolkitLock.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -package javax.media.nwi; - -/** Provides an interface for locking and unlocking the underlying - window toolkit, where this is necessary in the OpenGL - implementation. This mechanism is generally only needed on X11 - platforms. Currently it is only used when the AWT is in use. - Implementations of this lock, if they are not no-ops, must support - reentrant locking and unlocking. */ - -public interface ToolkitLock { - /** Locks the toolkit. */ - public void lock(); - - /** Unlocks the toolkit. */ - public void unlock(); -} diff --git a/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java b/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java deleted file mode 100644 index 313654c05..000000000 --- a/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsConfiguration.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi.awt; - -import java.awt.GraphicsConfiguration; -import javax.media.nwi.AbstractGraphicsConfiguration; - -/** A wrapper for an AWT GraphicsConfiguration allowing it to be - handled in a toolkit-independent manner. */ - -public class AWTGraphicsConfiguration implements AbstractGraphicsConfiguration { - private GraphicsConfiguration config; - - public AWTGraphicsConfiguration(GraphicsConfiguration config) { - this.config = config; - } - - public GraphicsConfiguration getGraphicsConfiguration() { - return config; - } -} diff --git a/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsDevice.java b/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsDevice.java deleted file mode 100644 index f6da16176..000000000 --- a/src/nwi/classes/javax/media/nwi/awt/AWTGraphicsDevice.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -package javax.media.nwi.awt; - -import java.awt.GraphicsDevice; -import javax.media.nwi.AbstractGraphicsDevice; - -/** A wrapper for an AWT GraphicsDevice allowing it to be - handled in a toolkit-independent manner. */ - -public class AWTGraphicsDevice implements AbstractGraphicsDevice { - private GraphicsDevice device; - - public AWTGraphicsDevice(GraphicsDevice device) { - this.device = device; - } - - public GraphicsDevice getGraphicsDevice() { - return device; - } -} diff --git a/src/nwi/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java b/src/nwi/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java deleted file mode 100644 index f18185fa7..000000000 --- a/src/nwi/classes/javax/media/nwi/x11/X11GraphicsConfiguration.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -package javax.media.nwi.x11; - -import javax.media.nwi.*; - -/** Encapsulates a graphics configuration, or OpenGL pixel format, on - X11 platforms. Objects of this type are returned from {@link - NativeWindowFactory#chooseGraphicsConfiguration - NativeWindowFactory.chooseGraphicsConfiguration()} on X11 - platforms when toolkits other than the AWT are being used. */ - -public class X11GraphicsConfiguration implements AbstractGraphicsConfiguration { - private long visualID; - - /** Constructs a new X11GraphicsConfiguration corresponding to the given visual ID. */ - public X11GraphicsConfiguration(long visualID) { - this.visualID = visualID; - } - - /** Returns the visual ID that this graphics configuration object represents. */ - public long getVisualID() { - return visualID; - } -} diff --git a/src/nwi/classes/javax/media/nwi/x11/X11GraphicsDevice.java b/src/nwi/classes/javax/media/nwi/x11/X11GraphicsDevice.java deleted file mode 100644 index 3288447d9..000000000 --- a/src/nwi/classes/javax/media/nwi/x11/X11GraphicsDevice.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ - -package javax.media.nwi.x11; - -import javax.media.nwi.*; - -/** Encapsulates a graphics device, or screen, on X11 - platforms. Objects of this type are passed to {@link - NativeWindowFactory#chooseGraphicsConfiguration - NativeWindowFactory.chooseGraphicsConfiguration()} on X11 - platforms when toolkits other than the AWT are being used. */ - -public class X11GraphicsDevice implements AbstractGraphicsDevice { - private int screen; - - /** Constructs a new X11GraphicsDevice corresponding to the given screen. */ - public X11GraphicsDevice(int screen) { - this.screen = screen; - } - - /** Returns the screen that this graphics device object represents. */ - public int getScreen() { - return screen; - } -} diff --git a/src/nwi/native/JAWT_DrawingSurfaceInfo.c b/src/nwi/native/JAWT_DrawingSurfaceInfo.c deleted file mode 100644 index 0a6daace0..000000000 --- a/src/nwi/native/JAWT_DrawingSurfaceInfo.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - * Sun gratefully acknowledges that this software was originally authored - * and developed by Kenneth Bradley Russell and Christopher John Kline. - */ - -#include - -#ifdef WIN32 - #define PLATFORM_DSI_SIZE sizeof(JAWT_Win32DrawingSurfaceInfo) -#elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX) - #define PLATFORM_DSI_SIZE sizeof(JAWT_X11DrawingSurfaceInfo) -#elif defined(macosx) - #define PLATFORM_DSI_SIZE sizeof(JAWT_MacOSXDrawingSurfaceInfo) -#else - ERROR: port JAWT_DrawingSurfaceInfo.c to your platform -#endif - -JNIEXPORT jobject JNICALL -Java_com_sun_nwi_impl_jawt_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) { - JAWT_DrawingSurfaceInfo* dsi; - dsi = (*env)->GetDirectBufferAddress(env, jthis0); - if (dsi == NULL) { - (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/RuntimeException"), - "Argument \"jthis0\" was not a direct buffer"); - return NULL; - } - if (dsi->platformInfo == NULL) { - return NULL; - } - return (*env)->NewDirectByteBuffer(env, dsi->platformInfo, PLATFORM_DSI_SIZE); -} diff --git a/src/nwi/native/x11/Xinerama.c b/src/nwi/native/x11/Xinerama.c deleted file mode 100644 index 98dcfe095..000000000 --- a/src/nwi/native/x11/Xinerama.c +++ /dev/null @@ -1,316 +0,0 @@ -/* $TOG: XPanoramiX.c /main/2 1997/11/16 08:45:41 kaleb $ */ -/**************************************************************** -* * -* Copyright (c) Digital Equipment Corporation, 1991, 1997 * -* * -* All Rights Reserved. Unpublished rights reserved under * -* the copyright laws of the United States. * -* * -* The software contained on this media is proprietary to * -* and embodies the confidential technology of Digital * -* Equipment Corporation. Possession, use, duplication or * -* dissemination of the software and media is authorized only * -* pursuant to a valid written license from Digital Equipment * -* Corporation. * -* * -* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure * -* by the U.S. Government is subject to restrictions as set * -* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, * -* or in FAR 52.227-19, as applicable. * -* * -*****************************************************************/ -/* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.1 2000/02/27 23:10:04 mvojkovi Exp $ */ - -#ifndef __linux__ - #error This file should only be built under Linux -#endif - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -/* #include "Xext.h" */ /* in ../include */ -#include "extutil.h" /* in ../include */ -#include "panoramiXext.h" -#include "panoramiXproto.h" /* in ../include */ -#include "Xinerama.h" - - -static XExtensionInfo _panoramiX_ext_info_data; -static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data; -static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME; - -#define PanoramiXCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, panoramiX_extension_name, val) -#define PanoramiXSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension (dpy, i, panoramiX_extension_name) - -static int close_display(); -static /* const */ XExtensionHooks panoramiX_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - NULL, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - NULL, /* error_string */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info, - panoramiX_extension_name, - &panoramiX_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info) - - - -/**************************************************************************** - * * - * PanoramiX public interfaces * - * * - ****************************************************************************/ - -Bool XPanoramiXQueryExtension ( - Display *dpy, - int *event_basep, - int *error_basep -) -{ - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - return True; - } else { - return False; - } -} - - -Status XPanoramiXQueryVersion( - Display *dpy, - int *major_versionp, - int *minor_versionp -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXQueryVersionReply rep; - register xPanoramiXQueryVersionReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXQueryVersion; - req->clientMajor = PANORAMIX_MAJOR_VERSION; - req->clientMinor = PANORAMIX_MINOR_VERSION; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - *major_versionp = rep.majorVersion; - *minor_versionp = rep.minorVersion; - UnlockDisplay (dpy); - SyncHandle (); - return 1; -} - -XPanoramiXInfo *XPanoramiXAllocInfo(void) -{ - return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo)); -} - -Status XPanoramiXGetState ( - Display *dpy, - Drawable drawable, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetStateReply rep; - register xPanoramiXGetStateReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetState, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetState; - req->window = drawable; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->State = rep.state; - return 1; -} - -Status XPanoramiXGetScreenCount ( - Display *dpy, - Drawable drawable, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetScreenCountReply rep; - register xPanoramiXGetScreenCountReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetScreenCount, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetScreenCount; - req->window = drawable; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->ScreenCount = rep.ScreenCount; - return 1; -} - -Status XPanoramiXGetScreenSize ( - Display *dpy, - Drawable drawable, - int screen_num, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetScreenSizeReply rep; - register xPanoramiXGetScreenSizeReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetScreenSize, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetScreenSize; - req->window = drawable; - req->screen = screen_num; /* need to define */ - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->screen = rep.screen; - panoramiX_info->width = rep.width; - panoramiX_info->height = rep.height; - return 1; -} - -/*******************************************************************\ - Alternate interface to make up for shortcomings in the original, - namely, the omission of the screen origin. The new interface is - in the "Xinerama" namespace instead of "PanoramiX". -\*******************************************************************/ - -Bool XineramaQueryExtension ( - Display *dpy, - int *event_base, - int *error_base -) -{ - return XPanoramiXQueryExtension(dpy, event_base, error_base); -} - -Status XineramaQueryVersion( - Display *dpy, - int *major, - int *minor -) -{ - return XPanoramiXQueryVersion(dpy, major, minor); -} - -Bool XineramaIsActive(Display *dpy) -{ - xXineramaIsActiveReply rep; - xXineramaIsActiveReq *req; - XExtDisplayInfo *info = find_display (dpy); - - if(!XextHasExtension(info)) - return False; /* server doesn't even have the extension */ - - LockDisplay (dpy); - GetReq (XineramaIsActive, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_XineramaIsActive; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return False; - } - UnlockDisplay (dpy); - SyncHandle (); - return rep.state; -} - -#include - -XineramaScreenInfo * -XineramaQueryScreens( - Display *dpy, - int *number -) -{ - XExtDisplayInfo *info = find_display (dpy); - xXineramaQueryScreensReply rep; - xXineramaQueryScreensReq *req; - XineramaScreenInfo *scrnInfo = NULL; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (XineramaQueryScreens, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_XineramaQueryScreens; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return NULL; - } - - if(rep.number) { - if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) { - xXineramaScreenInfo scratch; - CARD32 i; - - for(i = 0; i < rep.number; i++) { - _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo); - scrnInfo[i].screen_number = i; - scrnInfo[i].x_org = scratch.x_org; - scrnInfo[i].y_org = scratch.y_org; - scrnInfo[i].width = scratch.width; - scrnInfo[i].height = scratch.height; - } - - *number = rep.number; - } else - _XEatData(dpy, rep.length << 2); - } - - UnlockDisplay (dpy); - SyncHandle (); - return scrnInfo; -} diff --git a/src/nwi/native/x11/Xinerama.h b/src/nwi/native/x11/Xinerama.h deleted file mode 100644 index 7177f5131..000000000 --- a/src/nwi/native/x11/Xinerama.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Soft- -ware"), to deal in the Software without restriction, including without -limitation the rights to use, copy, modify, merge, publish, distribute, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, provided that the above copyright -notice(s) and this permission notice appear in all copies of the Soft- -ware and that both the above copyright notice(s) and this permission -notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- -ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY -RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN -THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- -QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- -MANCE OF THIS SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization of -the copyright holder. -*/ - -/* $XFree86: xc/include/extensions/Xinerama.h,v 3.2 2000/03/01 01:04:20 dawes Exp $ */ - -#ifdef __linux__ - -#ifndef _Xinerama_h -#define _Xinerama_h - -typedef struct { - int screen_number; - short x_org; - short y_org; - short width; - short height; -} XineramaScreenInfo; - -Bool XineramaQueryExtension ( - Display *dpy, - int *event_base, - int *error_base -); - -Status XineramaQueryVersion( - Display *dpy, - int *major, - int *minor -); - -Bool XineramaIsActive(Display *dpy); - - -/* - Returns the number of heads and a pointer to an array of - structures describing the position and size of the individual - heads. Returns NULL and number = 0 if Xinerama is not active. - - Returned array should be freed with XFree(). -*/ - -XineramaScreenInfo * -XineramaQueryScreens( - Display *dpy, - int *number -); - -#endif /* _Xinerama_h */ - -#endif /* __linux__ */ diff --git a/src/nwi/native/x11/XineramaHelper.c b/src/nwi/native/x11/XineramaHelper.c deleted file mode 100644 index 09ad0b706..000000000 --- a/src/nwi/native/x11/XineramaHelper.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * - Redistribution of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistribution in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of Sun Microsystems, Inc. or the names of - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * This software is provided "AS IS," without a warranty of any kind. ALL - * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, - * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN - * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR - * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR - * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR - * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR - * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE - * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, - * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF - * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * - * You acknowledge that this software is not designed or intended for use - * in the design, construction, operation or maintenance of any nuclear - * facility. - * - */ - -/* This file contains a helper routine to be called by Java code to - determine whether the Xinerama extension is in use and therefore to - treat the multiple AWT screens as one large screen. */ - -#include -#include - -#ifdef __sun - -typedef Status XineramaGetInfoFunc(Display* display, int screen_number, - XRectangle* framebuffer_rects, unsigned char* framebuffer_hints, - int* num_framebuffers); -typedef Status XineramaGetCenterHintFunc(Display* display, int screen_number, - int* x, int* y); - -XineramaGetCenterHintFunc* XineramaSolarisCenterFunc = NULL; -#include - -#elif defined(__linux__) - -#include "Xinerama.h" - -#endif - -Bool XineramaEnabled(Display* display) { -#ifdef __sun - -#define MAXFRAMEBUFFERS 16 - char* XinExtName = "XINERAMA"; - int32_t major_opcode, first_event, first_error; - Bool gotXinExt = False; - void* libHandle = 0; - unsigned char fbhints[MAXFRAMEBUFFERS]; - XRectangle fbrects[MAXFRAMEBUFFERS]; - int locNumScr = 0; - Bool usingXinerama = False; - - char* XineramaLibName= "libXext.so"; - char* XineramaGetInfoName = "XineramaGetInfo"; - char* XineramaGetCenterHintName = "XineramaGetCenterHint"; - XineramaGetInfoFunc* XineramaSolarisFunc = NULL; - - gotXinExt = XQueryExtension(display, XinExtName, &major_opcode, - &first_event, &first_error); - - if (gotXinExt) { - /* load library, load and run XineramaGetInfo */ - libHandle = dlopen(XineramaLibName, RTLD_LAZY | RTLD_GLOBAL); - if (libHandle != 0) { - XineramaSolarisFunc = (XineramaGetInfoFunc*)dlsym(libHandle, XineramaGetInfoName); - XineramaSolarisCenterFunc = - (XineramaGetCenterHintFunc*)dlsym(libHandle, - XineramaGetCenterHintName); - if (XineramaSolarisFunc != NULL) { - if ((*XineramaSolarisFunc)(display, 0, &fbrects[0], - &fbhints[0], &locNumScr) != 0) { - - usingXinerama = True; - } - } - dlclose(libHandle); - } - } - return usingXinerama; - -#elif defined(__linux__) - - char* XinExtName = "XINERAMA"; - int32_t major_opcode, first_event, first_error; - Bool gotXinExt = False; - int32_t locNumScr = 0; - - XineramaScreenInfo *xinInfo; - - gotXinExt = XQueryExtension(display, XinExtName, &major_opcode, - &first_event, &first_error); - - if (gotXinExt) { - xinInfo = XineramaQueryScreens(display, &locNumScr); - if (xinInfo != NULL) { - return True; - } - } - return False; - -#else - return False; -#endif -} diff --git a/src/nwi/native/x11/extutil.h b/src/nwi/native/x11/extutil.h deleted file mode 100644 index f0d3b59c3..000000000 --- a/src/nwi/native/x11/extutil.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * $Xorg: extutil.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ - * -Copyright 1989, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * - * Author: Jim Fulton, MIT The Open Group - * - * Xlib Extension-Writing Utilities - * - * This package contains utilities for writing the client API for various - * protocol extensions. THESE INTERFACES ARE NOT PART OF THE X STANDARD AND - * ARE SUBJECT TO CHANGE! - */ -/* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */ - -#ifdef __linux__ - -#ifndef _EXTUTIL_H_ -#define _EXTUTIL_H_ - -/* - * We need to keep a list of open displays since the Xlib display list isn't - * public. We also have to per-display info in a separate block since it isn't - * stored directly in the Display structure. - */ -typedef struct _XExtDisplayInfo { - struct _XExtDisplayInfo *next; /* keep a linked list */ - Display *display; /* which display this is */ - XExtCodes *codes; /* the extension protocol codes */ - XPointer data; /* extra data for extension to use */ -} XExtDisplayInfo; - -typedef struct _XExtensionInfo { - XExtDisplayInfo *head; /* start of list */ - XExtDisplayInfo *cur; /* most recently used */ - int ndisplays; /* number of displays */ -} XExtensionInfo; - -typedef struct _XExtensionHooks { - int (*create_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*copy_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*flush_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*free_gc)( -#if NeedNestedPrototypes - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -#endif -); - int (*create_font)( -#if NeedNestedPrototypes - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -#endif -); - int (*free_font)( -#if NeedNestedPrototypes - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -#endif -); - int (*close_display)( -#if NeedNestedPrototypes - Display* /* display */, - XExtCodes* /* codes */ -#endif -); - Bool (*wire_to_event)( -#if NeedNestedPrototypes - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -#endif -); - Status (*event_to_wire)( -#if NeedNestedPrototypes - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -#endif -); - int (*error)( -#if NeedNestedPrototypes - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ -#endif -); - char *(*error_string)( -#if NeedNestedPrototypes - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ -#endif -); -} XExtensionHooks; - -extern XExtensionInfo *XextCreateExtension( -#if NeedFunctionPrototypes - void -#endif -); -extern void XextDestroyExtension( -#if NeedFunctionPrototypes - XExtensionInfo* /* info */ -#endif -); -extern XExtDisplayInfo *XextAddDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */, - char* /* ext_name */, - XExtensionHooks* /* hooks */, - int /* nevents */, - XPointer /* data */ -#endif -); -extern int XextRemoveDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -#endif -); -extern XExtDisplayInfo *XextFindDisplay( -#if NeedFunctionPrototypes - XExtensionInfo* /* extinfo */, - Display* /* dpy */ -#endif -); - -#define XextHasExtension(i) ((i) && ((i)->codes)) -#define XextCheckExtension(dpy,i,name,val) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; } -#define XextSimpleCheckExtension(dpy,i,name) \ - if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; } - - -/* - * helper macros to generate code that is common to all extensions; caller - * should prefix it with static if extension source is in one file; this - * could be a utility function, but have to stack 6 unused arguments for - * something that is called many, many times would be bad. - */ -#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \ -XExtDisplayInfo *proc (Display *dpy) \ -{ \ - XExtDisplayInfo *dpyinfo; \ - if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \ - if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \ - dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \ - return dpyinfo; \ -} - -#define XEXT_FIND_DISPLAY_PROTO(proc) \ - XExtDisplayInfo *proc(Display *dpy) - -#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \ -int proc (Display *dpy, XExtCodes *codes) \ -{ \ - return XextRemoveDisplay (extinfo, dpy); \ -} - -#define XEXT_CLOSE_DISPLAY_PROTO(proc) \ - int proc(Display *dpy, XExtCodes *codes) - -#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \ -char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \ -{ \ - code -= codes->first_error; \ - if (code >= 0 && code < nerr) { \ - char tmp[256]; \ - sprintf (tmp, "%s.%d", extname, code); \ - XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \ - return buf; \ - } \ - return (char *)0; \ -} - -#define XEXT_ERROR_STRING_PROTO(proc) \ - char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n) -#endif - -#endif /* __linux__ */ diff --git a/src/nwi/native/x11/panoramiXext.h b/src/nwi/native/x11/panoramiXext.h deleted file mode 100644 index 11267d0c1..000000000 --- a/src/nwi/native/x11/panoramiXext.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $Xorg: panoramiXext.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -/* - * PanoramiX definitions - */ -/* $XFree86: xc/include/extensions/panoramiXext.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ - -#ifdef __linux__ - -/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ - -#define PANORAMIX_MAJOR_VERSION 1 /* current version number */ -#define PANORAMIX_MINOR_VERSION 1 - -typedef struct { - Window window; /* PanoramiX window - may not exist */ - int screen; - int State; /* PanroamiXOff, PanoramiXOn */ - int width; /* width of this screen */ - int height; /* height of this screen */ - int ScreenCount; /* real physical number of screens */ - XID eventMask; /* selected events for this client */ -} XPanoramiXInfo; - -extern XPanoramiXInfo *XPanoramiXAllocInfo ( -#if NeedFunctionPrototypes - void -#endif -); - -#endif /* __linux__*/ diff --git a/src/nwi/native/x11/panoramiXproto.h b/src/nwi/native/x11/panoramiXproto.h deleted file mode 100644 index 1a66940f7..000000000 --- a/src/nwi/native/x11/panoramiXproto.h +++ /dev/null @@ -1,196 +0,0 @@ -/* $Xorg: panoramiXproto.h,v 1.4 2000/08/18 04:05:45 coskrey Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -/* $XFree86: xc/include/extensions/panoramiXproto.h,v 3.6 2001/01/17 17:53:22 dawes Exp $ */ - -#ifdef __linux__ - -/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */ - -#ifndef _PANORAMIXPROTO_H_ -#define _PANORAMIXPROTO_H_ - -#define PANORAMIX_PROTOCOL_NAME "XINERAMA" - -#define X_PanoramiXQueryVersion 0 -#define X_PanoramiXGetState 1 -#define X_PanoramiXGetScreenCount 2 -#define X_PanoramiXGetScreenSize 3 - -#define X_XineramaIsActive 4 -#define X_XineramaQueryScreens 5 - -typedef struct _PanoramiXQueryVersion { - CARD8 reqType; /* always PanoramiXReqCode */ - CARD8 panoramiXReqType; /* always X_PanoramiXQueryVersion */ - CARD16 length B16; - CARD8 clientMajor; - CARD8 clientMinor; - CARD16 unused B16; -} xPanoramiXQueryVersionReq; - -#define sz_xPanoramiXQueryVersionReq 8 - -typedef struct { - CARD8 type; /* must be X_Reply */ - CARD8 pad1; /* unused */ - CARD16 sequenceNumber B16; /* last sequence number */ - CARD32 length B32; /* 0 */ - CARD16 majorVersion B16; - CARD16 minorVersion B16; - CARD32 pad2 B32; /* unused */ - CARD32 pad3 B32; /* unused */ - CARD32 pad4 B32; /* unused */ - CARD32 pad5 B32; /* unused */ - CARD32 pad6 B32; /* unused */ -} xPanoramiXQueryVersionReply; - -#define sz_xPanoramiXQueryVersionReply 32 - - -typedef struct _PanoramiXGetState { - CARD8 reqType; /* always PanoramiXReqCode */ - CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ - CARD16 length B16; - CARD32 window B32; -} xPanoramiXGetStateReq; -#define sz_xPanoramiXGetStateReq 8 - -typedef struct { - BYTE type; - BYTE state; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 window B32; - CARD32 pad1 B32; /* unused */ - CARD32 pad2 B32; /* unused */ - CARD32 pad3 B32; /* unused */ - CARD32 pad4 B32; /* unused */ - CARD32 pad5 B32; /* unused */ -} xPanoramiXGetStateReply; - -#define sz_panoramiXGetStateReply 32 - -typedef struct _PanoramiXGetScreenCount { - CARD8 reqType; /* always PanoramiXReqCode */ - CARD8 panoramiXReqType; /* always X_PanoramiXGetScreenCount */ - CARD16 length B16; - CARD32 window B32; -} xPanoramiXGetScreenCountReq; -#define sz_xPanoramiXGetScreenCountReq 8 - -typedef struct { - BYTE type; - BYTE ScreenCount; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 window B32; - CARD32 pad1 B32; /* unused */ - CARD32 pad2 B32; /* unused */ - CARD32 pad3 B32; /* unused */ - CARD32 pad4 B32; /* unused */ - CARD32 pad5 B32; /* unused */ -} xPanoramiXGetScreenCountReply; -#define sz_panoramiXGetScreenCountReply 32 - -typedef struct _PanoramiXGetScreenSize { - CARD8 reqType; /* always PanoramiXReqCode */ - CARD8 panoramiXReqType; /* always X_PanoramiXGetState */ - CARD16 length B16; - CARD32 window B32; - CARD32 screen B32; -} xPanoramiXGetScreenSizeReq; -#define sz_xPanoramiXGetScreenSizeReq 12 - -typedef struct { - BYTE type; - CARD8 pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 width B32; - CARD32 height B32; - CARD32 window B32; - CARD32 screen B32; - CARD32 pad2 B32; /* unused */ - CARD32 pad3 B32; /* unused */ -} xPanoramiXGetScreenSizeReply; -#define sz_panoramiXGetScreenSizeReply 32 - -/************ Alternate protocol ******************/ - -typedef struct { - CARD8 reqType; - CARD8 panoramiXReqType; - CARD16 length B16; -} xXineramaIsActiveReq; -#define sz_xXineramaIsActiveReq 4 - -typedef struct { - BYTE type; - CARD8 pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 state B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXineramaIsActiveReply; -#define sz_XineramaIsActiveReply 32 - - -typedef struct { - CARD8 reqType; - CARD8 panoramiXReqType; - CARD16 length B16; -} xXineramaQueryScreensReq; -#define sz_xXineramaQueryScreensReq 4 - -typedef struct { - BYTE type; - CARD8 pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; - CARD32 number B32; - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; -} xXineramaQueryScreensReply; -#define sz_XineramaQueryScreensReply 32 - -typedef struct { - INT16 x_org B16; - INT16 y_org B16; - CARD16 width B16; - CARD16 height B16; -} xXineramaScreenInfo; -#define sz_XineramaScreenInfo 8 - -#endif - -#endif /* __linux__ */ -- cgit v1.2.3