From d14d319a6c31003f5b07d51474ebfb71e77f8122 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 31 Jan 2014 10:59:47 +0100 Subject: NewtFactory: Cleanup / createWindow(..) w/ parentWindow variant shall fall back to top-level ctor if parentWindow is null --- src/newt/classes/com/jogamp/newt/NewtFactory.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/newt/classes/com') diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index fc3716a52..9685200eb 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -244,7 +244,7 @@ public class NewtFactory { *

*/ public static Window createWindow(Screen screen, CapabilitiesImmutable caps) { - return createWindowImpl(screen, caps); + return WindowImpl.create(null, 0, screen, caps); } /** @@ -271,6 +271,9 @@ public class NewtFactory { */ public static Window createWindow(NativeWindow parentWindow, CapabilitiesImmutable caps) { final String type = NativeWindowFactory.getNativeWindowType(true); + if( null == parentWindow ) { + return createWindowImpl(type, caps); + } Screen screen = null; Window newtParentWindow = null; @@ -291,7 +294,7 @@ public class NewtFactory { screen = NewtFactory.createScreen(display, 0); // screen 0 } } - final Window win = createWindowImpl(parentWindow, screen, caps); + final Window win = WindowImpl.create(parentWindow, 0, screen, caps); win.setSize(parentWindow.getWidth(), parentWindow.getHeight()); if ( null != newtParentWindow ) { @@ -301,15 +304,7 @@ public class NewtFactory { return win; } - protected static Window createWindowImpl(NativeWindow parentNativeWindow, Screen screen, CapabilitiesImmutable caps) { - return WindowImpl.create(parentNativeWindow, 0, screen, caps); - } - - protected static Window createWindowImpl(Screen screen, CapabilitiesImmutable caps) { - return WindowImpl.create(null, 0, screen, caps); - } - - protected static Window createWindowImpl(String type, CapabilitiesImmutable caps) { + private static Window createWindowImpl(String type, CapabilitiesImmutable caps) { Display display = NewtFactory.createDisplay(type, null, true); // local display Screen screen = NewtFactory.createScreen(display, 0); // screen 0 return WindowImpl.create(null, 0, screen, caps); -- cgit v1.2.3