aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-02 17:09:37 -0700
committerSven Gothel <[email protected]>2009-10-02 17:09:37 -0700
commit1304fcd939bea7ea804d2fef22a942848b02a20b (patch)
treeb371dc12428c29794be7910a72ea769c14a7e4e3 /src/newt/classes/com/sun
parentd3a4046f5c45b8ef6e6f70115fcf6250e09a8732 (diff)
NEWT: Offscreen integration
Diffstat (limited to 'src/newt/classes/com/sun')
-rw-r--r--src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java89
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java7
2 files changed, 95 insertions, 1 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java
new file mode 100644
index 000000000..4b35f2562
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java
@@ -0,0 +1,89 @@
+/*
+ * 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 com.sun.javafx.newt;
+
+import javax.media.nativewindow.*;
+
+public class OffscreenWindow extends Window {
+
+ public OffscreenWindow() {
+ }
+
+ static long nextWindowHandle = 1;
+
+ protected void createNative(long parentWindowHandle, Capabilities caps) {
+ if(0!=parentWindowHandle) {
+ throw new NativeWindowException("OffscreenWindow does not support window parenting");
+ }
+ if(caps.isOnscreen()) {
+ throw new NativeWindowException("Capabilities is onscreen");
+ }
+ AbstractGraphicsScreen aScreen = screen.getGraphicsScreen();
+ config = new DefaultGraphicsConfiguration(aScreen, caps, caps);
+ if (config == null) {
+ throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
+ }
+
+ synchronized(OffscreenWindow.class) {
+ windowHandle = nextWindowHandle++;
+ }
+ }
+
+ protected void closeNative() {
+ // nop
+ }
+
+ public void setVisible(boolean visible) {
+ if(!visible) {
+ this.visible = visible;
+ }
+ }
+
+ public void setSize(int width, int height) {
+ if(!visible) {
+ this.width = width;
+ this.height = height;
+ }
+ }
+
+ public void setPosition(int x, int y) {
+ // nop
+ }
+
+ public boolean setFullscreen(boolean fullscreen) {
+ // nop
+ return false;
+ }
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 8b78943d4..da31b084c 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -87,7 +87,12 @@ public abstract class Window implements NativeWindow
protected static Window create(String type, long parentWindowHandle, Screen screen, Capabilities caps, boolean undecorated) {
try {
- Class windowClass = getWindowClass(type);
+ Class windowClass;
+ if(caps.isOnscreen()) {
+ windowClass = getWindowClass(type);
+ } else {
+ windowClass = OffscreenWindow.class;
+ }
Window window = (Window) windowClass.newInstance();
window.invalidate();
window.screen = screen;