mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-24 04:54:40 +02:00
8020371: [macosx] applets with Drag and Drop fail with IllegalArgumentException
Reviewed-by: anthony, art
This commit is contained in:
parent
a507980e6d
commit
0b20e5e9af
3 changed files with 7 additions and 6 deletions
|
@ -107,10 +107,6 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||||
loc = rootComponent.getLocation();
|
loc = rootComponent.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
//It sure will be LWComponentPeer instance as rootComponent is a Window
|
|
||||||
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
|
|
||||||
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
|
|
||||||
|
|
||||||
// If there isn't any drag image make one of default appearance:
|
// If there isn't any drag image make one of default appearance:
|
||||||
if (fDragImage == null)
|
if (fDragImage == null)
|
||||||
this.setDefaultDragImage(component);
|
this.setDefaultDragImage(component);
|
||||||
|
@ -137,6 +133,11 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
//It sure will be LWComponentPeer instance as rootComponent is a Window
|
||||||
|
PlatformWindow platformWindow = ((LWComponentPeer)rootComponent.getPeer()).getPlatformWindow();
|
||||||
|
long nativeViewPtr = CPlatformWindow.getNativeViewPtr(platformWindow);
|
||||||
|
if (nativeViewPtr == 0L) throw new InvalidDnDOperationException("Unsupported platform window implementation");
|
||||||
|
|
||||||
// Create native dragging source:
|
// Create native dragging source:
|
||||||
final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
|
final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
|
||||||
(int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
|
(int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
|
||||||
|
|
|
@ -52,6 +52,8 @@ public final class CDropTarget {
|
||||||
fPeer = peer;
|
fPeer = peer;
|
||||||
|
|
||||||
long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
|
long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
|
||||||
|
if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)
|
||||||
|
|
||||||
// Create native dragging destination:
|
// Create native dragging destination:
|
||||||
fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
|
fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
|
||||||
if (fNativeDropTarget == 0) {
|
if (fNativeDropTarget == 0) {
|
||||||
|
|
|
@ -896,8 +896,6 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||||
nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
|
nativePeer = ((CPlatformWindow) platformWindow).getContentView().getAWTView();
|
||||||
} else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
|
} else if (platformWindow instanceof CViewPlatformEmbeddedFrame){
|
||||||
nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
|
nativePeer = ((CViewPlatformEmbeddedFrame) platformWindow).getNSViewPtr();
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Unsupported platformWindow implementation");
|
|
||||||
}
|
}
|
||||||
return nativePeer;
|
return nativePeer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue