Added doPrivileged to MacOSXDisplay.setCursorPosition()

This commit is contained in:
Elias Naur 2005-06-01 07:18:09 +00:00
parent f1705b7fde
commit 29a51b7cad
1 changed files with 6 additions and 2 deletions

View File

@ -375,11 +375,15 @@ final class MacOSXDisplay implements DisplayImplementation {
public void setCursorPosition(int x, int y) {
try {
Robot robot = new Robot(frame.getGraphicsConfiguration().getDevice());
Robot robot = (Robot)AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws Exception {
return new Robot(frame.getGraphicsConfiguration().getDevice());
}
});
int transformed_x = frame.getX() + x;
int transformed_y = frame.getY() + frame.getHeight() - 1 - y;
robot.mouseMove(transformed_x, transformed_y);
} catch (AWTException e) {
} catch (PrivilegedActionException e) {
LWJGLUtil.log("Got exception while setting mouse cursor position: " + e);
}
}