summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java
index 1be6dcea8..d7e184a3c 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/X11UnderlayTracker.java
@@ -140,6 +140,13 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
Point underlayOnScreen = new Point();
overlayWindow.getLocationOnScreen(overlayOnScreen);
underlayWindow.getLocationOnScreen(underlayOnScreen);
+ /*
+ * Apply an offset when the dimensions of over- and
+ * underlay don't match
+ */
+ int dx = (overlayWindow.getScreen().getWidth() - underlayWindow.getScreen().getWidth()) / 2;
+ int dy = (overlayWindow.getScreen().getHeight() - underlayWindow.getScreen().getHeight()) / 2;
+ underlayOnScreen.translate(dx, dy);
if(overlayOnScreen.getX()!=underlayOnScreen.getX() ||
overlayOnScreen.getY()!=underlayOnScreen.getY()) {
overlayWindow.setPosition(underlayOnScreen.getX(), underlayOnScreen.getY());
@@ -316,7 +323,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_CLICKED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -327,7 +334,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -338,7 +345,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_EXITED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -349,7 +356,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -360,7 +367,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -371,7 +378,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -382,7 +389,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}
@@ -393,7 +400,7 @@ public class X11UnderlayTracker implements WindowListener, KeyListener, MouseLis
if (underlayWindowMap.containsKey(s)) {
WindowImpl overlayWindow = underlayWindowMap.get(s);
overlayWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_WHEEL_MOVED, 0,
- e.getX(), e.getY(), (short) 0, 0);
+ e.getX(), e.getY(), e.getButton(), 0);
}
}