From ff80f4d5527a2bb7fd8100dc1aa136321fc9a9ad Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Tue, 8 Oct 2019 15:01:17 -0400 Subject: [PATCH] replacing MACOSX with MACOS --- core/src/processing/awt/PSurfaceAWT.java | 12 +++++----- core/src/processing/core/PApplet.java | 26 +++++++++++----------- core/src/processing/core/PFont.java | 4 ++-- core/src/processing/javafx/PSurfaceFX.java | 8 +++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index 71a59e87f..8d897f44d 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -425,7 +425,7 @@ public class PSurfaceAWT extends PSurfaceNone { sketch.displayWidth = screenRect.width; sketch.displayHeight = screenRect.height; - windowScaleFactor = PApplet.platform == PConstants.MACOSX ? + windowScaleFactor = PApplet.platform == PConstants.MACOS ? 1 : sketch.pixelDensity; sketchWidth = sketch.sketchWidth() * windowScaleFactor; @@ -565,7 +565,7 @@ public class PSurfaceAWT extends PSurfaceNone { // Workaround for apparent Java bug on OS X? // https://github.com/processing/processing/issues/3472 if (cursorVisible && - (PApplet.platform == PConstants.MACOSX) && + (PApplet.platform == PConstants.MACOS) && (cursorType != PConstants.ARROW)) { hideCursor(); showCursor(); @@ -588,7 +588,7 @@ public class PSurfaceAWT extends PSurfaceNone { public void setIcon(PImage image) { Image awtImage = (Image) image.getNative(); - if (PApplet.platform != PConstants.MACOSX) { + if (PApplet.platform != PConstants.MACOS) { frame.setIconImage(awtImage); } else { @@ -623,12 +623,12 @@ public class PSurfaceAWT extends PSurfaceNone { protected void setProcessingIcon(Frame frame) { // On OS X, this only affects what shows up in the dock when minimized. // So replacing it is actually a step backwards. Brilliant. - if (PApplet.platform != PConstants.MACOSX) { + if (PApplet.platform != PConstants.MACOS) { //Image image = Toolkit.getDefaultToolkit().createImage(ICON_IMAGE); //frame.setIconImage(image); try { if (iconImages == null) { - iconImages = new ArrayList(); + iconImages = new ArrayList<>(); final int[] sizes = { 16, 32, 48, 64, 128, 256, 512 }; for (int sz : sizes) { @@ -1475,7 +1475,7 @@ public class PSurfaceAWT extends PSurfaceNone { public void setCursor(int kind) { // Swap the HAND cursor because MOVE doesn't seem to be available on OS X // https://github.com/processing/processing/issues/2358 - if (PApplet.platform == PConstants.MACOSX && kind == PConstants.MOVE) { + if (PApplet.platform == PConstants.MACOS && kind == PConstants.MOVE) { kind = PConstants.HAND; } canvas.setCursor(Cursor.getPredefinedCursor(kind)); diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 51e1bc928..e4208ca62 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -155,7 +155,7 @@ public class PApplet implements PConstants { String osname = System.getProperty("os.name"); if (osname.indexOf("Mac") != -1) { - platform = MACOSX; + platform = MACOS; } else if (osname.indexOf("Windows") != -1) { platform = WINDOWS; @@ -981,7 +981,7 @@ public class PApplet implements PConstants { // be called, conjuring up the demons of various rendering configurations. settings(); - if (display == SPAN && platform == MACOSX) { + if (display == SPAN && platform == MACOS) { // Make sure "Displays have separate Spaces" is unchecked // in System Preferences > Mission Control Process p = exec("defaults", "read", "com.apple.spaces", "spans-displays"); @@ -1158,7 +1158,7 @@ public class PApplet implements PConstants { * @param display the display number to check */ public int displayDensity(int display) { - if (PApplet.platform == PConstants.MACOSX) { + if (PApplet.platform == PConstants.MACOS) { // This should probably be reset each time there's a display change. // A 5-minute search didn't turn up any such event in the Java 7 API. // Also, should we use the Toolkit associated with the editor window? @@ -2696,7 +2696,7 @@ public class PApplet implements PConstants { int button = event.getButton(); // If running on Mac OS, allow ctrl-click as right mouse. - if (PApplet.platform == PConstants.MACOSX && event.getButton() == PConstants.LEFT) { + if (PApplet.platform == PConstants.MACOS && event.getButton() == PConstants.LEFT) { if (action == MouseEvent.PRESS && event.isControlDown()) { macosxLeftButtonWithCtrlPressed = true; } @@ -3037,8 +3037,8 @@ public class PApplet implements PConstants { // embedded inside an application that has its own close behavior. if (external && event.getKeyCode() == 'W' && - ((event.isMetaDown() && platform == MACOSX) || - (event.isControlDown() && platform != MACOSX))) { + ((event.isMetaDown() && platform == MACOS) || + (event.isControlDown() && platform != MACOS))) { // Can't use this native stuff b/c the native event might be NEWT // if (external && event.getNative() instanceof java.awt.event.KeyEvent && // ((java.awt.event.KeyEvent) event.getNative()).getModifiers() == @@ -3504,7 +3504,7 @@ public class PApplet implements PConstants { // in the user.dir part of the url params = new String[] { "cmd", "/c" }; - } else if (platform == MACOSX) { + } else if (platform == MACOS) { params = new String[] { "open" }; } else if (platform == LINUX) { @@ -3841,7 +3841,7 @@ public class PApplet implements PConstants { handleMethods("dispose"); } - if (platform == MACOSX) { + if (platform == MACOS) { try { final String td = "processing.core.ThinkDifferent"; final Class thinkDifferent = getClass().getClassLoader().loadClass(td); @@ -6678,7 +6678,7 @@ public class PApplet implements PConstants { (sketch.g instanceof PGraphicsOpenGL) && (platform == WINDOWS); if (hide) sketch.surface.setVisible(false); - if (platform == MACOSX && useNativeSelect != false) { + if (platform == MACOS && useNativeSelect != false) { FileDialog fileDialog = new FileDialog(parentFrame, prompt, FileDialog.LOAD); if (defaultSelection != null) { @@ -7967,7 +7967,7 @@ public class PApplet implements PConstants { // Workaround for bug in Java for OS X from Oracle (7u51) // https://github.com/processing/processing/issues/2181 - if (platform == MACOSX) { + if (platform == MACOS) { if (jarPath.contains("Contents/Java/")) { String appPath = jarPath.substring(0, jarPath.indexOf(".app") + 4); File containingFolder = new File(appPath).getParentFile(); @@ -9258,7 +9258,7 @@ public class PApplet implements PConstants { static Pattern matchPattern(String regexp) { Pattern p = null; if (matchPatterns == null) { - matchPatterns = new LinkedHashMap(16, 0.75f, true) { + matchPatterns = new LinkedHashMap<>(16, 0.75f, true) { @Override protected boolean removeEldestEntry(Map.Entry eldest) { // Limit the number of match patterns at 10 most recently used @@ -10857,7 +10857,7 @@ public class PApplet implements PConstants { } } - if (platform == MACOSX) { + if (platform == MACOS) { try { final String td = "processing.core.ThinkDifferent"; Class thinkDifferent = @@ -11077,7 +11077,7 @@ public class PApplet implements PConstants { /** Convenience method, should only be called by PSurface subclasses. */ static public void hideMenuBar() { - if (PApplet.platform == PConstants.MACOSX) { + if (PApplet.platform == PConstants.MACOS) { // Call some native code to remove the menu bar on OS X. Not necessary // on Linux and Windows, who are happy to make full screen windows. japplemenubar.JAppleMenuBar.hide(); diff --git a/core/src/processing/core/PFont.java b/core/src/processing/core/PFont.java index 33ca7eb40..9812063af 100644 --- a/core/src/processing/core/PFont.java +++ b/core/src/processing/core/PFont.java @@ -914,7 +914,7 @@ public class PFont implements PConstants { GraphicsEnvironment.getLocalGraphicsEnvironment(); fonts = ge.getAllFonts(); - if (PApplet.platform == PConstants.MACOSX) { + if (PApplet.platform == PConstants.MACOS) { fontDifferent = new HashMap<>(); for (Font font : fonts) { // No need to use getPSName() anymore because getName() @@ -936,7 +936,7 @@ public class PFont implements PConstants { * See: issue #5481 */ static public Font findFont(String name) { - if (PApplet.platform == PConstants.MACOSX) { + if (PApplet.platform == PConstants.MACOS) { loadFonts(); Font maybe = fontDifferent.get(name); if (maybe != null) { diff --git a/core/src/processing/javafx/PSurfaceFX.java b/core/src/processing/javafx/PSurfaceFX.java index c2905f08f..831ef4418 100644 --- a/core/src/processing/javafx/PSurfaceFX.java +++ b/core/src/processing/javafx/PSurfaceFX.java @@ -154,7 +154,7 @@ public class PSurfaceFX implements PSurface { //addEventHandler(eventType, eventHandler); - EventHandler mouseHandler = new EventHandler() { + EventHandler mouseHandler = new EventHandler<>() { public void handle(MouseEvent e) { fxMouseEvent(e); } @@ -175,7 +175,7 @@ public class PSurfaceFX implements PSurface { } }); - EventHandler keyHandler = new EventHandler() { + EventHandler keyHandler = new EventHandler<>() { public void handle(KeyEvent e) { fxKeyEvent(e); } @@ -248,7 +248,7 @@ public class PSurfaceFX implements PSurface { // See JEP 263 float renderScale = Screen.getMainScreen().getRecommendedOutputScaleX(); - if (PApplet.platform == PConstants.MACOSX) { + if (PApplet.platform == PConstants.MACOS) { for (Screen s : Screen.getScreens()) { renderScale = Math.max(renderScale, s.getRecommendedOutputScaleX()); } @@ -337,7 +337,7 @@ public class PSurfaceFX implements PSurface { // Workaround for https://bugs.openjdk.java.net/browse/JDK-8136495 // https://github.com/processing/processing/issues/3823 - if ((PApplet.platform == PConstants.MACOSX || + if ((PApplet.platform == PConstants.MACOS || PApplet.platform == PConstants.LINUX) && PApplet.javaVersionName.compareTo("1.8.0_60") >= 0 && PApplet.javaVersionName.compareTo("1.8.0_72") < 0) {