mirror of
https://github.com/processing/processing4.git
synced 2026-02-22 23:05:58 +01:00
Added NEWT window listener to catch window focus events. Fixes issue #1483
This commit is contained in:
@@ -60,6 +60,8 @@ import processing.event.MouseEvent;
|
||||
|
||||
import com.jogamp.newt.awt.NewtCanvasAWT;
|
||||
import com.jogamp.newt.event.InputEvent;
|
||||
import com.jogamp.newt.event.WindowEvent;
|
||||
import com.jogamp.newt.event.WindowUpdateEvent;
|
||||
import com.jogamp.newt.opengl.GLWindow;
|
||||
import com.jogamp.opengl.FBObject;
|
||||
import com.jogamp.opengl.util.AnimatorBase;
|
||||
@@ -655,6 +657,9 @@ public class PGL {
|
||||
com.jogamp.newt.event.KeyListener keyListener = new NEWTKeyAdapter();
|
||||
window.addKeyListener(keyListener);
|
||||
|
||||
com.jogamp.newt.event.WindowListener winListener = new NEWTWindowListener();
|
||||
window.addWindowListener(winListener);
|
||||
|
||||
capabilities = window.getChosenGLCapabilities();
|
||||
canvas = canvasNEWT;
|
||||
canvasAWT = null;
|
||||
@@ -3296,6 +3301,33 @@ public class PGL {
|
||||
pg.parent.postEvent(ke);
|
||||
}
|
||||
|
||||
class NEWTWindowListener implements com.jogamp.newt.event.WindowListener {
|
||||
@Override
|
||||
public void windowGainedFocus(WindowEvent arg0) {
|
||||
pg.parent.focusGained(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowLostFocus(WindowEvent arg0) {
|
||||
pg.parent.focusLost(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowDestroyNotify(WindowEvent arg0) { }
|
||||
|
||||
@Override
|
||||
public void windowDestroyed(WindowEvent arg0) { }
|
||||
|
||||
@Override
|
||||
public void windowMoved(WindowEvent arg0) { }
|
||||
|
||||
@Override
|
||||
public void windowRepaint(WindowUpdateEvent arg0) { }
|
||||
|
||||
@Override
|
||||
public void windowResized(WindowEvent arg0) { }
|
||||
}
|
||||
|
||||
// NEWT mouse listener
|
||||
class NEWTMouseAdapter extends com.jogamp.newt.event.MouseAdapter {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user