From 43e5518a778b25fe0a7a08aaf4a4cd79cc92f785 Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 11 Jan 2025 18:42:12 -0500 Subject: [PATCH] new activateSketchWindow static method for macOS --- core/src/processing/core/ThinkDifferent.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/src/processing/core/ThinkDifferent.java b/core/src/processing/core/ThinkDifferent.java index bf1d20138..411e093e8 100644 --- a/core/src/processing/core/ThinkDifferent.java +++ b/core/src/processing/core/ThinkDifferent.java @@ -129,6 +129,22 @@ public class ThinkDifferent { static native public void activate(); + // Used by py5 to bring windows to the front + static public void activateSketchWindow() { + try { + String osVersion = System.getProperty("os.version"); + int versionNumber = Integer.parseInt(osVersion.split("\\.")[0]); + + if (versionNumber >= 14) { + activate(); + } else if (versionNumber >= 10) { + activateIgnoringOtherApps(); + } + } catch (Exception e) { + // ignore + } + } + static { final String NATIVE_FILENAME = "libDifferent.jnilib"; try {