From 6ff7ba18a549a3fef9fcb01a2944bd0907799864 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 7 Sep 2011 02:09:23 +0200 Subject: Fix commit e1ecd85a9d5877861cde35baababb298d1339898 - send resize event Completes fix 2934c9814daf7ae053c3f03957961a2e62125aee Turns out it's more safe to send out the resize events to the listener, since the native event messaging is not reliable in some cases. --- src/newt/classes/jogamp/newt/WindowImpl.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 6631505c1..ca4188e94 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -692,6 +692,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } finally { windowLock.unlock(); } + if( nativeWindowCreated || madeVisible ) { + sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener + } } private class VisibleAction implements Runnable { @@ -1121,10 +1124,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } finally { windowLock.unlock(); } - - if(wasVisible && ACTION_NATIVE_CREATION == reparentAction) { - // This may run on the new Display/Screen connection, hence a new EDT task - runOnEDTIfAvail(true, reparentActionRecreate); + if(wasVisible) { + switch (reparentAction) { + case ACTION_NATIVE_REPARENTING: + // trigger a resize/relayout and repaint to listener + sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); + break; + + case ACTION_NATIVE_CREATION: + // This may run on the new Display/Screen connection, hence a new EDT task + runOnEDTIfAvail(true, reparentActionRecreate); + break; + } } if(DEBUG_IMPLEMENTATION) { System.err.println("Window.reparentWindow: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+x+"/"+y+" "+width+"x"+height); @@ -1226,6 +1237,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } finally { windowLock.unlock(); } + sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener } } @@ -1527,6 +1539,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } finally { windowLock.unlock(); } + sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener } } -- cgit v1.2.3