diff options
author | Sven Gothel <[email protected]> | 2013-05-07 00:35:08 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-05-07 00:35:08 +0200 |
commit | 84576bc0b7c5bd9b7554ec02f01786228efdbe07 (patch) | |
tree | 8544a03b8df8a92a62e1a36ada8d462ca22747bc | |
parent | 5fb7f6322863e11892ace100e131ac7451ba8274 (diff) |
MonitorMode: Fix API doc / comments / names.
10 files changed, 122 insertions, 119 deletions
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index fbe4d8cf0..4b0a760a4 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -117,22 +117,26 @@ public abstract class MonitorDevice { } /** - * Return the immutable original {@link com.jogamp.newt.MonitorMode}, as used at NEWT initialization. - * @return original {@link MonitorMode} which is element of the list {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * Returns the immutable original {@link com.jogamp.newt.MonitorMode}, as used at NEWT initialization. + * <p> + * The returned {@link MonitorMode} is element of the lists {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * </p> */ public final MonitorMode getOriginalMode() { return originalMode; } /** - * FIXME: May need to support mutable mode, i.e. adding modes on the fly! - * @return the immutable list of {@link MonitorMode}s supported by this monitor. Use w/ care, it's not a copy! + * Returns a list of immutable {@link MonitorMode}s supported by this monitor. + * <p> + * Use w/ care, it's not a copy! + * </p> */ public final List<MonitorMode> getSupportedModes() { return supportedModes.getData(); } - /** @return the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */ + /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */ public final RectangleImmutable getViewport() { return viewport; } @@ -199,24 +203,20 @@ public abstract class MonitorDevice { } /** - * Return the current cached {@link MonitorMode} w/o native query. + * Returns the cached current {@link MonitorMode} w/o native query. * <p> - * If {@link MonitorMode}s are not supported for this - * native type {@link com.jogamp.newt.Display#getType()}, it returns one with the current screen size. </p> - * - * @return current {@link MonitorMode} which is element of the list {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * The returned {@link MonitorMode} is element of the lists {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * </p> */ public final MonitorMode getCurrentMode() { return currentMode; } /** - * Return the current {@link MonitorMode} including a native query. + * Returns the current {@link MonitorMode} resulting from a native query. * <p> - * If {@link MonitorMode}s are not supported for this - * native type {@link com.jogamp.newt.Display#getType()}, it returns one with the current screen size. </p> - * - * @return current {@link MonitorMode} which is element of the list {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * The returned {@link MonitorMode} is element of the lists {@link #getSupportedModes()} and {@link Screen#getMonitorModes()}. + * </p> */ public abstract MonitorMode queryCurrentMode(); diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java index e5b329d47..914aa880f 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorMode.java +++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java @@ -29,79 +29,84 @@ package com.jogamp.newt; import javax.media.nativewindow.util.DimensionImmutable; +import javax.media.nativewindow.util.RectangleImmutable; import javax.media.nativewindow.util.SurfaceSize; +import com.jogamp.newt.util.MonitorModeUtil; -/** Immutable MonitorMode Class, consisting of it's read only components:<br> + +/** + * Immutable MonitorMode Class, consisting of it's read only components:<br> * <ul> * <li>nativeId</li> - * <li>{@link SizeAndRRate}, non rotated surfaceSize and refreshRate</li> + * <li>{@link SizeAndRRate}, consist out of non rotated {@link #getSurfaceSize() surface size}, {@link #getRefreshRate() refresh rate} and {@link #getFlags() flags}.</li> * <li><code>rotation</code>, measured counter clockwise (CCW)</li> * </ul> * * <i>Aquire and filter MonitorMode</i><br> * <ul> - * <li>A List of read only MonitorModes is being returned by {@link com.jogamp.newt.Screen#getMonitorModes()}.</li> - * <li>You may utilize {@link com.jogamp.newt.util.MonitorModeUtil} to filter and select a desired ScreenMode.</li> - * <li>The current ScreenMode can be obtained via {@link com.jogamp.newt.Screen#getCurrentScreenMode()}.</li> - * <li>The initial original ScreenMode (at startup) can be obtained via {@link com.jogamp.newt.Screen#getOriginalScreenMode()}.</li> + * <li>{@link MonitorDevice} Selection: + * <ul> + * <li>A List of all {@link MonitorDevice}s is accessible via {@link Screen#getMonitorDevices()}.</li> + * <li>The main monitor used by a windows is accessible via {@link Window#getMainMonitor()}.</li> + * <li>The main monitor covering an arbitrary rectnagle is accessible via {@link Screen#getMainMonitor(RectangleImmutable)}.</li> + * </ul></li> + * <li>The current MonitorMode can be obtained via {@link MonitorDevice#getCurrentMode()}.</li> + * <li>The original MonitorMode can be obtained via {@link MonitorDevice#getOriginalMode()}.</li> + * <li>{@link MonitorMode} Filtering: + * <ul> + * <li>A {@link MonitorDevice}'s MonitorModes is accessible via {@link MonitorDevice#getSupportedModes()}.</li> + * <li>You may utilize {@link MonitorModeUtil} to filter and select a desired MonitorMode.</li> + * </ul></li> * </ul> * <br> * - * <i>Changing ScreenModes</i><br> - * FIXME!!!!! + * <i>Changing MonitorMode</i><br> * <ul> - * <li> Use {@link com.jogamp.newt.Screen#setCurrentScreenMode(com.jogamp.newt.MonitorMode)}</li> - * to change the current ScreenMode of all Screen's referenced via the full qualified name (FQN) - * {@link com.jogamp.newt.Screen#getFQName()}.</li> - * <li> When the last FQN referenced Screen closes, the original ScreenMode ({@link com.jogamp.newt.Screen#getOriginalScreenMode()}) - * is restored.</li> + * <li> Use {@link MonitorDevice#setCurrentMode(MonitorMode)} + * to change the current MonitorMode for all {@link Screen}s referenced via the {@link Screen#getFQName() full qualified name (FQN)}.</li> + * <li> The {@link MonitorDevice#getOriginalMode() original mode} is restored when + * <ul> + * <li>the last FQN referenced Screen closes.</li> + * <li>the JVM shuts down.</li> + * </ul></li> * </ul> * <br> - * Example for changing the ScreenMode: + * Example for changing the MonitorMode: * <pre> - // determine target refresh rate - ScreenMode orig = screen.getOriginalScreenMode(); - int freq = orig.getOutputMode().getRefreshRate(); + // Pick the monitor: + // Either the one used by a window .. + MonitorDevice monitor = window.getMainMonitor(); + + // Or arbitrary from the list .. + List<MonitorDevice> allMonitor = getMonitorDevices(); + MonitorDevice monitor = allMonitor.get(0); - // target resolution + // Current and original modes .. + MonitorMode mmCurrent = monitor.queryCurrentMode(); + MonitorMode mmOrig = monitor.getOriginalMode(); + + // Target resolution Dimension res = new Dimension(800, 600); - // target rotation - int rot = 0; - - // filter available ScreenModes - List screenModes = screen.getScreenModes(); - screenModes = ScreenModeUtil.filterByRate(screenModes, freq); // get the nearest ones - screenModes = ScreenModeUtil.filterByRotation(screenModes, rot); - screenModes = ScreenModeUtil.filterByResolution(screenModes, res); // get the nearest ones - screenModes = ScreenModeUtil.getHighestAvailableBpp(screenModes); - - // pick 1st one .. - screen.setCurrentScreenMode((ScreenMode) screenModes.get(0)); - * </pre> - * - * X11 / AMD just works<br> - * <br> - * X11 / NVidia difficulties - * <pre> - NVidia RANDR RefreshRate Bug - If NVidia's 'DynamicTwinView' is enabled, all refresh rates are - unique, ie consequent numbers starting with the default refresh, ie 50, 51, .. - The only way to workaround it is to disable 'DynamicTwinView'. - Read: http://us.download.nvidia.com/XFree86/Linux-x86/260.19.12/README/configtwinview.html + // Target refresh rate shall be similar to current one .. + float freq = mmCurrent.getRefreshRate(); - Check to see if 'DynamicTwinView' is enable: - nvidia-settings -q :0/DynamicTwinview + // Target rotation shall be similar to current one + int rot = mmCurrent.getRotation(); - To disable it (workaround), add the following option to your xorg.conf device section: - Option "DynamicTwinView" "False" + // Filter criterias sequential out of all available MonitorMode of the chosen MonitorDevice + List<MonitorMode> monitorModes = monitor.getSupportedModes(); + monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc + monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot); + monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res); + monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq); + monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); - NVidia RANDR Rotation: - To enable it, add the following option to your xorg.conf device section: - Option "RandRRotation" "on" + // pick 1st one and set to current .. + MonitorMode mm = monitorModes.get(0); + monitor.setCurrentMode(mm); * </pre> - * */ public class MonitorMode { /** @@ -113,8 +118,11 @@ public class MonitorMode { * </ul> */ public static class SizeAndRRate { + /** Non rotated surface size */ public final SurfaceSize surfaceSize; + /** Vertical refresh rate */ public final float refreshRate; + /** Mode bitfield flags, i.e. {@link #FLAG_DOUBLESCAN}, {@link #FLAG_INTERLACE}, .. */ public final int flags; public final int hashCode; @@ -262,6 +270,7 @@ public class MonitorMode { return sizeAndRRate.surfaceSize; } + /** Returns the vertical refresh rate. */ public final float getRefreshRate() { return sizeAndRRate.refreshRate; } diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index 81a62d898..f56aff964 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -163,18 +163,12 @@ public abstract class Screen { public abstract String getFQName(); /** - * Return a list of all available {@link MonitorMode}s for all {@link MonitorDevice}s. - * <p> - * If {@link com.jogamp.newt.MonitorMode ScreenMode}s are not supported for this - * native type {@link com.jogamp.newt.Display#getType()}, it returns a list of size one with the current screen size.</p> + * Return a list of all {@link MonitorMode}s for all {@link MonitorDevice}s. */ public abstract List<MonitorMode> getMonitorModes(); /** - * Return a list of all available {@link MonitorDevice}s. - * <p> - * If {@link com.jogamp.newt.MonitorMode ScreenMode}s are not supported for this - * native type {@link com.jogamp.newt.Display#getType()}, it returns a list of size one with the current screen size.</p> + * Return a list of available {@link MonitorDevice}s. */ public abstract List<MonitorDevice> getMonitorDevices(); diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java index 96daed54a..db31cc83f 100644 --- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java +++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java @@ -64,7 +64,7 @@ public class MonitorDeviceImpl extends MonitorDevice { // if mode has changed somehow, update it .. if( getCurrentMode().hashCode() != mmU.hashCode() ) { setCurrentModeValue(mmU); - sms.fireScreenModeChanged(this, mmU, true); + sms.fireMonitorModeChanged(this, mmU, true); } return mmU; } finally { @@ -75,7 +75,7 @@ public class MonitorDeviceImpl extends MonitorDevice { @Override public final boolean setCurrentMode(MonitorMode mode) { if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode.0: "+this+" -> "+mode); + System.err.println("Screen.setCurrentMode.0: "+this+" -> "+mode); } final ScreenImpl screenImpl = (ScreenImpl)screen; final ScreenMonitorState sms = screenImpl.getScreenMonitorStatus(true); @@ -88,7 +88,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } if( mmU.equals( mmC ) ) { if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode: 0.0 is-current (skip) "+mmU+" == "+mmC); + System.err.println("Screen.setCurrentMode: 0.0 is-current (skip) "+mmU+" == "+mmC); } return true; } @@ -99,32 +99,32 @@ public class MonitorDeviceImpl extends MonitorDevice { tStart = 0; } - sms.fireScreenModeChangeNotify(this, mmU); + sms.fireMonitorModeChangeNotify(this, mmU); if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode ("+(System.nanoTime()-tStart)/1e6+"ms): fireScreenModeChangeNotify() "+mmU); + System.err.println("Screen.setCurrentMode ("+(System.nanoTime()-tStart)/1e6+"ms): fireModeChangeNotify() "+mmU); } boolean success = screenImpl.setCurrentMonitorModeImpl(this, mmU); if(success) { if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode ("+(System.nanoTime()-tStart)/1e6+"ms): setCurrentScreenModeImpl() "+mmU+", success(1): "+success); + System.err.println("Screen.setCurrentMode ("+(System.nanoTime()-tStart)/1e6+"ms): setCurrentModeImpl() "+mmU+", success(1): "+success); } } else { // 2nd attempt validate! - final MonitorMode queriedCurrent = queryCurrentMode(); // may fireScreenModeChanged(..) if successful and differs! + final MonitorMode queriedCurrent = queryCurrentMode(); // may fireModeChanged(..) if successful and differs! success = queriedCurrent.hashCode() == mmU.hashCode() ; if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode.2: queried "+queriedCurrent); - System.err.println("Screen.setCurrentScreenMode ("+(System.nanoTime()-tStart)/1e6+"ms): setCurrentScreenModeImpl() "+mmU+", success(2): "+success); + System.err.println("Screen.setCurrentMode.2: queried "+queriedCurrent); + System.err.println("Screen.setCurrentMode ("+(System.nanoTime()-tStart)/1e6+"ms): setCurrentModeImpl() "+mmU+", success(2): "+success); } } if( success ) { setCurrentModeValue(mmU); modeChanged = !isOriginalMode(); } - sms.fireScreenModeChanged(this, mmU, success); + sms.fireMonitorModeChanged(this, mmU, success); if(Screen.DEBUG) { - System.err.println("Screen.setCurrentScreenMode ("+(System.nanoTime()-tStart)/1e6+"ms): X.X "+this+", success: "+success); + System.err.println("Screen.setCurrentMode ("+(System.nanoTime()-tStart)/1e6+"ms): X.X "+this+", success: "+success); } return success; } finally { @@ -144,4 +144,4 @@ public class MonitorDeviceImpl extends MonitorDevice { return supportedModes; } -}
\ No newline at end of file +} diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 4d20fdb83..d7bd326fe 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -73,7 +73,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected Rectangle vOriginSize = new Rectangle(0, 0, 0, 0); // virtual rotated screen origin and size protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight protected static volatile boolean usrSizeQueried = false; - private ArrayList<MonitorModeListener> referencedScreenModeListener = new ArrayList<MonitorModeListener>(); + private ArrayList<MonitorModeListener> refMonitorModeListener = new ArrayList<MonitorModeListener>(); private long tCreated; // creationTime @@ -181,7 +181,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen"); } - initScreenMonitorState(); + initMonitorState(); if(DEBUG) { System.err.println("Screen.createNative() END ("+DisplayImpl.getThreadName()+", "+this+"), total "+ (System.nanoTime()-tCreated)/1e6 +"ms"); } @@ -195,7 +195,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { @Override public synchronized final void destroy() { - releaseScreenModeStatus(); + releaseMonitorState(); synchronized(screenList) { screenList.remove(this); @@ -261,7 +261,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { /** * Stores the virtual origin and virtual <b>rotated</b> screen size. * <p> - * This method is called after the ScreenMode has been set or changed, + * This method is called after the MonitorMode has been set or changed, * hence you may utilize it. * </p> * <p> @@ -393,7 +393,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { final String key = this.getFQName(); final ScreenMonitorState res = ScreenMonitorState.getScreenMonitorState(key); if(null == res & throwException) { - throw new InternalError("ScreenMonitorStatus.getScreenModeStatus("+key+") == null"); + throw new InternalError("ScreenMonitorStatus.getMonitorModeStatus("+key+") == null"); } return res; } @@ -403,8 +403,8 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if(DEBUG) { System.err.println("monitorModeChangeNotify: "+me); } - for(int i=0; i<referencedScreenModeListener.size(); i++) { - ((MonitorModeListener)referencedScreenModeListener.get(i)).monitorModeChangeNotify(me); + for(int i=0; i<refMonitorModeListener.size(); i++) { + ((MonitorModeListener)refMonitorModeListener.get(i)).monitorModeChangeNotify(me); } } @@ -431,19 +431,19 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { if(DEBUG) { System.err.println("monitorModeChanged: success "+success+", "+me); } - for(int i=0; i<referencedScreenModeListener.size(); i++) { - ((MonitorModeListener)referencedScreenModeListener.get(i)).monitorModeChanged(me, success); + for(int i=0; i<refMonitorModeListener.size(); i++) { + ((MonitorModeListener)refMonitorModeListener.get(i)).monitorModeChanged(me, success); } } @Override public synchronized final void addMonitorModeListener(MonitorModeListener sml) { - referencedScreenModeListener.add(sml); + refMonitorModeListener.add(sml); } @Override public synchronized final void removeMonitorModeListener(MonitorModeListener sml) { - referencedScreenModeListener.remove(sml); + refMonitorModeListener.remove(sml); } private final MonitorMode getVirtualMonitorMode(int modeId) { @@ -503,11 +503,11 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { return res; } - private final ScreenMonitorState initScreenMonitorState() { + private final ScreenMonitorState initMonitorState() { long t0; if(DEBUG) { t0 = System.nanoTime(); - System.err.println("Screen.initScreenModeStatus() START ("+DisplayImpl.getThreadName()+", "+this+")"); + System.err.println("Screen.initMonitorState() START ("+DisplayImpl.getThreadName()+", "+this+")"); } else { t0 = 0; } @@ -549,7 +549,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { ScreenMonitorState.unlockScreenMonitorState(); } if(DEBUG) { - System.err.println("Screen.initScreenModeStatus() END dt "+ (System.nanoTime()-t0)/1e6 +"ms"); + System.err.println("Screen.initMonitorState() END dt "+ (System.nanoTime()-t0)/1e6 +"ms"); } if( !vScrnSizeUpdated ) { updateVirtualScreenOriginAndSize(); @@ -596,7 +596,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { return cache.monitorDevices.size(); } - private void releaseScreenModeStatus() { + private void releaseMonitorState() { ScreenMonitorState sms; ScreenMonitorState.lockScreenMonitorState(); try { @@ -666,4 +666,4 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { } }); } -}
\ No newline at end of file +} diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java index beeb7b922..7cda18521 100644 --- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java +++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java @@ -137,7 +137,7 @@ public class ScreenMonitorState { lock(); try { if(!listener.remove(l)) { - throw new RuntimeException("ScreenModeListener "+l+" not contained"); + throw new RuntimeException("MonitorModeListener "+l+" not contained"); } if(DEBUG) { System.err.println("ScreenMonitorState.removeListener (size: "+listener.size()+"): "+l); @@ -159,7 +159,7 @@ public class ScreenMonitorState { } } - protected final void fireScreenModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) { + protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) { lock(); try { validateMonitor(monitor); @@ -172,7 +172,7 @@ public class ScreenMonitorState { } } - protected void fireScreenModeChanged(MonitorDevice monitor, MonitorMode currentMode, boolean success) { + protected void fireMonitorModeChanged(MonitorDevice monitor, MonitorMode currentMode, boolean success) { lock(); try { validateMonitor(monitor); diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 3a018d231..578dbec7b 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -254,7 +254,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer void destroyActionInLock(); /** - * Invoked for expensive modifications, ie while reparenting and ScreenMode change.<br> + * Invoked for expensive modifications, ie while reparenting and MonitorMode change.<br> * No lock is hold when invoked.<br> * * @return true is paused, otherwise false. If true {@link #resumeRenderingAction()} shall be issued. @@ -264,7 +264,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer boolean pauseRenderingAction(); /** - * Invoked for expensive modifications, ie while reparenting and ScreenMode change. + * Invoked for expensive modifications, ie while reparenting and MonitorMode change. * No lock is hold when invoked.<br> * * @see #pauseRenderingAction() @@ -311,7 +311,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } final long t0 = System.currentTimeMillis(); createNativeImpl(); - screen.addMonitorModeListener(screenModeListenerImpl); + screen.addMonitorModeListener(monitorModeListenerImpl); setTitleImpl(title); setPointerVisibleImpl(pointerVisible); confinePointerImpl(pointerConfined); @@ -937,7 +937,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } if( isNativeValid() ) { - screen.removeMonitorModeListener(screenModeListenerImpl); + screen.removeMonitorModeListener(monitorModeListenerImpl); closeNativeImpl(); final AbstractGraphicsDevice cfgADevice = config.getScreen().getDevice(); if( cfgADevice != screen.getDisplay().getGraphicsDevice() ) { // don't pull display's device @@ -1962,12 +1962,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } - private class ScreenModeListenerImpl implements MonitorModeListener { + private class MonitorModeListenerImpl implements MonitorModeListener { boolean animatorPaused = false; public void monitorModeChangeNotify(MonitorEvent me) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.screenModeChangeNotify: "+me); + System.err.println("Window.monitorModeChangeNotify: "+me); } if(null!=lifecycleHook) { @@ -1977,7 +1977,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer public void monitorModeChanged(MonitorEvent me, boolean success) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.screenModeChanged: "+me+", success: "+success); + System.err.println("Window.monitorModeChanged: "+me+", success: "+success); } if(success) { @@ -2007,7 +2007,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener } } - private final ScreenModeListenerImpl screenModeListenerImpl = new ScreenModeListenerImpl(); + private final MonitorModeListenerImpl monitorModeListenerImpl = new MonitorModeListenerImpl(); diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 803c7e1de..653cbf945 100644 --- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java @@ -562,7 +562,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { surface=null; } if(getScreen().isNativeValid()) { - // if ScreenMode changed .. trigger ScreenMode event + // if MonitorMode changed .. trigger MonitorMode event final MonitorDevice mainMonitor = getMainMonitor(); mainMonitor.queryCurrentMode(); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java index ba22a6ce4..f2836f190 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java @@ -188,7 +188,7 @@ public class ScreenDriver extends ScreenImpl { }).booleanValue(); if(DEBUG || !done) { - System.err.println("X11Screen.setCurrentScreenModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+ + System.err.println("X11Screen.setCurrentMonitorModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+ (System.currentTimeMillis()-t0)+"ms; "+monitor.getCurrentMode()+" -> "+mode); } return done; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01aNEWT.java index 96ada3c96..c638058f4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01aNEWT.java @@ -155,13 +155,13 @@ public class TestScreenMode01aNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode sm = (MonitorMode) monitorModes.get(0); - System.err.println("[0] set current: "+sm); - Assert.assertTrue(monitor.setCurrentMode(sm)); + MonitorMode mm = monitorModes.get(0); + System.err.println("[0] set current: "+mm); + Assert.assertTrue(monitor.setCurrentMode(mm)); Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(sm, monitor.getCurrentMode()); + Assert.assertEquals(mm, monitor.getCurrentMode()); Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(sm, monitor.queryCurrentMode()); + Assert.assertEquals(mm, monitor.queryCurrentMode()); Thread.sleep(waitTimeShort); @@ -176,7 +176,7 @@ public class TestScreenMode01aNEWT extends UITestCase { Assert.assertTrue(monitor.setCurrentMode(mmOrig)); Assert.assertFalse(monitor.isModeChangedByUs()); Assert.assertEquals(mmOrig, monitor.getCurrentMode()); - Assert.assertNotSame(sm, monitor.getCurrentMode()); + Assert.assertNotSame(mm, monitor.getCurrentMode()); Assert.assertEquals(mmOrig, monitor.queryCurrentMode()); destroyWindow(window0); |