Skip to content

Commit 43e5518

Browse files
committed
new activateSketchWindow static method for macOS
1 parent 42d0612 commit 43e5518

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

core/src/processing/core/ThinkDifferent.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,22 @@ static private Desktop getDesktop() {
129129

130130
static native public void activate();
131131

132+
// Used by py5 to bring windows to the front
133+
static public void activateSketchWindow() {
134+
try {
135+
String osVersion = System.getProperty("os.version");
136+
int versionNumber = Integer.parseInt(osVersion.split("\\.")[0]);
137+
138+
if (versionNumber >= 14) {
139+
activate();
140+
} else if (versionNumber >= 10) {
141+
activateIgnoringOtherApps();
142+
}
143+
} catch (Exception e) {
144+
// ignore
145+
}
146+
}
147+
132148
static {
133149
final String NATIVE_FILENAME = "libDifferent.jnilib";
134150
try {

0 commit comments

Comments
 (0)