Skip to content

Commit 6c1d316

Browse files
authored
Merge pull request #574 from hx2A/openglthinkdifferent
Change ThinkDifferent call
2 parents 94a91d1 + a36fb10 commit 6c1d316

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

py5_jar/src/main/java/py5/core/Sketch.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,12 @@ public void setup() {
191191
PSurface surface = getSurface();
192192

193193
// request focus for Java2D renderer on Windows and MacOS
194-
if (sketchRenderer().equals(JAVA2D)) {
195-
if (platform == WINDOWS) {
196-
Canvas canvas = (Canvas) surface.getNative();
197-
canvas.setFocusable(true);
198-
canvas.requestFocus();
199-
} else if (platform == MACOS) {
200-
ThinkDifferent.activateIgnoringOtherApps();
201-
}
194+
if (platform == WINDOWS && sketchRenderer().equals(JAVA2D)) {
195+
Canvas canvas = (Canvas) surface.getNative();
196+
canvas.setFocusable(true);
197+
canvas.requestFocus();
198+
} else if (platform == MACOS && (sketchRenderer().equals(JAVA2D) || g.isGL())) {
199+
ThinkDifferent.activateIgnoringOtherApps();
202200
}
203201

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

0 commit comments

Comments
 (0)