@Override public int compare(final MonitorMode mm1, final MonitorMode mm2) { return mm2.compareTo(mm1); }
/** Applies all settings not related to OpenGL (screen resolution, screen size, etc...) */ protected void applySettings() { _newtWindow.setUndecorated(_settings.isFullScreen()); if (_settings.isFullScreen()) { _newtWindow.setFullscreen(_monitorDevices); for (final MonitorDevice monitorDevice : _monitorDevices) { List<MonitorMode> monitorModes = monitorDevice.getSupportedModes(); final MonitorMode currentMode = monitorDevice.getCurrentMode(); if (monitorDevice == _monitorDevices.get(0)) { final Dimension dimension; // the resolution is taken into account only if it is valid if (_settings.getWidth() > 0 && _settings.getHeight() > 0) { dimension = new Dimension(_settings.getWidth(), _settings.getHeight()); } else { final DimensionImmutable currentResolution = currentMode.getSurfaceSize().getResolution(); dimension = new Dimension(currentResolution.getWidth(), currentResolution.getHeight()); } monitorModes = MonitorModeUtil.filterByResolution(monitorModes, dimension); } else { // FIXME the display settings should store the size of the other monitors } // if the frequency may be valid (greater than zero), it tries to use it final List<MonitorMode> byRateMonitorModes; if (_settings.getFrequency() > 0) { byRateMonitorModes = MonitorModeUtil.filterByRate(monitorModes, _settings.getFrequency()); } else { // if the frequency is set to zero, it tries to preserve the refresh rate if (_settings.getFrequency() == 0) { byRateMonitorModes = MonitorModeUtil.filterByRate(monitorModes, currentMode.getRefreshRate()); } else { // otherwise it picks the highest available rate byRateMonitorModes = MonitorModeUtil.getHighestAvailableRate(monitorModes); } } if (!byRateMonitorModes.isEmpty()) { monitorModes = byRateMonitorModes; } final List<MonitorMode> byBppMonitorModes; switch (_settings.getColorDepth()) { case 16: case 24: case 32: { byBppMonitorModes = MonitorModeUtil.filterByBpp(monitorModes, _settings.getColorDepth()); break; } case 0: { byBppMonitorModes = MonitorModeUtil.filterByBpp( monitorModes, currentMode.getSurfaceSize().getBitsPerPixel()); break; } case -1: { byBppMonitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); break; } default: { byBppMonitorModes = monitorModes; } } if (!byBppMonitorModes.isEmpty()) { monitorModes = byBppMonitorModes; } if (_settings.getRotation() == MonitorMode.ROTATE_0 || _settings.getRotation() == MonitorMode.ROTATE_90 || _settings.getRotation() == MonitorMode.ROTATE_180 || _settings.getRotation() == MonitorMode.ROTATE_270) { final List<MonitorMode> rotatedMonitorModes = MonitorModeUtil.filterByRotation(monitorModes, _settings.getRotation()); if (!rotatedMonitorModes.isEmpty()) { monitorModes = rotatedMonitorModes; } } monitorDevice.setCurrentMode(monitorModes.get(0)); } } else { _newtWindow.setFullscreen(false); } }