src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
Print this page
*** 96,127 ****
// Get drag source component and its peer:
Component component = trigger.getComponent();
Point componentOffset = new Point();
ComponentPeer peer = component.getPeer();
- // For a lightweight component traverse up the hierarchy to the first heavyweight
- // which will be used as the ComponentModel for the native drag source.
- if (component.isLightweight()) {
- Point loc = component.getLocation();
- componentOffset.translate(loc.x, loc.y);
-
- for (Component parent = component.getParent(); parent != null; parent = parent.getParent()) {
- if (parent.isLightweight() == false) {
- peer = parent.getPeer();
- break;
- }
! loc = parent.getLocation();
componentOffset.translate(loc.x, loc.y);
}
- }
-
- // Make sure the drop target is a ComponentModel:
- if (!(peer instanceof LWComponentPeer))
- throw new IllegalArgumentException("DragSource's peer must be a ComponentModel.");
! // Get model pointer (CButton.m and such) and its native peer:
LWComponentPeer model = (LWComponentPeer) peer;
CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow();
long nativeWindowPtr = platformWindow.getNSWindowPtr();
// Get drag cursor:
--- 96,115 ----
// Get drag source component and its peer:
Component component = trigger.getComponent();
Point componentOffset = new Point();
ComponentPeer peer = component.getPeer();
! // For a component traverse up the hierarchy to the root
! Point loc = new Point();
! for (Component loopComponent = component; loopComponent != null; loopComponent = loopComponent.getParent()) {
! peer = loopComponent.getPeer();
componentOffset.translate(loc.x, loc.y);
+ loc = loopComponent.getLocation();
}
! //Get a pointer to a native window
LWComponentPeer model = (LWComponentPeer) peer;
CPlatformWindow platformWindow = (CPlatformWindow) model.getPlatformWindow();
long nativeWindowPtr = platformWindow.getNSWindowPtr();
// Get drag cursor: