diff options
author | Sven Gothel <[email protected]> | 2019-04-05 05:54:48 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-04-05 05:54:48 +0200 |
commit | 1c697274a3c1e976bd9c9b089d6583edf4f346ae (patch) | |
tree | 81e34ba1c905a36dc5bd6b090b9f79b3ccab8ea6 /src/nativewindow | |
parent | 38cb6fa11f00fb358b8bbe40dc79443a5f30269f (diff) |
Bug 1370: Call from Main-Thread: NW's OSXUtil.CreateNSWindow0(..) and NEWT's WindowDriver.createWindow0(..)
OSX 10.14.3 Mojave issues a WARNING: NSWindow drag regions should only be invalidated on the Main Thread! This will throw an exception in the future.
The complaint about NativeWindow (NW)'s OSXUtil.CreateNSWindow0(..)
might be valid, which does create a NS Window instance w/ NSView and framebuffer initialized.
However, the complaint about NEWT's WindowDriver.createWindow0(..)
is not, since the initialization incl framebuffer happened later
on the main thread.
Regardless, encapsulated both construction fully to run on the Main-Thread.
+++
Originally the Main-Thread design spec was like:
Must run on Main-Thread when or after making visible.
Oh well.
Diffstat (limited to 'src/nativewindow')
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index f71dff1cb..b1bf248ce 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -31,7 +31,6 @@ import com.jogamp.nativewindow.NativeWindowException; import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.util.Insets; import com.jogamp.nativewindow.util.Point; - import com.jogamp.common.util.Function; import com.jogamp.common.util.FunctionTask; import com.jogamp.common.util.InterruptedRuntimeException; @@ -124,10 +123,16 @@ public class OSXUtil implements ToolkitProperties { } public static long CreateNSWindow(final int x, final int y, final int width, final int height) { - return CreateNSWindow0(x, y, width, height); + final long res[] = { 0 }; + RunOnMainThread(true, false /* kickNSApp */, new Runnable() { + @Override + public void run() { + res[0] = CreateNSWindow0(x, y, width, height); + } } ); + return res[0]; } public static void DestroyNSWindow(final long nsWindow) { - DestroyNSWindow0(nsWindow); + DestroyNSWindow0(nsWindow); } public static long GetNSView(final long nsWindow) { return GetNSView0(nsWindow); |