diff options
author | Sven Gothel <[email protected]> | 2011-09-24 04:27:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-24 04:27:16 +0200 |
commit | 71d13d8a581ffa68a9a8c3c690c1fa9ea76663ba (patch) | |
tree | 967323e1651976608e6d2b9d1275f042fae72634 /src | |
parent | 187e0b768e28c7cb712a00bcd6f103d3a7bd64c5 (diff) |
CreateWindow set visible; lockSurface: lock AWT if available
Diffstat (limited to 'src')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java index 8706983cc..1f471b9b5 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/MacWindow.java @@ -39,7 +39,10 @@ import javax.media.nativewindow.*; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.newt.event.*; + +import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.newt.*; + import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.Point; @@ -179,6 +182,9 @@ public class MacWindow extends WindowImpl { @Override protected int lockSurfaceImpl() { + if(NativeWindowFactory.isAWTAvailable()) { + JAWTUtil.lockToolkit(); + } nsViewLock.lock(); return LOCK_SUCCESS; } @@ -186,6 +192,9 @@ public class MacWindow extends WindowImpl { @Override protected void unlockSurfaceImpl() { nsViewLock.unlock(); + if(NativeWindowFactory.isAWTAvailable()) { + JAWTUtil.unlockToolkit(); + } } @Override @@ -220,9 +229,6 @@ public class MacWindow extends WindowImpl { if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) { if (0 != ( FLAG_IS_VISIBLE & flags)) { createWindow(false, x, y, width, height, 0 != ( FLAG_IS_FULLSCREEN & flags)); - if (getWindowHandle() != 0) { - makeKeyAndOrderFront0(getWindowHandle()); - } } else { if (getWindowHandle() != 0) { orderOut0(getWindowHandle()); @@ -234,9 +240,6 @@ public class MacWindow extends WindowImpl { 0 != ( FLAG_CHANGE_PARENTING & flags) || 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) { createWindow(true, x, y, width, height, 0 != ( FLAG_IS_FULLSCREEN & flags)); - if (getWindowHandle() != 0) { - makeKeyAndOrderFront0(getWindowHandle()); - } } else { if(x>=0 || y>=0) { setFrameTopLeftPoint0(getParentWindowHandle(), getWindowHandle(), x, y); @@ -391,16 +394,17 @@ public class MacWindow extends WindowImpl { } surfaceHandle = contentView0(getWindowHandle()); setTitle0(getWindowHandle(), getTitle()); - // don't make the window visible on window creation - // makeKeyAndOrderFront0(windowHandle); + makeKeyAndOrderFront0(getWindowHandle()); // } } ); } catch (Exception ie) { ie.printStackTrace(); } - enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED); - enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_RESIZED); - enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_GAINED_FOCUS); + if(recreate) { + enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED); + enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_RESIZED); + enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_GAINED_FOCUS); + } } protected static native boolean initIDs0(); |