diff options
author | Sven Gothel <[email protected]> | 2010-10-29 04:00:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-29 04:00:03 +0200 |
commit | fbb30f2e484b3fd0f98a32bed18c272528af7ba5 (patch) | |
tree | f0cdf60f3f09c79da8d4be71694f6b66c29f6359 | |
parent | 7e606ef39fa9d73cc7306cc0027989bc7704708d (diff) |
Changed Lifecycle of NEWT Display/Screen (part 5)
--------------------------------------------------
Per default, creating a NEWT Display tries to reuse an existing one
to match the native platform display semantics closer.
The 'key' for a Display reuse is it's FQN.
The difference with the old 'reusage' is the removal of the TLS binding,
hence we use a global pool.
The user is able to 'override' this 'reuse' behavior with
'NewtFactory.createDisplay(String name, boolean reuse)'.
However, it is not recommended for AMD drivers (see above).
Screen's are always reused if possible.
The 'key' for a Screen reuse is it's FQN,
hence it's reuse depends on the Display reuse.
-rw-r--r-- | src/newt/classes/com/jogamp/newt/Display.java | 51 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/NewtFactory.java | 81 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/Screen.java | 109 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java | 25 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java | 57 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/WindowImpl.java | 14 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java | 1 |
7 files changed, 246 insertions, 92 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index 7ce20e4bb..71ea12ad8 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -39,6 +39,18 @@ import javax.media.nativewindow.AbstractGraphicsDevice; public abstract class Display { public static final boolean DEBUG = Debug.debug("Display"); + /** return precomputed hashCode from FQN {@link #getFQName()} */ + public abstract int hashCode(); + + /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ + public boolean equals(Object obj) { + if (obj instanceof Display) { + Display d = (Display)obj; + return d.getFQName().equals(getFQName()); + } + return false; + } + /** * @return true if the native display handle is valid and ready to operate, * otherwise false. @@ -140,6 +152,43 @@ public abstract class Display { } } + /** + * + * @param type + * @param name + * @param fromIndex start index, then increasing until found or end of list * + * @return + */ + public static Display getFirstDisplayOf(String type, String name, int fromIndex) { + return getDisplayOfImpl(type, name, fromIndex, 1); + } + + /** + * + * @param type + * @param name + * @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1. + * @return + */ + public static Display getLastDisplayOf(String type, String name, int fromIndex) { + return getDisplayOfImpl(type, name, fromIndex, -1); + } + + private static Display getDisplayOfImpl(String type, String name, int fromIndex, int incr) { + synchronized(displayList) { + int i = fromIndex >= 0 ? fromIndex : displayList.size() - 1 ; + while( ( incr > 0 ) ? i < displayList.size() : i >= 0 ) { + Display display = (Display) displayList.get(i); + if( display.getType().equals(type) && + display.getName().equals(name) ) { + return display; + } + i+=incr; + } + } + return null; + } + /** Returns the global display collection */ public static Collection getAllDisplays() { ArrayList list; @@ -167,7 +216,7 @@ public abstract class Display { return "0x" + Long.toHexString(hex); } - public static int hashCode(Object o) { + public static int hashCodeNullSafe(Object o) { return ( null != o ) ? o.hashCode() : 0; } } diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index e01e04304..e1b15da69 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -82,33 +82,35 @@ public class NewtFactory { * Create a Display entity, incl native creation */ public static Display createDisplay(String name) { - return DisplayImpl.create(NativeWindowFactory.getNativeWindowType(true), name, 0); + return createDisplay(name, true); + } + + public static Display createDisplay(String name, boolean reuse) { + return DisplayImpl.create(NativeWindowFactory.getNativeWindowType(true), name, 0, reuse); } /** * Create a Display entity using the given implementation type, incl native creation */ public static Display createDisplay(String type, String name) { - return DisplayImpl.create(type, name, 0); + return createDisplay(type, name, true); } - /** - * Create a Screen entity, incl native creation - */ - public static Screen createScreen(Display display, int index) { - return ScreenImpl.create(NativeWindowFactory.getNativeWindowType(true), display, index); + public static Display createDisplay(String type, String name, boolean reuse) { + return DisplayImpl.create(type, name, 0, reuse); } /** - * Create a Screen entity using the given implementation type, incl native creation + * Create a Screen entity, incl native creation */ - public static Screen createScreen(String type, Display display, int index) { - return ScreenImpl.create(type, display, index); + public static Screen createScreen(Display display, int index) { + return ScreenImpl.create(display, index); } /** - * Create a top level Window entity, incl native creation. - * The Display/Screen is created and owned, ie destructed atomatic. + * Create a top level Window entity, incl native creation.<br> + * The Display/Screen is created and owned, ie destructed atomatically.<br> + * A new Display is only created if no preexisting one could be found via {@link Display#getLastDisplayOf(java.lang.String, java.lang.String, int)}. */ public static Window createWindow(Capabilities caps) { return createWindowImpl(NativeWindowFactory.getNativeWindowType(true), caps); @@ -118,7 +120,7 @@ public class NewtFactory { * Create a top level Window entity, incl native creation */ public static Window createWindow(Screen screen, Capabilities caps) { - return createWindowImpl(NativeWindowFactory.getNativeWindowType(true), screen, caps); + return createWindowImpl(screen, caps); } /** @@ -154,15 +156,15 @@ public class NewtFactory { if(null!=nParentConfig) { AbstractGraphicsScreen nParentScreen = nParentConfig.getScreen(); AbstractGraphicsDevice nParentDevice = nParentScreen.getDevice(); - Display display = NewtFactory.createDisplay(type, nParentDevice.getHandle()); - screen = NewtFactory.createScreen(type, display, nParentScreen.getIndex()); + Display display = NewtFactory.createDisplay(type, nParentDevice.getHandle(), true); + screen = NewtFactory.createScreen(display, nParentScreen.getIndex()); } else { - Display display = NewtFactory.createDisplay(type, null); // local display - screen = NewtFactory.createScreen(type, display, 0); // screen 0 + Display display = NewtFactory.createDisplay(type, null, true); // local display + screen = NewtFactory.createScreen(display, 0); // screen 0 } screen.setDestroyWhenUnused(true); } - final Window win = createWindowImpl(type, nParentWindow, screen, caps); + final Window win = createWindowImpl(nParentWindow, screen, caps); win.setSize(nParentWindow.getWidth(), nParentWindow.getHeight()); if ( null != parentWindow ) { @@ -172,23 +174,23 @@ public class NewtFactory { return win; } - protected static Window createWindowImpl(String type, NativeWindow parentNativeWindow, Screen screen, Capabilities caps) { - return WindowImpl.create(type, parentNativeWindow, 0, screen, caps); + protected static Window createWindowImpl(NativeWindow parentNativeWindow, Screen screen, Capabilities caps) { + return WindowImpl.create(parentNativeWindow, 0, screen, caps); } - protected static Window createWindowImpl(String type, long parentWindowHandle, Screen screen, Capabilities caps) { - return WindowImpl.create(type, null, parentWindowHandle, screen, caps); + protected static Window createWindowImpl(long parentWindowHandle, Screen screen, Capabilities caps) { + return WindowImpl.create(null, parentWindowHandle, screen, caps); } - protected static Window createWindowImpl(String type, Screen screen, Capabilities caps) { - return WindowImpl.create(type, null, 0, screen, caps); + protected static Window createWindowImpl(Screen screen, Capabilities caps) { + return WindowImpl.create(null, 0, screen, caps); } protected static Window createWindowImpl(String type, Capabilities caps) { - Display display = NewtFactory.createDisplay(type, null); // local display - Screen screen = NewtFactory.createScreen(type, display, 0); // screen 0 + Display display = NewtFactory.createDisplay(type, null, true); // local display + Screen screen = NewtFactory.createScreen(display, 0); // screen 0 screen.setDestroyWhenUnused(true); - return WindowImpl.create(type, null, 0, screen, caps); + return WindowImpl.create(null, 0, screen, caps); } /** @@ -198,7 +200,7 @@ public class NewtFactory { * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always */ public static Window createWindow(long parentWindowHandle, Screen screen, Capabilities caps) { - return createWindowImpl(NativeWindowFactory.getNativeWindowType(true), parentWindowHandle, screen, caps); + return createWindowImpl(parentWindowHandle, screen, caps); } /** @@ -209,27 +211,14 @@ public class NewtFactory { * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always */ public static Window createWindow(Object[] cstrArguments, Screen screen, Capabilities caps) { - return WindowImpl.create(NativeWindowFactory.getNativeWindowType(true), cstrArguments, screen, caps); - } - - /** - * Create a Window entity using the given implementation type, incl native creation - * - * @param undecorated only impacts if the window is in top-level state, while attached to a parent window it's rendered undecorated always - */ - public static Window createWindow(String type, Screen screen, Capabilities caps) { - return createWindowImpl(type, null, screen, caps); - } - - public static Window createWindow(String type, Object[] cstrArguments, Screen screen, Capabilities caps) { - return WindowImpl.create(type, cstrArguments, screen, caps); + return WindowImpl.create(cstrArguments, screen, caps); } /** * Instantiate a Display entity using the native handle. */ - public static Display createDisplay(String type, long handle) { - return DisplayImpl.create(type, null, handle); + public static Display createDisplay(String type, long handle, boolean reuse) { + return DisplayImpl.create(type, null, handle, false); } private static final boolean instanceOf(Object obj, String clazzName) { @@ -292,8 +281,8 @@ public class NewtFactory { // Prep NEWT's Display and Screen according to the parent final String type = NativeWindowFactory.getNativeWindowType(true); - Display display = NewtFactory.createDisplay(type, parentDevice.getHandle()); - return NewtFactory.createScreen(type, display, parentScreen.getIndex()); + Display display = NewtFactory.createDisplay(type, parentDevice.getHandle(), true); + return NewtFactory.createScreen(display, parentScreen.getIndex()); } } diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index 2cea88d19..fc91047c0 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -29,10 +29,12 @@ package com.jogamp.newt; import com.jogamp.newt.event.ScreenModeListener; import com.jogamp.newt.impl.Debug; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import javax.media.nativewindow.AbstractGraphicsScreen; -public interface Screen { +public abstract class Screen { /** * A 10s timeout for screen mode change. It is observed, that some platforms @@ -42,15 +44,27 @@ public interface Screen { public static final boolean DEBUG = Debug.debug("Screen"); - boolean isNativeValid(); + /** return precomputed hashCode from FQN {@link #getFQName()} */ + public abstract int hashCode(); + + /** return true if obj is of type Display and both FQN {@link #getFQName()} equals */ + public boolean equals(Object obj) { + if (obj instanceof Screen) { + Screen s = (Screen)obj; + return s.getFQName().equals(getFQName()); + } + return false; + } + + public abstract boolean isNativeValid(); /** * * @return number of references by Window */ - int getReferenceCount(); + public abstract int getReferenceCount(); - void destroy(); + public abstract void destroy(); /** * @return {@link Display#getDestroyWhenUnused()} @@ -59,7 +73,7 @@ public interface Screen { * @see #removeReference() * @see Display#setDestroyWhenUnused(boolean) */ - boolean getDestroyWhenUnused(); + public abstract boolean getDestroyWhenUnused(); /** * calls {@link Display#setDestroyWhenUnused(boolean)}. @@ -68,7 +82,7 @@ public interface Screen { * @see #removeReference() * @see Display#setDestroyWhenUnused(boolean) */ - void setDestroyWhenUnused(boolean v); + public abstract void setDestroyWhenUnused(boolean v); /** * See {@link Display#addReference()} @@ -77,7 +91,7 @@ public interface Screen { * @see #setDestroyWhenUnused(boolean) * @see #getDestroyWhenUnused() */ - int addReference(); + public abstract int addReference(); /** * See {@link Display#removeReference()} @@ -86,52 +100,52 @@ public interface Screen { * @see #setDestroyWhenUnused(boolean) * @see #getDestroyWhenUnused() */ - int removeReference(); + public abstract int removeReference(); - AbstractGraphicsScreen getGraphicsScreen(); + public abstract AbstractGraphicsScreen getGraphicsScreen(); /** * @return this Screen index of all Screens of {@link #getDisplay()}. */ - int getIndex(); + public abstract int getIndex(); /** * @return the current screen width */ - int getWidth(); + public abstract int getWidth(); /** * @return the current screen height */ - int getHeight(); + public abstract int getHeight(); /** * @return the associated Display */ - Display getDisplay(); + public abstract Display getDisplay(); /** * @return the screen fully qualified Screen name, * which is a key of {@link com.jogamp.newt.Display#getFQName()} + {@link #getIndex()}. */ - String getFQName(); + public abstract String getFQName(); /** * @param sml ScreenModeListener to be added for ScreenMode change events */ - public void addScreenModeListener(ScreenModeListener sml); + public abstract void addScreenModeListener(ScreenModeListener sml); /** * @param sml ScreenModeListener to be removed from ScreenMode change events */ - public void removeScreenModeListener(ScreenModeListener sml); + public abstract void removeScreenModeListener(ScreenModeListener sml); /** * Return a list of available {@link com.jogamp.newt.ScreenMode}s. * @return a shallow copy of the internal immutable {@link com.jogamp.newt.ScreenMode}s, * or null if not implemented for this native type {@link com.jogamp.newt.Display#getType()}. */ - List/*<ScreenMode>*/ getScreenModes(); + public abstract List/*<ScreenMode>*/ getScreenModes(); /** * Return the original {@link com.jogamp.newt.ScreenMode}, as used at NEWT initialization. @@ -139,19 +153,74 @@ public interface Screen { * otherwise the original ScreenMode which is element of the list {@link #getScreenModes()}. * */ - ScreenMode getOriginalScreenMode(); + public abstract ScreenMode getOriginalScreenMode(); /** * Return the current {@link com.jogamp.newt.ScreenMode}. * @return null if functionality not implemented, * otherwise the current ScreenMode which is element of the list {@link #getScreenModes()}. */ - ScreenMode getCurrentScreenMode(); + public abstract ScreenMode getCurrentScreenMode(); /** * Set the current {@link com.jogamp.newt.ScreenMode}. * @param screenMode to be made current, must be element of the list {@link #getScreenModes()}. * @return true if successful, otherwise false */ - boolean setCurrentScreenMode(ScreenMode screenMode); + public abstract boolean setCurrentScreenMode(ScreenMode screenMode); + + // Global Screens + protected static ArrayList screenList = new ArrayList(); + protected static int screensActive = 0; + + /** + * + * @param type + * @param name + * @param fromIndex start index, then increasing until found or end of list * + * @return + */ + public static Screen getFirstScreenOf(Display display, int idx, int fromIndex) { + return getScreenOfImpl(display, idx, fromIndex, 1); + } + + /** + * + * @param type + * @param name + * @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1. + * @return + */ + public static Screen getLastScreenOf(Display display, int idx, int fromIndex) { + return getScreenOfImpl(display, idx, fromIndex, -1); + } + + private static Screen getScreenOfImpl(Display display, int idx, int fromIndex, int incr) { + synchronized(screenList) { + int i = fromIndex >= 0 ? fromIndex : screenList.size() - 1 ; + while( ( incr > 0 ) ? i < screenList.size() : i >= 0 ) { + Screen screen = (Screen) screenList.get(i); + if( screen.getDisplay().equals(display) && + screen.getIndex() == idx ) { + return screen; + } + i+=incr; + } + } + return null; + } + /** Returns the global display collection */ + public static Collection getAllScreens() { + ArrayList list; + synchronized(screenList) { + list = (ArrayList) screenList.clone(); + } + return list; + } + + public static int getActiveScreenNumber() { + synchronized(screenList) { + return screensActive; + } + } } diff --git a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java index 30b3cc409..d4f391e6c 100644 --- a/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/DisplayImpl.java @@ -70,18 +70,28 @@ public abstract class DisplayImpl extends Display { } /** Make sure to reuse a Display with the same name */ - public static DisplayImpl create(String type, String name, final long handle) { + public static Display create(String type, String name, final long handle, boolean reuse) { try { Class displayClass = getDisplayClass(type); DisplayImpl display = (DisplayImpl) displayClass.newInstance(); name = display.validateDisplayName(name, handle); - display.name = name; - display.type=type; - display.destroyWhenUnused=false; - display.refCount=0; synchronized(displayList) { + if(reuse) { + Display display0 = Display.getLastDisplayOf(type, name, -1); + if(null != display0) { + if(DEBUG) { + System.err.println("Display.create() REUSE: "+display0+" "+getThreadName()); + } + return display0; + } + } + display.name = name; + display.type=type; + display.destroyWhenUnused=false; + display.refCount=0; display.id = serialno++; display.fqname = getFQName(display.type, display.name, display.id); + display.hashCode = display.fqname.hashCode(); displayList.add(display); } display.createEDTUtil(); @@ -94,6 +104,10 @@ public abstract class DisplayImpl extends Display { } } + public int hashCode() { + return hashCode; + } + protected synchronized final void createNative() { if(null==aDevice) { if(DEBUG) { @@ -376,6 +390,7 @@ public abstract class DisplayImpl extends Display { protected String name; protected String type; protected String fqname; + protected int hashCode; protected int refCount; // number of Display references by Screen protected boolean destroyWhenUnused; protected AbstractGraphicsDevice aDevice; diff --git a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java index 9dc1c1bcc..05732deb1 100644 --- a/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/ScreenImpl.java @@ -50,10 +50,11 @@ import java.security.*; import java.util.ArrayList; import java.util.List; -public abstract class ScreenImpl implements Screen, ScreenModeListener { +public abstract class ScreenImpl extends Screen implements ScreenModeListener { protected DisplayImpl display; protected int screen_idx; protected String fqname; + protected int hashCode; protected AbstractGraphicsScreen aScreen; protected int refCount; // number of Screen references by Window protected int width=-1, height=-1; // detected values: set using setScreenSize @@ -84,26 +85,50 @@ public abstract class ScreenImpl implements Screen, ScreenModeListener { return screenClass; } - public static ScreenImpl create(String type, Display display, final int idx) { + public static Screen create(Display display, final int idx) { try { if(usrWidth<0 || usrHeight<0) { - usrWidth = Debug.getIntProperty("newt.ws.swidth", true, localACC); - usrHeight = Debug.getIntProperty("newt.ws.sheight", true, localACC); - if(usrWidth>0 || usrHeight>0) { - System.err.println("User screen size "+usrWidth+"x"+usrHeight); + synchronized (Screen.class) { + if(usrWidth<0 || usrHeight<0) { + usrWidth = Debug.getIntProperty("newt.ws.swidth", true, localACC); + usrHeight = Debug.getIntProperty("newt.ws.sheight", true, localACC); + if(usrWidth>0 || usrHeight>0) { + System.err.println("User screen size "+usrWidth+"x"+usrHeight); + } + } } } - Class screenClass = getScreenClass(type); - ScreenImpl screen = (ScreenImpl) screenClass.newInstance(); - screen.display = (DisplayImpl) display; - screen.screen_idx = idx; - screen.fqname = display.getFQName()+idx; - return screen; + synchronized(screenList) { + { + Screen screen0 = ScreenImpl.getLastScreenOf(display, idx, -1); + if(null != screen0) { + if(DEBUG) { + System.err.println("Screen.create() REUSE: "+screen0+" "+Display.getThreadName()); + } + return screen0; + } + } + Class screenClass = getScreenClass(display.getType()); + ScreenImpl screen = (ScreenImpl) screenClass.newInstance(); + screen.display = (DisplayImpl) display; + screen.screen_idx = idx; + screen.fqname = display.getFQName()+idx; + screen.hashCode = screen.fqname.hashCode(); + screenList.add(screen); + if(DEBUG) { + System.err.println("Screen.create() NEW: "+screen+" "+Display.getThreadName()); + } + return screen; + } } catch (Exception e) { throw new RuntimeException(e); } } + public int hashCode() { + return hashCode; + } + protected synchronized final void createNative() { if(null == aScreen) { if(DEBUG) { @@ -118,6 +143,9 @@ public abstract class ScreenImpl implements Screen, ScreenModeListener { if(DEBUG) { System.err.println("Screen.createNative() END ("+DisplayImpl.getThreadName()+", "+this+")"); } + synchronized(screenList) { + screensActive++; + } } initScreenModeStatus(); } @@ -125,6 +153,11 @@ public abstract class ScreenImpl implements Screen, ScreenModeListener { public synchronized final void destroy() { releaseScreenModeStatus(); + synchronized(screenList) { + screenList.remove(this); + screensActive--; + } + if ( null != aScreen ) { closeNativeImpl(); aScreen = null; diff --git a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java index 0eb8f9644..7d80712e6 100644 --- a/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java +++ b/src/newt/classes/com/jogamp/newt/impl/WindowImpl.java @@ -96,11 +96,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod return windowClass; } - public static WindowImpl create(String type, NativeWindow parentWindow, long parentWindowHandle, Screen screen, Capabilities caps) { + public static WindowImpl create(NativeWindow parentWindow, long parentWindowHandle, Screen screen, Capabilities caps) { try { Class windowClass; if(caps.isOnscreen()) { - windowClass = getWindowClass(type); + windowClass = getWindowClass(screen.getDisplay().getType()); } else { windowClass = OffscreenWindow.class; } @@ -118,9 +118,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod } } - public static WindowImpl create(String type, Object[] cstrArguments, Screen screen, Capabilities caps) { + public static WindowImpl create(Object[] cstrArguments, Screen screen, Capabilities caps) { try { - Class windowClass = getWindowClass(type); + Class windowClass = getWindowClass(screen.getDisplay().getType()); Class[] cstrArgumentTypes = getCustomConstructorArgumentTypes(windowClass); if(null==cstrArgumentTypes) { throw new NativeWindowException("WindowClass "+windowClass+" doesn't support custom arguments in constructor"); @@ -790,7 +790,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod long newParentWindowHandle = 0 ; if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.reparent: START ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCode(parentWindow)+", new parentWindow: "+Display.hashCode(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate+", DEBUG_TEST_REPARENT_INCOMPATIBLE "+DEBUG_TEST_REPARENT_INCOMPATIBLE+" "+x+"/"+y+" "+width+"x"+height); + System.err.println("Window.reparent: START ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate+", DEBUG_TEST_REPARENT_INCOMPATIBLE "+DEBUG_TEST_REPARENT_INCOMPATIBLE+" "+x+"/"+y+" "+width+"x"+height); } if(null!=newParentWindow) { @@ -996,7 +996,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod WindowImpl.this.height = height; if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.reparentWindow: END ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCode(parentWindow)+" "+x+"/"+y+" "+width+"x"+height); + System.err.println("Window.reparentWindow: END ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+x+"/"+y+" "+width+"x"+height); } } finally { windowLock.unlock(); @@ -1016,7 +1016,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer, ScreenMod try { visible = true; if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.reparentWindow: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCode(parentWindow)); + System.err.println("Window.reparentWindow: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCodeNullSafe(parentWindow)); } setVisible(true); // native creation } finally { diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java index 60af9b9af..06c7dfa99 100644 --- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java +++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Window.java @@ -33,7 +33,6 @@ package com.jogamp.newt.impl.x11; -import com.jogamp.newt.ScreenMode; import com.jogamp.newt.impl.WindowImpl; import javax.media.nativewindow.*; import javax.media.nativewindow.x11.*; |