JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.nativewindow.NativeWindow Interface Reference

Extend the NativeSurface interface with windowing information such as window-handle, window-size and window-position. More...

Inheritance diagram for com.jogamp.nativewindow.NativeWindow:
Collaboration diagram for com.jogamp.nativewindow.NativeWindow:

Public Member Functions

NativeSurface getNativeSurface ()
 Returns the associated NativeSurface of this NativeSurfaceHolder. More...
 
void destroy ()
 Destroys this window incl. More...
 
NativeWindow getParent ()
 
long getWindowHandle ()
 Returns the window handle for this NativeWindow. More...
 
InsetsImmutable getInsets ()
 Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units. More...
 
int getX ()
 Returns the current x position of this window, relative to it's parent. More...
 
int getY ()
 Returns the current y position of the top-left corner of the client area relative to it's parent in window units. More...
 
int getWidth ()
 Returns the width of the client area excluding insets (window decorations) in window units. More...
 
int getHeight ()
 Returns the height of the client area excluding insets (window decorations) in window units. More...
 
Rectangle getBounds ()
 Returns a newly created Rectangle containing window origin, getX() & getY(), and size, getWidth() & getHeight(), in window units. More...
 
Rectangle getSurfaceBounds ()
 Returns a newly created Rectangle containing window's surface origin and size in pixel units. More...
 
Point getLocationOnScreen (Point point)
 Returns the window's top-left client-area position in the screen. More...
 
boolean hasFocus ()
 Returns true if this native window owns the focus, otherwise false. More...
 
- Public Member Functions inherited from com.jogamp.nativewindow.NativeSurface
RecursiveLock getLock ()
 Returns the implementation's RecursiveLock synchronizing multithreaded access if used. More...
 
int lockSurface () throws NativeWindowException, RuntimeException
 Lock the surface of this native window. More...
 
void unlockSurface ()
 Unlock the surface of this native window. More...
 
boolean isSurfaceLockedByOtherThread ()
 Query if surface is locked by another thread, i.e. More...
 
Thread getSurfaceLockOwner ()
 Return the locking owner's Thread, or null if not locked. More...
 
boolean surfaceSwap ()
 Provide a mechanism to utilize custom (pre-) swap surface code. More...
 
void addSurfaceUpdatedListener (SurfaceUpdatedListener l)
 Appends the given SurfaceUpdatedListener to the end of the list. More...
 
void addSurfaceUpdatedListener (int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException
 Inserts the given SurfaceUpdatedListener at the specified position in the list. More...
 
void removeSurfaceUpdatedListener (SurfaceUpdatedListener l)
 Remove the specified SurfaceUpdatedListener from the list. More...
 
long getSurfaceHandle ()
 Returns the handle to the surface for this NativeSurface. More...
 
int getSurfaceWidth ()
 Returns the width of the client area excluding insets (window decorations) in pixel units. More...
 
int getSurfaceHeight ()
 Returns the height of the client area excluding insets (window decorations) in pixel units. More...
 
int[] convertToWindowUnits (final int[] pixelUnitsAndResult)
 Converts the given pixel units into window units in place. More...
 
int[] convertToPixelUnits (final int[] windowUnitsAndResult)
 Converts the given window units into pixel units in place. More...
 
AbstractGraphicsConfiguration getGraphicsConfiguration ()
 Returns the graphics configuration corresponding to this window. More...
 
long getDisplayHandle ()
 Convenience: Get display handle from AbstractGraphicsConfiguration . More...
 
int getScreenIndex ()
 Convenience: Get display handle from AbstractGraphicsConfiguration . More...
 
- Public Member Functions inherited from com.jogamp.nativewindow.SurfaceUpdatedListener
void surfaceUpdated (Object updater, NativeSurface ns, long when)
 Notification of a surface update event, eg. More...
 
NativeSurface getNativeSurface ()
 Returns the associated NativeSurface of this NativeSurfaceHolder. More...
 

Additional Inherited Members

- Static Public Attributes inherited from com.jogamp.nativewindow.NativeSurface
static final int LOCK_SURFACE_UNLOCKED = 0
 Unlocked state, {@value}. More...
 
static final int LOCK_SURFACE_NOT_READY = 1
 Returned by lockSurface() if the surface is not ready to be locked, {@value}. More...
 
static final int LOCK_SURFACE_CHANGED = 2
 Returned by lockSurface() if the surface is locked, but has changed, {@value}. More...
 
static final int LOCK_SUCCESS = 3
 Returned by lockSurface() if the surface is locked, and is unchanged, {@value}. More...
 

Detailed Description

Extend the NativeSurface interface with windowing information such as window-handle, window-size and window-position.

All values of this interface are represented in window units, if not stated otherwise. See NativeSurface.

Coordinate System
  • Abstract screen space has it's origin in the top-left corner, and may not be at 0/0.
  • Window origin is in it's top-left corner, see getX() and getY().
  • Window client-area excludes insets, i.e. window decoration.
  • Window origin is relative to it's parent window if exist, or the screen position (top-level).

A window toolkit such as the AWT may either implement this interface directly with one of its components, or provide and register an implementation of NativeWindowFactory which can create NativeWindow objects for its components.

Definition at line 72 of file NativeWindow.java.

Member Function Documentation

◆ destroy()

void com.jogamp.nativewindow.NativeWindow.destroy ( )

Destroys this window incl.

releasing all related resources.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, com.jogamp.newt.opengl.GLWindow, and com.jogamp.newt.Window.

Here is the caller graph for this function:

◆ getBounds()

Rectangle com.jogamp.nativewindow.NativeWindow.getBounds ( )

Returns a newly created Rectangle containing window origin, getX() & getY(), and size, getWidth() & getHeight(), in window units.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getHeight()

int com.jogamp.nativewindow.NativeWindow.getHeight ( )

Returns the height of the client area excluding insets (window decorations) in window units.

Returns
height of the client area in window units
See also
NativeSurface::getSurfaceHeight()

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getInsets()

InsetsImmutable com.jogamp.nativewindow.NativeWindow.getInsets ( )

Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.

Insets are zero if the window is undecorated, including child windows.

Insets are available only after the native window has been created, ie. the native window has been made visible.

The top-level window area's top-left corner is located at

  getX() - getInsets(). getLeftWidth()
  getY() - getInsets(). getTopHeight()

The top-level window size is

  getWidth()  + getInsets(). getTotalWidth()
  getHeight() + getInsets(). getTotalHeight()
Returns
insets

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getLocationOnScreen()

Point com.jogamp.nativewindow.NativeWindow.getLocationOnScreen ( Point  point)

Returns the window's top-left client-area position in the screen.

If Point is not null, it is translated about the resulting screen position and returned.

See Coordinate System.

Since the position reflects the client area, it does not include the insets.

Parameters
pointOptional Point storage. If not null, null, it is translated about the resulting screen position and returned.
See also
getX()
getY()
getInsets()

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getNativeSurface()

NativeSurface com.jogamp.nativewindow.NativeWindow.getNativeSurface ( )

Returns the associated NativeSurface of this NativeSurfaceHolder.

Returns this instance, which is-a NativeSurface.

Implements com.jogamp.nativewindow.NativeSurfaceHolder.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow.

◆ getParent()

NativeWindow com.jogamp.nativewindow.NativeWindow.getParent ( )
Returns
The parent NativeWindow, or null if this NativeWindow is top level.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getSurfaceBounds()

Rectangle com.jogamp.nativewindow.NativeWindow.getSurfaceBounds ( )

Returns a newly created Rectangle containing window's surface origin and size in pixel units.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

◆ getWidth()

int com.jogamp.nativewindow.NativeWindow.getWidth ( )

Returns the width of the client area excluding insets (window decorations) in window units.

Returns
width of the client area in window units
See also
NativeSurface::getSurfaceWidth()

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getWindowHandle()

long com.jogamp.nativewindow.NativeWindow.getWindowHandle ( )

Returns the window handle for this NativeWindow.

The window handle shall reflect the platform one for all window related operations, e.g. open, close, resize.

On X11 this returns an entity of type Window.
On Microsoft Windows this returns an entity of type HWND.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getX()

int com.jogamp.nativewindow.NativeWindow.getX ( )

Returns the current x position of this window, relative to it's parent.

Returns the x position of the top-left corner of the client area relative to it's parent in window units.

If no parent exist (top-level window), this coordinate equals the screen coordinate.

Since the position reflects the client area, it does not include the insets.

See Coordinate System.

See also
getInsets()
getLocationOnScreen(Point)

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ getY()

int com.jogamp.nativewindow.NativeWindow.getY ( )

Returns the current y position of the top-left corner of the client area relative to it's parent in window units.

If no parent exist (top-level window), this coordinate equals the screen coordinate.

Since the position reflects the client area, it does not include the insets.

See Coordinate System.

See also
getInsets()
getLocationOnScreen(Point)

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.

Here is the caller graph for this function:

◆ hasFocus()

boolean com.jogamp.nativewindow.NativeWindow.hasFocus ( )

Returns true if this native window owns the focus, otherwise false.

Implemented in com.jogamp.nativewindow.awt.JAWTWindow, and com.jogamp.newt.opengl.GLWindow.


The documentation for this interface was generated from the following file: