File tree Expand file tree Collapse file tree
py5_jar/src/main/java/py5/core Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments