aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-02 10:18:22 -0700
committerSven Gothel <[email protected]>2009-10-02 10:18:22 -0700
commit9fd3c095ce2117c3cb67169c97531cac78ab04c4 (patch)
treedd65dac2d4b406b7e47e92afee880d7e56cbebc5 /src/newt/classes/com/sun
parentcd45d13bbd0ff1da3dac678a6461b5fdce2783c1 (diff)
NativeWindowFactory:
- If property 'nativewindow.ws.name' is set, use it as the custom windowing type returned by getNativeWindowType(true) NEWT: - Using NativeWindowFactory's property 'nativewindow.ws.name' as a package name for custom NEWT windowing imlementations, ie: -Dnativewindow.ws.name=com.sun.javafx.newt.intel.gdl -Dnativewindow.ws.name=com.sun.javafx.newt.broadcom.egl This allows far more flexibility to add custom impl. - Add Intel-GDL, define property 'useIntelGDL' to build the native part. Intel GDL is impl in the package 'com.sun.javafx.newt.intel.gdl' JOGL: - All impl. of 'createGLDrawable(..)', which were actually creating onscreen drawable only, were renamed to 'createOnscreenDrawable(..)'. - GLDrawableFactoryImpl impl. 'createGLDrawable(..)' now and dispatches to the actual create* methods in respect to the Capabilities, ie onscreen, pbuffer and offscreen. - GLDrawableFactory: - If using a native ES profile -> EGLDrawableFactory - If existing native OS factory -> Use that .. - Else -> Use EGLDrawableFactory, if available
Diffstat (limited to 'src/newt/classes/com/sun')
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Display.java30
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/NewtFactory.java13
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Screen.java30
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/Window.java30
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java104
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java68
-rw-r--r--src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java135
-rw-r--r--src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java)13
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java)9
-rwxr-xr-xsrc/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java)17
10 files changed, 381 insertions, 68 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/sun/javafx/newt/Display.java
index 38d0021ce..0be8aedbc 100755
--- a/src/newt/classes/com/sun/javafx/newt/Display.java
+++ b/src/newt/classes/com/sun/javafx/newt/Display.java
@@ -43,21 +43,21 @@ public abstract class Display implements Runnable {
private static Class getDisplayClass(String type)
throws ClassNotFoundException
{
- Class displayClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLDisplay");
- } else {
- throw new RuntimeException("Unknown display type \"" + type + "\"");
+ Class displayClass = NewtFactory.getCustomClass(type, "Display");
+ if(null==displayClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
+ } else {
+ throw new RuntimeException("Unknown display type \"" + type + "\"");
+ }
}
return displayClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
index 2f719110d..c4180eb46 100755
--- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
@@ -39,8 +39,6 @@ import java.util.Iterator;
import com.sun.nativewindow.impl.jvm.JVMUtil;
public abstract class NewtFactory {
- public static final String TYPE_BROADCOM_EGL = "BroadcomEGL";
-
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
static {
@@ -48,6 +46,17 @@ public abstract class NewtFactory {
Window.init(NativeWindowFactory.getNativeWindowType(true));
}
+ static Class getCustomClass(String packageName, String classBaseName) {
+ Class clazz = null;
+ if(packageName!=null || classBaseName!=null) {
+ String clazzName = packageName + "." + classBaseName ;
+ try {
+ clazz = Class.forName(clazzName);
+ } catch (Throwable t) {}
+ }
+ return clazz;
+ }
+
/**
* Create a Display entity, incl native creation
*/
diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/sun/javafx/newt/Screen.java
index 57ed34211..e347a69c2 100755
--- a/src/newt/classes/com/sun/javafx/newt/Screen.java
+++ b/src/newt/classes/com/sun/javafx/newt/Screen.java
@@ -43,21 +43,21 @@ public abstract class Screen {
private static Class getScreenClass(String type)
throws ClassNotFoundException
{
- Class screenClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDScreen");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.macosx.MacScreen");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLScreen");
- } else {
- throw new RuntimeException("Unknown window type \"" + type + "\"");
+ Class screenClass = NewtFactory.getCustomClass(type, "Screen");
+ if(null==screenClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDScreen");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.macosx.MacScreen");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
+ } else {
+ throw new RuntimeException("Unknown window type \"" + type + "\"");
+ }
}
return screenClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/sun/javafx/newt/Window.java
index 2b82cb887..8b78943d4 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/sun/javafx/newt/Window.java
@@ -66,21 +66,21 @@ public abstract class Window implements NativeWindow
private static Class getWindowClass(String type)
throws ClassNotFoundException
{
- Class windowClass = null;
- if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDWindow");
- } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.windows.WindowsWindow");
- } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.macosx.MacWindow");
- } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
- } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
- } else if (NewtFactory.TYPE_BROADCOM_EGL.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.opengl.broadcom.BCEGLWindow");
- } else {
- throw new NativeWindowException("Unknown window type \"" + type + "\"");
+ Class windowClass = NewtFactory.getCustomClass(type, "Window");
+ if(null==windowClass) {
+ if (NativeWindowFactory.TYPE_EGL.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDWindow");
+ } else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.windows.WindowsWindow");
+ } else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.macosx.MacWindow");
+ } else if (NativeWindowFactory.TYPE_X11.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
+ } else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
+ windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
+ } else {
+ throw new NativeWindowException("Unknown window type \"" + type + "\"");
+ }
}
return windowClass;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java
new file mode 100644
index 000000000..b1f0ac6d2
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java
@@ -0,0 +1,104 @@
+/*
+ * 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.intel.gdl;
+
+import com.sun.javafx.newt.impl.*;
+import javax.media.nativewindow.*;
+
+public class Display extends com.sun.javafx.newt.Display {
+ static int initCounter = 0;
+
+ static {
+ NativeLibLoader.loadNEWT();
+
+ if (!Screen.initIDs()) {
+ throw new NativeWindowException("Failed to initialize GDL Screen jmethodIDs");
+ }
+ if (!Window.initIDs()) {
+ throw new NativeWindowException("Failed to initialize GDL Window jmethodIDs");
+ }
+ }
+
+ public static void initSingleton() {
+ // just exist to ensure static init has been run
+ }
+
+
+ public Display() {
+ }
+
+ protected void createNative() {
+ synchronized(Display.class) {
+ if(0==initCounter) {
+ displayHandle = CreateDisplay();
+ if(0==displayHandle) {
+ throw new NativeWindowException("Couldn't initialize GDL Display");
+ }
+ }
+ initCounter++;
+ }
+ aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, displayHandle);
+ }
+
+ protected void closeNative() {
+ if(0==displayHandle) {
+ throw new NativeWindowException("displayHandle null; initCnt "+initCounter);
+ }
+ synchronized(Display.class) {
+ if(initCounter>0) {
+ initCounter--;
+ if(0==initCounter) {
+ DestroyDisplay(displayHandle);
+ }
+ }
+ }
+ }
+
+ protected void dispatchMessages() {
+ if(0!=displayHandle) {
+ DispatchMessages(displayHandle, focusedWindow);
+ }
+ }
+
+ protected void setFocus(Window focus) {
+ focusedWindow = focus;
+ }
+
+ private long displayHandle = 0;
+ private Window focusedWindow = null;
+ private native long CreateDisplay();
+ private native void DestroyDisplay(long displayHandle);
+ private native void DispatchMessages(long displayHandle, Window focusedWindow);
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java
new file mode 100644
index 000000000..83d9074e2
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java
@@ -0,0 +1,68 @@
+/*
+ * 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.intel.gdl;
+
+import com.sun.javafx.newt.impl.*;
+import javax.media.nativewindow.*;
+
+public class Screen extends com.sun.javafx.newt.Screen {
+
+ static {
+ Display.initSingleton();
+ }
+
+ public Screen() {
+ }
+
+ protected void createNative(int index) {
+ AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice();
+ GetScreenInfo(adevice.getHandle(), index);
+ aScreen = new DefaultGraphicsScreen(adevice, index);
+ }
+
+ protected void closeNative() { }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ protected static native boolean initIDs();
+ private native void GetScreenInfo(long displayHandle, int screen_idx);
+
+ // called by GetScreenInfo() ..
+ private void screenCreated(int width, int height) {
+ setScreenSize(width, height);
+ }
+}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java
new file mode 100644
index 000000000..2c68a2054
--- /dev/null
+++ b/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java
@@ -0,0 +1,135 @@
+/*
+ * 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.intel.gdl;
+
+import javax.media.nativewindow.*;
+
+public class Window extends com.sun.javafx.newt.Window {
+ static {
+ Display.initSingleton();
+ }
+
+ public Window() {
+ }
+
+ static long nextWindowHandle = 1;
+
+ protected void createNative(long parentWindowHandle, Capabilities caps) {
+ if(0!=parentWindowHandle) {
+ throw new NativeWindowException("GDL Window does not support window parenting");
+ }
+ AbstractGraphicsScreen aScreen = screen.getGraphicsScreen();
+ AbstractGraphicsDevice aDevice = screen.getDisplay().getGraphicsDevice();
+
+ config = GraphicsConfigurationFactory.getFactory(aDevice).chooseGraphicsConfiguration(caps, null, aScreen);
+ if (config == null) {
+ throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
+ }
+
+ synchronized(Window.class) {
+ windowHandle = nextWindowHandle++;
+ }
+ }
+
+ protected void closeNative() {
+ if(0!=surfaceHandle) {
+ synchronized(Window.class) {
+ CloseSurface(getDisplayHandle(), surfaceHandle);
+ }
+ surfaceHandle = 0;
+ ((Display)screen.getDisplay()).setFocus(null);
+ }
+ }
+
+ public void setVisible(boolean visible) {
+ if(this.visible!=visible) {
+ this.visible=visible;
+ if(visible && 0==surfaceHandle) {
+ synchronized(Window.class) {
+ AbstractGraphicsDevice aDevice = screen.getDisplay().getGraphicsDevice();
+ surfaceHandle = CreateSurface(aDevice.getHandle(), width, height);
+ }
+ if (surfaceHandle == 0) {
+ throw new NativeWindowException("Error creating window");
+ }
+ ((Display)screen.getDisplay()).setFocus(this);
+ }
+ }
+ }
+
+ public void setSize(int width, int height) {
+ if(0!=surfaceHandle) {
+ System.err.println("setSize "+width+"x"+height+" n/a in IntelGDL _after_ surface established");
+ } else {
+ Screen screen = (Screen) getScreen();
+ if(width>screen.getWidth() || height>screen.getHeight()) {
+ width=screen.getWidth();
+ height=screen.getHeight();
+ }
+ this.width = width;
+ this.height = height;
+ }
+ }
+
+ public void setPosition(int x, int y) {
+ // n/a in IntelGDL
+ System.err.println("setPosition n/a in IntelGDL");
+ }
+
+ public boolean setFullscreen(boolean fullscreen) {
+ // n/a in IntelGDL
+ System.err.println("setFullscreen n/a in IntelGDL");
+ return false;
+ }
+
+ public void requestFocus() {
+ ((Display)screen.getDisplay()).setFocus(this);
+ }
+
+ //----------------------------------------------------------------------
+ // Internals only
+ //
+
+ protected static native boolean initIDs();
+ private native long CreateSurface(long displayHandle, int width, int height);
+ private native void CloseSurface(long displayHandle, long surfaceHandle);
+
+
+ private void updateSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ private long surfaceHandle;
+}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java
index dbe126c91..debe9e9b9 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLDisplay.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java
@@ -31,21 +31,20 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import com.sun.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-public class BCEGLDisplay extends Display {
+public class Display extends com.sun.javafx.newt.Display {
static {
NativeLibLoader.loadNEWT();
- if (!BCEGLWindow.initIDs()) {
- throw new NativeWindowException("Failed to initialize BCEGLWindow jmethodIDs");
+ if (!Window.initIDs()) {
+ throw new NativeWindowException("Failed to initialize BCEGL Window jmethodIDs");
}
}
@@ -54,11 +53,11 @@ public class BCEGLDisplay extends Display {
}
- public BCEGLDisplay() {
+ public Display() {
}
protected void createNative() {
- long handle = CreateDisplay(BCEGLScreen.fixedWidth, BCEGLScreen.fixedHeight);
+ long handle = CreateDisplay(Screen.fixedWidth, Screen.fixedHeight);
if (handle == EGL.EGL_NO_DISPLAY) {
throw new NativeWindowException("BC EGL CreateDisplay failed");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java
index 165081cde..28f7211c3 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLScreen.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java
@@ -31,20 +31,19 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import javax.media.nativewindow.*;
-public class BCEGLScreen extends Screen {
+public class Screen extends com.sun.javafx.newt.Screen {
static {
- BCEGLDisplay.initSingleton();
+ Display.initSingleton();
}
- public BCEGLScreen() {
+ public Screen() {
}
protected void createNative(int index) {
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java
index e3d7c2042..7d087416c 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/BCEGLWindow.java
+++ b/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java
@@ -31,9 +31,8 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom;
+package com.sun.javafx.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.*;
import com.sun.javafx.newt.impl.*;
import com.sun.opengl.impl.egl.*;
import javax.media.nativewindow.*;
@@ -41,12 +40,12 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import javax.media.nativewindow.NativeWindowException;
-public class BCEGLWindow extends Window {
+public class Window extends com.sun.javafx.newt.Window {
static {
- BCEGLDisplay.initSingleton();
+ Display.initSingleton();
}
- public BCEGLWindow() {
+ public Window() {
}
protected void createNative(long parentWindowHandle, Capabilities caps) {
@@ -88,10 +87,10 @@ public class BCEGLWindow extends Window {
void setSizeImpl(int width, int height) {
if(0!=windowHandle) {
// n/a in BroadcomEGL
- System.err.println("BCEGLWindow.setSizeImpl n/a in BroadcomEGL with realized window");
+ System.err.println("BCEGL Window.setSizeImpl n/a in BroadcomEGL with realized window");
} else {
if(DEBUG_IMPLEMENTATION) {
- Exception e = new Exception("BCEGLWindow.setSizeImpl() "+this.width+"x"+this.height+" -> "+width+"x"+height);
+ Exception e = new Exception("BCEGL Window.setSizeImpl() "+this.width+"x"+this.height+" -> "+width+"x"+height);
e.printStackTrace();
}
this.width = width;
@@ -130,7 +129,7 @@ public class BCEGLWindow extends Window {
private long realizeWindow(boolean chromaKey, int width, int height) {
if(DEBUG_IMPLEMENTATION) {
- System.out.println("BCEGLWindow.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+config);
+ System.out.println("BCEGL Window.realizeWindow() with: chroma "+chromaKey+", "+width+"x"+height+", "+config);
}
long handle = CreateWindow(getDisplayHandle(), chromaKey, width, height);
if (0 == handle) {
@@ -149,7 +148,7 @@ public class BCEGLWindow extends Window {
throw new NativeWindowException("Error creating EGLGraphicsConfiguration from id: "+cfgID+", "+this);
}
if(DEBUG_IMPLEMENTATION) {
- System.out.println("BCEGLWindow.windowCreated(): 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config);
+ System.out.println("BCEGL Window.windowCreated(): 0x"+Integer.toHexString(cfgID)+", "+width+"x"+height+", "+config);
}
}