Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions py5_jar/src/main/java/py5/core/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,12 @@ public void setup() {
PSurface surface = getSurface();

// request focus for Java2D renderer on Windows and MacOS
if (sketchRenderer().equals(JAVA2D)) {
if (platform == WINDOWS) {
Canvas canvas = (Canvas) surface.getNative();
canvas.setFocusable(true);
canvas.requestFocus();
} else if (platform == MACOS) {
ThinkDifferent.activateIgnoringOtherApps();
}
if (platform == WINDOWS && sketchRenderer().equals(JAVA2D)) {
Canvas canvas = (Canvas) surface.getNative();
canvas.setFocusable(true);
canvas.requestFocus();
} else if (platform == MACOS && (sketchRenderer().equals(JAVA2D) || g.isGL())) {
ThinkDifferent.activateIgnoringOtherApps();
}

if (py5IconPath != null && !(g instanceof PGraphicsOpenGL)) {
Expand Down Expand Up @@ -229,8 +227,7 @@ public void setup() {
capturePixels();
GLWindow window = (GLWindow) surface.getNative();
long windowHandle = window.getWindowHandle();
// also need to pass the window handle to the bridge to make a Windows
// API call to request focus
// the bridge will make a Windows API call to request focus
py5Bridge.focus_window(windowHandle);
}
}
Expand Down