28package com.jogamp.newt;
30import com.jogamp.newt.event.MonitorModeListener;
32import jogamp.newt.Debug;
34import java.lang.ref.WeakReference;
35import java.util.ArrayList;
36import java.util.Collection;
39import com.jogamp.nativewindow.AbstractGraphicsScreen;
40import com.jogamp.nativewindow.NativeWindowException;
41import com.jogamp.nativewindow.util.Rectangle;
42import com.jogamp.nativewindow.util.RectangleImmutable;
66 public static final boolean DEBUG = Debug.debug(
"Screen");
74 public boolean equals(
final Object obj) {
75 if (
this == obj) {
return true; }
76 if (obj instanceof
Screen) {
229 float maxCoverage = Float.MIN_VALUE;
232 if( !monitor.isClone() ) {
233 final float coverage = monitor.getViewportInWindowUnits().coverage(r);
234 if( coverage > maxCoverage ) {
235 maxCoverage = coverage;
240 if( maxCoverage > 0.0f &&
null != res ) {
243 return monitors.get(0);
257 if( !monitor.isClone() && monitor.getViewportInWindowUnits().contains(r) ) {
272 if( monitor.getId() == monitorId ) {
287 if( monitor.getHandle() == monitorHandle ) {
301 if(
null == name || name.isEmpty() ) {
305 if( name.equals( monitor.getName() ) ) {
336 protected static final ArrayList<WeakReference<Screen>>
screenList =
new ArrayList<WeakReference<Screen>>();
347 return getScreenOfImpl(display, idx, fromIndex, 1);
358 return getScreenOfImpl(display, idx, fromIndex, -1);
361 private static Screen getScreenOfImpl(
final Display display,
final int idx,
final int fromIndex,
final int incr) {
363 int i = fromIndex >= 0 ? fromIndex :
screenList.size() - 1 ;
364 while( ( incr > 0 ) ? i <
screenList.size() : i >= 0 ) {
366 if(
null == screen ) {
396 screenList.add(
new WeakReference<Screen>(screen));
402 ArrayList<Screen> list;
404 list =
new ArrayList<Screen>();
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
boolean equals(final Object obj)
return true if obj is of type Display and both FQN getFQName() equals
Visual output device, i.e.
static void unionOfViewports(final Rectangle viewport, final Rectangle viewportInWindowUnits, final List< MonitorDevice > monitors)
Calculates the union of the given monitor's viewport in pixel- and window units.
Immutable MonitorMode Class, consisting of it's read only components:
A screen may span multiple MonitorDevices representing their combined virtual size.
static final ArrayList< WeakReference< Screen > > screenList
abstract AbstractGraphicsScreen getGraphicsScreen()
abstract int addReference()
See Display#addReference().
final void unionOfMonitorViewports(final Rectangle viewport, final Rectangle viewportInWindowUnits)
Calculates the union of all monitor's viewport in pixel- and window units.
abstract int hashCode()
return precomputed hashCode from FQN getFQName()
abstract Display getDisplay()
static final boolean DEBUG
abstract void addMonitorModeListener(MonitorModeListener sml)
abstract String getFQName()
static Collection< Screen > getAllScreens()
Returns the global screen collection.
abstract int removeReference()
See Display#removeReference().
static Screen getFirstScreenOf(final Display display, final int idx, final int fromIndex)
abstract RectangleImmutable getViewport()
See Coordinate System.
abstract int getX()
See Coordinate System.
abstract RectangleImmutable getViewportInWindowUnits()
See Coordinate System.
abstract void removeMonitorModeListener(MonitorModeListener sml)
static int getActiveScreenNumber()
abstract List< MonitorMode > getMonitorModes()
Return a list of all MonitorModes for all MonitorDevices.
static void addScreen2List(final Screen screen)
abstract MonitorDevice getPrimaryMonitor()
Returns the windowing manager's primary MonitorDevice, which holds the system menu bar,...
abstract int getY()
See Coordinate System.
final MonitorDevice getFullyEnteredMonitor(final RectangleImmutable r)
Returns the MonitorDevice which completely which viewport completely coverage the given rectangle in ...
abstract void destroy()
Manually trigger the destruction, incl.
abstract int getReferenceCount()
static Screen getLastScreenOf(final Display display, final int idx, final int fromIndex)
final MonitorDevice getMainMonitor(final RectangleImmutable r)
Returns the MonitorDevice with the highest viewport coverage of the given rectangle in window units,...
boolean equals(final Object obj)
return true if obj is of type Display and both FQN getFQName() equals
final MonitorDevice getMonitorByHandle(final long monitorHandle)
Returns the MonitorDevice which matches the given long monitorHandle.
static final int SCREEN_MODE_CHANGE_TIMEOUT
A 10s timeout for screen mode change.
abstract boolean isNativeValid()
abstract void createNative()
Manual trigger the native creation, if not done yet.. This is useful to be able to request the com....
final MonitorDevice getMonitorByName(final String name)
Returns the MonitorDevice which matches the given name.
final MonitorDevice getMonitorById(final int monitorId)
Returns the MonitorDevice which matches the given integer monitorId.
abstract List< MonitorDevice > getMonitorDevices()
Return a list of available MonitorDevices.
A interface describing a graphics screen in a toolkit-independent manner.
Immutable Rectangle interface, with its position on the top-left.