()
| 838 | |
| 839 | |
| 840 | void handleSettings() { |
| 841 | insideSettings = true; |
| 842 | |
| 843 | if (!disableAWT) { |
| 844 | displayWidth = ShimAWT.getDisplayWidth(); |
| 845 | displayHeight = ShimAWT.getDisplayHeight(); |
| 846 | } else { |
| 847 | // https://github.com/processing/processing4/issues/57 |
| 848 | System.err.println("AWT disabled, displayWidth/displayHeight will be 0"); |
| 849 | } |
| 850 | |
| 851 | // Here's where size(), fullScreen(), smooth(N) and noSmooth() might |
| 852 | // be called, conjuring up the demons of various rendering configurations. |
| 853 | settings(); |
| 854 | |
| 855 | if (display == SPAN && platform == MACOS) { |
| 856 | // Make sure "Displays have separate Spaces" is unchecked |
| 857 | // in System Preferences > Mission Control |
| 858 | Process p = exec("defaults", "read", "com.apple.spaces", "spans-displays"); |
| 859 | BufferedReader outReader = createReader(p.getInputStream()); |
| 860 | BufferedReader errReader = createReader(p.getErrorStream()); |
| 861 | StringBuilder stdout = new StringBuilder(); |
| 862 | StringBuilder stderr = new StringBuilder(); |
| 863 | String line; |
| 864 | try { |
| 865 | while ((line = outReader.readLine()) != null) { |
| 866 | stdout.append(line); |
| 867 | } |
| 868 | while ((line = errReader.readLine()) != null) { |
| 869 | stderr.append(line); |
| 870 | } |
| 871 | } catch (IOException e) { |
| 872 | printStackTrace(e); |
| 873 | } |
| 874 | |
| 875 | int resultCode = -1; |
| 876 | try { |
| 877 | resultCode = p.waitFor(); |
| 878 | } catch (InterruptedException ignored) { } |
| 879 | |
| 880 | if (resultCode == 1) { |
| 881 | String msg = trim(stderr.toString()); |
| 882 | // This message is confusing, so don't print if it's something typical |
| 883 | if (!(msg.contains("The domain/default pair") && msg.contains("does not exist"))) { |
| 884 | System.err.println("Could not check the status of “Displays have separate spaces.”"); |
| 885 | System.err.println("Result for 'defaults read' was " + resultCode); |
| 886 | System.err.println(msg); |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | String processOutput = trim(stdout.toString()); |
| 891 | // On Catalina, the option may not be set, so resultCode |
| 892 | // will be 1 (an error, since the param doesn't exist.) |
| 893 | // But "Displays have separate spaces" is on by default. |
| 894 | // For Monterey, it appears to not be set until the user |
| 895 | // has visited the Mission Control preference pane once. |
| 896 | if (resultCode == 1 || "0".equals(processOutput)) { |
| 897 | System.err.println("To use fullScreen(SPAN), visit System Preferences → Mission Control"); |
no test coverage detected