mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fix bug with multiple key events coming through
This commit is contained in:
@@ -1097,6 +1097,22 @@ public class PApplet extends Applet
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
protected boolean listenersAdded;
|
||||
|
||||
public void addListeners() {
|
||||
if (!listenersAdded) {
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
addKeyListener(this);
|
||||
addFocusListener(this);
|
||||
listenersAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
MouseEvent mouseEventQueue[] = new MouseEvent[10];
|
||||
int mouseEventCount;
|
||||
|
||||
|
||||
@@ -319,12 +319,12 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* @param iheight viewport height
|
||||
*/
|
||||
public PGraphics(int iwidth, int iheight, PApplet applet) {
|
||||
if (applet != null) {
|
||||
applet.addMouseListener(applet);
|
||||
applet.addMouseMotionListener(applet);
|
||||
applet.addKeyListener(applet);
|
||||
applet.addFocusListener(applet);
|
||||
}
|
||||
if (applet != null) applet.addListeners();
|
||||
//applet.addMouseListener(applet);
|
||||
//applet.addMouseMotionListener(applet);
|
||||
//applet.addKeyListener(applet);
|
||||
//applet.addFocusListener(applet);
|
||||
//}
|
||||
resize(iwidth, iheight);
|
||||
}
|
||||
|
||||
@@ -2079,7 +2079,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
public void defaultLights() {
|
||||
throw new RuntimeException("defaultLights() can only be used with depth()");
|
||||
}
|
||||
|
||||
|
||||
public void light(int num, float x, float y, float z,
|
||||
float red, float green, float blue) {
|
||||
throw new RuntimeException("light() can only be used with depth()");
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
0083 core
|
||||
X fix double key events
|
||||
|
||||
_ fix bezierVertex() for newer api
|
||||
|
||||
@@ -31,9 +32,6 @@ _ angleMode shouldn't be the first param
|
||||
_ fix the flicker in java2d mode
|
||||
X is it because the lock was taken off (g) in PApplet?
|
||||
|
||||
GraphicsDevice theDevice =
|
||||
frame.getGraphicsConfiguration().getDevice();
|
||||
|
||||
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
|
||||
|
||||
_ apply tint() to textures as well
|
||||
@@ -57,6 +55,7 @@ _ make illustrator lib
|
||||
_ move really general things out of PConstants (X, Y, Z..)
|
||||
|
||||
sound
|
||||
_ duration as an internal param, not a function
|
||||
_ When a sound is finished playing, it should return to 0 so it can play again
|
||||
_ Putting sound.loop() in draw() seemed to spawn multiple sounds threads?
|
||||
_ After a sound is paused, it will only play from where it was paused
|
||||
@@ -161,6 +160,7 @@ _ Stroking a rect() leaves the upper right pixel off.
|
||||
|
||||
|
||||
api questions
|
||||
_ rename video.Camera to video.Video ?
|
||||
_ what to call firstMouse, implement rightMouse?
|
||||
_ should nf() handle commas as well?
|
||||
_ yes, and add nf(int what) so that non-padded version works
|
||||
@@ -196,6 +196,21 @@ _ for postscript, can grab the real font
|
||||
_ -> altho problem here is that really the fonts just need a name
|
||||
_ since needs to render to screen as well
|
||||
|
||||
text api solutions
|
||||
_ store the font name in the vlw font file (at the end)
|
||||
o could include multiple names for multi platforms
|
||||
_ is getFontList returning a different set of fonts from device2d?
|
||||
_ or is it only those with ps names?
|
||||
_ createFont() with a .ttf does a create font internally (1.3+ only)
|
||||
_ although the images aren't populated
|
||||
_ until a P2D/P3D/OPENGL tries to draw them, which triggers it
|
||||
_ but if PGraphics2, just uses the built-in font
|
||||
_ how does ftgl handle tesselation? will our tesselator just work?
|
||||
_ createFont() also works for font names and just creating them
|
||||
_ if font name doesn't end with otf or ttf, then tries to create it
|
||||
_ illustrator api can get the ps name from the java font name
|
||||
_ since it's associated with the font file.. wee!
|
||||
|
||||
_ beginShape()
|
||||
_ don't allow you to draw stroked items unless stroke() is called
|
||||
_ don't allow beginShape() if shape is already set
|
||||
|
||||
@@ -85,6 +85,7 @@ public class PGraphicsGL extends PGraphics3 {
|
||||
|
||||
//System.out.println("creating PGraphicsGL 5");
|
||||
|
||||
//System.out.println("adding canvas listeners");
|
||||
canvas.addMouseListener(applet);
|
||||
canvas.addMouseMotionListener(applet);
|
||||
canvas.addKeyListener(applet);
|
||||
|
||||
@@ -21,6 +21,7 @@ _ need to fix up the make/dist scripts for linux
|
||||
|
||||
_ saved window positions.. if displays has changed, becomes a problem
|
||||
_ record the display that it was on?
|
||||
_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
|
||||
_ make sure that the applet is within the bounds of the current display?
|
||||
_ (from 0, 0 to width, height)
|
||||
|
||||
@@ -31,6 +32,8 @@ _ to run explicitly later
|
||||
_ this seems too complicated.. just make people restart
|
||||
|
||||
_ ability to select monitor via preferences panel
|
||||
_ this applies to any applet that's run externally currently (verify)
|
||||
_ make it also work with anything that's run inside of p5 itself
|
||||
_ check current present code with multiple monitors
|
||||
_ if it's working, make it all reflection-based in PApplet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user