aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-02 18:37:23 +0200
committerSven Gothel <[email protected]>2011-08-02 18:37:23 +0200
commit8c8940308c1be5e547b4a2456e8bb5c674fce9f9 (patch)
tree37fb8f1072a81ba7879a9f3c1442b3dc25734fdc /src/newt/classes/com
parentd62d5e771052957ba2628532235d344c8d65e718 (diff)
Hide NEWT AWT Event implementation details to jogamp.newt.awt.event
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java73
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java8
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java146
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java130
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java2
8 files changed, 17 insertions, 350 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 3c16abbea..80dcdba47 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -45,12 +45,14 @@ import javax.media.nativewindow.awt.AWTWindowClosingProtocol;
import jogamp.nativewindow.awt.AWTMisc;
import com.jogamp.newt.event.awt.AWTAdapter;
-import com.jogamp.newt.event.awt.AWTParentWindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowListener;
import jogamp.newt.Debug;
+import jogamp.newt.awt.event.AWTParentWindowAdapter;
+import jogamp.newt.awt.event.NewtFactoryAWT;
+
import javax.swing.MenuSelectionManager;
public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol {
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java
deleted file mode 100644
index e1370f05e..000000000
--- a/src/newt/classes/com/jogamp/newt/awt/NewtFactoryAWT.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-
-package com.jogamp.newt.awt;
-
-
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.awt.*;
-
-import com.jogamp.newt.NewtFactory;
-import jogamp.newt.Debug;
-
-public class NewtFactoryAWT extends NewtFactory {
- public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
-
- /**
- * Wraps an AWT component into a {@link javax.media.nativewindow.NativeWindow} utilizing the {@link javax.media.nativewindow.NativeWindowFactory},<br>
- * using a configuration agnostic dummy {@link javax.media.nativewindow.DefaultGraphicsConfiguration}.<br>
- * <p>
- * The actual wrapping implementation is {@link jogamp.nativewindow.jawt.JAWTWindow}.<br></p>
- * <p>
- * Purpose of this wrapping is to access the AWT window handle,<br>
- * not to actually render into it.<br>
- * Hence the dummy configuration only.</p>
- *
- * @param awtCompObject must be of type java.awt.Component
- */
- public static NativeWindow getNativeWindow(Object awtCompObject, CapabilitiesImmutable capsRequested) {
- if(null==awtCompObject) {
- throw new NativeWindowException("Null AWT Component");
- }
- if( ! (awtCompObject instanceof java.awt.Component) ) {
- throw new NativeWindowException("AWT Component not a java.awt.Component");
- }
- return getNativeWindow( (java.awt.Component) awtCompObject, capsRequested );
- }
-
- public static NativeWindow getNativeWindow(java.awt.Component awtComp, CapabilitiesImmutable capsRequested) {
- DefaultGraphicsConfiguration config = AWTGraphicsConfiguration.create(awtComp, capsRequested, capsRequested);
- NativeWindow awtNative = NativeWindowFactory.getNativeWindow(awtComp, config); // a JAWTWindow
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("NewtFactoryAWT.getNativeWindow: "+awtComp+" -> "+awtNative);
- }
- return awtNative;
- }
-}
-
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index e24002659..8991203d5 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -162,6 +162,14 @@ public abstract class AWTAdapter implements java.util.EventListener
}
}
+ public final com.jogamp.newt.Window getNewtWindow() {
+ return newtWindow;
+ }
+
+ public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
+ return newtListener;
+ }
+
/**
* Due to the fact that some NEWT {@link com.jogamp.newt.event.NEWTEventListener}
* are mapped to more than one {@link java.util.EventListener},
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
index 8fe6ff63a..7b0f6ba97 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -28,6 +28,8 @@
package com.jogamp.newt.event.awt;
+import jogamp.newt.awt.event.AWTNewtEventFactory;
+
public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener
{
public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener) {
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
index bd421073a..5dcd4d962 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -28,6 +28,8 @@
package com.jogamp.newt.event.awt;
+import jogamp.newt.awt.event.AWTNewtEventFactory;
+
public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
{
public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener) {
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java
deleted file mode 100644
index dcd33abc9..000000000
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTNewtEventFactory.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.newt.event.awt;
-
-import com.jogamp.common.util.IntIntHashMap;
-
-class AWTNewtEventFactory {
-
- protected static final IntIntHashMap eventTypeAWT2NEWT;
-
- static {
- IntIntHashMap map = new IntIntHashMap();
- map.setKeyNotFoundValue(0xFFFFFFFF);
- // n/a map.put(java.awt.event.WindowEvent.WINDOW_OPENED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_OPENED);
- map.put(java.awt.event.WindowEvent.WINDOW_CLOSING, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
- map.put(java.awt.event.WindowEvent.WINDOW_CLOSED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_DESTROYED);
- // n/a map.put(java.awt.event.WindowEvent.WINDOW_ICONIFIED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_ICONIFIED);
- // n/a map.put(java.awt.event.WindowEvent.WINDOW_DEICONIFIED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_DEICONIFIED);
- map.put(java.awt.event.WindowEvent.WINDOW_ACTIVATED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_GAINED_FOCUS);
- map.put(java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_GAINED_FOCUS);
- map.put(java.awt.event.FocusEvent.FOCUS_GAINED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_GAINED_FOCUS);
- map.put(java.awt.event.WindowEvent.WINDOW_DEACTIVATED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS);
- map.put(java.awt.event.WindowEvent.WINDOW_LOST_FOCUS, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS);
- map.put(java.awt.event.FocusEvent.FOCUS_LOST, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS);
- // n/a map.put(java.awt.event.WindowEvent.WINDOW_STATE_CHANGED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_STATE_CHANGED);
-
- map.put(java.awt.event.ComponentEvent.COMPONENT_MOVED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_MOVED);
- map.put(java.awt.event.ComponentEvent.COMPONENT_RESIZED, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_RESIZED);
- // n/a map.put(java.awt.event.ComponentEvent.COMPONENT_SHOWN, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_SHOWN);
- // n/a map.put(java.awt.event.ComponentEvent.COMPONENT_HIDDEN, com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_HIDDEN);
-
- map.put(java.awt.event.MouseEvent.MOUSE_CLICKED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED);
- map.put(java.awt.event.MouseEvent.MOUSE_PRESSED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED);
- map.put(java.awt.event.MouseEvent.MOUSE_RELEASED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED);
- map.put(java.awt.event.MouseEvent.MOUSE_MOVED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_MOVED);
- map.put(java.awt.event.MouseEvent.MOUSE_ENTERED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_ENTERED);
- map.put(java.awt.event.MouseEvent.MOUSE_EXITED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_EXITED);
- map.put(java.awt.event.MouseEvent.MOUSE_DRAGGED, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED);
- map.put(java.awt.event.MouseEvent.MOUSE_WHEEL, com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_WHEEL_MOVED);
-
- map.put(java.awt.event.KeyEvent.KEY_PRESSED, com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED);
- map.put(java.awt.event.KeyEvent.KEY_RELEASED, com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED);
- map.put(java.awt.event.KeyEvent.KEY_TYPED, com.jogamp.newt.event.KeyEvent.EVENT_KEY_TYPED);
-
- eventTypeAWT2NEWT = map;
- }
-
- public static final int awtModifiers2Newt(int awtMods, boolean mouseHint) {
- int newtMods = 0;
- if ((awtMods & java.awt.event.InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
- if ((awtMods & java.awt.event.InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
- if ((awtMods & java.awt.event.InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
- if ((awtMods & java.awt.event.InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_MASK;
- if ((awtMods & java.awt.event.InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK;
- return newtMods;
- }
-
- public static final int awtButton2Newt(int awtButton) {
- switch (awtButton) {
- case java.awt.event.MouseEvent.BUTTON1: return com.jogamp.newt.event.MouseEvent.BUTTON1;
- case java.awt.event.MouseEvent.BUTTON2: return com.jogamp.newt.event.MouseEvent.BUTTON2;
- case java.awt.event.MouseEvent.BUTTON3: return com.jogamp.newt.event.MouseEvent.BUTTON3;
- }
- return 0;
- }
-
- static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.WindowEvent event, com.jogamp.newt.Window newtSource) {
- int type = eventTypeAWT2NEWT.get(event.getID());
- if(0xFFFFFFFF != type) {
- return new com.jogamp.newt.event.WindowEvent(type, ((null==newtSource)?(Object)event.getComponent():(Object)newtSource), System.currentTimeMillis());
- }
- return null; // no mapping ..
- }
-
- static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.ComponentEvent event, com.jogamp.newt.Window newtSource) {
- int type = eventTypeAWT2NEWT.get(event.getID());
- if(0xFFFFFFFF != type) {
- return new com.jogamp.newt.event.WindowEvent(type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, System.currentTimeMillis());
- }
- return null; // no mapping ..
- }
-
- static final com.jogamp.newt.event.WindowEvent createWindowEvent(java.awt.event.FocusEvent event, com.jogamp.newt.Window newtSource) {
- int type = eventTypeAWT2NEWT.get(event.getID());
- if(0xFFFFFFFF != type) {
- return new com.jogamp.newt.event.WindowEvent(type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, System.currentTimeMillis());
- }
- return null; // no mapping ..
- }
-
- static final com.jogamp.newt.event.MouseEvent createMouseEvent(java.awt.event.MouseEvent event, com.jogamp.newt.Window newtSource) {
- int type = eventTypeAWT2NEWT.get(event.getID());
- if(0xFFFFFFFF != type) {
- int rotation = 0;
- if (event instanceof java.awt.event.MouseWheelEvent) {
- rotation = ((java.awt.event.MouseWheelEvent)event).getWheelRotation();
- }
-
- return new com.jogamp.newt.event.MouseEvent(
- type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), true),
- event.getX(), event.getY(), event.getClickCount(),
- awtButton2Newt(event.getButton()), rotation);
- }
- return null; // no mapping ..
- }
-
- static final com.jogamp.newt.event.KeyEvent createKeyEvent(java.awt.event.KeyEvent event, com.jogamp.newt.Window newtSource) {
- int type = eventTypeAWT2NEWT.get(event.getID());
- if(0xFFFFFFFF != type) {
- return new com.jogamp.newt.event.KeyEvent(
- type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), false),
- event.getKeyCode(), event.getKeyChar());
- }
- return null; // no mapping ..
- }
-
-}
-
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
deleted file mode 100644
index 68f2b3e0f..000000000
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTParentWindowAdapter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.newt.event.awt;
-
-/**
- * Specialized parent/client adapter,
- * where the NEWT child window really gets resized,
- * and the parent move window event gets discarded. */
-public class AWTParentWindowAdapter
- extends AWTWindowAdapter
- implements java.awt.event.HierarchyListener
-{
- public AWTParentWindowAdapter(com.jogamp.newt.Window downstream) {
- super(downstream);
- }
-
- public AWTAdapter addTo(java.awt.Component awtComponent) {
- awtComponent.addHierarchyListener(this);
- return super.addTo(awtComponent);
- }
-
- public AWTAdapter removeFrom(java.awt.Component awtComponent) {
- awtComponent.removeHierarchyListener(this);
- return super.removeFrom(awtComponent);
- }
-
- public void focusGained(java.awt.event.FocusEvent e) {
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: focusGained: "+ e);
- }
- }
-
- public void focusLost(java.awt.event.FocusEvent e) {
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: focusLost: "+ e);
- }
- }
-
- public void componentResized(java.awt.event.ComponentEvent e) {
- // Need to resize the NEWT child window
- // the resized event will be send via the native window feedback.
- final java.awt.Component comp = e.getComponent();
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: componentResized: "+comp);
- }
- if(newtWindow.isValid()) {
- newtWindow.runOnEDTIfAvail(false, new Runnable() {
- public void run() {
- int cw = comp.getWidth();
- int ch = comp.getHeight();
- if( 0 < cw * ch ) {
- if( newtWindow.getWidth() != cw || newtWindow.getHeight() != ch ) {
- newtWindow.setSize(cw, ch);
- if(comp.isVisible() != newtWindow.isVisible()) {
- newtWindow.setVisible(comp.isVisible());
- }
- }
- } else if(newtWindow.isVisible()) {
- newtWindow.setVisible(false);
- }
- }});
- }
- }
-
- public void componentMoved(java.awt.event.ComponentEvent e) {
- // no propagation to NEWT child window
- }
-
- public void windowActivated(java.awt.event.WindowEvent e) {
- // no propagation to NEWT child window
- }
-
- public void windowDeactivated(java.awt.event.WindowEvent e) {
- // no propagation to NEWT child window
- }
-
- public void hierarchyChanged(java.awt.event.HierarchyEvent e) {
- if( null == newtListener ) {
- long bits = e.getChangeFlags();
- final java.awt.Component changed = e.getChanged();
- if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
- final boolean showing = changed.isShowing();
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed);
- }
- if(newtWindow.isValid()) {
- newtWindow.runOnEDTIfAvail(false, new Runnable() {
- public void run() {
- if(newtWindow.isVisible() != showing) {
- newtWindow.setVisible(showing);
- }
- }});
- }
- }
- if(DEBUG_IMPLEMENTATION) {
- if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
- final boolean displayability = changed.isDisplayable();
- System.err.println("AWT: hierarchyChanged DISPLAYABILITY_CHANGED: displayability "+displayability+", "+changed);
- }
- }
- }
- }
-}
-
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
index 85fe5407b..ae7474c73 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -28,6 +28,8 @@
package com.jogamp.newt.event.awt;
+import jogamp.newt.awt.event.AWTNewtEventFactory;
+
public class AWTWindowAdapter
extends AWTAdapter
implements java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener