aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2019-12-05 06:56:36 +0100
committerSven Gothel <[email protected]>2019-12-05 06:56:36 +0100
commit78292f1098ef3a83c0426bd0e30b4e725805fa1a (patch)
tree1155931dd1d08c40e3e626fd6c6c494cec7eebb6 /src/newt/classes
parent59fe721a926ff66e98b716a25a08bdfa584ca6fa (diff)
Bug 1156: NEWT DRM/GBM PointerIcon: Use hotX/hotY drmModeSetCursor2(..), hence pass PointerIconImpl through
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java45
-rw-r--r--src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java4
3 files changed, 30 insertions, 27 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
index bc177a8b3..a7fa29170 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/DisplayDriver.java
@@ -152,10 +152,11 @@ public class DisplayDriver extends DisplayImpl {
//----------------------------------------------------------------------
// Internals only
//
- /* pp */ boolean setPointerIcon(final int crtc_id, final long piHandle, final boolean enable, final int x, final int y) {
+
+ /* pp */ boolean setPointerIcon(final int crtc_id, final long piHandle, final boolean enable, final int hotX, final int hotY, final int x, final int y) {
this.aDevice.lock();
try {
- return SetPointerIcon0(DRMUtil.getDrmFd(), crtc_id, piHandle, enable, x, y);
+ return SetPointerIcon0(DRMUtil.getDrmFd(), crtc_id, piHandle, enable, hotX, hotY, x, y);
} finally {
this.aDevice.unlock();
}
@@ -188,7 +189,8 @@ public class DisplayDriver extends DisplayImpl {
private static native long CreatePointerIcon0(long gbmDevice, Object pixels, int pixels_byte_offset, boolean pixels_is_direct,
int width, int height, int hotX, int hotY);
private static native void DestroyPointerIcon0(long piHandle);
- private static native boolean SetPointerIcon0(int drmFd, int crtc_id, long piHandle, boolean enable, int x, int y);
+
+ private static native boolean SetPointerIcon0(int drmFd, int crtc_id, long piHandle, boolean enable, int hotX, int hotY, int x, int y);
private static native boolean MovePointerIcon0(int drmFd, int crtc_id, int x, int y);
/* pp */ static final boolean DEBUG_POINTER_ICON = Display.DEBUG_POINTER_ICON;
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
index 2faa8e54e..2e1b88c47 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java
@@ -28,6 +28,7 @@
package jogamp.newt.driver.egl.gbm;
import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.nativewindow.util.Rectangle;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -121,9 +122,9 @@ public class ScreenDriver extends ScreenImpl {
if( null != defaultPointerIcon ) {
final LinuxMouseTracker lmt = LinuxMouseTracker.getSingleton();
if( null != lmt ) {
- setPointerIconActive(defaultPointerIcon.getHandle(), lmt.getLastX(), lmt.getLastY());
+ setPointerIconActive(defaultPointerIcon, lmt.getLastX(), lmt.getLastY());
} else {
- setPointerIconActive(defaultPointerIcon.getHandle(), 0, 0);
+ setPointerIconActive(defaultPointerIcon, 0, 0);
}
}
}
@@ -148,43 +149,43 @@ public class ScreenDriver extends ScreenImpl {
viewportInWindowUnits.set(viewport);
}
- /* pp */ void setPointerIconActive(long piHandle, final int x, final int y) {
+ /* pp */ void setPointerIconActive(PointerIconImpl pi, final int x, final int y) {
synchronized(pointerIconSync) {
if( DisplayDriver.DEBUG_POINTER_ICON ) {
System.err.println("Screen.PointerIcon.set.0: "+Thread.currentThread().getName());
- System.err.println("Screen.PointerIcon.set.0: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+Display.toHexString(activePointerIcon)+", visible "+activePointerIconVisible+"] -> "+Display.toHexString(piHandle));
+ System.err.println("Screen.PointerIcon.set.0: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+activePointerIcon+", visible "+activePointerIconVisible+"] -> "+pi);
}
- if( 0 != activePointerIcon && activePointerIconVisible ) {
+ if( null != activePointerIcon && activePointerIconVisible ) {
// disable active pointerIcon first
- System.err.println("Screen.PointerIcon.set.1");
- ((DisplayDriver)display).setPointerIcon(crtc_ids[0], activePointerIcon, false, x, y);
+ ((DisplayDriver)display).setPointerIcon(crtc_ids[0], activePointerIcon.validatedHandle(), false, 0, 0, x, y);
}
- if( 0 == piHandle && null != defaultPointerIcon ) {
- System.err.println("Screen.PointerIcon.set.2");
- piHandle = ((DisplayDriver)display).defaultPointerIcon.getHandle();
+ if( null == pi && null != defaultPointerIcon ) {
+ // fallback to default
+ pi = ((DisplayDriver)display).defaultPointerIcon;
}
- if( 0 != piHandle ) {
- System.err.println("Screen.PointerIcon.set.3");
- ((DisplayDriver)display).setPointerIcon(crtc_ids[0], piHandle, true, x, y);
+ if( null != pi ) {
+ final PointImmutable hot = pi.getHotspot();
+ ((DisplayDriver)display).setPointerIcon(crtc_ids[0], pi.validatedHandle(), true, hot.getX(), hot.getY(), x, y);
activePointerIconVisible = true;
} else {
- System.err.println("Screen.PointerIcon.set.4");
activePointerIconVisible = false;
}
- activePointerIcon = piHandle;
+ activePointerIcon = pi;
if( DisplayDriver.DEBUG_POINTER_ICON ) {
- System.err.println("Screen.PointerIcon.set.X: active ["+Display.toHexString(activePointerIcon)+", visible "+activePointerIconVisible+"]");
+ System.err.println("Screen.PointerIcon.set.X: active ["+activePointerIcon+", visible "+activePointerIconVisible+"]");
}
}
+
}
/* pp */ void setActivePointerIconVisible(final boolean visible, final int x, final int y) {
synchronized(pointerIconSync) {
if( DisplayDriver.DEBUG_POINTER_ICON ) {
- System.err.println("Screen.PointerIcon.visible: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+Display.toHexString(activePointerIcon)+", visible "+activePointerIconVisible+"] -> visible "+visible);
+ System.err.println("Screen.PointerIcon.visible: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+activePointerIcon+", visible "+activePointerIconVisible+"] -> visible "+visible);
}
if( activePointerIconVisible != visible ) {
- if( 0 != activePointerIcon ) {
- ((DisplayDriver)display).setPointerIcon(crtc_ids[0], activePointerIcon, visible, x, y);
+ if( null != activePointerIcon ) {
+ final PointImmutable hot = activePointerIcon.getHotspot();
+ ((DisplayDriver)display).setPointerIcon(crtc_ids[0], activePointerIcon.validatedHandle(), visible, hot.getX(), hot.getY(), x, y);
}
activePointerIconVisible = visible;
}
@@ -193,9 +194,9 @@ public class ScreenDriver extends ScreenImpl {
/* pp */ void moveActivePointerIcon(final int x, final int y) {
synchronized(pointerIconSync) {
if( DisplayDriver.DEBUG_POINTER_ICON ) {
- System.err.println("Screen.PointerIcon.move: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+Display.toHexString(activePointerIcon)+", visible "+activePointerIconVisible+"], "+x+"/"+y);
+ System.err.println("Screen.PointerIcon.move: crtc id "+Display.toHexString(crtc_ids[0])+", active ["+activePointerIcon+", visible "+activePointerIconVisible+"], "+x+"/"+y);
}
- if( 0 != activePointerIcon && activePointerIconVisible ) {
+ if( null != activePointerIcon && activePointerIconVisible ) {
((DisplayDriver)display).movePointerIcon(crtc_ids[0], x, y);
}
}
@@ -208,7 +209,7 @@ public class ScreenDriver extends ScreenImpl {
protected native void initNative(long drmHandle);
protected int[] crtc_ids;
- private long activePointerIcon;
+ private PointerIconImpl activePointerIcon;
private boolean activePointerIconVisible;
private final Object pointerIconSync = new Object();
private PointerIconImpl defaultPointerIcon = null;
diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
index e618e1b8c..ce1ffc1da 100644
--- a/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/WindowDriver.java
@@ -353,9 +353,9 @@ public class WindowDriver extends WindowImpl {
protected void setPointerIconImpl(final PointerIconImpl pi) {
final ScreenDriver screen = (ScreenDriver) getScreen();
if( null != mouseTracker ) {
- screen.setPointerIconActive(null != pi ? pi.validatedHandle() : 0, mouseTracker.getLastX(), mouseTracker.getLastY());
+ screen.setPointerIconActive(pi, mouseTracker.getLastX(), mouseTracker.getLastY());
} else {
- screen.setPointerIconActive(null != pi ? pi.validatedHandle() : 0, 0, 0);
+ screen.setPointerIconActive(pi, 0, 0);
}
}