diff --git a/core/different/different.m b/core/different/different.m index c93538dee..5edfbe0f6 100644 --- a/core/different/different.m +++ b/core/different/different.m @@ -1,7 +1,7 @@ #import #import -#import -// #include +// #import +#include JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_hideMenuBar (JNIEnv *env, jclass clazz, jboolean visible, jboolean kioskMode) @@ -24,3 +24,10 @@ JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_activateIgnoringOther { [NSApp activateIgnoringOtherApps:true]; } + + +JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_activate +(JNIEnv *env, jclass klass) +{ + [NSApp activate]; +} diff --git a/core/different/libDifferent_aarch64 b/core/different/libDifferent_aarch64 index f45612d57..8021f386e 100755 Binary files a/core/different/libDifferent_aarch64 and b/core/different/libDifferent_aarch64 differ diff --git a/core/different/libDifferent_x86_64 b/core/different/libDifferent_x86_64 index 7862ddbac..342e899ec 100755 Binary files a/core/different/libDifferent_x86_64 and b/core/different/libDifferent_x86_64 differ diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index 1b54396c5..29d4efc4b 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -740,7 +740,7 @@ public class PFont implements PConstants { // six element array received from the Java2D path iterator float[] iterPoints = new float[6]; // array passed to createGlyphVector - char[] textArray = new char[] { ch }; + char[] textArray = { ch }; //Graphics2D graphics = (Graphics2D) this.getGraphics(); //FontRenderContext frc = graphics.getFontRenderContext(); @@ -755,16 +755,17 @@ public class PFont implements PConstants { shp.getPathIterator(null, detail); // convert to line segments int contours = 0; + s.beginShape(); + s.noStroke(); + s.fill(0); while (!iter.isDone()) { int type = iter.currentSegment(iterPoints); switch (type) { case PathIterator.SEG_MOVETO: // 1 point (2 vars) in textPoints - if (contours == 0) { - s.beginShape(); - } else { + if (contours > 0) { s.beginContour(); } - contours++; + ++contours; s.vertex(iterPoints[0], iterPoints[1]); break; diff --git a/core/src/processing/core/ThinkDifferent.java b/core/src/processing/core/ThinkDifferent.java index 141779be5..bfa6768be 100644 --- a/core/src/processing/core/ThinkDifferent.java +++ b/core/src/processing/core/ThinkDifferent.java @@ -124,9 +124,33 @@ public class ThinkDifferent { static native public void showMenuBar(); - // Used by Python (Jython) Mode to bring windows to the front + // deprecated + // https://developer.apple.com/documentation/appkit/nsapplication/activate(ignoringotherapps:) static native public void activateIgnoringOtherApps(); + // added in macOS 14 (Sonoma) + // https://developer.apple.com/documentation/appkit/nsapplication/activate() + static native public void activate(); + + // Used by py5 to bring Sketch to the front + static public boolean activateSketchWindow() { + try { + String osVersion = System.getProperty("os.version"); + int versionNumber = Integer.parseInt(osVersion.split("\\.")[0]); + + if (versionNumber >= 14) { + activate(); + return true; + } else if (versionNumber >= 10) { + activateIgnoringOtherApps(); + return true; + } + } catch (Exception e) { + return false; + } + + return false; + } static { final String NATIVE_FILENAME = "libDifferent.jnilib"; diff --git a/core/src/processing/core/libDifferent.jnilib b/core/src/processing/core/libDifferent.jnilib index c45256c03..c24b8efe1 100755 Binary files a/core/src/processing/core/libDifferent.jnilib and b/core/src/processing/core/libDifferent.jnilib differ