summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java26
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java68
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java22
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java23
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java3
6 files changed, 102 insertions, 50 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index f6b2bab1f..37e9f9813 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -104,7 +104,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private boolean newtChildAttached = false;
private boolean isOnscreen = true;
private WindowClosingMode newtChildCloseOp;
- private final AWTParentWindowAdapter awtAdapter;
+ private final AWTParentWindowAdapter awtWinAdapter;
private final AWTAdapter awtMouseAdapter;
private final AWTAdapter awtKeyAdapter;
@@ -140,8 +140,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super();
awtMouseAdapter = new AWTMouseAdapter().addTo(this);
awtKeyAdapter = new AWTKeyAdapter().addTo(this);
- awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
- awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
+ awtWinAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtWinAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
}
/**
@@ -151,8 +151,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super(gc);
awtMouseAdapter = new AWTMouseAdapter().addTo(this);
awtKeyAdapter = new AWTKeyAdapter().addTo(this);
- awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
- awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
+ awtWinAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtWinAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
}
/**
@@ -162,8 +162,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super();
awtMouseAdapter = new AWTMouseAdapter().addTo(this);
awtKeyAdapter = new AWTKeyAdapter().addTo(this);
- awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
- awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
+ awtWinAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtWinAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
setNEWTChild(child);
}
@@ -174,8 +174,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super(gc);
awtMouseAdapter = new AWTMouseAdapter().addTo(this);
awtKeyAdapter = new AWTKeyAdapter().addTo(this);
- awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
- awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
+ awtWinAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter().addTo(this);
+ awtWinAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
setNEWTChild(child);
}
@@ -779,11 +779,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
private final void configureNewtChild(boolean attach) {
- awtAdapter.clear();
+ awtWinAdapter.clear();
+ awtKeyAdapter.clear();
awtMouseAdapter.clear();
- awtKeyAdapter.setConsumeAWTEvent(false);
- awtMouseAdapter.clear();
- awtKeyAdapter.setConsumeAWTEvent(false);
if(null != keyboardFocusManager) {
keyboardFocusManager.removePropertyChangeListener("focusOwner", focusPropertyChangeListener);
@@ -797,7 +795,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
throw new InternalError("XXX");
}
isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
- awtAdapter.setDownstream(jawtWindow, newtChild);
+ awtWinAdapter.setDownstream(jawtWindow, newtChild);
newtChild.addWindowListener(clearAWTMenusOnNewtFocus);
newtChild.setFocusAction(focusAction); // enable AWT focus traversal
newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
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 cf533eb9e..9b1348288 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -28,6 +28,8 @@
package com.jogamp.newt.event.awt;
+import javax.media.nativewindow.NativeSurfaceHolder;
+
import jogamp.newt.Debug;
/**
@@ -117,37 +119,44 @@ public abstract class AWTAdapter implements java.util.EventListener
com.jogamp.newt.event.NEWTEventListener newtListener;
com.jogamp.newt.Window newtWindow;
+ NativeSurfaceHolder nsHolder;
boolean consumeAWTEvent;
protected boolean isSetup;
/**
- * Simply wrap aroung a NEWT EventListener, exposed as an AWT EventListener.<br>
+ * Create a proxy adapter, wrapping around an NEWT EventListener, exposed as an AWT EventListener,<br>
+ * where the given {@link NativeSurfaceHolder} impersonates the event's source.
* The NEWT EventListener will be called when an event happens.<br>
*/
- protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener) {
+ protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, NativeSurfaceHolder nsProxy) {
if(null==newtListener) {
- throw new RuntimeException("Argument newtListener is null");
+ throw new IllegalArgumentException("Argument newtListener is null");
+ }
+ if(null==nsProxy) {
+ throw new IllegalArgumentException("Argument nwProxy is null");
}
this.newtListener = newtListener;
this.newtWindow = null;
+ this.nsHolder = nsProxy;
this.consumeAWTEvent = false;
this.isSetup = true;
}
/**
- * Wrap aroung a NEWT EventListener, exposed as an AWT EventListener,<br>
- * where the given NEWT Window impersonates as the event's source.
+ * Create a proxy adapter, wrapping around an NEWT EventListener, exposed as an AWT EventListener,<br>
+ * where the given {@link com.jogamp.newt.Window NEWT Window}, a {@link NativeSurfaceHolder}, impersonates the event's source.
* The NEWT EventListener will be called when an event happens.<br>
*/
protected AWTAdapter(com.jogamp.newt.event.NEWTEventListener newtListener, com.jogamp.newt.Window newtProxy) {
if(null==newtListener) {
- throw new RuntimeException("Argument newtListener is null");
+ throw new IllegalArgumentException("Argument newtListener is null");
}
if(null==newtProxy) {
- throw new RuntimeException("Argument newtProxy is null");
+ throw new IllegalArgumentException("Argument newtProxy is null");
}
this.newtListener = newtListener;
this.newtWindow = newtProxy;
+ this.nsHolder = newtProxy;
this.consumeAWTEvent = false;
this.isSetup = true;
}
@@ -156,8 +165,9 @@ public abstract class AWTAdapter implements java.util.EventListener
* Create a pipeline adapter, AWT EventListener.<br>
* Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br>
* This is only supported with EDT enabled!
+ * @throws IllegalStateException if EDT is not enabled
*/
- protected AWTAdapter(com.jogamp.newt.Window downstream) {
+ protected AWTAdapter(com.jogamp.newt.Window downstream) throws IllegalStateException {
this();
setDownstream(downstream);
}
@@ -171,26 +181,34 @@ public abstract class AWTAdapter implements java.util.EventListener
* Setup a pipeline adapter, AWT EventListener.<br>
* Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br>
* This is only supported with EDT enabled!
+ * @throws IllegalStateException if EDT is not enabled
*/
- public synchronized AWTAdapter setDownstream(com.jogamp.newt.Window downstream) {
+ public synchronized AWTAdapter setDownstream(com.jogamp.newt.Window downstream) throws IllegalStateException {
if(null==downstream) {
throw new RuntimeException("Argument downstream is null");
}
this.newtListener = null;
this.newtWindow = downstream;
- this.consumeAWTEvent = false;
+ this.nsHolder = downstream;
if( null == newtWindow.getScreen().getDisplay().getEDTUtil() ) {
- throw new RuntimeException("EDT not enabled");
+ throw new IllegalStateException("EDT not enabled");
}
this.isSetup = true;
return this;
}
- /** Removes all references, downstream and NEWT-EventListener. */
+ /**
+ * Removes all references, downstream and NEWT-EventListener.
+ * <p>
+ * Also sets the internal <code>setup</code> flag and {@link #setConsumeAWTEvent(boolean)} to <code>false</code>.
+ * </p>
+ */
public synchronized AWTAdapter clear() {
this.newtListener = null;
this.newtWindow = null;
+ this.nsHolder = null;
this.isSetup = false;
+ this.consumeAWTEvent = false;
return this;
}
@@ -198,10 +216,36 @@ public abstract class AWTAdapter implements java.util.EventListener
this.consumeAWTEvent = v;
}
+ /**
+ * Returns the {@link NativeSurfaceHolder} acting {@link #AWTAdapter(com.jogamp.newt.Window) as downstream},
+ * {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, com.jogamp.newt.Window) NEWT window proxy}
+ * or as an {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, NativeSurfaceHolder) NativeSurfaceHolder proxy}.
+ * <p>
+ * Returned value is never null.
+ * </p>
+ */
+ public final synchronized NativeSurfaceHolder getNativeSurfaceHolder() {
+ return nsHolder;
+ }
+
+ /**
+ * Returns the {@link com.jogamp.newt.Window NEWT Window} acting {@link #AWTAdapter(com.jogamp.newt.Window) as downstream}
+ * or as a {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, com.jogamp.newt.Window) NEWT window proxy}.
+ * <p>
+ * Returned value maybe null if instance is used to be a
+ * {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, NativeSurfaceHolder) NativeSurfaceHolder proxy}.
+ * </p>
+ */
public final synchronized com.jogamp.newt.Window getNewtWindow() {
return newtWindow;
}
+ /**
+ * Returns the {@link com.jogamp.newt.event.NEWTEventListener NEWT event-listener} if instance
+ * is used as an {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, NativeSurfaceHolder) NativeSurfaceHolder proxy}
+ * or {@link #AWTAdapter(com.jogamp.newt.event.NEWTEventListener, com.jogamp.newt.Window) NEWT window proxy},
+ * otherwise method returns <code>null</code>.
+ */
public final synchronized com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
return newtListener;
}
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 ddbeb6e42..5ea36bac8 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 javax.media.nativewindow.NativeSurfaceHolder;
+
import jogamp.newt.awt.event.AWTNewtEventFactory;
/**
@@ -37,8 +39,8 @@ import jogamp.newt.awt.event.AWTNewtEventFactory;
*/
public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListener
{
- public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener) {
- super(newtListener);
+ public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, NativeSurfaceHolder nsProxy) {
+ super(newtListener, nsProxy);
}
public AWTKeyAdapter(com.jogamp.newt.event.KeyListener newtListener, com.jogamp.newt.Window newtProxy) {
@@ -68,7 +70,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
@Override
public synchronized void keyPressed(java.awt.event.KeyEvent e) {
if( !isSetup ) { return; }
- final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, newtWindow);
+ final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED, e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -80,7 +82,7 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
@Override
public synchronized void keyReleased(java.awt.event.KeyEvent e) {
if( !isSetup ) { return; }
- final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, newtWindow);
+ final com.jogamp.newt.event.KeyEvent event = AWTNewtEventFactory.createKeyEvent(com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED, e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
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 d0f73ef33..53fe70bf7 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -28,14 +28,16 @@
package com.jogamp.newt.event.awt;
+import javax.media.nativewindow.NativeSurfaceHolder;
+
import jogamp.newt.awt.event.AWTNewtEventFactory;
public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener,
java.awt.event.MouseMotionListener,
java.awt.event.MouseWheelListener
{
- public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener) {
- super(newtListener);
+ public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, NativeSurfaceHolder nsProxy) {
+ super(newtListener, nsProxy);
}
public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener, com.jogamp.newt.Window newtProxy) {
@@ -69,7 +71,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseClicked(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -81,7 +83,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseEntered(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -93,7 +95,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseExited(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -105,7 +107,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mousePressed(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -117,7 +119,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseReleased(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -129,7 +131,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseDragged(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -141,7 +143,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseMoved(java.awt.event.MouseEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
@@ -153,7 +155,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
@Override
public synchronized void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
+ com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, nsHolder);
if( consumeAWTEvent ) {
e.consume();
}
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 43a28b3b3..698fe86f4 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -30,6 +30,8 @@ package com.jogamp.newt.event.awt;
import java.awt.Dimension;
+import javax.media.nativewindow.NativeSurfaceHolder;
+
import jogamp.newt.awt.event.AWTNewtEventFactory;
public class AWTWindowAdapter
@@ -38,8 +40,8 @@ public class AWTWindowAdapter
{
WindowClosingListener windowClosingListener;
- public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener) {
- super(newtListener);
+ public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, NativeSurfaceHolder nsProxy) {
+ super(newtListener, nsProxy);
}
public AWTWindowAdapter(com.jogamp.newt.event.WindowListener newtListener, com.jogamp.newt.Window newtProxy) {
@@ -49,6 +51,7 @@ public class AWTWindowAdapter
public AWTWindowAdapter(com.jogamp.newt.Window downstream) {
super(downstream);
}
+
public AWTWindowAdapter() {
super();
}
@@ -100,7 +103,7 @@ public class AWTWindowAdapter
@Override
public synchronized void focusGained(java.awt.event.FocusEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusGained: "+e+" -> "+event);
}
@@ -112,7 +115,7 @@ public class AWTWindowAdapter
@Override
public synchronized void focusLost(java.awt.event.FocusEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusLost: "+e+" -> "+event);
}
@@ -124,7 +127,7 @@ public class AWTWindowAdapter
@Override
public synchronized void componentResized(java.awt.event.ComponentEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if(DEBUG_IMPLEMENTATION) {
final java.awt.Component c = e.getComponent();
final java.awt.Dimension sz = c.getSize();
@@ -148,7 +151,7 @@ public class AWTWindowAdapter
@Override
public synchronized void componentMoved(java.awt.event.ComponentEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: componentMoved: "+e+" -> "+event);
}
@@ -198,7 +201,7 @@ public class AWTWindowAdapter
@Override
public synchronized void windowActivated(java.awt.event.WindowEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if( EventProcRes.DISPATCH == processEvent(false, event) ) {
((com.jogamp.newt.event.WindowListener)newtListener).windowGainedFocus(event);
}
@@ -213,7 +216,7 @@ public class AWTWindowAdapter
@Override
public synchronized void windowDeactivated(java.awt.event.WindowEvent e) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if( EventProcRes.DISPATCH == processEvent(false, event) ) {
((com.jogamp.newt.event.WindowListener)newtListener).windowLostFocus(event);
}
@@ -233,7 +236,7 @@ public class AWTWindowAdapter
public void windowClosing(java.awt.event.WindowEvent e) {
synchronized( AWTWindowAdapter.this ) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if( EventProcRes.DISPATCH == processEvent(true, event) ) {
((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyNotify(event);
}
@@ -243,7 +246,7 @@ public class AWTWindowAdapter
public void windowClosed(java.awt.event.WindowEvent e) {
synchronized( AWTWindowAdapter.this ) {
if( !isSetup ) { return; }
- com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
+ com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, nsHolder);
if( EventProcRes.DISPATCH == processEvent(true, event) ) {
((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
}
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index 93ecc8bb2..674d467f9 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -548,6 +548,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
@Override
+ public final NativeSurface getNativeSurface() { return this; }
+
+ @Override
public AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config;
}