Fixed AWTUtil.setCursorPosition. Added check to LinuxAWTInput.

This commit is contained in:
Elias Naur 2006-10-28 22:06:24 +00:00
parent b449fff026
commit 4c5a2fe644
3 changed files with 5 additions and 4 deletions

View File

@ -108,8 +108,9 @@ final class AWTUtil {
public static void setCursorPosition(Component component, Robot robot, int x, int y) {
if (robot != null) {
int transformed_x = component.getX() + x;
int transformed_y = component.getY() + component.getHeight() - 1 - y;
Point location = component.getLocationOnScreen();
int transformed_x = location.x + x;
int transformed_y = location.y + component.getHeight() - 1 - y;
robot.mouseMove(transformed_x, transformed_y);
}
}

View File

@ -117,7 +117,7 @@ final class LinuxAWTInput extends AbstractAWTInput {
try {
LinuxPeerInfo linux_peer_info = (LinuxPeerInfo)peer_info;
long new_window = linux_peer_info.getDrawable();
if (new_window != cached_window) {
if (cached_mouse == null || new_window != cached_window) {
ungrabInput();
cached_window = new_window;
try {

View File

@ -321,7 +321,7 @@ final class MacOSXDisplay implements DisplayImplementation {
}
public void setCursorPosition(int x, int y) {
AWTUtil.setCursorPosition(frame, robot, x, y);
AWTUtil.setCursorPosition(frame.getCanvas(), robot, x, y);
}
public void setNativeCursor(Object handle) throws LWJGLException {