Skip to content

Commit b3b62d0

Browse files
Only display touch bar on macOS 10.12 and higher (#8281)
1 parent 30e1466 commit b3b62d0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

app/src/processing/app/EditorToolbar.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.thizzer.jtouchbar.item.TouchBarItem;
3232
import com.thizzer.jtouchbar.item.view.TouchBarButton;
3333

34+
import cc.arduino.contributions.VersionComparator;
3435
import processing.app.helpers.OSUtils;
3536

3637
import java.awt.*;
@@ -149,7 +150,7 @@ public EditorToolbar(Editor editor, JMenu menu) {
149150
statusFont = Theme.getFont("buttons.status.font");
150151
statusColor = Theme.getColor("buttons.status.color");
151152

152-
if (OSUtils.isMacOS()) {
153+
if (OSUtils.isMacOS() && VersionComparator.greaterThanOrEqual(OSUtils.version(), "10.12")) {
153154
editor.addWindowListener(new WindowAdapter() {
154155
public void windowActivated(WindowEvent e) {
155156
if (touchBar == null) {

arduino-core/src/cc/arduino/contributions/VersionComparator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public int compare(String a, String b) {
6161
public static boolean greaterThan(String a, String b) {
6262
return compareTo(a, b) > 0;
6363
}
64+
65+
public static boolean greaterThanOrEqual(String a, String b) {
66+
return compareTo(a, b) >= 0;
67+
}
6468

6569
public static String max(String a, String b) {
6670
return greaterThan(a, b) ? a : b;

arduino-core/src/processing/app/helpers/OSUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ static public boolean isMacOS() {
2929
static public boolean hasMacOSStyleMenus() {
3030
return OSUtils.isMacOS() && "true".equals(System.getProperty("apple.laf.useScreenMenuBar"));
3131
}
32+
33+
static public String version() {
34+
return System.getProperty("os.version");
35+
}
3236
}

0 commit comments

Comments
 (0)