summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-10 05:10:26 +0200
committerSven Gothel <[email protected]>2011-10-10 05:10:26 +0200
commit24e0591b6be036d5389cc1eb986ed5e86043ba65 (patch)
treee9abb4999bad2f01860490338b0dc588818ee495 /src/newt/classes/com
parent51a9f23d629cd4e6b22d7afaf009bb96b2ed270f (diff)
NEWT: Add pointer features: visibility, confined and warp (move)
visibility: - set pointer visible or invisible confined: - confine pointer to window, or not warp: - set mouse position within the window Implemented for X11, tested manually with TestGearsES2NEWT (see code for action keys). TODO: Windows, MaxOSX and Android (limited)
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java34
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java19
2 files changed, 53 insertions, 0 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 24555bf39..a69b8dbb3 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -225,6 +225,40 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
String getTitle();
+ boolean isPointerVisible();
+
+ /**
+ * Makes the pointer visible or invisible.
+ *
+ * @param pointerVisible defaults to <code>true</code> for platforms w/ visible pointer,
+ * otherwise defaults to <code>true</code>, eg. Android.
+ * @see #confinePointer(boolean)
+ */
+ void setPointerVisible(boolean pointerVisible);
+
+ boolean isPointerConfined();
+
+ /**
+ * Confine the pointer to this window, ie. pointer jail.
+ * <p>
+ * In combination w/ {@link #warpPointer(int, int)}
+ * and maybe {@link #setPointerVisible(boolean)} a simple mouse
+ * navigation can be realized.</p>
+ *
+ * @param confine defaults to <code>false</code>.
+ */
+ void confinePointer(boolean confine);
+
+ /**
+ * Moves the pointer to x/y relative to this window's origin.
+ *
+ * @param x relative pointer x position within this window
+ * @param y relative pointer y position within this window
+ *
+ * @see #confinePointer(boolean)
+ */
+ void warpPointer(int x, int y);
+
/** Defining ids for the reparenting strategy */
public interface ReparentAction {
/** No native reparenting valid */
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 3a49c06f0..5001e55e5 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -215,10 +215,29 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
return window.getTitle();
}
+ public final boolean isPointerVisible() {
+ return window.isPointerVisible();
+ }
+
+ public final void setPointerVisible(boolean mouseVisible) {
+ window.setPointerVisible(mouseVisible);
+ }
+
+ public final boolean isPointerConfined() {
+ return window.isPointerConfined();
+ }
+
+ public final void confinePointer(boolean grab) {
+ window.confinePointer(grab);
+ }
+
public final void setUndecorated(boolean value) {
window.setUndecorated(value);
}
+ public final void warpPointer(int x, int y) {
+ window.warpPointer(x, y);
+ }
public final boolean isUndecorated() {
return window.isUndecorated();
}