diff options
author | Sven Gothel <[email protected]> | 2011-09-02 02:18:39 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-02 02:18:39 +0200 |
commit | b4b9041daf6004d041d789cb564b839fac0fb149 (patch) | |
tree | 47d588dff8767f71cab24b84ee3bb470b3c5c180 | |
parent | 7cc793a3c6310085f0e2f89d425b94fe7965c79f (diff) |
Fix NEWT/Window/Windows: setSize/setPosition/reconfigure: 'nop size' -1x-1 -> 0x0
Windows: setPosition was invoking setSize (new size propagation) even w/ nop size,
let WM event wmSize invoke setSize.
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 22 | ||||
-rw-r--r-- | src/newt/native/WindowsWindow.c | 3 |
2 files changed, 9 insertions, 16 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 415de22fa..a0ee5c2b2 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1405,8 +1405,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if ( WindowImpl.this.x != x || WindowImpl.this.y != y ) { if(!fullscreen) { if(0!=windowHandle) { - // this.x/this.y will be set by windowChanged, called by the native implementation - reconfigureWindowImpl(x, y, -1, -1, false, 0, 0); + // this.x/this.y will be set by sizeChanged, triggered by windowing event system + reconfigureWindowImpl(x, y, 0, 0, false, 0, 0); } else { WindowImpl.this.x = x; WindowImpl.this.y = y; @@ -2054,6 +2054,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(DEBUG_IMPLEMENTATION) { System.err.println("Window.sizeChanged: ("+getThreadName()+"): force "+force+", "+width+"x"+height+" -> "+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)"); + } width = newWidth; height = newHeight; if(isNativeValid()) { @@ -2091,22 +2094,15 @@ 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; if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.windowRepaint "+getThreadName()+" - "+x+"/"+y+" "+width+"x"+height); - // Exception ee = new Exception("Window.windowRepaint: "+" - "+x+"/"+y+" "+width+"x"+height); - // ee.printStackTrace(); + System.err.println("Window.windowRepaint "+getThreadName()+" - "+x+"/"+y+" "+_width+"x"+_height); } if(isValid()) { - if(0>width) { - width=this.width; - } - if(0>height) { - height=this.height; - } - 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/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 16b6f8aec..0dd1b6260 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -1435,9 +1435,6 @@ int NewtWindow_setVisiblePosSize(JNIEnv *env, jobject obj, HWND hwnd, jboolean t InvalidateRect(hwnd, NULL, TRUE); UpdateWindow(hwnd); - // we report back the size of client area - (*env)->CallVoidMethod(env, obj, sizeChangedID, (jint) width, (jint) height, JNI_FALSE); - return iRes; } |