Skip to content

Commit 0c1ab7c

Browse files
committed
requestFocus() out of PSurface, key events firing in FX
1 parent d13291b commit 0c1ab7c

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

core/src/processing/core/PSurface.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ public void initFrame(PApplet sketch, int backgroundColor,
108108

109109
public void setFrameRate(float fps);
110110

111-
// called on the first frame so that the now-visible drawing surface can
112-
// receive key and mouse events
113-
public void requestFocus();
111+
// // called on the first frame so that the now-visible drawing surface can
112+
// // receive key and mouse events
113+
// public void requestFocus();
114114

115115
// // finish rendering to the screen (called by PApplet)
116116
// public void blit();

core/src/processing/core/PSurfaceAWT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void componentResized(ComponentEvent e) {
111111
* invokeLater() happens in here rather than requiring the caller to wrap it.
112112
*/
113113
@Override
114-
public void requestFocus() {
114+
void requestFocus() {
115115
// for 2.0a6, moving this request to the EDT
116116
EventQueue.invokeLater(new Runnable() {
117117
public void run() {

core/src/processing/core/PSurfaceFX.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public void handle(ScrollEvent e) {
115115

116116
EventHandler<KeyEvent> keyHandler = new EventHandler<KeyEvent>() {
117117
public void handle(KeyEvent e) {
118+
System.out.println(e);
118119
fxKeyEvent(e);
119120
}
120121
};
@@ -231,6 +232,7 @@ public void setVisible(boolean visible) {
231232
Platform.runLater(new Runnable() {
232233
public void run() {
233234
stage.show();
235+
canvas.requestFocus();
234236
}
235237
});
236238
}
@@ -408,11 +410,10 @@ public void setFrameRate(float fps) {
408410
}
409411

410412

411-
@Override
412-
public void requestFocus() {
413-
// TODO Auto-generated method stub
414-
415-
}
413+
// @Override
414+
// public void requestFocus() {
415+
// canvas.requestFocus();
416+
// }
416417

417418

418419
public void setCursor(int kind) {

core/src/processing/core/PSurfaceNone.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void setSmooth(int level) {
141141

142142
}
143143

144-
public void requestFocus() {
144+
void requestFocus() {
145145
// TODO Auto-generated method stub
146146

147147
}

0 commit comments

Comments
 (0)