Class Screen
- java.lang.Object
-
- com.jogamp.newt.Screen
-
public abstract class Screen extends Object
A screen may span multipleMonitorDevices representing their combined virtual size.All values of this interface are represented in pixel units, if not stated otherwise.
Coordinate System
- Screen space has it's origin in the top-left corner, and may not be at 0/0.
Virtual viewportcovers allMonitorDevicesviewportsand has it's origin in the top-left corner, and may not be at 0/0.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEBUGstatic intSCREEN_MODE_CHANGE_TIMEOUTA 10s timeout for screen mode change.
-
Constructor Summary
Constructors Constructor Description Screen()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddMonitorModeListener(MonitorModeListener sml)abstract intaddReference()abstract voidcreateNative()Manual trigger the native creation, if not done yet..
This is useful to be able to request theAbstractGraphicsScreen, viagetGraphicsScreen().
Otherwise the abstract device won't be available before the dependent component (Window) is realized.abstract voiddestroy()Manually trigger the destruction, incl.booleanequals(Object obj)return true if obj is of type Display and both FQNgetFQName()equalsstatic intgetActiveScreenNumber()static Collection<Screen>getAllScreens()Returns the global screen collectionabstract DisplaygetDisplay()static ScreengetFirstScreenOf(Display display, int idx, int fromIndex)abstract StringgetFQName()MonitorDevicegetFullyEnteredMonitor(RectangleImmutable r)Returns theMonitorDevicewhich completely whichviewportcompletelycoveragethe given rectangle in window units, which is not aclone.abstract AbstractGraphicsScreengetGraphicsScreen()abstract intgetHeight()abstract intgetIndex()static ScreengetLastScreenOf(Display display, int idx, int fromIndex)MonitorDevicegetMainMonitor(RectangleImmutable r)Returns theMonitorDevicewith the highestviewportcoverageof the given rectangle in window units, which is not aclone.MonitorDevicegetMonitorByHandle(long monitorHandle)Returns theMonitorDevicewhich matches the given long monitorHandle.MonitorDevicegetMonitorById(int monitorId)Returns theMonitorDevicewhich matches the given integer monitorId.MonitorDevicegetMonitorByName(String name)Returns theMonitorDevicewhich matches the given name.abstract List<MonitorDevice>getMonitorDevices()Return a list of availableMonitorDevices.abstract List<MonitorMode>getMonitorModes()Return a list of allMonitorModes for allMonitorDevices.abstract MonitorDevicegetPrimaryMonitor()Returns the windowing manager's primaryMonitorDevice, which holds the system menu bar, etc.abstract intgetReferenceCount()abstract RectangleImmutablegetViewport()See Coordinate System.abstract RectangleImmutablegetViewportInWindowUnits()See Coordinate System.abstract intgetWidth()abstract intgetX()See Coordinate System.abstract intgetY()See Coordinate System.abstract inthashCode()return precomputed hashCode from FQNgetFQName()abstract booleanisNativeValid()abstract voidremoveMonitorModeListener(MonitorModeListener sml)abstract intremoveReference()voidunionOfMonitorViewports(Rectangle viewport, Rectangle viewportInWindowUnits)Calculates the union of all monitor'sviewportin pixel- and window units.
-
-
-
Field Detail
-
SCREEN_MODE_CHANGE_TIMEOUT
public static final int SCREEN_MODE_CHANGE_TIMEOUT
A 10s timeout for screen mode change. It is observed, that some platforms need a notable amount of time for this task, especially in case of rotation change.- See Also:
- Constant Field Values
-
DEBUG
public static final boolean DEBUG
-
-
Method Detail
-
hashCode
public abstract int hashCode()
return precomputed hashCode from FQNgetFQName()
-
equals
public boolean equals(Object obj)
return true if obj is of type Display and both FQNgetFQName()equals
-
createNative
public abstract void createNative() throws NativeWindowExceptionManual trigger the native creation, if not done yet..
This is useful to be able to request theAbstractGraphicsScreen, viagetGraphicsScreen().
Otherwise the abstract device won't be available before the dependent component (Window) is realized.This method is usually invoke by
addReference()This method invokes
Display.addReference()after creating the native peer,
which will issueDisplay.createNative()if the reference count was 0.- Throws:
NativeWindowException- if the native creation failed.
-
destroy
public abstract void destroy()
Manually trigger the destruction, incl. native destruction.
This method is usually invoke by
removeReference()This method invokes
Display.removeReference()after it's own destruction,
which will issueDisplay.destroy()if the reference count becomes 0.
-
isNativeValid
public abstract boolean isNativeValid()
-
getReferenceCount
public abstract int getReferenceCount()
- Returns:
- number of references
-
addReference
public abstract int addReference() throws NativeWindowException- Returns:
- number of references post operation
- Throws:
NativeWindowException- if the native creation failed.- See Also:
removeReference(),#setDestroyWhenUnused(boolean),#getDestroyWhenUnused()
-
removeReference
public abstract int removeReference()
- Returns:
- number of references post operation
- See Also:
addReference(),#setDestroyWhenUnused(boolean),#getDestroyWhenUnused()
-
getGraphicsScreen
public abstract AbstractGraphicsScreen getGraphicsScreen()
-
getIndex
public abstract int getIndex()
- Returns:
- this Screen index of all Screens of
getDisplay().
-
getX
public abstract int getX()
See Coordinate System.- Returns:
- the x position of the virtual viewport's top-left origin in pixel units.
-
getY
public abstract int getY()
See Coordinate System.- Returns:
- the y position of the virtual viewport's top-left origin in pixel units.
-
getWidth
public abstract int getWidth()
- Returns:
- the rotated virtual viewport's width in pixel units.
-
getHeight
public abstract int getHeight()
- Returns:
- the rotated virtual viewport's height in pixel units.
-
getViewport
public abstract RectangleImmutable getViewport()
See Coordinate System.- Returns:
- the rotated virtual viewport, i.e. top-left origin and size, in pixel units.
- See Also:
getViewportInWindowUnits()
-
getViewportInWindowUnits
public abstract RectangleImmutable getViewportInWindowUnits()
See Coordinate System.- Returns:
- the rotated virtual viewport, i.e. top-left origin and size, in window units.
- See Also:
getViewport()
-
getDisplay
public abstract Display getDisplay()
- Returns:
- the associated Display
-
getFQName
public abstract String getFQName()
- Returns:
- The screen fully qualified Screen name,
which is a key of
Display.getFQName()+getIndex().
-
getMonitorModes
public abstract List<MonitorMode> getMonitorModes()
Return a list of allMonitorModes for allMonitorDevices.The list is ordered in descending order, see
MonitorMode.compareTo(MonitorMode).
-
getMonitorDevices
public abstract List<MonitorDevice> getMonitorDevices()
Return a list of availableMonitorDevices.
-
getPrimaryMonitor
public abstract MonitorDevice getPrimaryMonitor()
Returns the windowing manager's primaryMonitorDevice, which holds the system menu bar, etc.- See Also:
MonitorDevice.isPrimary()
-
getMainMonitor
public final MonitorDevice getMainMonitor(RectangleImmutable r)
Returns theMonitorDevicewith the highestviewportcoverageof the given rectangle in window units, which is not aclone.If no coverage is detected the first
MonitorDeviceis returned.- Parameters:
r- arbitrary rectangle in window units
-
getFullyEnteredMonitor
public final MonitorDevice getFullyEnteredMonitor(RectangleImmutable r)
Returns theMonitorDevicewhich completely whichviewportcompletelycoveragethe given rectangle in window units, which is not aclone.If no match is found, null is being returned
- Parameters:
r- arbitrary rectangle in window units
-
getMonitorById
public final MonitorDevice getMonitorById(int monitorId)
Returns theMonitorDevicewhich matches the given integer monitorId.If no match is found, null is being returned
-
getMonitorByHandle
public final MonitorDevice getMonitorByHandle(long monitorHandle)
Returns theMonitorDevicewhich matches the given long monitorHandle.If no match is found, null is being returned
-
getMonitorByName
public final MonitorDevice getMonitorByName(String name)
Returns theMonitorDevicewhich matches the given name.If no match is found or the given name is null or empty, null is being returned
-
unionOfMonitorViewports
public final void unionOfMonitorViewports(Rectangle viewport, Rectangle viewportInWindowUnits)
Calculates the union of all monitor'sviewportin pixel- and window units.Should be equal to
getX(),getY(),getWidth()andgetHeight(), however, some native toolkits may choose a different virtual screen area.- Parameters:
viewport- storage for result in pixel units, maybe nullviewportInWindowUnits- storage for result in window units, maybe null
-
addMonitorModeListener
public abstract void addMonitorModeListener(MonitorModeListener sml)
- Parameters:
sml-MonitorModeListenerto be added forMonitorEvent
-
removeMonitorModeListener
public abstract void removeMonitorModeListener(MonitorModeListener sml)
- Parameters:
sml-MonitorModeListenerto be removed fromMonitorEvent
-
getFirstScreenOf
public static Screen getFirstScreenOf(Display display, int idx, int fromIndex)
- Parameters:
type-name-fromIndex- start index, then increasing until found or end of list *- Returns:
-
getLastScreenOf
public static Screen getLastScreenOf(Display display, int idx, int fromIndex)
- Parameters:
type-name-fromIndex- start index, then decreasing until found or end of list. -1 is interpreted as size - 1.- Returns:
-
getAllScreens
public static Collection<Screen> getAllScreens()
Returns the global screen collection
-
getActiveScreenNumber
public static int getActiveScreenNumber()
-
-