summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-04 20:32:46 +0200
committerSven Gothel <[email protected]>2011-09-04 20:32:46 +0200
commitd4670328991c02a6f11f8873ea7a2331f17d0ef0 (patch)
tree6111ef98a9142b44aa22f86e1920decc30fa52b1 /src/newt
parent70b495519094de5fcca37da68fbbf8762eecbe28 (diff)
NativeWindow/NEWT: Refine Insets definition for size and position, read and write access
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java112
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java13
-rw-r--r--src/newt/classes/jogamp/newt/OffscreenWindow.java7
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java79
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java7
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java13
-rw-r--r--src/newt/classes/jogamp/newt/driver/broadcom/egl/Window.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/Window.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/KDWindow.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java31
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java23
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11Window.java5
-rw-r--r--src/newt/native/NewtMacWindow.m2
13 files changed, 172 insertions, 136 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index a76862055..c8eb2b1f5 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -37,7 +37,6 @@ import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.util.Insets;
/**
* Specifying the public Window functionality for the
@@ -124,13 +123,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Zero size semantics are respected, see {@link #setSize(int,int)}:<br>
* <pre>
* if ( 0 == windowHandle && visible ) {
- * this.visible = visible;
- * if( 0<width*height ) {
- * createNative();
- * }
+ * this.visible = visible;
+ * if( 0 &lt; width*height ) {
+ * createNative();
+ * }
* } else if ( this.visible != visible ) {
- * this.visible = visible;
- * setNativeSizeImpl();
+ * this.visible = visible;
+ * setNativeSizeImpl();
* }
* </pre></p>
* <p>
@@ -156,39 +155,72 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
//
/**
- * Sets the size of the client area of the window, excluding decorations
- * Total size of the window will be
- * {@code width+insets.left+insets.right, height+insets.top+insets.bottom}<br>
+ * Sets the size of the window's client area, excluding decorations.
+ *
* <p>
* Zero size semantics are respected, see {@link #setVisible(boolean)}:<br>
* <pre>
- * if ( 0 != windowHandle && 0>=width*height && visible ) {
- * setVisible(false);
- * } else if ( 0 == windowHandle && 0<width*height && visible ) {
- * setVisible(true);
+ * if ( 0 != windowHandle && 0 &ge; width*height && visible ) {
+ * setVisible(false);
+ * } else if ( 0 == windowHandle && 0 &lt; width*height && visible ) {
+ * setVisible(true);
* } else {
- * // as expected ..
+ * // as expected ..
* }
* </pre></p>
* <p>
* This call is ignored if in fullscreen mode.<br></p>
*
- * @param width of the client area of the window
- * @param height of the client area of the window
+ * @param width of the window's client area
+ * @param height of the window's client area
+ *
+ * @see #getInsets()
*/
void setSize(int width, int height);
/**
- * Returns the width of the client area of this window
- * @return width of the client area
+ * Sets the size of the top-level window including decorations.
+ *
+ * @param width of the top-level window area
+ * @param height of the top-level window area
+ *
+ * @see #setSize(int, int)
+ * @see #getInsets()
*/
- int getWidth();
-
+ void setTopLevelSize(int width, int height);
+
+ /**
+ * Sets the location of the window's client area, excluding decorations.<br>
+ *
+ * This call is ignored if in fullscreen mode.<br>
+ *
+ * @param x coord of the client-area's top left corner
+ * @param y coord of the client-area's top left corner
+ *
+ * @see #getInsets()
+ */
+ void setPosition(int x, int y);
+
/**
- * Returns the height of the client area of this window
- * @return height of the client area
+ * Sets the location of the top-level window inclusive decorations.<br>
+ *
+ * This call is ignored if in fullscreen mode.<br>
+ *
+ * @param x coord of the top-level left corner
+ * @param y coord of the top-level left corner
+ *
+ * @see #setPosition(int, int)
+ * @see #getInsets()
*/
- int getHeight();
+ void setTopLevelPosition(int x, int y);
+
+ void setUndecorated(boolean value);
+
+ boolean isUndecorated();
+
+ void setTitle(String title);
+
+ String getTitle();
/** Defining ids for the reparenting strategy */
public interface ReparentAction {
@@ -228,38 +260,6 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
boolean isFullscreen();
- /**
- * Sets the location of the top left corner of the window, including
- * decorations (so the client area will be placed at
- * {@code x+insets.left,y+insets.top}.<br>
- *
- * This call is ignored if in fullscreen mode.<br>
- *
- * @param x coord of the top left corner
- * @param y coord of the top left corner
- */
- void setPosition(int x, int y);
-
- int getX();
-
- int getY();
-
- /**
- * Returns the insets for this native window (the difference between the
- * size of the toplevel window with the decorations and the client area).
- *
- * @return insets for this platform window
- */
- Insets getInsets();
-
- void setUndecorated(boolean value);
-
- boolean isUndecorated();
-
- void setTitle(String title);
-
- String getTitle();
-
static interface FocusRunnable {
/**
* @return false if NEWT shall proceed requesting the focus,
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 559130298..9de664982 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -44,8 +44,8 @@ import com.jogamp.newt.event.*;
import jogamp.newt.WindowImpl;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.Insets;
import javax.media.opengl.*;
import jogamp.opengl.FPSCounterImpl;
@@ -234,13 +234,16 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
return window.hasFocus();
}
- public final Insets getInsets() {
+ public final InsetsImmutable getInsets() {
return window.getInsets();
}
public final void setPosition(int x, int y) {
window.setPosition(x, y);
}
+ public void setTopLevelPosition(int x, int y) {
+ window.setTopLevelPosition(x, y);
+ }
public final boolean setFullscreen(boolean fullscreen) {
return window.setFullscreen(fullscreen);
@@ -291,7 +294,10 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
public final void setSize(int width, int height) {
window.setSize(width, height);
}
-
+ public void setTopLevelSize(int width, int height) {
+ window.setTopLevelSize(width, height);
+ }
+
public final boolean isValid() {
return window.isValid();
}
@@ -900,5 +906,4 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
glWindow.setVisible(true);
glWindow.destroy();
}
-
}
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index e797a15cd..2f893fb2c 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -35,6 +35,7 @@
package jogamp.newt;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
public class OffscreenWindow extends WindowImpl implements SurfaceChangeable {
@@ -121,9 +122,13 @@ public class OffscreenWindow extends WindowImpl implements SurfaceChangeable {
}
return new Point(0,0);
}
-
+
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+
+ protected void updateInsetsImpl(Insets insets) {
+ // nop ..
+ }
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 55b735b4f..faf4c1a50 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -66,6 +66,7 @@ import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.SurfaceUpdatedListener;
import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.nativewindow.util.Insets;
+import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.Rectangle;
@@ -84,9 +85,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected CapabilitiesImmutable capsRequested = null;
protected CapabilitiesChooser capabilitiesChooser = null; // default null -> default
protected boolean fullscreen = false, visible = false, hasFocus = false;
- protected int width = 128, height = 128, x = 0, y = 0; // default values
+ protected int width = 128, height = 128, x = 0, y = 0; // client-area size/pos w/o insets
+ protected Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
- protected int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen dimensions ..
+ protected int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
protected String title = "Newt Window";
protected boolean undecorated = false;
private LifecycleHook lifecycleHook = null;
@@ -404,8 +406,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*
* @param x -1 if no position change requested, otherwise greater than zero
* @param y -1 if no position change requested, otherwise greater than zero
- * @param width -1 if no size change requested, otherwise greater than zero
- * @param height -1 if no size change requested, otherwise greater than zero
+ * @param width 0 if no size change requested, otherwise greater than zero
+ * @param height 0 if no size change requested, otherwise greater than zero
* @param parentChange true if reparenting requested, otherwise false
* @param fullScreenChange 0 if unchanged, -1 fullscreen off, 1 fullscreen on
* @param decorationChange 0 if unchanged, -1 undecorated, 1 decorated
@@ -426,6 +428,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return if not null, the screen location of the given coordinates
*/
protected abstract Point getLocationOnScreenImpl(int x, int y);
+
+ /** Triggered by user via {@link #getInsets()}.<br>
+ * Implementations may implement this hook to update the insets.<br>
+ * However, they may prefer the event driven path via {@link #insetsChanged(int, int, int, int)}.
+ *
+ * @see #getInsets()
+ * @see #insetsChanged(int, int, int, int)
+ */
+ protected abstract void updateInsetsImpl(Insets insets);
//----------------------------------------------------------------------
// NativeSurface
@@ -719,6 +730,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
runOnEDTIfAvail(true, new SetSizeActionImpl(width, height));
}
}
+
+ public void setTopLevelSize(int width, int height) {
+ setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight());
+ }
private class DestroyAction implements Runnable {
public final void run() {
@@ -1222,7 +1237,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- public boolean isUndecorated() {
+ public final boolean isUndecorated() {
return 0 != parentWindowHandle || undecorated || fullscreen ;
}
@@ -1230,14 +1245,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
enqueueRequestFocus(true);
}
- public boolean hasFocus() {
+ public final boolean hasFocus() {
return hasFocus;
}
- public Insets getInsets() {
- return new Insets(0,0,0,0);
+ public final InsetsImmutable getInsets() {
+ if(isUndecorated()) {
+ return Insets.getZero();
+ }
+ updateInsetsImpl(insets);
+ return insets;
}
-
+
public final int getWidth() {
return width;
}
@@ -1430,6 +1449,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
runOnEDTIfAvail(true, new SetPositionActionImpl(x, y));
}
}
+
+ public void setTopLevelPosition(int x, int y) {
+ setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight());
+ }
private class FullScreenActionImpl implements Runnable {
boolean fullscreen;
@@ -2010,9 +2033,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /**
- * @param focusGained
- */
+ /** Triggered by implementation's WM events to update the focus state. */
protected void focusChanged(boolean focusGained) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.focusChanged: ("+getThreadName()+"): "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -2025,6 +2046,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ /** Triggered by implementation's WM events to update the visibility state. */
protected void visibleChanged(boolean visible) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.visibleChanged ("+getThreadName()+"): "+this.visible+" -> "+visible+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -2055,6 +2077,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return this.visible == visible;
}
+ /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
protected void sizeChanged(int newWidth, int newHeight, boolean force) {
if(force || width != newWidth || height != newHeight) {
if(DEBUG_IMPLEMENTATION) {
@@ -2071,6 +2094,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ /** Triggered by implementation's WM events to update the position. */
protected void positionChanged(int newX, int newY) {
if( 0==parentWindowHandle && ( x != newX || y != newY ) ) {
if(DEBUG_IMPLEMENTATION) {
@@ -2082,6 +2106,27 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ /**
+ * Triggered by implementation's WM events to update the insets.
+ *
+ * @see #getInsets()
+ * @see #updateInsetsImpl(Insets)
+ */
+ protected void insetsChanged(int left, int right, int top, int bottom) {
+ if ( left >= 0 && right >= 0 && top >= 0 && bottom >= 0 &&
+ (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
+ top != insets.getTopHeight() || bottom != insets.getBottomHeight() )
+ ) {
+ insets.setLeftWidth(left);
+ insets.setRightWidth(right);
+ insets.setTopHeight(top);
+ insets.setBottomHeight(bottom);
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.insetsChanged: "+insets);
+ }
+ }
+ }
+
protected void windowDestroyNotify() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.windowDestroyNotify START "+getThreadName());
@@ -2100,15 +2145,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void windowRepaint(int x, int y, int width, int height) {
- final int _width = ( 0 > width ) ? this.width : width;
- final int _height = ( 0 > height ) ? this.height : height;
+ x = ( 0 > x ) ? this.x : x;
+ y = ( 0 > y ) ? this.y : y;
+ width = ( 0 >= width ) ? this.width : width;
+ height = ( 0 >= height ) ? this.height : height;
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.windowRepaint "+getThreadName()+" - "+x+"/"+y+" "+_width+"x"+_height);
+ System.err.println("Window.windowRepaint "+getThreadName()+" - "+x+"/"+y+" "+width+"x"+height);
}
if(isValid()) {
NEWTEvent e = new WindowUpdateEvent(WindowEvent.EVENT_WINDOW_REPAINT, this, System.currentTimeMillis(),
- new Rectangle(x, y, _width, _height));
+ new Rectangle(x, y, width, height));
doEvent(false, false, e);
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
index aaefae037..cbe343f2c 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
@@ -35,6 +35,7 @@ import jogamp.newt.driver.android.event.AndroidNewtEventFactory;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.egl.EGLGraphicsDevice;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLException;
@@ -212,6 +213,10 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
return new Point(x,y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // nop ..
+ }
+
//----------------------------------------------------------------------
// Surface Callbacks
//
@@ -262,5 +267,5 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
protected static native boolean initIDs();
protected static native long getSurfaceHandle(Surface surface);
protected static native void setSurfaceVisualID(long surfaceHandle, int nativeVisualID);
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
index e05c6d63a..3ed0c758d 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java
@@ -181,15 +181,12 @@ public class AWTWindow extends WindowImpl {
}
- @Override
- public javax.media.nativewindow.util.Insets getInsets() {
- final int insets[] = new int[] { 0, 0, 0, 0 };
+ protected void updateInsetsImpl(javax.media.nativewindow.util.Insets insets) {
Insets contInsets = container.getInsets();
- insets[0] = contInsets.top;
- insets[1] = contInsets.left;
- insets[2] = contInsets.bottom;
- insets[3] = contInsets.right;
- return new javax.media.nativewindow.util.Insets(insets[0],insets[1],insets[2],insets[3]);
+ insets.setLeftWidth(contInsets.left);
+ insets.setRightWidth(contInsets.right);
+ insets.setTopHeight(contInsets.top);
+ insets.setBottomHeight(contInsets.bottom);
}
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, final boolean parentChange, final int fullScreenChange, final int decorationChange) {
diff --git a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Window.java b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Window.java
index 5bb567067..0a7f63a82 100644
--- a/src/newt/classes/jogamp/newt/driver/broadcom/egl/Window.java
+++ b/src/newt/classes/jogamp/newt/driver/broadcom/egl/Window.java
@@ -35,7 +35,7 @@ package jogamp.newt.driver.broadcom.egl;
import jogamp.opengl.egl.*;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -119,6 +119,9 @@ public class Window extends jogamp.newt.WindowImpl {
return new Point(x,y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // nop ..
+ }
@Override
public boolean surfaceSwap() {
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/Window.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/Window.java
index 0e9a17b09..5e312f24d 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/Window.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/Window.java
@@ -34,6 +34,7 @@
package jogamp.newt.driver.intel.gdl;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
public class Window extends jogamp.newt.WindowImpl {
@@ -128,6 +129,10 @@ public class Window extends jogamp.newt.WindowImpl {
return new Point(x,y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // nop ..
+ }
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java b/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
index 2befaa9aa..f63233b37 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/KDWindow.java
@@ -36,7 +36,7 @@ package jogamp.newt.driver.kd;
import jogamp.newt.*;
import jogamp.opengl.egl.*;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -118,6 +118,10 @@ public class KDWindow extends WindowImpl {
return new Point(x,y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // nop ..
+ }
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java
index 19a374511..c38c83972 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java
@@ -132,9 +132,6 @@ public class MacWindow extends WindowImpl {
private volatile long surfaceHandle;
- // non fullscreen dimensions ..
- private final Insets insets = new Insets(0,0,0,0);
-
static {
MacDisplay.initSingleton();
}
@@ -173,19 +170,6 @@ public class MacWindow extends WindowImpl {
return surfaceHandle;
}
- @Override
- public Insets getInsets() {
- // in order to properly calculate insets we need the window to be
- // created
- nsViewLock.lock();
- try {
- createWindow(false, getX(), getY(), getWidth(), getHeight(), isFullscreen());
- return (Insets) insets.clone();
- } finally {
- nsViewLock.unlock();
- }
- }
-
private RecursiveLock nsViewLock = new RecursiveLock();
@Override
@@ -273,19 +257,10 @@ public class MacWindow extends WindowImpl {
return null;
}
- private void insetsChanged(int left, int top, int right, int bottom) {
- if (DEBUG_IMPLEMENTATION) {
- System.err.println(Thread.currentThread().getName()+
- " Insets changed to " + left + ", " + top + ", " + right + ", " + bottom);
- }
- if (left != -1 && top != -1 && right != -1 && bottom != -1) {
- insets.left = left;
- insets.top = top;
- insets.right = right;
- insets.bottom = bottom;
- }
+ protected void updateInsetsImpl(Insets insets) {
+ // nop - using event driven insetsChange(..)
}
-
+
private char convertKeyChar(char keyChar) {
if (keyChar == '\r') {
// Turn these into \n
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java b/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java
index 029819913..d6ca64d24 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowsWindow.java
@@ -46,7 +46,6 @@ public class WindowsWindow extends WindowImpl {
private long hmon;
private long hdc;
private long windowHandleClose;
- private final Insets insets = new Insets(0, 0, 0, 0);
static {
WindowsDisplay.initSingleton();
@@ -167,15 +166,14 @@ public class WindowsWindow extends WindowImpl {
setTitle0(getWindowHandle(), title);
}
- @Override
- public Insets getInsets() {
- return (Insets)insets.clone();
- }
-
protected Point getLocationOnScreenImpl(int x, int y) {
return GDI.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // nop - using event driven insetsChange(..)
+ }
+
//----------------------------------------------------------------------
// Internals only
//
@@ -193,17 +191,4 @@ public class WindowsWindow extends WindowImpl {
private static native void setTitle0(long windowHandle, String title);
private native void requestFocus0(long windowHandle, boolean force);
- private void insetsChanged(int left, int top, int right, int bottom) {
- if (left != -1 && top != -1 && right != -1 && bottom != -1) {
- if (left != insets.left || top != insets.top || right != insets.right || bottom != insets.bottom) {
- insets.left = left;
- insets.top = top;
- insets.right = right;
- insets.bottom = bottom;
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.insetsChanged: "+insets);
- }
- }
- }
- }
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11Window.java b/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
index 0efb32cc3..265bec898 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11Window.java
@@ -37,6 +37,7 @@ import jogamp.nativewindow.x11.X11Util;
import jogamp.newt.WindowImpl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
+import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
public class X11Window extends WindowImpl {
@@ -119,6 +120,10 @@ public class X11Window extends WindowImpl {
return X11Util.GetRelativeLocation( getDisplayEDTHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
+ protected void updateInsetsImpl(Insets insets) {
+ // TODO !!
+ }
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index cba69498a..cd435eb1d 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -173,7 +173,7 @@ static jmethodID windowDestroyNotifyID = NULL;
jint right = (jint)(frameRect.size.width - (contentRect.size.width + l));
(*env)->CallVoidMethod(env, javaWindowObject, insetsChangedID,
- left, top, right, bottom);
+ left, right, top, bottom);
}
- (id) initWithContentRect: (NSRect) contentRect