aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2023-01-29 19:56:45 +0100
committerSven Gothel <sgothel@jausoft.com>2023-01-29 19:56:45 +0100
commite96aeb6e9acd2b1435f5fad244a1488e74a3a6d6 (patch)
tree68a4466d97b006e63f12040ff2db0a24d263344c /src/newt/classes/jogamp
parent516d3d57eb54f6fe95d842d29a2929e024ee8f34 (diff)
GDIUtil: Add GetMonitor*() variants incl. PixelScale; NEWT MonitorDevice: Add 64-bit nativeHandle (Windows HMONITOR), add PixelScale for Windows
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/MonitorDeviceImpl.java7
-rw-r--r--src/newt/classes/jogamp/newt/MonitorModeProps.java15
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/ios/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java37
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java5
14 files changed, 77 insertions, 42 deletions
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 9f458d215..3e81d3877 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -40,7 +40,8 @@ public class MonitorDeviceImpl extends MonitorDevice {
/**
* @param screen associated {@link Screen}
- * @param nativeId unique monitor device ID
+ * @param nativeHandle unique monitor device long handle, implementation specific
+ * @param nativeId unique monitor device integer Id, implementation specific
* @param isClone flag
* @param isPrimary flag
* @param sizeMM size in millimeters
@@ -50,11 +51,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,
+ public MonitorDeviceImpl(final ScreenImpl screen, final long nativeHandle, 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);
+ super(screen, nativeHandle, nativeId, isClone, isPrimary, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java
index eabb6be01..873ee3ed6 100644
--- a/src/newt/classes/jogamp/newt/MonitorModeProps.java
+++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java
@@ -271,6 +271,7 @@ public class MonitorModeProps {
* </p>
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
* @param screen the associated {@link ScreenImpl}
+ * @param monitor_handle unique monitor long handle, implementation specific
* @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
* @param monitorProperties the input data inclusive supported modes.
* @param offset the offset to the input data
@@ -279,9 +280,9 @@ public class MonitorModeProps {
* matching the input <code>modeProperties</code>, or null if input could not be processed.
*/
public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen,
- final float[] pixelScale,
- final int[] monitorProperties, int offset,
- final int[] monitor_idx) {
+ final long monitor_handle,
+ final float[] pixelScale, final int[] monitorProperties,
+ int offset, final int[] monitor_idx) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
final int count = monitorProperties[offset];
if(MIN_MONITOR_DEVICE_PROPERTIES > count) {
@@ -318,7 +319,7 @@ public class MonitorModeProps {
}
}
}
- MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, isClone, isPrimary,
+ MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, monitor_handle, id, isClone, isPrimary,
sizeMM, currentMode, pixelScale,
viewportPU, viewportWU, supportedModes);
if(null!=cache) {
@@ -356,6 +357,7 @@ public class MonitorModeProps {
* </p>
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
* @param screen the associated {@link ScreenImpl}
+ * @param monitor_handle unique monitor long handle, implementation specific
* @param currentMode pre-fetched current {@link MonitorMode}s from cache.
* @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
* @param supportedModes pre-assembled list of supported {@link MonitorMode}s from cache.
@@ -366,6 +368,7 @@ public class MonitorModeProps {
* matching the input <code>modeProperties</code>, or null if input could not be processed.
*/
public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen,
+ final long monitor_handle,
final MonitorMode currentMode,
final float[] pixelScale,
final ArrayHashSet<MonitorMode> supportedModes,
@@ -383,13 +386,13 @@ public class MonitorModeProps {
throw new RuntimeException("properties array too short (count), should be >= "+count+", is "+(monitorProperties.length-offset));
}
offset++;
- final int id = monitorProperties[offset++];
+ final int monitor_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, isPrimary,
+ MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, monitor_handle, monitor_id, isClone, isPrimary,
sizeMM, currentMode, pixelScale,
viewportPU, viewportWU, supportedModes);
if(null!=cache) {
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 00bba64df..1dba31d4f 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -360,8 +360,8 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li>
* </ul>, i.e.
* <ul>
- * <li>{@link MonitorModeProps#streamInMonitorDevice(jogamp.newt.MonitorModeProps.Cache, ScreenImpl, double[], int[], int, int[])}</li>
- * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ArrayHashSet, int[], int, ScreenImpl)}</li>
+ * <li>{@link MonitorModeProps#streamInMonitorDevice(jogamp.newt.MonitorModeProps.Cache, ScreenImpl, long, double[], int[], int, int[])}</li>
+ * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, long, ArrayHashSet, int[], int, ScreenImpl)}</li>
* <li>{@link MonitorModeProps#streamInMonitorMode(int[], jogamp.newt.MonitorModeProps.Cache, int[], int)}</li>
* </ul>
* @param cache memory pool caching the result
@@ -520,7 +520,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if( MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES != i ) {
throw new InternalError("XX");
}
- return MonitorModeProps.streamInMonitorDevice(cache, this, null, props, 0, null);
+ return MonitorModeProps.streamInMonitorDevice(cache, this, monitorId, null, props, 0, null);
}
/**
diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
index a95b3d429..3c0b1aef4 100644
--- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
@@ -100,10 +100,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
}
}
+ final int crt_id = 0;
final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
int i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
i = getScreenSizeMM(outMetrics, props, i); // sizeMM
@@ -115,7 +116,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = outMetrics.widthPixels; // rotated viewport width window-units
props[i++] = outMetrics.heightPixels; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
index 69bbef06c..d577ed501 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
@@ -105,10 +105,11 @@ public class ScreenDriver extends ScreenImpl {
}
final MonitorMode currentMode = getModeProps(cache, awtGD.getDisplayMode());
+ final int crt_id = 0;
final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
int i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = ScreenImpl.default_sm_widthmm; // FIXME
@@ -121,7 +122,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units
props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
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 9c68c1528..62dbd0c72 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
@@ -80,10 +80,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotation
final MonitorMode currentMode = MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ final int crt_id = 0;
props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = ScreenImpl.default_sm_widthmm; // FIXME
@@ -96,7 +97,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = fixedWidth; // FIXME rotated viewport width window-units
props[i++] = fixedHeight; // FIXME rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
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 b4af4045c..9e05e1002 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
@@ -73,10 +73,11 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotation
final MonitorMode currentMode = MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ final int crt_id = 0;
props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = ScreenImpl.default_sm_widthmm; // FIXME
@@ -89,7 +90,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedHeight; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
index eb0b93f3e..5281f0ddc 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
@@ -112,10 +112,11 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotation
final MonitorMode currentMode = MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ final int crt_id = encoder[scridx].getCrtc_id();
props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
i = 0;
props[i++] = props.length;
- props[i++] = encoder[scridx].getCrtc_id(); // crt_id
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = connectors[scridx].getMmWidth();
@@ -128,7 +129,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = mode[scridx].getHdisplay(); // rotated viewport width window-units
props[i++] = mode[scridx].getVdisplay(); // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
crtc_ids = new int[] { encoder[scridx].getCrtc_id() };
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 5c29c4e37..ceb2c4cc6 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
@@ -82,10 +82,11 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotation
final MonitorMode currentMode = MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ final int crt_id = 0;
props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = ScreenImpl.default_sm_widthmm; // FIXME
@@ -98,7 +99,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedWidth; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/ios/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/ios/ScreenDriver.java
index daa033edb..de5cdd239 100644
--- a/src/newt/classes/jogamp/newt/driver/ios/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/ios/ScreenDriver.java
@@ -176,9 +176,8 @@ public class ScreenDriver extends ScreenImpl {
}
// merge monitor-props + supported modes
final float pixelScale = crtProps.pixelScaleArray[crtIdx];
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode,
- new float[] { pixelScale, pixelScale },
- supportedModes, crtProps.propsFixedArray[crtIdx], 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode,
+ new float[] { pixelScale, pixelScale }, supportedModes, crtProps.propsFixedArray[crtIdx], 0, null);
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
index 328523ad4..3112aa88f 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
@@ -78,10 +78,11 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotation
final MonitorMode currentMode = MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ final int crt_id = 0;
props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
i = 0;
props[i++] = props.length;
- props[i++] = 0; // crt_idx
+ props[i++] = crt_id;
props[i++] = 0; // is-clone
props[i++] = 1; // is-primary
props[i++] = ScreenImpl.default_sm_widthmm; // FIXME
@@ -94,7 +95,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedWidth; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
index 590f706df..a4823034f 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
@@ -109,8 +109,8 @@ public class ScreenDriver extends ScreenImpl {
final int x = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+0];
final int y = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+1];
final float thisPixelScale = pixelScaleArray[crtIdx];
- thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+2] *= thisPixelScale; // fix width
- thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+3] *= thisPixelScale; // fix height
+ thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+2] *= thisPixelScale; // fix width in pixel
+ thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+3] *= thisPixelScale; // fix height in pixel
if( 0 != x ) {
// find matching viewport width for x-offset to apply it's pixelSize
for(int i=0; i<count; i++) {
@@ -182,9 +182,8 @@ public class ScreenDriver extends ScreenImpl {
}
// merge monitor-props + supported modes
final float pixelScale = crtProps.pixelScaleArray[crtIdx];
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode,
- new float[] { pixelScale, pixelScale },
- supportedModes, crtProps.propsFixedArray[crtIdx], 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, currentMode,
+ new float[] { pixelScale, pixelScale }, supportedModes, crtProps.propsFixedArray[crtIdx], 0, null);
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
index dfdb8b155..002836e0c 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
@@ -34,8 +34,10 @@
package jogamp.newt.driver.windows;
import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.util.Rectangle;
+import jogamp.nativewindow.windows.GDIUtil;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.ScreenImpl;
@@ -71,6 +73,9 @@ public class ScreenDriver extends ScreenImpl {
private final String getMonitorName(final String adapterName, final int monitor_idx, final boolean onlyActive) {
return getMonitorName0(adapterName, monitor_idx, onlyActive);
}
+ private final String getMonitorName(final long hmon) {
+ return getMonitorName1(hmon);
+ }
private final MonitorMode getMonitorModeImpl(final MonitorModeProps.Cache cache, final String adapterName, final int mode_idx) {
if( null == adapterName ) {
@@ -120,12 +125,31 @@ 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(adapterIdx, monitorIdx, getMonitorId(adapterIdx, monitorIdx));
- // merge monitor-props + supported modes
- MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, supportedModes, monitorProps, 0, null);
-
- // next monitor, 1st mode
- supportedModes = new ArrayHashSet<MonitorMode>(false, ArrayHashSet.DEFAULT_INITIAL_CAPACITY, ArrayHashSet.DEFAULT_LOAD_FACTOR);
+ final int monitor_id = getMonitorId(adapterIdx, monitorIdx);
+ final float pixel_scale[] = { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ final int[] monitorProps = getMonitorDevice0(adapterIdx, monitorIdx, monitor_id);
+ if( null != monitorProps && monitorProps.length >= MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT + 4 ) {
+ final int v_left = monitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+0];
+ final int v_top = monitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+1];
+ final int v_width = monitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+2];
+ final int v_height = monitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+3];
+ long monitor_handle = GDIUtil.GetMonitorFromRect(v_left, v_top, v_width, v_height);
+ if( 0 != monitor_handle ) {
+ final float pixel_scale_raw[] = new float[2];
+ if( GDIUtil.GetMonitorPixelScale(monitor_handle, pixel_scale_raw) ) {
+ System.arraycopy(pixel_scale_raw, 0, pixel_scale, 0, 2);
+ }
+ } else {
+ monitor_handle = monitor_id;
+ }
+ // merge monitor-props + supported modes
+ MonitorModeProps.streamInMonitorDevice(cache, this, monitor_handle, currentMode, pixel_scale, supportedModes, monitorProps, 0, null);
+
+ // next monitor, 1st mode
+ supportedModes = new ArrayHashSet<MonitorMode>(false, ArrayHashSet.DEFAULT_INITIAL_CAPACITY, ArrayHashSet.DEFAULT_LOAD_FACTOR);
+ } else {
+ throw new RuntimeException("monitorProps length should be > "+(MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+4)+", but is "+(monitorProps.length));
+ }
}
}
}
@@ -187,6 +211,7 @@ public class ScreenDriver extends ScreenImpl {
private static native void dumpMonitorInfo0();
private native String getAdapterName0(int adapter_idx);
private native String getMonitorName0(String adapterName, int monitor_idx, boolean onlyActive);
+ private native String getMonitorName1(long hmon);
private native int[] getMonitorMode0(String adapterName, int mode_idx);
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/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index 873ee3f53..7fb70cc32 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -150,11 +150,12 @@ public class ScreenDriver extends ScreenImpl {
}
if( cache.monitorModes.size() > 0 ) {
for(int i = 0; i < crtCount; i++) {
- final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, crt_ids[i]);
+ final int crt_id = crt_ids[i];
+ final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, crt_id);
if( null != monitorProps &&
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) {
- MonitorModeProps.streamInMonitorDevice(cache, this, null, monitorProps, 0, null);
+ MonitorModeProps.streamInMonitorDevice(cache, this, crt_id, null, monitorProps, 0, null);
}
}
}