aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/javax/media/opengl/ToolkitLock.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
committerKenneth Russel <[email protected]>2008-12-20 08:58:00 +0000
commit6eda9476e8168bacdeb1854540d89bd9db0d5029 (patch)
tree692317f9924638836b16bf83a9cefe0c1047bb66 /src/classes/javax/media/opengl/ToolkitLock.java
parent14a94c810910f88d3b7214ae9be5027dc74df39f (diff)
Factored out the remaining toolkit, and specifically AWT, dependencies
from GLDrawableFactory implementations into NativeWindowFactory implementations. These dependencies were the up-front selection of the GraphicsConfiguration and the locking and unlocking of the toolkit, which are both currently needed only on X11 platforms due to how OpenGL and the window system interact there. Added X11GraphicsDevice and X11GraphicsConfiguration classes which are intended to be used by Newt or potentially other third-party window toolkits. Unified the separate NativeWindow and AWT GLDrawableFactory implementations in the GLDrawableFactory class. Exposed the toolkit locking mechanism through the NativeWindowFactory and introduced the concept of a default NativeWindowFactory which is used by the X11 drawable and context implementations. Removed unnecessary toolkit locking calls from Mac OS X and Windows drawable and context implementations. Added a registration mechanism for new NativeWindowFactories, allowing third parties to plug in new window toolkits orthogonally to the OpenGL drawable and context code. The public APIs for the NativeWindowFactory and the GLDrawableFactory, in particular how they are fetched, changed as a result of these refactorings. Updated all uses. Fixed bug in X11OffscreenGLXDrawable introduced during last set of changes. Tested demos on Solaris, Mac OS X and Windows. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1824 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/javax/media/opengl/ToolkitLock.java')
-rw-r--r--src/classes/javax/media/opengl/ToolkitLock.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/classes/javax/media/opengl/ToolkitLock.java b/src/classes/javax/media/opengl/ToolkitLock.java
new file mode 100644
index 000000000..9574de77c
--- /dev/null
+++ b/src/classes/javax/media/opengl/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.opengl;
+
+/** 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();
+}