diff options
Diffstat (limited to 'src/newt')
5 files changed, 41 insertions, 5 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java index ee6dfd080..cf1099c85 100644 --- a/src/newt/classes/com/jogamp/newt/Display.java +++ b/src/newt/classes/com/jogamp/newt/Display.java @@ -37,6 +37,8 @@ import java.util.Iterator; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.util.DimensionImmutable; +import javax.media.nativewindow.util.PointImmutable; import jogamp.newt.Debug; @@ -71,7 +73,15 @@ public abstract class Display { * PointerIcons can be used via {@link Window#setPointerIcon(PointerIcon)}. * </p> */ - public static interface PointerIcon { } + public static interface PointerIcon { + /** Returns the size, i.e. width and height. */ + DimensionImmutable getSize(); + /** Returns the hotspot. */ + PointImmutable getHotspot(); + + @Override + String toString(); + } /** * Returns the created {@link PointerIcon} or <code>null</code> if not implemented on platform. diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 4e9b8b441..dc3705daa 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -51,6 +51,8 @@ import java.util.ArrayList; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.NativeWindowFactory; +import javax.media.nativewindow.util.DimensionImmutable; +import javax.media.nativewindow.util.PointImmutable; public abstract class DisplayImpl extends Display { private static int serialno = 1; @@ -68,8 +70,24 @@ public abstract class DisplayImpl extends Display { public static class PointerIconImpl implements PointerIcon { public final long handle; - public PointerIconImpl(long handle) { + private final DimensionImmutable size; + private final PointImmutable hotspot; + public PointerIconImpl(final long handle, final DimensionImmutable size, final PointImmutable hotspot) { this.handle=handle; + this.size = size; + this.hotspot = hotspot; + } + @Override + public final DimensionImmutable getSize() { + return size; + } + @Override + public final PointImmutable getHotspot() { + return hotspot; + } + @Override + public final String toString() { + return "PointerIcon[0x"+Long.toHexString(handle)+", "+size+", "+hotspot+"]"; } } diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java index 86c8464a8..b932efde6 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java @@ -41,6 +41,8 @@ import java.nio.ByteBuffer; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.util.Dimension; +import javax.media.nativewindow.util.Point; import com.jogamp.common.util.IOUtil; import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice; @@ -115,7 +117,8 @@ public class DisplayDriver extends DisplayImpl { final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; if( null != pngResource && 0 < pngResource.resourceCount() ) { final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size, elem_bytesize); - return new PointerIconImpl( createPointerIcon0(data, width[0], height[0], hotX, hotY) ); + return new PointerIconImpl( createPointerIcon0(data, width[0], height[0], hotX, hotY), + new Dimension(width[0], height[0]), new Point(hotX, hotY)); } } return null; diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java index 8d4d8972b..72a93ce2e 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java @@ -47,6 +47,8 @@ import jogamp.newt.driver.PNGIcon; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.util.Dimension; +import javax.media.nativewindow.util.Point; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; @@ -107,7 +109,8 @@ public class DisplayDriver extends DisplayImpl { final int[] width = { 0 }, height = { 0 }, data_size = { 0 }, elem_bytesize = { 0 }; if( null != pngResource && 0 < pngResource.resourceCount() ) { final ByteBuffer data = PNGIcon.singleToRGBAImage(pngResource, 0, true /* toBGRA */, width, height, data_size, elem_bytesize); - return new PointerIconImpl( createBGRA8888Icon0(data, width[0], height[0], true, hotX, hotY) ); + return new PointerIconImpl( createBGRA8888Icon0(data, width[0], height[0], true, hotX, hotY), + new Dimension(width[0], height[0]), new Point(hotX, hotY)); } } return null; diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java index 8170c2e3d..85b31a77c 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java @@ -41,6 +41,8 @@ import java.nio.ByteBuffer; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.nativewindow.NativeWindowException; +import javax.media.nativewindow.util.Dimension; +import javax.media.nativewindow.util.Point; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; @@ -146,7 +148,7 @@ public class DisplayDriver extends DisplayImpl { return Long.valueOf(h); } }).longValue(); - return new PointerIconImpl(handle); + return new PointerIconImpl(handle, new Dimension(width[0], height[0]), new Point(hotX, hotY)); } } return null; |