aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-11-10 04:41:31 +0100
committerSven Gothel <[email protected]>2011-11-10 04:41:31 +0100
commit1eafd5b458db26ae47a836969968aded584abc70 (patch)
treebae4284f0af33cd05504f129d0fb9a495fdd65ab /src/nativewindow
parentd1ac91ae3e8fab5176cb677a20fd764f04a00cc8 (diff)
Fix MacOSXJAWTWindow: Impl. SurfaceChangeable ; Proper invalidateNative()
Impl. SurfaceChangeable (regression 8f5465396fe429ce6b7ecae808416691271c7867) - offscreenSurfaceLayer code requires instanceof SurfaceChangeable - overwrite JAWTWindow size getter: use surfaceSizeChanged() values if used. Proper invalidateNative() - detach JAWTSurfaceLayer if set - destroy dummy NSWindow (was typo)
Diffstat (limited to 'src/nativewindow')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java45
2 files changed, 38 insertions, 11 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
index 41f79c98f..109ae020f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTWindow.java
@@ -246,11 +246,11 @@ public abstract class JAWTWindow implements NativeWindow {
return config.getScreen().getIndex();
}
- public final int getWidth() {
+ public int getWidth() {
return component.getWidth();
}
- public final int getHeight() {
+ public int getHeight() {
return component.getHeight();
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index ec070e404..71b297791 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -49,6 +49,7 @@ import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.SurfaceChangeable;
import javax.media.nativewindow.util.Point;
import jogamp.nativewindow.jawt.JAWT;
@@ -60,7 +61,7 @@ import jogamp.nativewindow.jawt.JAWT_DrawingSurfaceInfo;
import jogamp.nativewindow.jawt.JAWT_Rectangle;
import jogamp.nativewindow.macosx.OSXUtil;
-public class MacOSXJAWTWindow extends JAWTWindow {
+public class MacOSXJAWTWindow extends JAWTWindow implements SurfaceChangeable {
public MacOSXJAWTWindow(Object comp, AbstractGraphicsConfiguration config) {
super(comp, config);
isOffscreenLayerSurface = JAWTUtil.isCachedJAWTUsingOffscreenLayer();
@@ -72,9 +73,15 @@ public class MacOSXJAWTWindow extends JAWTWindow {
protected void invalidateNative() {
surfaceHandle=0;
- if(isOffscreenLayerSurface && 0 == drawable) {
- OSXUtil.DestroyNSWindow(drawable);
- drawable = 0;
+ if(isOffscreenLayerSurface) {
+ if(0 != drawable) {
+ OSXUtil.DestroyNSWindow(drawable);
+ drawable = 0;
+ }
+ if(0 != surfaceLayerHandle && null!=dsi) {
+ OSXUtil.AttachJAWTSurfaceLayer(dsi, 0);
+ }
+ surfaceLayerHandle = 0;
}
}
@@ -95,7 +102,21 @@ public class MacOSXJAWTWindow extends JAWTWindow {
}
this.surfaceHandle = surfaceHandle;
}
-
+
+ public void surfaceSizeChanged(int width, int height) {
+ sscSet = true;
+ sscWidth = width;
+ sscHeight = height;
+ }
+
+ public int getWidth() {
+ return sscSet ? sscWidth : super.getWidth();
+ }
+
+ public int getHeight() {
+ return sscSet ? sscHeight: super.getHeight();
+ }
+
/*
public long getSurfaceLayer() {
if( !isLayeredSurface() ) {
@@ -120,7 +141,10 @@ public class MacOSXJAWTWindow extends JAWTWindow {
if(DEBUG) {
System.err.println("MacOSXJAWTWindow.attachSurfaceLayer(): 0x"+Long.toHexString(layerHandle));
}
- OSXUtil.AttachJAWTSurfaceLayer(dsi, layerHandle);
+ if(!OSXUtil.AttachJAWTSurfaceLayer(dsi, layerHandle)) {
+ throw new NativeWindowException("Could not attach JAWT surfaceLayerHandle: "+this);
+ }
+ surfaceLayerHandle = layerHandle;
} finally {
unlockSurface();
}
@@ -285,9 +309,12 @@ public class MacOSXJAWTWindow extends JAWTWindow {
private JAWT_MacOSXDrawingSurfaceInfo macosxdsi;
// private JAWT_SurfaceLayers macosxsl;
- final boolean isOffscreenLayerSurface;
- long surfaceHandle = 0;
-
+ private final boolean isOffscreenLayerSurface;
+ private long surfaceLayerHandle = 0;
+ private long surfaceHandle = 0;
+ private int sscWidth, sscHeight;
+ private boolean sscSet = false;
+
// Workaround for instance of 4796548
private boolean firstLock = true;