diff options
Diffstat (limited to 'src/newt/classes/jogamp')
13 files changed, 124 insertions, 86 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index afb1ad020..a9fc28a33 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -148,8 +148,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private volatile long windowHandle = 0; // lifecycle critical private volatile boolean visible = false; // lifecycle critical private volatile boolean hasFocus = false; - private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user - private volatile int x = 64, y = 64; // client-area pos w/o insets + private volatile int pixWidth = 128, pixHeight = 128; // client-area size w/o insets in pixel units, default: may be overwritten by user + private volatile int winWidth = 128, winHeight = 128; // client-area size w/o insets in window units, default: may be overwritten by user + private volatile int x = 64, y = 64; // client-area pos w/o insets in window units private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated) private boolean blockInsetsChange = false; // block insets change (from same thread) @@ -910,7 +911,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final MonitorDevice getMainMonitor() { - return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight())); + return screen.getMainMonitor(new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight())); } protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) { @@ -934,7 +935,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(!isNativeValid() && visible) { - if( 0<getWidth()*getHeight() ) { + if( 0<getSurfaceWidth()*getSurfaceHeight() ) { nativeWindowCreated = createNative(); madeVisible = nativeWindowCreated; } @@ -942,7 +943,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer WindowImpl.this.visible = true; } else if(WindowImpl.this.visible != visible) { if(isNativeValid()) { - setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight()); + setVisibleImpl(visible, getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); WindowImpl.this.waitForVisible(visible, false); madeVisible = visible; } else { @@ -965,7 +966,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible); + System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible); } } finally { if(null!=lifecycleHook) { @@ -993,7 +994,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final void setVisible(boolean wait, boolean visible) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)); + System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)); } runOnEDTIfAvail(wait, new VisibleAction(visible)); } @@ -1018,9 +1019,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final RecursiveLock _lock = windowLock; _lock.lock(); try { - if ( ( disregardFS || !isFullscreen() ) && ( getWidth() != width || getHeight() != height ) ) { + if ( ( disregardFS || !isFullscreen() ) && ( getSurfaceWidth() != width || getSurfaceHeight() != height ) ) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setSize: START "+getWidth()+"x"+getHeight()+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible); + System.err.println("Window setSize: START "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible); } int visibleAction; // 0 nop, 1 invisible, 2 visible (create) if ( visible && isNativeValid() && ( 0 >= width || 0 >= height ) ) { @@ -1040,7 +1041,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer defineSize(width, height); } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setSize: END "+getWidth()+"x"+getHeight()+", visibleAction "+visibleAction); + System.err.println("Window setSize: END "+getSurfaceWidth()+"x"+getSurfaceHeight()+", visibleAction "+visibleAction); } switch(visibleAction) { case 1: setVisibleActionImpl(false); break; @@ -1247,8 +1248,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // mirror pos/size so native change notification can get overwritten final int oldX = getX(); final int oldY = getY(); - final int oldWidth = getWidth(); - final int oldHeight = getHeight(); + final int oldWidth = getSurfaceWidth(); + final int oldHeight = getSurfaceHeight(); final int x, y; int width = oldWidth; int height = oldHeight; @@ -1299,11 +1300,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer y = 0; // refit if size is bigger than parent - if( width > newParentWindow.getWidth() ) { - width = newParentWindow.getWidth(); + if( width > newParentWindow.getSurfaceWidth() ) { + width = newParentWindow.getSurfaceWidth(); } - if( height > newParentWindow.getHeight() ) { - height = newParentWindow.getHeight(); + if( height > newParentWindow.getSurfaceHeight() ) { + height = newParentWindow.getSurfaceHeight(); } // Case: Child Window @@ -1510,7 +1511,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); + System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()); } } finally { if(null!=lifecycleHook) { @@ -1534,7 +1535,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); + System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()); } } } @@ -1611,8 +1612,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Mirror pos/size so native change notification can get overwritten final int x = getX(); final int y = getY(); - final int width = getWidth(); - final int height = getHeight(); + final int width = getSurfaceWidth(); + final int height = getSurfaceHeight(); DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date @@ -1657,8 +1658,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Mirror pos/size so native change notification can get overwritten final int x = getX(); final int y = getY(); - final int width = getWidth(); - final int height = getHeight(); + final int width = getSurfaceWidth(); + final int height = getSurfaceHeight(); DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date @@ -1823,7 +1824,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!setVal) { if(confine) { requestFocus(); - warpPointer(getWidth()/2, getHeight()/2); + warpPointer(getSurfaceWidth()/2, getSurfaceHeight()/2); } setVal = confinePointerImpl(confine); if(confine) { @@ -1857,13 +1858,39 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final int getWidth() { - return width; + public final int getSurfaceWidth() { + return pixWidth; } @Override - public final int getHeight() { - return height; + public final int getSurfaceHeight() { + return pixHeight; + } + + @Override + public final int getWindowWidth() { + return getSurfaceWidth(); // FIXME: Use 'scale' or an actual pixel-width + } + + @Override + public final int getWindowHeight() { + return getSurfaceHeight(); // FIXME: Use 'scale' or an actual pixel-width + } + + @Override + public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { + final int scale = 1; // FIXME: Use 'scale' .. + result[0] = pixelUnitXY[0] / scale; + result[1] = pixelUnitXY[1] / scale; + return result; + } + + @Override + public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { + final int scale = 1; // FIXME: Use 'scale' .. + result[0] = windowUnitXY[0] * scale; + result[1] = windowUnitXY[1] * scale; + return result; } @Override @@ -1888,13 +1915,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer this.x = x; this.y = y; } - /** Sets the size fields {@link #width} and {@link #height} to the given values. */ + /** Sets the size fields {@link #pixWidth} and {@link #pixHeight} to the given values. */ protected final void defineSize(int width, int height) { if(DEBUG_IMPLEMENTATION) { - System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height); + System.err.println("defineSize: "+this.pixWidth+"x"+this.pixHeight+" -> "+width+"x"+height); // Thread.dumpStack(); } - this.width = width; this.height = height; + this.pixWidth = width; this.pixHeight = height; } @Override @@ -1965,7 +1992,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer "\n, ParentWindowHandle "+toHexString(parentWindowHandle)+" ("+(0!=getParentWindowHandle())+")"+ "\n, WindowHandle "+toHexString(getWindowHandle())+ "\n, SurfaceHandle "+toHexString(getSurfaceHandle())+ " (lockedExt window "+windowLock.isLockedByOtherThread()+", surface "+isSurfaceLockedByOtherThread()+")"+ - "\n, Pos "+getX()+"/"+getY()+" (auto "+autoPosition()+"), size "+getWidth()+"x"+getHeight()+ + "\n, Pos "+getX()+"/"+getY()+" (auto "+autoPosition()+"), size "+getSurfaceWidth()+"x"+getSurfaceHeight()+ "\n, Visible "+isVisible()+", focus "+hasFocus()+ "\n, Undecorated "+undecorated+" ("+isUndecorated()+")"+ "\n, AlwaysOnTop "+alwaysOnTop+", Fullscreen "+fullscreen+ @@ -2111,7 +2138,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if ( !isFullscreen() && ( getX() != x || getY() != y || null != getParent()) ) { if(isNativeValid()) { // this.x/this.y will be set by sizeChanged, triggered by windowing event system - reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible())); + reconfigureWindowImpl(x, y, getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(0, isVisible())); if( null == parentWindow ) { // Wait until custom position is reached within tolerances waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW); @@ -2159,8 +2186,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer try { final int oldX = getX(); final int oldY = getY(); - final int oldWidth = getWidth(); - final int oldHeight = getHeight(); + final int oldWidth = getSurfaceWidth(); + final int oldHeight = getSurfaceHeight(); int x,y,w,h; @@ -2213,11 +2240,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer y = 0; // refit if size is bigger than parent - if( w > parentWindow.getWidth() ) { - w = parentWindow.getWidth(); + if( w > parentWindow.getSurfaceWidth() ) { + w = parentWindow.getSurfaceWidth(); } - if( h > parentWindow.getHeight() ) { - h = parentWindow.getHeight(); + if( h > parentWindow.getSurfaceHeight() ) { + h = parentWindow.getSurfaceHeight(); } } } @@ -2388,10 +2415,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Simply move/resize window to fit in virtual screen if required final RectangleImmutable viewport = screen.getViewport(); if( viewport.getWidth() > 0 && viewport.getHeight() > 0 ) { // failsafe - final RectangleImmutable rect = new Rectangle(getX(), getY(), getWidth(), getHeight()); + final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); final RectangleImmutable isect = viewport.intersection(rect); - if ( getHeight() > isect.getHeight() || - getWidth() > isect.getWidth() ) { + if ( getSurfaceHeight() > isect.getHeight() || + getSurfaceWidth() > isect.getWidth() ) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.monitorModeChanged: fit window "+rect+" into screen viewport "+viewport+ ", due to minimal intersection "+isect); @@ -2414,7 +2441,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if( fullscreenMonitors.contains(md) ) { final RectangleImmutable viewport = MonitorDevice.unionOfViewports(new Rectangle(), fullscreenMonitors); if(DEBUG_IMPLEMENTATION) { - final RectangleImmutable rect = new Rectangle(getX(), getY(), getWidth(), getHeight()); + final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); System.err.println("Window.monitorModeChanged: FS Monitor Match: Fit window "+rect+" into new viewport union "+viewport+", provoked by "+md); } definePosition(viewport.getX(), viewport.getY()); // set pos for setVisible(..) or createNative(..) - reduce EDT roundtrip @@ -2735,7 +2762,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // int x = pX[0]; int y = pY[0]; - final boolean insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight(); + final boolean insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight(); final Point movePositionP0 = pState1.getMovePosition(pID[0]); switch( eventType ) { case MouseEvent.EVENT_MOUSE_EXITED: @@ -2774,8 +2801,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return; } // clip coordinates to window dimension - x = Math.min(Math.max(x, 0), getWidth()-1); - y = Math.min(Math.max(y, 0), getHeight()-1); + x = Math.min(Math.max(x, 0), getSurfaceWidth()-1); + y = Math.min(Math.max(y, 0), getSurfaceHeight()-1); break; case MouseEvent.EVENT_MOUSE_MOVED: @@ -2938,7 +2965,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int y = pe.getY(); if(DEBUG_MOUSE_EVENT) { - System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+" clientSize["+getWidth()+"x"+getHeight()+"]"); + System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+", win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } // @@ -2962,8 +2990,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! case MouseEvent.EVENT_MOUSE_ENTERED: // clip coordinates to window dimension - x = Math.min(Math.max(x, 0), getWidth()-1); - y = Math.min(Math.max(y, 0), getHeight()-1); + x = Math.min(Math.max(x, 0), getSurfaceWidth()-1); + y = Math.min(Math.max(y, 0), getSurfaceHeight()-1); pState0.clearButton(); if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) { insideWindow = true; @@ -2986,20 +3014,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! default: - insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight(); + insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getWindowHeight(); if( pe.getPointerType(0) == PointerType.Mouse ) { if( !pState0.insideWindow && insideWindow ) { // ENTER .. use clipped coordinates eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getWidth()-1), - Math.min(Math.max(y, 0), getHeight()-1), + Math.min(Math.max(x, 0), getSurfaceWidth()-1), + Math.min(Math.max(y, 0), getSurfaceHeight()-1), (short)0, (short)0, pe.getRotation(), pe.getRotationScale()); pState0.exitSent = false; } else if( !insideWindow && eExitAllowed ) { // EXIT .. use clipped coordinates eExited = new MouseEvent(MouseEvent.EVENT_MOUSE_EXITED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getWidth()-1), - Math.min(Math.max(y, 0), getHeight()-1), + Math.min(Math.max(x, 0), getSurfaceWidth()-1), + Math.min(Math.max(y, 0), getSurfaceHeight()-1), (short)0, (short)0, pe.getRotation(), pe.getRotationScale()); pState0.exitSent = true; } @@ -3505,7 +3533,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected void consumeWindowEvent(WindowEvent e) { if(DEBUG_IMPLEMENTATION) { - System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); + System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+", win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } for(int i = 0; !e.isConsumed() && i < windowListeners.size(); i++ ) { WindowListener l = windowListeners.get(i); @@ -3597,9 +3626,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */ protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { - if(force || getWidth() != newWidth || getHeight() != newHeight) { + if(force || getSurfaceWidth() != newWidth || getSurfaceHeight() != newHeight) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+getWidth()+"x"+getHeight()+" -> "+newWidth+"x"+newHeight+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); + System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+newWidth+"x"+newHeight+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); } if(0>newWidth || 0>newHeight) { throw new NativeWindowException("Illegal width or height "+newWidth+"x"+newHeight+" (must be >= 0)"); @@ -3619,12 +3648,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date long sleep; - for(sleep = timeOut; 0<sleep && w!=getWidth() && h!=getHeight(); sleep-=10 ) { + for(sleep = timeOut; 0<sleep && w!=getSurfaceWidth() && h!=getSurfaceHeight(); sleep-=10 ) { try { Thread.sleep(10); } catch (InterruptedException ie) {} display.dispatchMessagesNative(); // status up2date } if(0 >= sleep) { - final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getWidth()+"x"+getHeight(); + final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getSurfaceWidth()+"x"+getSurfaceHeight(); if(failFast) { throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { @@ -3775,10 +3804,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** * Triggered by implementation's WM events to update the content + * @param defer if true sent event later, otherwise wait until processed. + * @param x dirty-region y-pos in pixels + * @param y dirty-region x-pos in pixels + * @param width dirty-region width in pixels + * @param height dirty-region height in pixels */ protected final void windowRepaint(boolean defer, int x, int y, int width, int height) { - width = ( 0 >= width ) ? getWidth() : width; - height = ( 0 >= height ) ? getHeight() : height; + width = ( 0 >= width ) ? getSurfaceWidth() : width; + height = ( 0 >= height ) ? getSurfaceHeight() : height; if(DEBUG_IMPLEMENTATION) { System.err.println("Window.windowRepaint "+getThreadName()+" (defer: "+defer+") "+x+"/"+y+" "+width+"x"+height); } diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 770502326..8b6bb95a9 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java @@ -124,7 +124,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt final int cw = comp.getWidth(); final int ch = comp.getHeight(); if( 0 < cw && 0 < ch ) { - if( newtChild.getWidth() != cw || newtChild.getHeight() != ch ) { + if( newtChild.getSurfaceWidth() != cw || newtChild.getSurfaceHeight() != ch ) { newtChild.setSize(cw, ch); final boolean v = comp.isShowing(); // compute showing-state throughout hierarchy if(v != newtChild.isVisible()) { diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java index 76eb890e2..5fe378f2c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -228,8 +228,8 @@ public class NewtBaseActivity extends Activity { androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } - if(newtWindow.getWidth()>0 && newtWindow.getHeight()>0 && !newtWindow.isFullscreen()) { - androidWindow.setLayout(newtWindow.getWidth(), newtWindow.getHeight()); + if(newtWindow.getSurfaceWidth()>0 && newtWindow.getSurfaceHeight()>0 && !newtWindow.isFullscreen()) { + androidWindow.setLayout(newtWindow.getSurfaceWidth(), newtWindow.getSurfaceHeight()); } } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index 259acb8f3..09de62326 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -83,7 +83,7 @@ public class NewtVersionActivity extends NewtBaseActivity { glWindow.setSize(32, 32); glWindow.setPosition(0, 0); final android.view.View androidGLView = ((WindowDriver)glWindow.getDelegatedWindow()).getAndroidView(); - viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT)); registerNEWTWindow(glWindow); glWindow.addGLEventListener(new GLEventListener() { diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 9af455445..20163f96c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -304,7 +304,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { if(null == androidView) { setupAndroidView( StaticContext.getContext() ); } - viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getWidth(), getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getSurfaceWidth(), getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT)); Log.d(MD.TAG, "canCreateNativeImpl: added to static ViewGroup - on thread "+Thread.currentThread().getName()); } }); for(long sleep = TIMEOUT_NATIVEWINDOW; 0<sleep && 0 == surfaceHandle; sleep-=10 ) { @@ -334,7 +334,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex()); Log.d(MD.TAG, "createNativeImpl 0 - eglDevice 0x"+Integer.toHexString(eglDevice.hashCode())+", "+eglDevice+", surfaceHandle 0x"+Long.toHexString(surfaceHandle)+ - ", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + ", format [a "+androidFormat+", n "+nativeFormat+"], win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+ + "] - on thread "+Thread.currentThread().getName()); if(0!=getParentWindowHandle()) { throw new NativeWindowException("Window parenting not supported (yet)"); @@ -379,7 +381,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { Log.d(MD.TAG, "closeNativeImpl 0 - eglDevice 0x"+Integer.toHexString(eglDevice.hashCode())+", "+eglDevice+", surfaceHandle 0x"+Long.toHexString(surfaceHandle)+ ", eglSurfaceHandle 0x"+Long.toHexString(eglSurface)+ - ", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + ", format [a "+androidFormat+", n "+nativeFormat+"], win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+ + " - on thread "+Thread.currentThread().getName()); if(WindowImpl.DEBUG_IMPLEMENTATION) { Thread.dumpStack(); } @@ -458,7 +462,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { Log.d(MD.TAG, "reconfigureWindowImpl.setFullscreen post creation (setContentView()) n/a"); return false; } - if(getWidth() != width || getHeight() != height) { + if(getSurfaceWidth() != width || getSurfaceHeight() != height) { if(0!=getWindowHandle()) { Log.d(MD.TAG, "reconfigureWindowImpl.setSize n/a"); res = false; @@ -544,7 +548,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { @Override public final void surfaceCreated(SurfaceHolder holder) { - Log.d(MD.TAG, "surfaceCreated: "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + Log.d(MD.TAG, "surfaceCreated: "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+" - on thread "+Thread.currentThread().getName()); } @Override @@ -611,7 +615,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { @Override public final void surfaceRedrawNeeded(SurfaceHolder holder) { Log.d(MD.TAG, "surfaceRedrawNeeded - on thread "+Thread.currentThread().getName()); - windowRepaint(0, 0, getWidth(), getHeight()); + windowRepaint(0, 0, getSurfaceWidth(), getSurfaceHeight()); } protected boolean handleKeyCodeBack(KeyEvent.DispatcherState state, android.view.KeyEvent event) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index 9854524d9..965426d4e 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java @@ -132,7 +132,7 @@ public class WindowDriver extends WindowImpl { new AWTWindowAdapter(new LocalWindowListener(), this).addTo(awtCanvas); // fwd all AWT Window events to here } - reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); + reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); // throws exception if failed .. final NativeWindow nw = awtCanvas.getNativeWindow(); @@ -297,7 +297,7 @@ public class WindowDriver extends WindowImpl { System.err.println("Window Resized: "+awtCanvas); } WindowDriver.this.sizeChanged(false, awtCanvas.getWidth(), awtCanvas.getHeight(), true); - WindowDriver.this.windowRepaint(false, 0, 0, getWidth(), getHeight()); + WindowDriver.this.windowRepaint(false, 0, 0, getSurfaceWidth(), getSurfaceHeight()); } } @Override @@ -322,7 +322,7 @@ public class WindowDriver extends WindowImpl { if(DEBUG_IMPLEMENTATION) { System.err.println("Window Repaint: "+awtCanvas); } - WindowDriver.this.windowRepaint(false, 0, 0, getWidth(), getHeight()); + WindowDriver.this.windowRepaint(false, 0, 0, getSurfaceWidth(), getSurfaceHeight()); } } } diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java index 39f168e0f..5b0d21c66 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java @@ -67,7 +67,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { setGraphicsConfiguration(cfg); setSizeImpl(getScreen().getWidth(), getScreen().getHeight()); - setWindowHandle(realizeWindow(true, getWidth(), getHeight())); + setWindowHandle(realizeWindow(true, getSurfaceWidth(), getSurfaceHeight())); if (0 == getWindowHandle()) { throw new NativeWindowException("Error native Window Handle is null"); } @@ -108,7 +108,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { // n/a in BroadcomEGL System.err.println("BCEGL Window.setSizeImpl n/a in BroadcomEGL with realized window"); } else { - defineSize((width>0)?width:getWidth(), (height>0)?height:getHeight()); + defineSize((width>0)?width:getSurfaceWidth(), (height>0)?height:getSurfaceHeight()); } } if(x>=0 || y>=0) { diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java index c3cb8a84c..817ce3aeb 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java @@ -110,7 +110,7 @@ public class WindowDriver extends WindowImpl { chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque()); } setGraphicsConfiguration(cfg); - nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getWidth(), getHeight(), + nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits()); if (nativeWindowHandle == 0) { throw new NativeWindowException("Error creating egl window: "+cfg); diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java index 0e96c65d0..d86cf7471 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java @@ -66,7 +66,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl { synchronized(WindowDriver.class) { setWindowHandle(nextWindowHandle++); // just a marker - surfaceHandle = CreateSurface(aDevice.getHandle(), getScreen().getWidth(), getScreen().getHeight(), getX(), getY(), getWidth(), getHeight()); + surfaceHandle = CreateSurface(aDevice.getHandle(), getScreen().getWidth(), getScreen().getHeight(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); if (surfaceHandle == 0) { throw new NativeWindowException("Error creating window"); } diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java index 158e6ab2f..35e9227d3 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java @@ -112,8 +112,8 @@ public class WindowDriver extends WindowImpl { } // int _x=(x>=0)?x:this.x; // int _y=(x>=0)?y:this.y; - width=(width>0)?width:getWidth(); - height=(height>0)?height:getHeight(); + width=(width>0)?width:getSurfaceWidth(); + height=(height>0)?height:getSurfaceHeight(); if(width>0 || height>0) { setSize0(eglWindowHandle, width, height); } @@ -158,7 +158,7 @@ public class WindowDriver extends WindowImpl { @Override protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { if(isFullscreen()) { - ((ScreenDriver)getScreen()).sizeChanged(getWidth(), getHeight()); + ((ScreenDriver)getScreen()).sizeChanged(getSurfaceWidth(), getSurfaceHeight()); } super.sizeChanged(defer, newWidth, newHeight, force); } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index e2a57debc..8f3eb1e89 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -70,7 +70,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); } setGraphicsConfiguration(cfg); - reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); + reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); if (0 == getWindowHandle()) { throw new NativeWindowException("Error creating window"); } @@ -236,7 +236,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl if( 0 != handle && !isOffscreenInstance ) { final NativeWindow parent = getParent(); final boolean useParent = useParent(parent); - if( useParent && ( getWidth() != newWidth || getHeight() != newHeight ) ) { + if( useParent && ( getSurfaceWidth() != newWidth || getSurfaceHeight() != newHeight ) ) { final int x=getX(), y=getY(); final Point p0S = getLocationOnScreenImpl(x, y, parent, useParent); if(DEBUG_IMPLEMENTATION) { diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java index a48fe2f62..0fc38f92d 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -145,7 +145,7 @@ public class WindowDriver extends WindowImpl { ( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ; final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(), winVer.getMajor(), winVer.getMinor(), - getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags); + getParentWindowHandle(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), autoPosition(), flags); if ( 0 == _windowHandle ) { throw new NativeWindowException("Error creating window"); } @@ -252,7 +252,7 @@ public class WindowDriver extends WindowImpl { public void run() { final Point p0 = getLocationOnScreenImpl(0, 0); res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine, - p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight())); + p0.getX(), p0.getY(), p0.getX()+getSurfaceWidth(), p0.getY()+getSurfaceHeight())); } }); return res[0].booleanValue(); diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 0eda37eac..2f4ccbfea 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -129,7 +129,7 @@ public class WindowDriver extends WindowImpl { setWindowHandle(CreateWindow(getParentWindowHandle(), edtDevice.getHandle(), screen.getIndex(), visualID, display.getJavaObjectAtom(), display.getWindowDeleteAtom(), - getX(), getY(), getWidth(), getHeight(), autoPosition(), flags, + getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), autoPosition(), flags, defaultIconDataSize, defaultIconData)); } finally { edtDevice.unlock(); @@ -238,7 +238,7 @@ public class WindowDriver extends WindowImpl { public Object run(long dpy) { reconfigureWindow0( dpy, getScreenIndex(), getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(), - getX(), getY(), getWidth(), getHeight(), flags); + getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), flags); return null; } }); |