diff options
Diffstat (limited to 'src/newt/classes')
15 files changed, 125 insertions, 29 deletions
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index ec38ce3c3..88f8376c7 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -68,6 +68,7 @@ public abstract class MonitorDevice { protected final Rectangle viewportPU; // in pixel units protected final Rectangle viewportWU; // in window units protected boolean isClone; + protected boolean isPrimary; protected MonitorMode currentMode; protected boolean modeChanged; @@ -75,6 +76,7 @@ public abstract class MonitorDevice { * @param screen associated {@link Screen} * @param nativeId unique monitor device ID * @param isClone flag + * @param isPrimary flag * @param sizeMM size in millimeters * @param currentMode * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. @@ -82,10 +84,10 @@ public abstract class MonitorDevice { * @param viewportWU viewport in window-units * @param supportedModes all supported {@link MonitorMode}s */ - protected MonitorDevice(final Screen screen, final int nativeId, final boolean isClone, - final DimensionImmutable sizeMM, - final MonitorMode currentMode, final float[] pixelScale, final Rectangle viewportPU, - final Rectangle viewportWU, final ArrayHashSet<MonitorMode> supportedModes) { + protected MonitorDevice(final Screen screen, final int nativeId, + final boolean isClone, final boolean isPrimary, + final DimensionImmutable sizeMM, final MonitorMode currentMode, final float[] pixelScale, + final Rectangle viewportPU, final Rectangle viewportWU, final ArrayHashSet<MonitorMode> supportedModes) { this.screen = screen; this.nativeId = nativeId; this.sizeMM = sizeMM; @@ -96,6 +98,7 @@ public abstract class MonitorDevice { this.viewportWU = viewportWU; this.isClone = isClone; + this.isPrimary = isPrimary; this.currentMode = currentMode; this.modeChanged = false; } @@ -141,6 +144,12 @@ public abstract class MonitorDevice { public final boolean isClone() { return isClone; } /** + * Returns {@code true} if this device represents the <i>primary device</i>, otherwise return {@code false}. + * @see Screen#getPrimaryMonitor() + */ + public final boolean isPrimary() { return isPrimary; } + + /** * @return the immutable monitor size in millimeters. */ public final DimensionImmutable getSizeMM() { @@ -331,9 +340,28 @@ public abstract class MonitorDevice { @Override public String toString() { - return "Monitor[Id "+Display.toHexString(nativeId)+", clone "+isClone+", "+sizeMM+" mm, pixelScale ["+pixelScale[0]+", "+pixelScale[1]+ - "], viewport "+viewportPU+ " [pixels], "+viewportWU+" [window], orig "+originalMode+", curr "+currentMode+ - ", modeChanged "+modeChanged+", modeCount "+supportedModes.size()+"]"; + boolean preComma = false; + final StringBuilder sb = new StringBuilder(); + sb.append("Monitor[Id ").append(Display.toHexString(nativeId)).append(", options["); + { + if( isClone() ) { + sb.append("clone"); + preComma = true; + } + if( isPrimary() ) { + if( preComma ) { + sb.append(", "); + } + sb.append("primary"); + } + } + preComma = false; + sb.append("], ").append(sizeMM).append(" mm, pixelScale [").append(pixelScale[0]).append(", ") + .append(pixelScale[1]).append("], viewport ").append(viewportPU).append(" [pixels], ").append(viewportWU) + .append(" [window], orig ").append(originalMode).append(", curr ") + .append(currentMode).append(", modeChanged ").append(modeChanged).append(", modeCount ") + .append(supportedModes.size()).append("]"); + return sb.toString(); } } diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java index b8f096fc3..9b2a280f9 100644 --- a/src/newt/classes/com/jogamp/newt/Screen.java +++ b/src/newt/classes/com/jogamp/newt/Screen.java @@ -209,6 +209,13 @@ public abstract class Screen { public abstract List<MonitorDevice> getMonitorDevices(); /** + * Returns the windowing manager's primary {@link MonitorDevice}, + * which holds the system menu bar, etc. + * @see MonitorDevice#isPrimary() + */ + public abstract MonitorDevice getPrimaryMonitor(); + + /** * Returns the {@link MonitorDevice} with the highest {@link MonitorDevice#getViewportInWindowUnits() viewport} * {@link RectangleImmutable#coverage(RectangleImmutable) coverage} of the given rectangle in window units, * which is not a {@link MonitorDevice#isClone() clone}. diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java index 3f039a9f4..9f458d215 100644 --- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java +++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java @@ -41,7 +41,8 @@ public class MonitorDeviceImpl extends MonitorDevice { /** * @param screen associated {@link Screen} * @param nativeId unique monitor device ID - * @param isClone TODO + * @param isClone flag + * @param isPrimary flag * @param sizeMM size in millimeters * @param currentMode * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}. @@ -49,11 +50,11 @@ public class MonitorDeviceImpl extends MonitorDevice { * @param viewportWU viewport in window-units * @param supportedModes all supported {@link MonitorMode}s */ - public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final boolean isClone, - final DimensionImmutable sizeMM, - final MonitorMode currentMode, final float[] pixelScale, final Rectangle viewportPU, - final Rectangle viewportWU, final ArrayHashSet<MonitorMode> supportedModes) { - super(screen, nativeId, isClone, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); + public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, + final boolean isClone, final boolean isPrimary, + final DimensionImmutable sizeMM, final MonitorMode currentMode, final float[] pixelScale, + final Rectangle viewportPU, final Rectangle viewportWU, final ArrayHashSet<MonitorMode> supportedModes) { + super(screen, nativeId, isClone, isPrimary, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); } @Override @@ -80,7 +81,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } // if mode has changed somehow, update it .. if( getCurrentMode().hashCode() != mmU.hashCode() ) { - setCurrentModeValue(mmU); + setCurrentModeValue(mmU, isPrimary); sms.fireMonitorModeChanged(this, mmU, true); } return mmU; @@ -139,7 +140,7 @@ public class MonitorDeviceImpl extends MonitorDevice { } } if( success ) { - setCurrentModeValue(mmU); + setCurrentModeValue(mmU, isPrimary); modeChanged = !isOriginalMode(); } sms.fireMonitorModeChanged(this, mmU, success); @@ -152,8 +153,9 @@ public class MonitorDeviceImpl extends MonitorDevice { } } - private final void setCurrentModeValue(final MonitorMode currentMode) { + private final void setCurrentModeValue(final MonitorMode currentMode, final boolean isPrimary) { this.currentMode = currentMode; + this.isPrimary = isPrimary; } /* pp */ final Rectangle getMutuableViewportPU() { return viewportPU; } @@ -166,4 +168,7 @@ public class MonitorDeviceImpl extends MonitorDevice { /* pp */ final void setIsClone(final boolean isClone) { this.isClone = isClone; } + /* pp */ final void setIsPrimary(final boolean isPrimary) { + this.isPrimary = isPrimary; + } } diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java index 873b9edc3..073a9a355 100644 --- a/src/newt/classes/jogamp/newt/MonitorModeProps.java +++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java @@ -133,6 +133,7 @@ public class MonitorModeProps { * <li>count</li> * <li>id</li> * <li>IsClone</li> + * <li>IsPrimary</li> * <li>ScreenSizeMM[width, height] (2 elements)</li> * <li>Rotated Viewport pixel-units (4 elements)</li> * <li>Rotated Viewport window-units (4 elements)</li> @@ -141,17 +142,18 @@ public class MonitorModeProps { * <li>SupportedModeId+</li> * </ul> * <p> - * Viewport := [x, y, width, height] (4 elements) + * with Viewport := [x, y, width, height] (4 elements) * </p> * <p> * WARNING: must be synchronized with ScreenMode.h, native implementation * </p> */ - public static final int MIN_MONITOR_DEVICE_PROPERTIES = 16; + public static final int MIN_MONITOR_DEVICE_PROPERTIES = 17; public static final int IDX_MONITOR_DEVICE_VIEWPORT = 1 // count + 1 // native mode + 1 // isClone + + 1 // isPrimary + MonitorModeProps.NUM_RESOLUTION_PROPERTIES // sizeMM ; @@ -161,6 +163,10 @@ public class MonitorModeProps { public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>(); public final ArrayHashSet<MonitorMode> monitorModes = new ArrayHashSet<MonitorMode>(); public final ArrayHashSet<MonitorDevice> monitorDevices = new ArrayHashSet<MonitorDevice>(); + + public final void setPrimary(final MonitorDevice p) { primary = p; } + public final MonitorDevice getPrimary() { return primary;} + private MonitorDevice primary = null; } /** WARNING: must be synchronized with ScreenMode.h, native implementation */ @@ -292,6 +298,7 @@ public class MonitorModeProps { final List<MonitorMode> allMonitorModes = cache.monitorModes.getData(); final int id = monitorProperties[offset++]; final boolean isClone = 0 == monitorProperties[offset++] ? false : true; + final boolean isPrimary = 0 == monitorProperties[offset++] ? false : true; final DimensionImmutable sizeMM = streamInResolution(monitorProperties, offset); offset+=NUM_RESOLUTION_PROPERTIES; final Rectangle viewportPU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); final Rectangle viewportWU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); @@ -311,9 +318,14 @@ public class MonitorModeProps { } } } - MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, isClone, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); + MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, isClone, isPrimary, + sizeMM, currentMode, pixelScale, + viewportPU, viewportWU, supportedModes); if(null!=cache) { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); + if( monitorDevice.isPrimary() ) { + cache.setPrimary(monitorDevice); + } } if( null != monitor_idx ) { final int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); @@ -373,12 +385,18 @@ public class MonitorModeProps { offset++; final int id = monitorProperties[offset++]; final boolean isClone = 0 == monitorProperties[offset++] ? false : true; + final boolean isPrimary = 0 == monitorProperties[offset++] ? false : true; final DimensionImmutable sizeMM = streamInResolution(monitorProperties, offset); offset+=NUM_RESOLUTION_PROPERTIES; final Rectangle viewportPU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); final Rectangle viewportWU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]); - MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, isClone, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes); + MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, isClone, isPrimary, + sizeMM, currentMode, pixelScale, + viewportPU, viewportWU, supportedModes); if(null!=cache) { monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice); + if( monitorDevice.isPrimary() ) { + cache.setPrimary(monitorDevice); + } } if( null != monitor_idx ) { final int _monitorIdx = cache.monitorDevices.indexOf(monitorDevice); @@ -402,6 +420,7 @@ public class MonitorModeProps { data[idx++] = data.length; data[idx++] = monitorDevice.getId(); data[idx++] = monitorDevice.isClone() ? 1 : 0; + data[idx++] = monitorDevice.isPrimary() ? 1 : 0; data[idx++] = monitorDevice.getSizeMM().getWidth(); data[idx++] = monitorDevice.getSizeMM().getHeight(); data[idx++] = monitorDevice.getViewport().getX(); @@ -424,8 +443,13 @@ public class MonitorModeProps { return data; } - /** Identify monitor devices in <i>cloned</i> mode, i.e. consecutive devices being 100% covered by preceding devices. */ - /* pp */ static void identifyClonedMonitorDevices(final MonitorModeProps.Cache cache) { + /** + * Identify monitor devices: + * <ul> + * <li><i>cloned</i> mode, i.e. consecutive devices being 100% covered by preceding devices.</li> + * </ul> + */ + /* pp */ static void identifyMonitorDevices(final MonitorModeProps.Cache cache) { final ArrayList<MonitorDevice> monitors = cache.monitorDevices.toArrayList(); final int monitorCount = monitors.size(); for(int i=0; i<monitorCount; i++) { diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 36e42e52c..c96a2e06e 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -406,6 +406,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { return null != sms ? sms.getMonitorDevices().getData() : null; } + @Override + public MonitorDevice getPrimaryMonitor() { + final ScreenMonitorState sms = getScreenMonitorStatus(false); + return null != sms ? sms.getPrimaryMonitorDevice() : null; + } + final ScreenMonitorState getScreenMonitorStatus(final boolean throwException) { final String key = this.getFQName(); final ScreenMonitorState res = ScreenMonitorState.getScreenMonitorState(key); @@ -501,6 +507,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { props[i++] = MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES; props[i++] = monitorId; props[i++] = 0; // is-clone + props[i++] = 0 == monitorId ? 1 : 0; // is-primary props[i++] = default_sm_widthmm; props[i++] = default_sm_heightmm; props[i++] = 0; // rotated viewport x pixel-units @@ -562,7 +569,18 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { final MonitorMode mode = getVirtualMonitorMode(cache, 0); cache.monitorModes.getOrAdd(mode); final MonitorDevice monitor = getVirtualMonitorDevice(cache, 0, mode); + ((MonitorDeviceImpl)monitor).setIsPrimary(true); cache.monitorDevices.getOrAdd(monitor); + cache.setPrimary(monitor); + } + if( null == cache.getPrimary() ) { + // Fallback .. + final MonitorDevice p = cache.monitorDevices.get(0); + ((MonitorDeviceImpl)p).setIsPrimary(true); + cache.setPrimary(p); + if( DEBUG ) { + System.err.println("WARNING: Fallback primary: "+p); + } } // Sort MonitorModes (all and per device) in descending order - default! MonitorModeUtil.sort(cache.monitorModes.getData(), false ); // descending order @@ -583,8 +601,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { System.err.println("["+i+"]["+j+"]: "+iMode.next()); } } + System.err.println("Primary: "+cache.getPrimary()); } - sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes); + sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes, cache.getPrimary()); ScreenMonitorState.mapScreenMonitorState(this.getFQName(), sms); } } finally { @@ -609,7 +628,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { private final int collectNativeMonitorModes(final MonitorModeProps.Cache cache) { if(!DEBUG_TEST_SCREENMODE_DISABLED) { collectNativeMonitorModesAndDevicesImpl(cache); - MonitorModeProps.identifyClonedMonitorDevices(cache); + MonitorModeProps.identifyMonitorDevices(cache); } // filter out insufficient modes for(int i=cache.monitorModes.size()-1; i>=0; i--) { diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java index ae982414b..fd1329f91 100644 --- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java +++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java @@ -46,6 +46,7 @@ public class ScreenMonitorState { private final RecursiveLock lock = LockFactory.createRecursiveLock(); private final ArrayHashSet<MonitorDevice> allMonitors; private final ArrayHashSet<MonitorMode> allMonitorModes; + private final MonitorDevice primaryMonitor; private final ArrayList<MonitorModeListener> listener = new ArrayList<MonitorModeListener>(); private static HashMap<String, ScreenMonitorState> screenFQN2ScreenMonitorState = new HashMap<String, ScreenMonitorState>(); @@ -107,15 +108,21 @@ public class ScreenMonitorState { } public ScreenMonitorState(final ArrayHashSet<MonitorDevice> allMonitors, - final ArrayHashSet<MonitorMode> allMonitorModes) { + final ArrayHashSet<MonitorMode> allMonitorModes, + final MonitorDevice primaryMonitor) { this.allMonitors = allMonitors; this.allMonitorModes = allMonitorModes; + this.primaryMonitor = primaryMonitor; } protected ArrayHashSet<MonitorDevice> getMonitorDevices() { return allMonitors; } + protected MonitorDevice getPrimaryMonitorDevice() { + return primaryMonitor; + } + protected ArrayHashSet<MonitorMode> getMonitorModes() { return allMonitorModes; } diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java index 60e6e7d5f..a95b3d429 100644 --- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java @@ -105,6 +105,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary i = getScreenSizeMM(outMetrics, props, i); // sizeMM props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index aba7a1ab9..69bbef06c 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -110,6 +110,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index 704fad73f..9c68c1528 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -85,6 +85,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index 8d46adeab..f236edd6b 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -78,6 +78,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index b55378459..5c29c4e37 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -87,6 +87,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index 1e878bc3a..328523ad4 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -83,6 +83,7 @@ public class ScreenDriver extends ScreenImpl { props[i++] = props.length; props[i++] = 0; // crt_idx props[i++] = 0; // is-clone + props[i++] = 1; // is-primary props[i++] = ScreenImpl.default_sm_widthmm; // FIXME props[i++] = ScreenImpl.default_sm_heightmm; // FIXME props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java index 013f9f9ca..ea3e76eb3 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java @@ -119,7 +119,7 @@ public class ScreenDriver extends ScreenImpl { // has at least one mode -> add device final MonitorMode currentMode = getMonitorModeImpl(cache, adapterName, -1); if ( null != currentMode ) { // enabled - final int[] monitorProps = getMonitorDevice0(adapterName, adapterIdx, monitorIdx, getMonitorId(adapterIdx, monitorIdx)); + final int[] monitorProps = getMonitorDevice0(adapterIdx, monitorIdx, getMonitorId(adapterIdx, monitorIdx)); // merge monitor-props + supported modes MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, supportedModes, monitorProps, 0, null); @@ -139,7 +139,7 @@ public class ScreenDriver extends ScreenImpl { final String adapterName = getAdapterName(adapterIdx); if( null != adapterName ) { if( null != getMonitorName(adapterName, monitorIdx, true) ) { - final int[] monitorProps = getMonitorDevice0(adapterName, adapterIdx, monitorIdx, getMonitorId(adapterIdx, monitorIdx)); + final int[] monitorProps = getMonitorDevice0(adapterIdx, monitorIdx, getMonitorId(adapterIdx, monitorIdx)); int offset = MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT; viewportPU.set(monitorProps[offset++], monitorProps[offset++], monitorProps[offset++], monitorProps[offset++]); viewportWU.set(monitorProps[offset++], monitorProps[offset++], monitorProps[offset++], monitorProps[offset++]); @@ -187,6 +187,6 @@ public class ScreenDriver extends ScreenImpl { private native String getAdapterName0(int adapter_idx); private native String getMonitorName0(String adapterName, int monitor_idx, boolean onlyActive); private native int[] getMonitorMode0(String adapterName, int mode_idx); - private native int[] getMonitorDevice0(String adapterName, int adapter_idx, int monitor_idx, int monitorId); + private native int[] getMonitorDevice0(int adapter_idx, int monitor_idx, int monitorId); private native boolean setMonitorMode0(int adapter_idx, int x, int y, int width, int height, int bits, int freq, int flags, int rot); } diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java index a4c578b26..e9cb95548 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java @@ -187,6 +187,7 @@ class RandR11 implements RandR { props[i++] = props.length; props[i++] = crt_idx; props[i++] = 0; // is-clone + props[i++] = 0 == crt_idx ? 1 : 0; // is-primary props[i++] = widthMM; props[i++] = heightMM; props[i++] = 0; // rotated viewport x pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java index b6d8f13a1..2f7110b5c 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java +++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java @@ -247,7 +247,6 @@ class RandR13 implements RandR { try { setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight()); } finally { - dumpInfo0(dpy, screen_idx, screenResources); releaseScreenResourceHandle(screenResources); } } |