aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com')
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/NewtFactory.java42
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/AWTNewtFactory.java7
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/impl/x11/X11Window.java29
3 files changed, 48 insertions, 30 deletions
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 531d686b2..60ad003af 100755
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -121,7 +121,7 @@ public abstract class NewtFactory {
* <p>
* In case <code>parentWindowObject</code> is a {@link javax.media.nativewindow.NativeWindow},<br>
* we create a child {@link com.jogamp.newt.Window},
- * utilizing {@link com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities)},
+ * utilizing {@link com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities, boolean)},
* passing the parent's native window handle retrieved via {@link javax.media.nativewindow.NativeWindow#getWindowHandle()}.<br></p>
* <p>
* In case <code>parentWindowObject</code> is even a {@link com.jogamp.newt.Window}, the following applies:<br>
@@ -132,17 +132,18 @@ public abstract class NewtFactory {
* you have to handle all events appropriatly.<br></p>
* <p>
* In case <code>parentWindowObject</code> is a {@link java.awt.Component},<br>
- * we utilize the {@link com.jogamp.newt.impl.awt.AWTNewtFactory#createNativeChildWindow(Object, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities)}
+ * we utilize the {@link com.jogamp.newt.impl.awt.AWTNewtFactory#createNativeChildWindow(Object, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities, boolean)}
* factory method.<br>
* The factory adds a {@link com.jogamp.newt.event.WindowListener} to propagate {@link com.jogamp.newt.event.WindowEvent}'s so
* your NEWT Window integrates into the AWT layout.<br></p>
*
* @param parentWindowObject either a NativeWindow or java.awt.Component
+ * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
*
- * @see com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities)
- * @see com.jogamp.newt.impl.awt.AWTNewtFactory#createNativeChildWindow(Object, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities)
+ * @see com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities, boolean)
+ * @see com.jogamp.newt.impl.awt.AWTNewtFactory#createNativeChildWindow(Object, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities, boolean)
*/
- public static Window createWindow(Object parentWindowObject, Screen screen, Capabilities caps) {
+ public static Window createWindow(Object parentWindowObject, Screen screen, Capabilities caps, boolean undecorated) {
if(null==parentWindowObject) {
throw new RuntimeException("Null parentWindowObject");
}
@@ -151,7 +152,7 @@ public abstract class NewtFactory {
nativeParentWindow.lockSurface();
long parentWindowHandle = nativeParentWindow.getWindowHandle();
nativeParentWindow.unlockSurface();
- final Window win = createWindow(parentWindowHandle, screen, caps);
+ final Window win = createWindow(parentWindowHandle, screen, caps, undecorated);
if ( nativeParentWindow instanceof Window) {
final Window f_nativeParentWindow = (Window) nativeParentWindow ;
f_nativeParentWindow.addWindowListener(new WindowAdapter() {
@@ -166,30 +167,41 @@ public abstract class NewtFactory {
if(ReflectionUtil.isClassAvailable("com.jogamp.newt.impl.awt.AWTNewtFactory")) {
return (Window) ReflectionUtil.callStaticMethod("com.jogamp.newt.impl.awt.AWTNewtFactory",
"createNativeChildWindow",
- new Class[] { Object.class, Screen.class, Capabilities.class },
- new Object[] { parentWindowObject, screen, caps } );
+ new Class[] { Object.class, Screen.class, Capabilities.class, java.lang.Boolean.TYPE},
+ new Object[] { parentWindowObject, screen, caps, new Boolean(undecorated) } );
}
}
}
throw new RuntimeException("No NEWT child Window factory method for parent object: "+parentWindowObject);
}
+ public static Window createWindow(Object parentWindowObject, Screen screen, Capabilities caps) {
+ return createWindow(parentWindowObject, screen, caps, false);
+ }
+
/**
* Create a child Window entity attached to the given parent, incl native creation<br>
*
* @param parentWindowObject the native parent window handle
+ * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
*/
- public static Window createWindow(long parentWindowHandle, Screen screen, Capabilities caps) {
+ public static Window createWindow(long parentWindowHandle, Screen screen, Capabilities caps, boolean undecorated) {
if(0==parentWindowHandle) {
throw new RuntimeException("Null parentWindowHandle");
}
- return Window.create(NativeWindowFactory.getNativeWindowType(true), parentWindowHandle, screen, caps, true);
+ return Window.create(NativeWindowFactory.getNativeWindowType(true), parentWindowHandle, screen, caps, undecorated);
+ }
+
+ public static Window createWindow(long parentWindowHandle, Screen screen, Capabilities caps) {
+ return createWindow(parentWindowHandle, screen, caps, false);
}
/**
* Ability to try a Window type with a construnctor argument, if supported ..<p>
* Currently only valid is <code> AWTWindow(Frame frame) </code>,
* to support an external created AWT Frame, ie the browsers embedded frame.
+ *
+ * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
*/
public static Window createWindow(Object[] cstrArguments, Screen screen, Capabilities caps, boolean undecorated) {
return Window.create(NativeWindowFactory.getNativeWindowType(true), cstrArguments, screen, caps, undecorated);
@@ -197,19 +209,13 @@ public abstract class NewtFactory {
/**
* Create a Window entity using the given implementation type, incl native creation
+ *
+ * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
*/
- public static Window createWindow(String type, Screen screen, Capabilities caps) {
- return Window.create(type, 0, screen, caps, false);
- }
-
public static Window createWindow(String type, Screen screen, Capabilities caps, boolean undecorated) {
return Window.create(type, 0, screen, caps, undecorated);
}
- public static Window createWindow(String type, long parentWindowHandle, Screen screen, Capabilities caps, boolean undecorated) {
- return Window.create(type, parentWindowHandle, screen, caps, undecorated);
- }
-
public static Window createWindow(String type, Object[] cstrArguments, Screen screen, Capabilities caps, boolean undecorated) {
return Window.create(type, cstrArguments, screen, caps, undecorated);
}
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTNewtFactory.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTNewtFactory.java
index f3296d9d5..eb2e27115 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTNewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTNewtFactory.java
@@ -83,14 +83,15 @@ public class AWTNewtFactory {
* utilizing {@link #getNativeWindow(java.awt.Component)}.<br>
* The actual wrapping implementation is {@link com.jogamp.nativewindow.impl.jawt.JAWTWindow}.<br></p>
* <p>
- * Second we create a child {@link com.jogamp.newt.Window}, utilizing {@link com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities)}, passing the AWT parent's native window handle retrieved via {@link com.jogamp.nativewindow.impl.jawt.JAWTWindow#getWindowHandle()}.<br></p>
+ * Second we create a child {@link com.jogamp.newt.Window}, utilizing {@link com.jogamp.newt.NewtFactory#createWindow(long, com.jogamp.newt.Screen, com.jogamp.newt.Capabilities, boolean)}, passing the AWT parent's native window handle retrieved via {@link com.jogamp.nativewindow.impl.jawt.JAWTWindow#getWindowHandle()}.<br></p>
* <p>
* Third we attach a {@link com.jogamp.newt.event.awt.AWTParentWindowAdapter} to the given AWT component.<br>
* The adapter passes window related events to our new child window, look at the implementation<br></p>
*
* @param awtParentObject must be of type java.awt.Component
+ * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always
*/
- public static Window createNativeChildWindow(Object awtParentObject, Screen newtScreen, Capabilities newtCaps) {
+ public static Window createNativeChildWindow(Object awtParentObject, Screen newtScreen, Capabilities newtCaps, boolean undecorated) {
NativeWindow parent = getNativeWindow(awtParentObject); // also checks java.awt.Component type
java.awt.Component awtParent = (java.awt.Component) awtParentObject;
if(null==parent) {
@@ -102,7 +103,7 @@ public class AWTNewtFactory {
if(0==windowHandle) {
throw new NativeWindowException("Null window handle: "+parent);
}
- Window window = NewtFactory.createWindow(windowHandle, newtScreen, newtCaps);
+ Window window = NewtFactory.createWindow(windowHandle, newtScreen, newtCaps, undecorated);
new AWTParentWindowAdapter(window).addTo(awtParent);
return window;
}
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
index e81d89a8c..4fe9f77ad 100755
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java
@@ -40,8 +40,6 @@ import javax.media.nativewindow.x11.*;
public class X11Window extends Window {
private static final String WINDOW_CLASS_NAME = "NewtWindow";
- // non fullscreen dimensions ..
- private int nfs_width, nfs_height, nfs_x, nfs_y;
static {
X11Display.initSingleton();
@@ -57,12 +55,13 @@ public class X11Window extends Window {
if (config == null) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
+ attachedToParent = 0 != parentWindowHandle ;
X11GraphicsConfiguration x11config = (X11GraphicsConfiguration) config;
long visualID = x11config.getVisualID();
long w = CreateWindow(parentWindowHandle,
display.getHandle(), screen.getIndex(), visualID,
display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
- x, y, width, height, undecorated||0!=parentWindowHandle);
+ x, y, width, height, undecorated());
if (w == 0 || w!=windowHandle) {
throw new NativeWindowException("Error creating window: "+w);
}
@@ -87,6 +86,9 @@ public class X11Window extends Window {
}
public void setVisible(boolean visible) {
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("X11Window setVisible: "+this.x+"/"+this.y+" "+this.width+"x"+this.height+", fs "+fullscreen+", windowHandle "+windowHandle);
+ }
if(0!=windowHandle && this.visible!=visible) {
this.visible=visible;
setVisible0(getDisplayHandle(), windowHandle, visible);
@@ -95,6 +97,9 @@ public class X11Window extends Window {
}
public void setSize(int width, int height) {
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("X11Window setSize: "+this.width+"x"+this.height+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+windowHandle);
+ }
if (width != this.width || this.height != height) {
if(!fullscreen) {
this.width = width;
@@ -109,6 +114,9 @@ public class X11Window extends Window {
}
public void setPosition(int x, int y) {
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("X11Window setPosition: "+this.x+"/"+this.y+" -> "+x+"/"+y+", fs "+fullscreen+", windowHandle "+windowHandle);
+ }
if ( this.x != x || this.y != y ) {
if(!fullscreen) {
this.x = x;
@@ -137,16 +145,15 @@ public class X11Window extends Window {
h = nfs_height;
}
if(DEBUG_IMPLEMENTATION || DEBUG_WINDOW_EVENT) {
- System.err.println("X11Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h);
- }
- setPosSizeDecor0(fullscreen?0:parentWindowHandle, getDisplayHandle(), getScreenIndex(), windowHandle, x, y, w, h, (undecorated||fullscreen)?-1:1);
- if(fullscreen) {
- requestFocus0(getDisplayHandle(), windowHandle);
+ System.err.println("X11Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+undecorated());
}
+ setPosSizeDecor0(fullscreen?0:parentWindowHandle, getDisplayHandle(), getScreenIndex(), windowHandle, x, y, w, h, undecorated());
}
return fullscreen;
}
+ final boolean undecorated() { return attachedToParent || undecorated || fullscreen ; }
+
// @Override
public void requestFocus() {
super.requestFocus();
@@ -179,7 +186,7 @@ public class X11Window extends Window {
private native void setVisible0(long display, long windowHandle, boolean visible);
private native void setSize0(long display, long windowHandle, int width, int height);
private native void setPosSizeDecor0(long parentWindowHandle, long display, int screen_index, long windowHandle,
- int x, int y, int width, int height, int decorationToggle);
+ int x, int y, int width, int height, boolean undecorated);
private native void setTitle0(long display, long windowHandle, String title);
private native void requestFocus0(long display, long windowHandle);
private native void setPosition0(long parentWindowHandle, long display, long windowHandle, int x, int y);
@@ -229,4 +236,8 @@ public class X11Window extends Window {
private long windowHandleClose;
private long displayHandleClose;
private long parentWindowHandle;
+ private boolean attachedToParent;
+
+ // non fullscreen dimensions ..
+ private int nfs_width, nfs_height, nfs_x, nfs_y;
}