Top Description Inners Fields Constructors Methods
com.jogamp.newt.swt

public Class NewtCanvasSWT

extends Canvas
implements WindowClosingProtocol
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.WindowClosingProtocol
Imports
com.jogamp.nativewindow.AbstractGraphicsConfiguration, .AbstractGraphicsDevice, .AbstractGraphicsScreen, .Capabilities, .CapabilitiesImmutable, .GraphicsConfigurationFactory, .NativeSurface, .NativeWindow, .NativeWindowException, .NativeWindowFactory, .SurfaceUpdatedListener, .WindowClosingProtocol, com.jogamp.nativewindow.util.Insets, .InsetsImmutable, .Point, com.jogamp.opengl.GLCapabilities, jogamp.nativewindow.macosx.OSXUtil, jogamp.nativewindow.windows.GDIUtil, jogamp.nativewindow.x11.X11Lib, jogamp.newt.Debug, jogamp.newt.swt.SWTEDTUtil, org.eclipse.swt.SWT, org.eclipse.swt.graphics.Rectangle, org.eclipse.swt.widgets.Canvas, .Composite, .Event, .Listener, com.jogamp.nativewindow.swt.SWTAccessor, com.jogamp.newt.Display, .Window, com.jogamp.newt.event.WindowEvent, com.jogamp.newt.util.EDTUtil

SWT Canvas containing a NEWT Window using native parenting.

Implementation allows use of custom GLCapabilities.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private volatile Rectangle
private static final boolean
private volatile NewtCanvasSWT.SWTNativeWindow
private volatile Window
private WindowClosingProtocol.WindowClosingMode
private volatile boolean
private volatile boolean
private volatile boolean
private final AbstractGraphicsScreen

Constructor Summary

AccessConstructor and Description
public
NewtCanvasSWT(final Composite
the SWT composite
parent
,
final int
additional styles to SWT#NO_BACKGROUND
style
,
final Window
optional preassigned Window, maybe null
child
)

Instantiates a NewtCanvas with a NEWT child.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
configureNewtChild(final boolean attach)

public static NewtCanvasSWT

Returns:

a new instance
create
(final Composite
the SWT composite
parent
,
final int
additional styles to SWT#NO_BACKGROUND
style
,
final Window
optional preassigned Window, maybe null
child
)

Creates an instance using NewtCanvasSWT(Composite, int, Window) on the SWT thread.

public void
dispose()

Overrides org.eclipse.swt.widgets.Widget.dispose.

Destroys this resource:
  • Make the NEWT Child invisible
  • Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL
  • Issues destroy() on the NEWT Child
  • Remove reference to the NEWT Child
public boolean
forceFocus()

Overrides org.eclipse.swt.widgets.Control.forceFocus.

Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.
public WindowClosingProtocol.WindowClosingMode
public NativeWindow

Returns:

this SWT Canvas NativeWindow representation, may be null in case it has not been realized.
getNativeWindow
()

public Window

Returns:

the current NEWT child
getNEWTChild
()

private Point
pack-priv boolean
pack-priv boolean
pack-priv static String
pack-priv void
reparentWindow(final boolean add)

private final void
public void
setBounds(final int
the new x coordinate for the receiver
x
,
final int
the new y coordinate for the receiver
y
,
final int
the new width for the receiver
width
,
final int
the new height for the receiver
height
)

Overrides org.eclipse.swt.widgets.Control.setBounds.

Sets the receiver's size and location in points to the rectangular area specified by the arguments.
public WindowClosingProtocol.WindowClosingMode
public Window

Returns:

the previous attached newt child.
setNEWTChild
(final Window newChild)

Sets a new NEWT child, provoking reparenting.

public boolean
setParent(final Composite
the new parent for the control.
parent
)

Overrides org.eclipse.swt.widgets.Control.setParent.

Changes the parent of the widget to be the one provided.
pack-priv static String
toHexString(final long l)

public void
update()

Overrides org.eclipse.swt.widgets.Control.update.

Forces all outstanding paint requests for the widget to be processed before this method returns.
protected final void
protected final void
updatePosSizeCheck(final int newX, final int newY, final int newWidth, final int newHeight, final boolean updatePos)

protected final void
protected final boolean
validateNative()

assumes nativeWindow == null !

Inherited from org.eclipse.swt.widgets.Canvas:
drawBackgroundgetCaretgetIMEscrollsetCaretsetFontsetIME

Field Detail

clientAreaback to summary
private volatile Rectangle clientArea
DEBUGback to summary
private static final boolean DEBUG
nativeWindowback to summary
private volatile NewtCanvasSWT.SWTNativeWindow nativeWindow
newtChildback to summary
private volatile Window newtChild
newtChildCloseOpback to summary
private WindowClosingProtocol.WindowClosingMode newtChildCloseOp
newtChildReadyback to summary
private volatile boolean newtChildReady
postSetPosback to summary
private volatile boolean postSetPos
postSetSizeback to summary
private volatile boolean postSetSize
screenback to summary
private final AbstractGraphicsScreen screen

Constructor Detail

NewtCanvasSWTback to summary
public NewtCanvasSWT(final Composite parent, final int style, final Window child)

Instantiates a NewtCanvas with a NEWT child.

Note

The NEWT child Display's EDTUtil is being set to an SWT conform implementation via Display#setEDTUtil(EDTUtil).

Parameters
parent:Composite

the SWT composite

style:int

additional styles to SWT#NO_BACKGROUND

child:Window

optional preassigned Window, maybe null

Method Detail

configureNewtChildback to summary
pack-priv void configureNewtChild(final boolean attach)
createback to summary
public static NewtCanvasSWT create(final Composite parent, final int style, final Window child)

Creates an instance using NewtCanvasSWT(Composite, int, Window) on the SWT thread.

Note

The NEWT child Display's EDTUtil is being set to an SWT conform implementation via Display#setEDTUtil(EDTUtil).

Parameters
parent:Composite

the SWT composite

style:int

additional styles to SWT#NO_BACKGROUND

child:Window

optional preassigned Window, maybe null

Returns:NewtCanvasSWT

a new instance

disposeback to summary
public void dispose()

Overrides org.eclipse.swt.widgets.Widget.dispose.

Destroys this resource:

  • Make the NEWT Child invisible
  • Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL
  • Issues destroy() on the NEWT Child
  • Remove reference to the NEWT Child
Annotations
@Override
See Also
Window#destroy()
forceFocusback to summary
public boolean forceFocus()

Overrides org.eclipse.swt.widgets.Control.forceFocus.

Doc from org.eclipse.swt.widgets.Control.forceFocus.

Forces the receiver to have the keyboard focus, causing all keyboard events to be delivered to it.

Returns:boolean

true if the control got focus, and false if it was unable to.

Annotations
@Override
getDefaultCloseOperationback to summary
public WindowClosingProtocol.WindowClosingMode getDefaultCloseOperation()

Implements com.jogamp.nativewindow.WindowClosingProtocol.getDefaultCloseOperation.

Returns:WindowClosingProtocol.WindowClosingMode

Doc from com.jogamp.nativewindow.WindowClosingProtocol.getDefaultCloseOperation.

the current close operation value

Annotations
@Override
getNativeWindowback to summary
public NativeWindow getNativeWindow()
Returns:NativeWindow

this SWT Canvas NativeWindow representation, may be null in case it has not been realized.

getNEWTChildback to summary
public Window getNEWTChild()
Returns:Window

the current NEWT child

getParentLocationOnScreenback to summary
private Point getParentLocationOnScreen()
isFullscreenback to summary
pack-priv boolean isFullscreen()
isParentback to summary
pack-priv boolean isParent()
newtWinHandleToHexStringback to summary
pack-priv static String newtWinHandleToHexString(final Window w)
reparentWindowback to summary
pack-priv void reparentWindow(final boolean add)
requestFocusNEWTChildback to summary
private final void requestFocusNEWTChild()
setBoundsback to summary
public void setBounds(final int x, final int y, final int width, final int height)

Overrides org.eclipse.swt.widgets.Control.setBounds.

Doc from org.eclipse.swt.widgets.Control.setBounds.

Sets the receiver's size and location in points to the rectangular area specified by the arguments. The x and y arguments are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell. In this case, the x and y arguments are relative to the display.

Note

Attempting to set the width or height of the receiver to a negative number will cause that value to be set to zero instead.

Note

On GTK, attempting to set the width or height of the receiver to a number higher or equal 2^14 will cause them to be set to (2^14)-1 instead.

Parameters
x:int

the new x coordinate for the receiver

y:int

the new y coordinate for the receiver

width:int

the new width for the receiver

height:int

the new height for the receiver

Annotations
@Override
setDefaultCloseOperationback to summary
public WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(final WindowClosingProtocol.WindowClosingMode op)

Implements com.jogamp.nativewindow.WindowClosingProtocol.setDefaultCloseOperation.

Parameters
op:WindowClosingProtocol.WindowClosingMode

Doc from com.jogamp.nativewindow.WindowClosingProtocol.setDefaultCloseOperation.

the new close operation value

Returns:WindowClosingProtocol.WindowClosingMode

Doc from com.jogamp.nativewindow.WindowClosingProtocol.setDefaultCloseOperation.

the previous close operation value

Annotations
@Override
setNEWTChildback to summary
public Window setNEWTChild(final Window newChild)

Sets a new NEWT child, provoking reparenting.

A previously detached newChild will be released to top-level status and made invisible.

Note

When switching NEWT child's, detaching the previous first via setNEWTChild(null) produced much cleaner visual results.

Note

The NEWT child Display's EDTUtil is being set to an SWT conform implementation via Display#setEDTUtil(EDTUtil).

Returns:Window

the previous attached newt child.

setParentback to summary
public boolean setParent(final Composite parent)

Overrides org.eclipse.swt.widgets.Control.setParent.

Doc from org.eclipse.swt.widgets.Control.setParent.

Changes the parent of the widget to be the one provided. Returns true if the parent is successfully changed.

Parameters
parent:Composite

the new parent for the control.

Returns:boolean

true if the parent is changed and false otherwise.

Annotations
@Override
toHexStringback to summary
pack-priv static String toHexString(final long l)
updateback to summary
public void update()

Overrides org.eclipse.swt.widgets.Control.update.

Doc from org.eclipse.swt.widgets.Control.update.

Forces all outstanding paint requests for the widget to be processed before this method returns. If there are no outstanding paint request, this method does nothing.

Note:

  • This method does not cause a redraw.
  • Some OS versions forcefully perform automatic deferred painting. This method does nothing in that case.
Annotations
@Override
updatePosSizeCheckback to summary
protected final void updatePosSizeCheck()
updatePosSizeCheckback to summary
protected final void updatePosSizeCheck(final int newX, final int newY, final int newWidth, final int newHeight, final boolean updatePos)
updateSizeCheckback to summary
protected final void updateSizeCheck()
validateNativeback to summary
protected final boolean validateNative()

assumes nativeWindow == null !

com.jogamp.newt.swt back to summary

private Class NewtCanvasSWT.SWTNativeWindow

extends Object
implements NativeWindow
Class Inheritance
All Implemented Interfaces
com.jogamp.nativewindow.NativeWindow, com.jogamp.nativewindow.NativeSurfaceHolder, com.jogamp.nativewindow.NativeSurface, com.jogamp.nativewindow.SurfaceUpdatedListener

Field Summary

Modifier and TypeField and Description
private final AbstractGraphicsConfiguration
private final InsetsImmutable
private final long

Constructor Summary

AccessConstructor and Description
public
SWTNativeWindow(final AbstractGraphicsConfiguration config, final long nativeWindowHandle)

Method Summary

Modifier and TypeMethod and Description
public void
public void
addSurfaceUpdatedListener(final int
Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().
index
,
final SurfaceUpdatedListener
The listener object to be inserted
l
)

Implements com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Inserts the given SurfaceUpdatedListener at the specified position in the list.
public final int[]
convertToPixelUnits(final int[]
int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.
windowUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Converts the given window units into pixel units in place.
public final int[]
convertToWindowUnits(final int[]
int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.
pixelUnitsAndResult
)

Implements com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Converts the given pixel units into window units in place.
public void
destroy()

Implements com.jogamp.nativewindow.NativeWindow.destroy.

Destroys this window incl.
public long
getDisplayHandle()

Implements com.jogamp.nativewindow.NativeSurface.getDisplayHandle.

Convenience: Get display handle from AbstractGraphicsConfiguration .
public AbstractGraphicsConfiguration
getGraphicsConfiguration()

Implements com.jogamp.nativewindow.NativeSurface.getGraphicsConfiguration.

Returns the graphics configuration corresponding to this window.
public int
getHeight()

Implements com.jogamp.nativewindow.NativeWindow.getHeight.

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

Implements 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.
public Point
getLocationOnScreen(final Point
Optional Point storage. If not null, null, it is translated about the resulting screen position and returned.
point
)

Implements com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Returns the window's top-left client-area position in the screen.
public final NativeSurface
public NativeWindow
public int
getScreenIndex()

Implements com.jogamp.nativewindow.NativeSurface.getScreenIndex.

Convenience: Get display handle from AbstractGraphicsConfiguration .
public long
getSurfaceHandle()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.
public int
getSurfaceHeight()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHeight.

Returns the height of the client area excluding insets (window decorations) in pixel units.
public Thread
getSurfaceLockOwner()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceLockOwner.

Return the locking owner's Thread, or null if not locked.
public int
getSurfaceWidth()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceWidth.

Returns the width of the client area excluding insets (window decorations) in pixel units.
public int
getWidth()

Implements com.jogamp.nativewindow.NativeWindow.getWidth.

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

Implements com.jogamp.nativewindow.NativeWindow.getWindowHandle.

Returns the window handle for this NativeWindow.
public int
getX()

Implements com.jogamp.nativewindow.NativeWindow.getX.

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

Implements 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.
public boolean
hasFocus()

Implements com.jogamp.nativewindow.NativeWindow.hasFocus.

Returns true if this native window owns the focus, otherwise false.
public boolean
isSurfaceLockedByOtherThread()

Implements com.jogamp.nativewindow.NativeSurface.isSurfaceLockedByOtherThread.

Query if surface is locked by another thread, i.e. not the current one.
public int
lockSurface()

Implements com.jogamp.nativewindow.NativeSurface.lockSurface.

Lock the surface of this native window.
public void
public boolean
surfaceSwap()

Implements com.jogamp.nativewindow.NativeSurface.surfaceSwap.

Provide a mechanism to utilize custom (pre-) swap surface code.
public void
surfaceUpdated(final Object
is the caller object who updated the surface, e.g. a JOGL GLDrawable.
updater
,
final NativeSurface
the updated NativeSurface
ns
,
final long
the time in ms, when the surface was updated
when
)

Implements com.jogamp.nativewindow.SurfaceUpdatedListener.surfaceUpdated.

Notification of a surface update event, eg.
public void
unlockSurface()

Implements com.jogamp.nativewindow.NativeSurface.unlockSurface.

Unlock the surface of this native window Shall not modify the surface handle, see lockSurface()

The implementation shall also invoke AbstractGraphicsDevice#unlock() for the final unlock (recursive count zero).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
private final AbstractGraphicsConfiguration config
insetsback to summary
private final InsetsImmutable insets
nativeWindowHandleback to summary
private final long nativeWindowHandle

Constructor Detail

SWTNativeWindowback to summary
public SWTNativeWindow(final AbstractGraphicsConfiguration config, final long nativeWindowHandle)

Method Detail

addSurfaceUpdatedListenerback to summary
public void addSurfaceUpdatedListener(final SurfaceUpdatedListener l)

Implements com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Doc from com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Appends the given SurfaceUpdatedListener to the end of the list.

Annotations
@Override
addSurfaceUpdatedListenerback to summary
public void addSurfaceUpdatedListener(final int index, final SurfaceUpdatedListener l) throws IndexOutOfBoundsException

Implements com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Doc from com.jogamp.nativewindow.NativeSurface.addSurfaceUpdatedListener.

Inserts the given SurfaceUpdatedListener at the specified position in the list.

Parameters
index:int

Position where the listener will be inserted. Should be within (0 <= index && index <= size()). An index value of -1 is interpreted as the end of the list, size().

l:SurfaceUpdatedListener

The listener object to be inserted

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
If the index is not within (0 <= index && index <= size()), or -1
convertToPixelUnitsback to summary
public final int[] convertToPixelUnits(final int[] windowUnitsAndResult)

Implements com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Doc from com.jogamp.nativewindow.NativeSurface.convertToPixelUnits.

Converts the given window units into pixel units in place.

Parameters
windowUnitsAndResult:int[]

int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.

Returns:int[]

result int[2] storage windowUnitsAndResult for chaining holding the converted values

Annotations
@Override
convertToWindowUnitsback to summary
public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult)

Implements com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Doc from com.jogamp.nativewindow.NativeSurface.convertToWindowUnits.

Converts the given pixel units into window units in place.

Parameters
pixelUnitsAndResult:int[]

int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.

Returns:int[]

result int[2] storage pixelUnitsAndResult for chaining holding the converted values

Annotations
@Override
destroyback to summary
public void destroy()

Implements com.jogamp.nativewindow.NativeWindow.destroy.

Doc from com.jogamp.nativewindow.NativeWindow.destroy.

Destroys this window incl. releasing all related resources.

Annotations
@Override
getDisplayHandleback to summary
public long getDisplayHandle()

Implements com.jogamp.nativewindow.NativeSurface.getDisplayHandle.

Doc from com.jogamp.nativewindow.NativeSurface.getDisplayHandle.

Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice

Annotations
@Override
getGraphicsConfigurationback to summary
public AbstractGraphicsConfiguration getGraphicsConfiguration()

Implements com.jogamp.nativewindow.NativeSurface.getGraphicsConfiguration.

Doc from com.jogamp.nativewindow.NativeSurface.getGraphicsConfiguration.

Returns the graphics configuration corresponding to this window.

In case the implementation utilizes a delegation pattern to wrap abstract toolkits, this method shall return the native AbstractGraphicsConfiguration via AbstractGraphicsConfiguration#getNativeGraphicsConfiguration().

Annotations
@Override
getHeightback to summary
public int getHeight()

Implements com.jogamp.nativewindow.NativeWindow.getHeight.

Doc from com.jogamp.nativewindow.NativeWindow.getHeight.

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

Returns:int

height of the client area in window units

Annotations
@Override
getInsetsback to summary
public InsetsImmutable getInsets()

Implements com.jogamp.nativewindow.NativeWindow.getInsets.

Doc from 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:InsetsImmutable

insets

Annotations
@Override
getLocationOnScreenback to summary
public Point getLocationOnScreen(final Point point)

Implements com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

Doc from com.jogamp.nativewindow.NativeWindow.getLocationOnScreen.

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
point:Point

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

Annotations
@Override
getNativeSurfaceback to summary
public final NativeSurface getNativeSurface()

Implements com.jogamp.nativewindow.NativeWindow.getNativeSurface.

Doc from com.jogamp.nativewindow.NativeWindow.getNativeSurface.

Returns the associated NativeSurface of this NativeSurfaceHolder.

Returns this instance, which is-a NativeSurface.

Annotations
@Override
getParentback to summary
public NativeWindow getParent()

Implements com.jogamp.nativewindow.NativeWindow.getParent.

Returns:NativeWindow

Doc from com.jogamp.nativewindow.NativeWindow.getParent.

The parent NativeWindow, or null if this NativeWindow is top level.

Annotations
@Override
getScreenIndexback to summary
public int getScreenIndex()

Implements com.jogamp.nativewindow.NativeSurface.getScreenIndex.

Doc from com.jogamp.nativewindow.NativeSurface.getScreenIndex.

Convenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen

Annotations
@Override
getSurfaceHandleback to summary
public long getSurfaceHandle()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceHandle.

Returns the handle to the surface for this NativeSurface.

The surface handle should be set/update by lockSurface(), where unlockSurface() is not allowed to modify it. After unlockSurface() it is no more guaranteed that the surface handle is still valid. The surface handle shall reflect the platform one for all drawable surface operations, e.g. opengl, swap-buffer.

On X11 this returns an entity of type Window, since there is no differentiation of surface and window there.
On Microsoft Windows this returns an entity of type HDC.

Annotations
@Override
getSurfaceHeightback to summary
public int getSurfaceHeight()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceHeight.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceHeight.

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

Returns:int

height of the client area in pixel units

Annotations
@Override
getSurfaceLockOwnerback to summary
public Thread getSurfaceLockOwner()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceLockOwner.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceLockOwner.

Return the locking owner's Thread, or null if not locked.

Annotations
@Override
getSurfaceWidthback to summary
public int getSurfaceWidth()

Implements com.jogamp.nativewindow.NativeSurface.getSurfaceWidth.

Doc from com.jogamp.nativewindow.NativeSurface.getSurfaceWidth.

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

Returns:int

width of the client area in pixel units

Annotations
@Override
getWidthback to summary
public int getWidth()

Implements com.jogamp.nativewindow.NativeWindow.getWidth.

Doc from com.jogamp.nativewindow.NativeWindow.getWidth.

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

Returns:int

width of the client area in window units

Annotations
@Override
getWindowHandleback to summary
public long getWindowHandle()

Implements com.jogamp.nativewindow.NativeWindow.getWindowHandle.

Doc from 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.

Annotations
@Override
getXback to summary
public int getX()

Implements com.jogamp.nativewindow.NativeWindow.getX.

Doc from com.jogamp.nativewindow.NativeWindow.getX.

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.

Annotations
@Override
getYback to summary
public int getY()

Implements com.jogamp.nativewindow.NativeWindow.getY.

Doc from 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.

Annotations
@Override
hasFocusback to summary
public boolean hasFocus()

Implements com.jogamp.nativewindow.NativeWindow.hasFocus.

Doc from com.jogamp.nativewindow.NativeWindow.hasFocus.

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

Annotations
@Override
isSurfaceLockedByOtherThreadback to summary
public boolean isSurfaceLockedByOtherThread()

Implements com.jogamp.nativewindow.NativeSurface.isSurfaceLockedByOtherThread.

Doc from com.jogamp.nativewindow.NativeSurface.isSurfaceLockedByOtherThread.

Query if surface is locked by another thread, i.e. not the current one.
Convenient shortcut for:

  final Thread o = getSurfaceLockOwner();
  if( null != o && Thread.currentThread() != o ) { .. }
Annotations
@Override
lockSurfaceback to summary
public int lockSurface() throws NativeWindowException, RuntimeException

Implements com.jogamp.nativewindow.NativeSurface.lockSurface.

Doc from com.jogamp.nativewindow.NativeSurface.lockSurface.

Lock the surface of this native window.

The surface handle shall be valid after a successfull call, ie return a value other than LOCK_SURFACE_UNLOCKED and LOCK_SURFACE_NOT_READY, which is

   boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();

The caller may need to take care of the result LOCK_SURFACE_CHANGED, where the surface handle is valid but has changed.

This call is blocking until the surface has been locked or a timeout is reached. The latter will throw a runtime exception.

This call allows recursion from the same thread.

The implementation may want to aquire the application level com.jogamp.common.util.locks.RecursiveLock first before proceeding with a native surface lock.

The implementation shall also invoke AbstractGraphicsDevice#lock() for the initial lock (recursive count zero).

Returns:int

LOCK_SUCCESS, LOCK_SURFACE_CHANGED or LOCK_SURFACE_NOT_READY.

Annotations
@Override
Exceptions
NativeWindowException:
if native locking failed, maybe platform related
RuntimeException:
after timeout when waiting for the surface lock
removeSurfaceUpdatedListenerback to summary
public void removeSurfaceUpdatedListener(final SurfaceUpdatedListener l)

Implements com.jogamp.nativewindow.NativeSurface.removeSurfaceUpdatedListener.

Doc from com.jogamp.nativewindow.NativeSurface.removeSurfaceUpdatedListener.

Remove the specified SurfaceUpdatedListener from the list.

Annotations
@Override
surfaceSwapback to summary
public boolean surfaceSwap()

Implements com.jogamp.nativewindow.NativeSurface.surfaceSwap.

Doc from com.jogamp.nativewindow.NativeSurface.surfaceSwap.

Provide a mechanism to utilize custom (pre-) swap surface code. This method is called before the render toolkit (e.g. JOGL) swaps the buffer/surface if double buffering is enabled.

The implementation may itself apply the swapping, in which case true shall be returned.

Returns:boolean

true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.

Annotations
@Override
surfaceUpdatedback to summary
public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when)

Implements com.jogamp.nativewindow.SurfaceUpdatedListener.surfaceUpdated.

Doc from com.jogamp.nativewindow.SurfaceUpdatedListener.surfaceUpdated.

Notification of a surface update event, eg. after a swap buffer operation.

Parameters
updater:Object

is the caller object who updated the surface, e.g. a JOGL GLDrawable.

ns:NativeSurface

the updated NativeSurface

when:long

the time in ms, when the surface was updated

Annotations
@Override
unlockSurfaceback to summary
public void unlockSurface()

Implements com.jogamp.nativewindow.NativeSurface.unlockSurface.

Doc from com.jogamp.nativewindow.NativeSurface.unlockSurface.

Unlock the surface of this native window Shall not modify the surface handle, see lockSurface()

The implementation shall also invoke AbstractGraphicsDevice#unlock() for the final unlock (recursive count zero).

The implementation shall be fail safe, i.e. tolerant in case the native resources are already released / unlocked. In this case the implementation shall simply ignore the call.

Annotations
@Override