From 9d4da2fa3ffafc6dc7b89b430e41de5bf7683c5b Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 3 Jun 2013 11:36:22 -0400 Subject: [PATCH] another focus tweak --- core/src/processing/core/PApplet.java | 2 +- core/src/processing/core/PGraphics.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index fdc5417df..00d2e49dd 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -2157,7 +2157,7 @@ public class PApplet extends Applet //requestFocusInWindow(); // For 2.0, pass this to the renderer, to lend a hand to OpenGL - g.requestFocus(PApplet.this); + g.requestFocus(); } }); } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 9b302cf23..5edf6b826 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -808,8 +808,10 @@ public class PGraphics extends PImage implements PConstants { * Handle grabbing the focus from the parent applet. Other renderers can * override this if handling needs to be different. */ - public void requestFocus(Component parent) { // ignore - parent.requestFocusInWindow(); + public void requestFocus() { // ignore + if (parent != null) { + parent.requestFocusInWindow(); + } }