src/macosx/classes/sun/lwawt/macosx/CCursorManager.java
Print this page
*** 49,67 ****
private CCursorManager() { }
@Override
protected Point getCursorPosition() {
- synchronized(this) {
- if (isDragging) {
- // during the drag operation, the appkit thread is blocked,
- // so nativeGetCursorPosition invocation may cause a deadlock.
- // In order to avoid this, we returns last know cursor position.
- return new Point(dragPos);
- }
- }
-
final Point2D nativePosition = nativeGetCursorPosition();
return new Point((int)nativePosition.getX(), (int)nativePosition.getY());
}
@Override
--- 49,58 ----
*** 99,131 ****
}
// do something special
throw new RuntimeException("Unimplemented");
}
-
- // package private methods to handle cursor change during drag-and-drop
- private boolean isDragging = false;
- private Point dragPos = null;
-
- synchronized void startDrag(int x, int y) {
- if (isDragging) {
- throw new RuntimeException("Invalid Drag state in CCursorManager!");
- }
- isDragging = true;
- dragPos = new Point(x, y);
- }
-
- synchronized void updateDragPosition(int x, int y) {
- if (!isDragging) {
- throw new RuntimeException("Invalid Drag state in CCursorManager!");
- }
- dragPos.move(x, y);
- }
-
- synchronized void stopDrag() {
- if (!isDragging) {
- throw new RuntimeException("Invalid Drag state in CCursorManager!");
- }
- isDragging = false;
- dragPos = null;
- }
}
--- 90,95 ----