1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-21 12:29:23 +01:00

Only display touch bar on macOS 10.12 and higher (#8281)

This commit is contained in:
Sandeep Mistry 2018-12-11 09:37:41 -05:00 committed by GitHub
parent 30e1466590
commit b3b62d0c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import com.thizzer.jtouchbar.JTouchBar;
import com.thizzer.jtouchbar.item.TouchBarItem;
import com.thizzer.jtouchbar.item.view.TouchBarButton;
import cc.arduino.contributions.VersionComparator;
import processing.app.helpers.OSUtils;
import java.awt.*;
@ -149,7 +150,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener, Key
statusFont = Theme.getFont("buttons.status.font");
statusColor = Theme.getColor("buttons.status.color");
if (OSUtils.isMacOS()) {
if (OSUtils.isMacOS() && VersionComparator.greaterThanOrEqual(OSUtils.version(), "10.12")) {
editor.addWindowListener(new WindowAdapter() {
public void windowActivated(WindowEvent e) {
if (touchBar == null) {

View File

@ -61,6 +61,10 @@ public class VersionComparator implements Comparator<String> {
public static boolean greaterThan(String a, String b) {
return compareTo(a, b) > 0;
}
public static boolean greaterThanOrEqual(String a, String b) {
return compareTo(a, b) >= 0;
}
public static String max(String a, String b) {
return greaterThan(a, b) ? a : b;

View File

@ -29,4 +29,8 @@ public class OSUtils {
static public boolean hasMacOSStyleMenus() {
return OSUtils.isMacOS() && "true".equals(System.getProperty("apple.laf.useScreenMenuBar"));
}
static public String version() {
return System.getProperty("os.version");
}
}