From 3e7119861051f03c6df5a29c4b88432ee99e181f Mon Sep 17 00:00:00 2001 From: David Bernard Date: Wed, 11 Nov 2015 19:58:23 +0100 Subject: [PATCH 1/2] jogl: use pixel unit for window's dimension (fix issue on MaxOS X) --- .../src/main/java/com/jme3/input/jogl/NewtMouseInput.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java b/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java index 3649b4ba1..8a345e0d6 100644 --- a/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java +++ b/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java @@ -176,7 +176,7 @@ public class NewtMouseInput implements MouseInput, MouseListener { // invert DY int actualX = lastKnownLocation.getX(); - int actualY = component.getHeight() - lastKnownLocation.getY(); + int actualY = component.getSurfaceHeight() - lastKnownLocation.getY(); MouseMotionEvent evt = new MouseMotionEvent(actualX, actualY, newX - lastEventX, lastEventY - newY, @@ -285,8 +285,8 @@ public class NewtMouseInput implements MouseInput, MouseListener { private void recenterMouse(final GLWindow component) { eventsSinceRecenter = 0; isRecentering = true; - centerLocation.setX(component.getWidth() / 2); - centerLocation.setY(component.getHeight() / 2); + centerLocation.setX(component.getSurfaceWidth() / 2); + centerLocation.setY(component.getSurfaceHeight() / 2); centerLocationOnScreen.setX(centerLocation.getX()); centerLocationOnScreen.setY(centerLocation.getY()); From 0f140370edbc16aeb4d9fe5f4e391f50645dc5cf Mon Sep 17 00:00:00 2001 From: David Bernard Date: Wed, 11 Nov 2015 22:48:00 +0100 Subject: [PATCH 2/2] jogl: flip y for mouse click --- .../src/main/java/com/jme3/input/jogl/NewtMouseInput.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java b/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java index 8a345e0d6..d7dd905fd 100644 --- a/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java +++ b/jme3-jogl/src/main/java/com/jme3/input/jogl/NewtMouseInput.java @@ -215,7 +215,7 @@ public class NewtMouseInput implements MouseInput, MouseListener { @Override public void mousePressed(MouseEvent newtEvt) { - MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, newtEvt.getX(), newtEvt.getY()); + MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(newtEvt), true, newtEvt.getX(), component.getSurfaceHeight() - newtEvt.getY()); evt.setTime(newtEvt.getWhen()); synchronized (eventQueue) { eventQueue.add(evt); @@ -224,7 +224,7 @@ public class NewtMouseInput implements MouseInput, MouseListener { @Override public void mouseReleased(MouseEvent awtEvt) { - MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(awtEvt), false, awtEvt.getX(), awtEvt.getY()); + MouseButtonEvent evt = new MouseButtonEvent(getJMEButtonIndex(awtEvt), false, awtEvt.getX(), component.getSurfaceHeight() - awtEvt.getY()); evt.setTime(awtEvt.getWhen()); synchronized (eventQueue) { eventQueue.add(evt);