diff options
author | Joshua Slack <[email protected]> | 2018-01-15 12:06:45 -0600 |
---|---|---|
committer | Joshua Slack <[email protected]> | 2018-01-15 12:06:45 -0600 |
commit | 2817b5e3a39ca1c9fe42bdfe344db3400ff83264 (patch) | |
tree | 161cea1e12adab75294472d9c9ed645afe13a849 | |
parent | ec71ecdbbb1437dd57a0f47a1f70d36a25529038 (diff) |
Update to mouse manager allowing null to be passed to setCursor to signify clearing the cursor
4 files changed, 10 insertions, 6 deletions
diff --git a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java index 194b729..9f5a816 100644 --- a/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java +++ b/ardor3d-awt/src/main/java/com/ardor3d/input/awt/AwtMouseManager.java @@ -62,7 +62,7 @@ public class AwtMouseManager implements MouseManager { } public void setCursor(final MouseCursor cursor) { - if (cursor == MouseCursor.SYSTEM_DEFAULT) { + if (cursor == MouseCursor.SYSTEM_DEFAULT || cursor == null) { if (_grabbedState == GrabbedState.GRABBED) { _pregrabCursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } else { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java index 10ca249..ae5692f 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/input/jogl/JoglNewtMouseManager.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -45,6 +45,10 @@ public class JoglNewtMouseManager implements MouseManager { } private PointerIcon createJoglCursor(final MouseCursor cursor) { + if (cursor == MouseCursor.SYSTEM_DEFAULT || cursor == null) { + return null; // setting the cursor to null in JOGL means using the system default one + } + final Image image = cursor.getImage(); final DimensionImmutable size = new Dimension(image.getWidth(), image.getHeight()); final ByteBuffer pixels = image.getData(0); diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java index b689841..0b2a64a 100644 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java +++ b/ardor3d-lwjgl/src/main/java/com/ardor3d/input/lwjgl/LwjglMouseManager.java @@ -63,7 +63,7 @@ public class LwjglMouseManager implements MouseManager { } private Cursor createLwjglCursor(final MouseCursor cursor) throws LWJGLException { - if (cursor == MouseCursor.SYSTEM_DEFAULT) { + if (cursor == MouseCursor.SYSTEM_DEFAULT || cursor == null) { return null; // setting the cursor to null in LWJGL means using the system default one } diff --git a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java index 8918263..012766d 100644 --- a/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java +++ b/ardor3d-swt/src/main/java/com/ardor3d/input/swt/SwtMouseManager.java @@ -49,15 +49,15 @@ public class SwtMouseManager implements MouseManager { } public void setCursor(final MouseCursor cursor) { - if (cursor == MouseCursor.SYSTEM_DEFAULT) { + if (cursor == MouseCursor.SYSTEM_DEFAULT || cursor == null) { _control.setCursor(null); return; } final ImageData imageData = SWTImageUtil.convertToSWT(cursor.getImage()).get(0); - final Cursor swtCursor = new Cursor(_control.getDisplay(), imageData, cursor.getHotspotX(), cursor - .getHotspotY()); + final Cursor swtCursor = new Cursor(_control.getDisplay(), imageData, cursor.getHotspotX(), + cursor.getHotspotY()); _control.setCursor(swtCursor); } |