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/newt | |
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/newt')
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java index 6f3c95570..748604994 100644 --- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java @@ -39,6 +39,8 @@ import javax.media.nativewindow.GraphicsConfigurationFactory; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowException; import javax.media.nativewindow.MutableSurface; +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.nativewindow.OffscreenLayerSurface; import javax.media.nativewindow.VisualIDHolder; import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.Point; @@ -403,7 +405,23 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl throw new RuntimeException("Failed: "+pi+", "+WindowDriver.this); } } } ); - } // else may need offscreen solution ? FIXME + } else { + final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(this, true); + if( null != ols ) { + try { + setOLSPointer(ols, pi); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + private static void setOLSPointer(final OffscreenLayerSurface ols, final PointerIconImpl pi) throws Exception { + if( null != pi ) { + ols.setCursor(pi.getResource(), pi.getHotspot()); + } else { + ols.setCursor(null, null); // default + } } @Override @@ -417,7 +435,21 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl } } } ); return true; // setPointerVisible0 always returns true .. - } // else may need offscreen solution ? FIXME + } else { + final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(this, true); + if( null != ols ) { + try { + if( pointerVisible ) { + setOLSPointer(ols, (PointerIconImpl)getPointerIcon()); + } else { + ols.hideCursor(); + } + return true; + } catch (Exception e) { + e.printStackTrace(); + } + } + } return false; } |