summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-17 07:30:34 +0100
committerSven Gothel <[email protected]>2015-02-17 07:30:34 +0100
commit37ec129f36097f41ed0d45cbccd7a93e493e2bb9 (patch)
treecb3f418d8b405c4ecb5825386cc04cf7687b5a98 /src/newt/classes/com
parenta28e1610e1c29279847bce80e1aa80a947ff799e (diff)
Bug 1130 - Add Mapping from AWT Component -> NEWT [Screen, MonitorDevice]
The mapping AWT Component -> NEWT [Screen, MonitorDevice] shall allow generic AWT applications to utilize NEWT's MonitorDevice information like physical monitor-size and DPI. - AWT-Component -> NEWT-Display: - NewtFactoryAWT.createDisplay - AWT-Component -> NEWT-Screen: - NewtFactoryAWT.createScreen - AWT-Component -> NEWT-MonitorMode: - NewtFactoryAWT.getMonitorDevice - NewtFactoryAWT.getMonitorDevice - If OSX, utilizing OSX's AWT Component -> MonitorDevice-Index mapping - Otherwise using the coverage to identify MonitorDevice See TestGearsES2GLJPanelAWT 'GetPixelScale', demonstrating the mapping while pressing 'p' (cached MonitorMode) and pressing SHIFT-'p' (non-cached MonitorMode).
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/Screen.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index 0e6895d4b..b8f096fc3 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -238,6 +238,18 @@ public abstract class Screen {
return monitors.get(0);
}
+ public final MonitorDevice getMonitor(final int monitorId) {
+ final List<MonitorDevice> monitors = getMonitorDevices();
+ final int monitorCount = monitors.size();
+ for(int i=0; i<monitorCount; i++) {
+ final MonitorDevice monitor = monitors.get(i);
+ if( monitor.getId() == monitorId ) {
+ return monitor;
+ }
+ }
+ return null;
+ }
+
/**
* Calculates the union of all monitor's {@link MonitorDevice#getViewport() viewport} in pixel- and window units.
* <p>