diff options
author | Sven Gothel <[email protected]> | 2014-01-04 17:18:47 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-04 17:18:47 +0100 |
commit | bec29cf970e6a55eb8f720afdae5a3bdc97c1ba2 (patch) | |
tree | b94db19188923dc674b5a594de9cbed4c298fd9c /src/nativewindow/classes/com/jogamp | |
parent | fcc0e7397bb6f3ceb1fe143667f8c59b5bf63874 (diff) |
Bug 935: NEWT OSX PointerIcon/Pointer-Visibility: Impl. OffscreenLayerSurface (OSX CALayer) w/ JAWTWindow Path
Add setCursor(..) and hideCursor() to OffscreenLayerSurface interface,
impl. in JAWTWindow w/ AWT.
This allows an OSX NEWT Window using CALayer (i.e. NewtCanvasAWT)
to have setPointerIcon(..) and setPointerVisible(..) functionality!
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 3c660b41b..46bdc4d1f 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -38,18 +38,21 @@ package com.jogamp.nativewindow.awt; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.IOUtil; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import java.awt.Component; import java.awt.Container; +import java.awt.Cursor; import java.awt.Window; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.HierarchyEvent; import java.awt.event.HierarchyListener; import java.applet.Applet; +import java.io.IOException; import javax.media.nativewindow.AbstractGraphicsConfiguration; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -63,6 +66,7 @@ import javax.media.nativewindow.SurfaceUpdatedListener; import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; +import javax.media.nativewindow.util.PointImmutable; import javax.media.nativewindow.util.Rectangle; import javax.media.nativewindow.util.RectangleImmutable; @@ -427,6 +431,30 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return surfaceLock; } + @Override + public final boolean setCursor(IOUtil.ClassResources resources, PointImmutable hotSpot) throws IOException { + final Cursor c; + if( null == resources || null == hotSpot ) { + c = Cursor.getDefaultCursor(); + } else { + final java.awt.Point awtHotspot = new java.awt.Point(hotSpot.getX(), hotSpot.getY()); + c = AWTMisc.getCursor(resources, awtHotspot); + } + if( null != c ) { + component.setCursor(c); + return true; + } else { + return false; + } + } + + @Override + public boolean hideCursor() { + final Cursor c = AWTMisc.getNullCursor(); + component.setCursor(c); + return true; + } + // // SurfaceUpdateListener // |