mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fix listener add/remove issue
This commit is contained in:
@@ -2114,8 +2114,18 @@ public class PApplet extends Applet
|
||||
comp.removeMouseMotionListener(this);
|
||||
comp.removeKeyListener(this);
|
||||
comp.removeFocusListener(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call to remove, then add, listeners to a component.
|
||||
* Avoids issues with double-adding.
|
||||
*/
|
||||
public void updateListeners(Component comp) {
|
||||
removeListeners(comp);
|
||||
addListeners(comp);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PGraphicsJava2D extends PGraphics /*PGraphics2D*/ {
|
||||
// parent.addListeners(canvas);
|
||||
//// canvas.createBufferStrategy(1);
|
||||
// g2 = (Graphics2D) canvas.getGraphics();
|
||||
parent.addListeners(parent);
|
||||
parent.updateListeners(parent); // in case they're already there
|
||||
|
||||
// Needs to be RGB otherwise there's a major performance hit [0204]
|
||||
// http://code.google.com/p/processing/issues/detail?id=729
|
||||
|
||||
Reference in New Issue
Block a user