diff options
author | Sven Gothel <[email protected]> | 2011-09-16 12:40:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-16 12:40:46 +0200 |
commit | e228acfcf5be36fb161043bb2ae21f8d60bc6ca4 (patch) | |
tree | b1e6d96b062f96dd1f857f96a04b85fcf76f85d7 /src/newt/classes/jogamp | |
parent | aca09874bd3abe651f88ead28154fa2feefbd6a6 (diff) |
NEWT Cleanup: AWT driver fix, WindowImpl createNative .., minor edits
AWT driver fix
- setVisible at creation, using reconfigureWindow impl (fixed
WindowImpl createNative ..,
- no double visibility check on creation
- visible:=true anyway for later creation, if failed or not available yet
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 7 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java | 34 |
2 files changed, 20 insertions, 21 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index dd8752613..420e9d1fa 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -294,7 +294,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } // always flag visible, // allowing to retry if visible && !isNativeValid() - setVisibleImpl(true, x, y, width, height); + visible = true; } } finally { if(null!=parentWindow) { @@ -693,10 +693,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!isNativeValid() && visible) { if( 0<width*height ) { nativeWindowCreated = createNative(); - if(nativeWindowCreated) { - WindowImpl.this.waitForVisible(visible, true); - madeVisible = visible; - } + madeVisible = nativeWindowCreated; } } else if(WindowImpl.this.visible != visible) { if(isNativeValid()) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java index 531b8d2a8..d71015d6c 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java +++ b/src/newt/classes/jogamp/newt/driver/awt/AWTWindow.java @@ -120,10 +120,9 @@ public class AWTWindow extends WindowImpl { container.setLocation(x, y); new AWTWindowAdapter(this).addTo(container); // fwd all AWT Window events to here - if(null!=frame) { - frame.setUndecorated(isUndecorated()); - } - + reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); + // throws exception if failed .. + setWindowHandle(1); // just a marker .. } @@ -175,11 +174,7 @@ public class AWTWindow extends WindowImpl { insets.setBottomHeight(contInsets.bottom); } - protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { - if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { - container.setVisible(0 != ( FLAG_IS_VISIBLE & flags)); - } - + protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) { if(0 != ( FLAG_CHANGE_DECORATION & flags) && null!=frame) { if(!container.isDisplayable()) { frame.setUndecorated(isUndecorated()); @@ -189,6 +184,11 @@ public class AWTWindow extends WindowImpl { } } } + + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { + container.setVisible(0 != ( FLAG_IS_VISIBLE & flags)); + } + x=(x>=0)?x:AWTWindow.this.x; y=(x>=0)?y:AWTWindow.this.y; width=(width>0)?width:AWTWindow.this.width; @@ -199,14 +199,16 @@ public class AWTWindow extends WindowImpl { container.setSize(width + insets.left + insets.right, height + insets.top + insets.bottom); - if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { - config = canvas.getAWTGraphicsConfiguration(); - - if (config == null) { - throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this); + if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { + if( 0 != ( FLAG_IS_VISIBLE & flags ) ) { + if( !hasDeviceChanged() ) { + // oops ?? + config = canvas.getAWTGraphicsConfiguration(); + if(null == config) { + throw new NativeWindowException("Error: !hasDeviceChanged && null == GraphicsConfiguration: "+this); + } + } } - - updateDeviceData(); visibleChanged(0 != ( FLAG_IS_VISIBLE & flags)); } |