Skip to content

Commit 7a325a8

Browse files
authored
Merge branch 'processing:main' into main-gradle
2 parents 839b1aa + 342a6eb commit 7a325a8

File tree

6 files changed

+40
-8
lines changed

6 files changed

+40
-8
lines changed

core/different/different.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import <AppKit/AppKit.h>
22
#import <Cocoa/Cocoa.h>
3-
#import <JavaNativeFoundation/JavaNativeFoundation.h>
4-
// #include <jni.h>
3+
// #import <JavaNativeFoundation/JavaNativeFoundation.h>
4+
#include <jni.h>
55

66
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_hideMenuBar
77
(JNIEnv *env, jclass clazz, jboolean visible, jboolean kioskMode)
@@ -24,3 +24,10 @@
2424
{
2525
[NSApp activateIgnoringOtherApps:true];
2626
}
27+
28+
29+
JNIEXPORT void JNICALL Java_processing_core_ThinkDifferent_activate
30+
(JNIEnv *env, jclass klass)
31+
{
32+
[NSApp activate];
33+
}

core/different/libDifferent_aarch64

135 Bytes
Binary file not shown.

core/different/libDifferent_x86_64

-23.9 KB
Binary file not shown.

core/src/processing/core/PFont.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public PShape getShape(char ch, float detail) {
740740
// six element array received from the Java2D path iterator
741741
float[] iterPoints = new float[6];
742742
// array passed to createGlyphVector
743-
char[] textArray = new char[] { ch };
743+
char[] textArray = { ch };
744744

745745
//Graphics2D graphics = (Graphics2D) this.getGraphics();
746746
//FontRenderContext frc = graphics.getFontRenderContext();
@@ -755,16 +755,17 @@ public PShape getShape(char ch, float detail) {
755755
shp.getPathIterator(null, detail); // convert to line segments
756756

757757
int contours = 0;
758+
s.beginShape();
759+
s.noStroke();
760+
s.fill(0);
758761
while (!iter.isDone()) {
759762
int type = iter.currentSegment(iterPoints);
760763
switch (type) {
761764
case PathIterator.SEG_MOVETO: // 1 point (2 vars) in textPoints
762-
if (contours == 0) {
763-
s.beginShape();
764-
} else {
765+
if (contours > 0) {
765766
s.beginContour();
766767
}
767-
contours++;
768+
++contours;
768769
s.vertex(iterPoints[0], iterPoints[1]);
769770
break;
770771

core/src/processing/core/ThinkDifferent.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,33 @@ static private Desktop getDesktop() {
124124

125125
static native public void showMenuBar();
126126

127-
// Used by Python (Jython) Mode to bring windows to the front
127+
// deprecated
128+
// https://developer.apple.com/documentation/appkit/nsapplication/activate(ignoringotherapps:)
128129
static native public void activateIgnoringOtherApps();
129130

131+
// added in macOS 14 (Sonoma)
132+
// https://developer.apple.com/documentation/appkit/nsapplication/activate()
133+
static native public void activate();
134+
135+
// Used by py5 to bring Sketch to the front
136+
static public boolean activateSketchWindow() {
137+
try {
138+
String osVersion = System.getProperty("os.version");
139+
int versionNumber = Integer.parseInt(osVersion.split("\\.")[0]);
140+
141+
if (versionNumber >= 14) {
142+
activate();
143+
return true;
144+
} else if (versionNumber >= 10) {
145+
activateIgnoringOtherApps();
146+
return true;
147+
}
148+
} catch (Exception e) {
149+
return false;
150+
}
151+
152+
return false;
153+
}
130154

131155
static {
132156
final String NATIVE_FILENAME = "libDifferent.jnilib";
-47.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)