Skip to content

Commit

Permalink
Only display touch bar on macOS 10.12 and higher (arduino#8281)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepmistry authored Dec 11, 2018
1 parent 30e1466 commit b3b62d0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/processing/app/EditorToolbar.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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.*;
Expand Down Expand Up @@ -149,7 +150,7 @@ public EditorToolbar(Editor editor, JMenu menu) {
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ public int compare(String a, String b) {
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;
Expand Down
4 changes: 4 additions & 0 deletions arduino-core/src/processing/app/helpers/OSUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@ static public boolean isMacOS() {
static public boolean hasMacOSStyleMenus() {
return OSUtils.isMacOS() && "true".equals(System.getProperty("apple.laf.useScreenMenuBar"));
}

static public String version() {
return System.getProperty("os.version");
}
}

0 comments on commit b3b62d0

Please sign in to comment.