()
| 951 | |
| 952 | |
| 953 | void handleSettings() { |
| 954 | insideSettings = true; |
| 955 | |
| 956 | // Need the list of display devices to be queried already for usage below. |
| 957 | // https://github.com/processing/processing/issues/3295 |
| 958 | // https://github.com/processing/processing/issues/3296 |
| 959 | // Not doing this from a static initializer because it may cause |
| 960 | // PApplet to cache and the values to stick through subsequent runs. |
| 961 | // Instead make it a runtime thing and a local variable. |
| 962 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
| 963 | GraphicsDevice device = ge.getDefaultScreenDevice(); |
| 964 | displayDevices = ge.getScreenDevices(); |
| 965 | |
| 966 | // Default or unparsed will be -1, spanning will be 0, actual displays will |
| 967 | // be numbered from 1 because it's too weird to say "display 0" in prefs. |
| 968 | if (display > 0 && display <= displayDevices.length) { |
| 969 | device = displayDevices[display-1]; |
| 970 | } |
| 971 | // Set displayWidth and displayHeight for people still using those. |
| 972 | DisplayMode displayMode = device.getDisplayMode(); |
| 973 | displayWidth = displayMode.getWidth(); |
| 974 | displayHeight = displayMode.getHeight(); |
| 975 | |
| 976 | // Here's where size(), fullScreen(), smooth(N) and noSmooth() might |
| 977 | // be called, conjuring up the demons of various rendering configurations. |
| 978 | settings(); |
| 979 | |
| 980 | if (display == SPAN && platform == MACOSX) { |
| 981 | // Make sure "Displays have separate Spaces" is unchecked |
| 982 | // in System Preferences > Mission Control |
| 983 | Process p = exec("defaults", "read", "com.apple.spaces", "spans-displays"); |
| 984 | BufferedReader outReader = createReader(p.getInputStream()); |
| 985 | BufferedReader errReader = createReader(p.getErrorStream()); |
| 986 | StringBuilder stdout = new StringBuilder(); |
| 987 | StringBuilder stderr = new StringBuilder(); |
| 988 | String line = null; |
| 989 | try { |
| 990 | while ((line = outReader.readLine()) != null) { |
| 991 | stdout.append(line); |
| 992 | } |
| 993 | while ((line = errReader.readLine()) != null) { |
| 994 | stderr.append(line); |
| 995 | } |
| 996 | } catch (IOException e) { |
| 997 | printStackTrace(e); |
| 998 | } |
| 999 | |
| 1000 | int resultCode = -1; |
| 1001 | try { |
| 1002 | resultCode = p.waitFor(); |
| 1003 | } catch (InterruptedException e) { } |
| 1004 | |
| 1005 | String result = trim(stdout.toString()); |
| 1006 | if ("0".equals(result)) { |
| 1007 | EventQueue.invokeLater(new Runnable() { |
| 1008 | public void run() { |
| 1009 | checkLookAndFeel(); |
| 1010 | final String msg = |
no test coverage detected