Class JAWTWindow
- java.lang.Object
-
- com.jogamp.nativewindow.awt.JAWTWindow
-
- All Implemented Interfaces:
NativeSurface,NativeSurfaceHolder,NativeWindow,OffscreenLayerOption,OffscreenLayerSurface,ScalableSurface,SurfaceUpdatedListener
public abstract class JAWTWindow extends Object implements NativeWindow, OffscreenLayerSurface, OffscreenLayerOption, ScalableSurface
-
-
Field Summary
-
Fields inherited from interface com.jogamp.nativewindow.NativeSurface
LOCK_SUCCESS, LOCK_SURFACE_CHANGED, LOCK_SURFACE_NOT_READY, LOCK_SURFACE_UNLOCKED
-
Fields inherited from interface com.jogamp.nativewindow.ScalableSurface
AUTOMAX_PIXELSCALE, IDENTITY_PIXELSCALE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)Inserts the givenSurfaceUpdatedListenerat the specified position in the list.voidaddSurfaceUpdatedListener(SurfaceUpdatedListener l)Appends the givenSurfaceUpdatedListenerto the end of the list.voidattachSurfaceLayer(long layerHandle)Attach the offscreen layer to this offscreen layer surface.int[]convertToPixelUnits(int[] windowUnitsAndResult)Converts the given window units into pixel units in place.int[]convertToWindowUnits(int[] pixelUnitsAndResult)Converts the given pixel units into window units in place.voiddestroy()Destroys this window incl.voiddetachSurfaceLayer()Detaches a previously attached offscreen layer from this offscreen layer surface.longgetAttachedSurfaceLayer()Returns the attached surface layer or null if none is attached.ComponentgetAWTComponent()AWTGraphicsConfigurationgetAWTGraphicsConfiguration()Return the currentAWTGraphicsConfigurationinstance, which also holds itsupstream component'sGraphicsConfigurationRectangleImmutablegetBounds()float[]getCurrentSurfaceScale(float[] result)Returns the current pixel scale of the associatedNativeSurface.longgetDisplayHandle()Convenience: Get display handle from AbstractGraphicsConfiguration .AbstractGraphicsConfigurationgetGraphicsConfiguration()Returns the graphics configuration corresponding to this window.intgetHeight()Returns the height of the client area excluding insets (window decorations) in window units.InsetsImmutablegetInsets()Returns the insets defined as the width and height of the window decoration on the left, right, top and bottom in window units.jogamp.nativewindow.jawt.JAWTgetJAWT()Returns the underlying JAWT instance created @lockSurface().PointgetLocationOnScreen(Point storage)Returns the window's top-left client-area position in the screen.RecursiveLockgetLock()Returns the recursive lock object of this surface, which synchronizes multithreaded access.float[]getMaximumSurfaceScale(float[] result)Returns the maximum pixel scale of the associatedNativeSurface.float[]getMinimumSurfaceScale(float[] result)Returns the minimum pixel scale of the associatedNativeSurface.NativeSurfacegetNativeSurface()Returns the associatedNativeSurfaceof thisNativeSurfaceHolder.NativeWindowgetParent()float[]getRequestedSurfaceScale(float[] result)Returns therequestedpixel scale of the associatedNativeSurface.intgetScreenIndex()Convenience: Get display handle from AbstractGraphicsConfiguration .booleangetShallUseOffscreenLayer()Returns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean).longgetSurfaceHandle()Returns the handle to the surface for this NativeSurface.intgetSurfaceHeight()Returns the height of the client area excluding insets (window decorations) in pixel units.ThreadgetSurfaceLockOwner()Return the locking owner's Thread, or null if not locked.intgetSurfaceWidth()Returns the width of the client area excluding insets (window decorations) in pixel units.intgetWidth()Returns the width of the client area excluding insets (window decorations) in window units.longgetWindowHandle()Returns the window handle for this NativeWindow.intgetX()Returns the x position of the top-left corner of the client area relative to it's parent in window units.intgetY()Returns the current y position of the top-left corner of the client area relative to it's parent in window units.booleanhasFocus()Returns true if this native window owns the focus, otherwise false.booleanhasPixelScaleChanged()Returns and clears thehasPixelScaleChangedflag, as set vialockSurface().booleanhideCursor()Optional method hiding the cursor in the corresponding on-screen surface/window, if exists.booleanisApplet()Returns true if the AWT component is parented to anApplet, otherwise false.booleanisOffscreenLayerSurfaceEnabled()Returns true if this instance uses an offscreen layer, otherwise false.booleanisSurfaceLayerAttached()Returns true if a surface layer is attached, otherwise false.booleanisSurfaceLockedByOtherThread()Query if surface is locked by another thread, i.e.intlockSurface()Lock the surface of this native window.voidremoveSurfaceUpdatedListener(SurfaceUpdatedListener l)Remove the specifiedSurfaceUpdatedListenerfrom the list.voidsetAWTGraphicsConfiguration(AWTGraphicsConfiguration config)Set a newAWTGraphicsConfigurationinstance, as required ifupstream component'sGraphicsConfigurationhas been changed due to reconfiguration, e.g.voidsetChosenCapabilities(CapabilitiesImmutable caps)Sets the capabilities of this instance, allowing upstream API's to refine it, i.e.booleansetCursor(PixelRectangle pixelrect, PointImmutable hotSpot)Optional method setting cursor in the corresponding on-screen surface/window, if exists.voidsetShallUseOffscreenLayer(boolean v)Request an offscreen layer, if supported.booleansetSurfaceScale(float[] pixelScale)Request a pixel scale in x- and y-direction for the associatedNativeSurface, wheresize_in_pixel_units = pixel_scale * size_in_window_units.booleansurfaceSwap()Provide a mechanism to utilize custom (pre-) swap surface code.voidsurfaceUpdated(Object updater, NativeSurface ns, long when)Notification of a surface update event, eg.StringtoString()voidunlockSurface()Unlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.lockSurface()booleanupdatePixelScale(GraphicsConfiguration gc, boolean clearFlag)Updates the minimum and maximum pixel-scale values and returnstrueif they were updated.
-
-
-
Method Detail
-
setAWTGraphicsConfiguration
public final void setAWTGraphicsConfiguration(AWTGraphicsConfiguration config)
Set a newAWTGraphicsConfigurationinstance, as required ifupstream component'sGraphicsConfigurationhas been changed due to reconfiguration, e.g. moving to a different monitor or changed capabilities.Upstream componentshall overrideComponent.getGraphicsConfiguration(), which shall call this method if detecting a reconfiguration. See JOGL's GLCanvas and NewtCanvasAWT.- Parameters:
config- the newAWTGraphicsConfiguration- See Also:
getAWTGraphicsConfiguration()
-
getAWTGraphicsConfiguration
public final AWTGraphicsConfiguration getAWTGraphicsConfiguration()
Return the currentAWTGraphicsConfigurationinstance, which also holds itsupstream component'sGraphicsConfiguration
-
setSurfaceScale
public boolean setSurfaceScale(float[] pixelScale)
Description copied from interface:ScalableSurfaceRequest a pixel scale in x- and y-direction for the associatedNativeSurface, wheresize_in_pixel_units = pixel_scale * size_in_window_units.Default pixel scale request for both directions is
ScalableSurface.AUTOMAX_PIXELSCALE.In case platform only supports uniform pixel scale, i.e. one scale for both directions, either
ScalableSurface.AUTOMAX_PIXELSCALEor the maximum requested pixel scale component is used.The requested pixel scale will be validated against platform limits before native scale-setup, i.e. clipped to
ScalableSurface.IDENTITY_PIXELSCALEif not supported or clipped to the platform maximum. It can be queried viaScalableSurface.getRequestedSurfaceScale(float[]).The actual realized pixel scale values of the
NativeSurfacecan be queried viaScalableSurface.getCurrentSurfaceScale(float[])or computed viasurface.convertToPixelUnits(new int[] { 1, 1 })- Specified by:
setSurfaceScalein interfaceScalableSurface- Parameters:
pixelScale- requested surface pixel scale float[2] values for x- and y-direction.- Returns:
trueif thecurrent pixel scalehas changed, otherwisefalse.- See Also:
ScalableSurface.getRequestedSurfaceScale(float[])
-
getRequestedSurfaceScale
public final float[] getRequestedSurfaceScale(float[] result)
Description copied from interface:ScalableSurfaceReturns therequestedpixel scale of the associatedNativeSurface.- Specified by:
getRequestedSurfaceScalein interfaceScalableSurface- Parameters:
result- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
- See Also:
ScalableSurface.setSurfaceScale(float[])
-
getCurrentSurfaceScale
public final float[] getCurrentSurfaceScale(float[] result)
Description copied from interface:ScalableSurfaceReturns the current pixel scale of the associatedNativeSurface.- Specified by:
getCurrentSurfaceScalein interfaceScalableSurface- Parameters:
result- float[2] storage for the result- Returns:
- the passed storage containing the current pixelScale for chaining
-
getMinimumSurfaceScale
public float[] getMinimumSurfaceScale(float[] result)
Description copied from interface:ScalableSurfaceReturns the minimum pixel scale of the associatedNativeSurface.- Specified by:
getMinimumSurfaceScalein interfaceScalableSurface- Parameters:
result- float[2] storage for the result- Returns:
- the passed storage containing the minimum pixelScale for chaining
-
getMaximumSurfaceScale
public final float[] getMaximumSurfaceScale(float[] result)
Description copied from interface:ScalableSurfaceReturns the maximum pixel scale of the associatedNativeSurface.The maximum pixel scale maybe used to determine the proper dpi value of the monitor displaying this
NativeSurface.surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale, with PpMM == pixel per millimeter- Specified by:
getMaximumSurfaceScalein interfaceScalableSurface- Parameters:
result- float[2] storage for the result- Returns:
- the passed storage containing the maximum pixelScale for chaining
-
updatePixelScale
public final boolean updatePixelScale(GraphicsConfiguration gc, boolean clearFlag)
Updates the minimum and maximum pixel-scale values and returnstrueif they were updated.- Parameters:
gc- pre-fetchedGraphicsConfigurationinstance ofupstream component, caller may use cachedgetAWTGraphicsConfiguration()'sGCor aComponent.getGraphicsConfiguration().clearFlag- iftrue, thehasPixelScaleChangedflag will be cleared- Returns:
trueif values were updated, otherwisefalse.- See Also:
hasPixelScaleChanged(),getAWTGraphicsConfiguration(),Component.getGraphicsConfiguration()
-
hasPixelScaleChanged
public final boolean hasPixelScaleChanged()
Returns and clears thehasPixelScaleChangedflag, as set vialockSurface().hasPixelScaleChangedistrue, if theminimumormaximumpixel scale has changed. User needs toset the current pixel scalein this case using therequested pixel scaleto update the surface pixel scale.
-
getBounds
public final RectangleImmutable getBounds()
- Returns:
- the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock
-
getInsets
public final InsetsImmutable getInsets()
Description copied from interface:NativeWindowReturns 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
The top-level window size isNativeWindow.getX()- getInsets().getLeftWidth()NativeWindow.getY()- getInsets().getTopHeight()NativeWindow.getWidth()+ getInsets().getTotalWidth()NativeWindow.getHeight()+ getInsets().getTotalHeight()- Specified by:
getInsetsin interfaceNativeWindow- Returns:
- insets
-
getAWTComponent
public final Component getAWTComponent()
-
isApplet
public final boolean isApplet()
Returns true if the AWT component is parented to anApplet, otherwise false. This information is valid only afterlockSurface().
-
getJAWT
public final jogamp.nativewindow.jawt.JAWT getJAWT()
Returns the underlying JAWT instance created @lockSurface().
-
setShallUseOffscreenLayer
public void setShallUseOffscreenLayer(boolean v)
Description copied from interface:OffscreenLayerOptionRequest an offscreen layer, if supported.Shall be called before the first
NativeSurface.lockSurface(), and hence before realization.- Specified by:
setShallUseOffscreenLayerin interfaceOffscreenLayerOption- See Also:
OffscreenLayerOption.getShallUseOffscreenLayer(),OffscreenLayerOption.isOffscreenLayerSurfaceEnabled()
-
getShallUseOffscreenLayer
public final boolean getShallUseOffscreenLayer()
Description copied from interface:OffscreenLayerOptionReturns the property set byOffscreenLayerOption.setShallUseOffscreenLayer(boolean).- Specified by:
getShallUseOffscreenLayerin interfaceOffscreenLayerOption
-
isOffscreenLayerSurfaceEnabled
public final boolean isOffscreenLayerSurfaceEnabled()
Description copied from interface:OffscreenLayerOptionReturns true if this instance uses an offscreen layer, otherwise false.This instance is an offscreen layer, if
The return value is undefined before issuing the firstsetShallUseOffscreenLayer(true)has been called before it's realization and first lock and the underlying implementation supports it.NativeSurface.lockSurface().- Specified by:
isOffscreenLayerSurfaceEnabledin interfaceOffscreenLayerOption- See Also:
OffscreenLayerOption.setShallUseOffscreenLayer(boolean)
-
attachSurfaceLayer
public final void attachSurfaceLayer(long layerHandle) throws NativeWindowExceptionDescription copied from interface:OffscreenLayerSurfaceAttach the offscreen layer to this offscreen layer surface.Implementation may realize all required resources at this point.
- Specified by:
attachSurfaceLayerin interfaceOffscreenLayerSurface- Throws:
NativeWindowException- if#isOffscreenLayerSurfaceEnabled()== false- See Also:
#isOffscreenLayerSurfaceEnabled()
-
detachSurfaceLayer
public final void detachSurfaceLayer() throws NativeWindowExceptionDescription copied from interface:OffscreenLayerSurfaceDetaches a previously attached offscreen layer from this offscreen layer surface.- Specified by:
detachSurfaceLayerin interfaceOffscreenLayerSurface- Throws:
NativeWindowException- if#isOffscreenLayerSurfaceEnabled()== false or no surface layer is attached.- See Also:
OffscreenLayerSurface.attachSurfaceLayer(long),#isOffscreenLayerSurfaceEnabled()
-
getAttachedSurfaceLayer
public final long getAttachedSurfaceLayer()
Description copied from interface:OffscreenLayerSurfaceReturns the attached surface layer or null if none is attached.- Specified by:
getAttachedSurfaceLayerin interfaceOffscreenLayerSurface
-
isSurfaceLayerAttached
public final boolean isSurfaceLayerAttached()
Description copied from interface:OffscreenLayerSurfaceReturns true if a surface layer is attached, otherwise false.- Specified by:
isSurfaceLayerAttachedin interfaceOffscreenLayerSurface
-
setChosenCapabilities
public final void setChosenCapabilities(CapabilitiesImmutable caps)
Description copied from interface:OffscreenLayerSurfaceSets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings.- Specified by:
setChosenCapabilitiesin interfaceOffscreenLayerSurface
-
getLock
public final RecursiveLock getLock()
Description copied from interface:OffscreenLayerSurfaceReturns the recursive lock object of this surface, which synchronizes multithreaded access.- Specified by:
getLockin interfaceOffscreenLayerSurface
-
setCursor
public final boolean setCursor(PixelRectangle pixelrect, PointImmutable hotSpot)
Description copied from interface:OffscreenLayerSurfaceOptional method setting cursor in the corresponding on-screen surface/window, if exists.- Specified by:
setCursorin interfaceOffscreenLayerSurface- Parameters:
pixelrect- cursor pixels, maybe null for default cursorhotSpot- maybe null for default cursor- Returns:
- true if successful, i.e. on-screen surface/window w/ cursor capabilities exists. Otherwise false.
-
hideCursor
public final boolean hideCursor()
Description copied from interface:OffscreenLayerSurfaceOptional method hiding the cursor in the corresponding on-screen surface/window, if exists.- Specified by:
hideCursorin interfaceOffscreenLayerSurface- Returns:
- true if successful, i.e. on-screen surface/window w/ cursor capabilities exists. Otherwise false.
-
lockSurface
public final int lockSurface() throws NativeWindowException, RuntimeExceptionDescription copied from interface:NativeSurfaceLock the surface of this native window.The surface handle shall be valid after a successfull call, ie return a value other than
NativeSurface.LOCK_SURFACE_UNLOCKEDandNativeSurface.LOCK_SURFACE_NOT_READY, which isboolean ok = LOCK_SURFACE_NOT_READY < lockSurface();The caller may need to take care of the result
NativeSurface.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
RecursiveLockfirst before proceeding with a native surface lock.The implementation shall also invoke
AbstractGraphicsDevice.lock()for the initial lock (recursive count zero).- Specified by:
lockSurfacein interfaceNativeSurface- Returns:
NativeSurface.LOCK_SUCCESS,NativeSurface.LOCK_SURFACE_CHANGEDorNativeSurface.LOCK_SURFACE_NOT_READY.- Throws:
NativeWindowException- if native locking failed, maybe platform relatedRuntimeException- after timeout when waiting for the surface lock- See Also:
RecursiveLock
-
unlockSurface
public final void unlockSurface()
Description copied from interface:NativeSurfaceUnlock the surface of this native window Shall not modify the surface handle, seeNativeSurface.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.
- Specified by:
unlockSurfacein interfaceNativeSurface- See Also:
NativeSurface.lockSurface(),RecursiveLock
-
isSurfaceLockedByOtherThread
public final boolean isSurfaceLockedByOtherThread()
Description copied from interface:NativeSurfaceQuery 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 ) { .. }- Specified by:
isSurfaceLockedByOtherThreadin interfaceNativeSurface
-
getSurfaceLockOwner
public final Thread getSurfaceLockOwner()
Description copied from interface:NativeSurfaceReturn the locking owner's Thread, or null if not locked.- Specified by:
getSurfaceLockOwnerin interfaceNativeSurface
-
surfaceSwap
public boolean surfaceSwap()
Description copied from interface:NativeSurfaceProvide 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.
- Specified by:
surfaceSwapin interfaceNativeSurface- Returns:
- true if this method completed swapping the surface, otherwise false, in which case eg the GLDrawable implementation has to swap the code.
-
addSurfaceUpdatedListener
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l)
Description copied from interface:NativeSurfaceAppends the givenSurfaceUpdatedListenerto the end of the list.- Specified by:
addSurfaceUpdatedListenerin interfaceNativeSurface
-
addSurfaceUpdatedListener
public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsExceptionDescription copied from interface:NativeSurfaceInserts the givenSurfaceUpdatedListenerat the specified position in the list.- Specified by:
addSurfaceUpdatedListenerin interfaceNativeSurface- Parameters:
index- 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- The listener object to be inserted- Throws:
IndexOutOfBoundsException- If the index is not within (0 <= index && index <= size()), or -1
-
removeSurfaceUpdatedListener
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l)
Description copied from interface:NativeSurfaceRemove the specifiedSurfaceUpdatedListenerfrom the list.- Specified by:
removeSurfaceUpdatedListenerin interfaceNativeSurface
-
surfaceUpdated
public void surfaceUpdated(Object updater, NativeSurface ns, long when)
Description copied from interface:SurfaceUpdatedListenerNotification of a surface update event, eg. after a swap buffer operation.- Specified by:
surfaceUpdatedin interfaceSurfaceUpdatedListener- Parameters:
updater- is the caller object who updated the surface, e.g. a JOGL GLDrawable.ns- the updated NativeSurfacewhen- the time in ms, when the surface was updated
-
getSurfaceHandle
public long getSurfaceHandle()
Description copied from interface:NativeSurfaceReturns the handle to the surface for this NativeSurface.The surface handle should be set/update by
NativeSurface.lockSurface(), whereNativeSurface.unlockSurface()is not allowed to modify it. AfterNativeSurface.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.- Specified by:
getSurfaceHandlein interfaceNativeSurface
-
getGraphicsConfiguration
public final AbstractGraphicsConfiguration getGraphicsConfiguration()
Description copied from interface:NativeSurfaceReturns 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
AbstractGraphicsConfigurationviaAbstractGraphicsConfiguration.getNativeGraphicsConfiguration().- Specified by:
getGraphicsConfigurationin interfaceNativeSurface- See Also:
AbstractGraphicsConfiguration.getNativeGraphicsConfiguration(),com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
-
getDisplayHandle
public final long getDisplayHandle()
Description copied from interface:NativeSurfaceConvenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice- Specified by:
getDisplayHandlein interfaceNativeSurface
-
getScreenIndex
public final int getScreenIndex()
Description copied from interface:NativeSurfaceConvenience: Get display handle from AbstractGraphicsConfiguration . AbstractGraphicsScreen- Specified by:
getScreenIndexin interfaceNativeSurface
-
getSurfaceWidth
public final int getSurfaceWidth()
Description copied from interface:NativeSurfaceReturns the width of the client area excluding insets (window decorations) in pixel units.- Specified by:
getSurfaceWidthin interfaceNativeSurface- Returns:
- width of the client area in pixel units
- See Also:
NativeWindow.getWidth(),NativeSurface.convertToWindowUnits(int[])
-
getSurfaceHeight
public final int getSurfaceHeight()
Description copied from interface:NativeSurfaceReturns the height of the client area excluding insets (window decorations) in pixel units.- Specified by:
getSurfaceHeightin interfaceNativeSurface- Returns:
- height of the client area in pixel units
- See Also:
NativeWindow.getHeight(),NativeSurface.convertToWindowUnits(int[])
-
convertToWindowUnits
public final int[] convertToWindowUnits(int[] pixelUnitsAndResult)
Description copied from interface:NativeSurfaceConverts the given pixel units into window units in place.- Specified by:
convertToWindowUnitsin interfaceNativeSurface- Parameters:
pixelUnitsAndResult- int[2] storage holding the pixel units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage pixelUnitsAndResult for chaining holding the converted values
- See Also:
ScalableSurface
-
convertToPixelUnits
public final int[] convertToPixelUnits(int[] windowUnitsAndResult)
Description copied from interface:NativeSurfaceConverts the given window units into pixel units in place.- Specified by:
convertToPixelUnitsin interfaceNativeSurface- Parameters:
windowUnitsAndResult- int[2] storage holding the window units for the x- and y-coord to convert and the resulting values.- Returns:
- result int[2] storage windowUnitsAndResult for chaining holding the converted values
- See Also:
ScalableSurface
-
getNativeSurface
public final NativeSurface getNativeSurface()
Description copied from interface:NativeWindowReturns the associatedNativeSurfaceof thisNativeSurfaceHolder.Returns this instance, which is-a
NativeSurface.- Specified by:
getNativeSurfacein interfaceNativeSurfaceHolder- Specified by:
getNativeSurfacein interfaceNativeWindow
-
getWidth
public final int getWidth()
Description copied from interface:NativeWindowReturns the width of the client area excluding insets (window decorations) in window units.- Specified by:
getWidthin interfaceNativeWindow- Returns:
- width of the client area in window units
- See Also:
NativeSurface.getSurfaceWidth()
-
getHeight
public final int getHeight()
Description copied from interface:NativeWindowReturns the height of the client area excluding insets (window decorations) in window units.- Specified by:
getHeightin interfaceNativeWindow- Returns:
- height of the client area in window units
- See Also:
NativeSurface.getSurfaceHeight()
-
destroy
public void destroy()
Description copied from interface:NativeWindowDestroys this window incl. releasing all related resources.- Specified by:
destroyin interfaceNativeWindow
-
getParent
public final NativeWindow getParent()
- Specified by:
getParentin interfaceNativeWindow- Returns:
- The parent NativeWindow, or null if this NativeWindow is top level.
-
getWindowHandle
public long getWindowHandle()
Description copied from interface:NativeWindowReturns 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.- Specified by:
getWindowHandlein interfaceNativeWindow
-
getX
public final int getX()
Description copied from interface:NativeWindowReturns 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.
- Specified by:
getXin interfaceNativeWindow- See Also:
NativeWindow.getInsets(),NativeWindow.getLocationOnScreen(Point)
-
getY
public final int getY()
Description copied from interface:NativeWindowReturns 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.
- Specified by:
getYin interfaceNativeWindow- See Also:
NativeWindow.getInsets(),NativeWindow.getLocationOnScreen(Point)
-
getLocationOnScreen
public Point getLocationOnScreen(Point storage)
Returns the window's top-left client-area position in the screen.If
Pointis notnull, 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.
This JAWT default implementation is currently still using a blocking implementation. It first attempts to retrieve the location via a native implementation. If this fails, it tries the blocking AWT implementation. If the latter fails due to an external AWT tree-lock, the non block implementation
#getLocationOnScreenNonBlocking(Point, Component)is being used. The latter simply traverse up to the AWT component tree and sums the rel. position. We have to determine whether the latter is good enough for all cases, currently only OS X utilizes the non blocking method per default.- Specified by:
getLocationOnScreenin interfaceNativeWindow- Parameters:
storage- OptionalPointstorage. If not null,null, it is translated about the resulting screen position and returned.- See Also:
NativeWindow.getX(),NativeWindow.getY(),NativeWindow.getInsets()
-
hasFocus
public boolean hasFocus()
Description copied from interface:NativeWindowReturns true if this native window owns the focus, otherwise false.- Specified by:
hasFocusin interfaceNativeWindow
-
-