From 061ce19983556a751471459a964d886e4d7e3908 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 7 May 2013 01:03:17 +0200 Subject: NEWT Multiple Monitor Mode: Add missing 'collect' impl. for NEWT/AWT impl. --- .../jogamp/newt/driver/awt/ScreenDriver.java | 47 ++++++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'src/newt/classes') diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index 8e584fc58..126143e1e 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -34,11 +34,11 @@ package jogamp.newt.driver.awt; import java.awt.DisplayMode; +import java.awt.GraphicsDevice; import jogamp.newt.MonitorModeProps.Cache; +import jogamp.newt.MonitorModeProps; import jogamp.newt.ScreenImpl; -import javax.media.nativewindow.util.Dimension; -import javax.media.nativewindow.util.Point; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; import com.jogamp.nativewindow.awt.AWTGraphicsScreen; @@ -71,9 +71,48 @@ public class ScreenDriver extends ScreenImpl { return idx; // pass through ... } + private static MonitorMode getModeProps(Cache cache, DisplayMode mode) { + int rate = mode.getRefreshRate(); + if( DisplayMode.REFRESH_RATE_UNKNOWN == rate ) { + rate = ScreenImpl.default_sm_rate; + } + int bpp = mode.getBitDepth(); + if( DisplayMode.BIT_DEPTH_MULTI == bpp ) { + bpp= ScreenImpl.default_sm_bpp; + } + int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ]; + int i = 0; + props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL; + props[i++] = mode.getWidth(); + props[i++] = mode.getHeight(); + props[i++] = bpp; + props[i++] = rate * 100; + props[i++] = 0; // flags + props[i++] = 0; // mode_idx + props[i++] = 0; // rotation + return MonitorModeProps.streamInMonitorMode(null, cache, props, 0); + } + @Override - protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) { - final DisplayMode mode = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice().getDisplayMode(); + protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) { + final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice(); + final DisplayMode[] awtModes = awtGD.getDisplayModes(); + for(int i=0; i