Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions java/awt/dnd/DragSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,11 @@ public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
{
flavorMap = map;

if (peer == null)
peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);

if (context == null)
context = createDragSourceContext(peer, trigger,
dragCursor,
dragImage,
imageOffset, trans,
dsl);
// Each drag gets its own peer and context; reusing the first ones
// would drag the first Transferable again.
peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
context = createDragSourceContext(peer, trigger, dragCursor,
dragImage, imageOffset, trans, dsl);

if (peer == null)
throw new InvalidDnDOperationException();
Expand Down
11 changes: 9 additions & 2 deletions java/awt/dnd/DropTargetContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,18 @@ public void removeNotify()
protected void setTargetActions(int actions)
{
targetActions = actions;
if (dtcp != null)
dtcp.setTargetActions(actions);
}

protected int getTargetActions()
{
return targetActions;
// As in the JDK, the peer knows the actions; without one, use the
// drop target's default actions.
if (dtcp != null)
return dtcp.getTargetActions();
return targetActions != 0 ? targetActions
: dropTarget.getDefaultActions();
}

/**
Expand Down Expand Up @@ -162,7 +169,7 @@ protected void rejectDrop ()
protected DataFlavor[] getCurrentDataFlavors ()
{
if (dtcp != null)
dtcp.getTransferDataFlavors();
return dtcp.getTransferDataFlavors();
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion java/awt/dnd/DropTargetDragEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public DropTargetDragEvent (DropTargetContext context, Point location,
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;

if (~(srcActions ^ srcActionsMask) != 0)
if ((srcActions & ~srcActionsMask) != 0)
throw new IllegalArgumentException ();

this.dropAction = dropAction;
Expand Down
2 changes: 1 addition & 1 deletion java/awt/dnd/DropTargetDropEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public DropTargetDropEvent(DropTargetContext dtc, Point location,
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;

if (~(actions ^ actionsMask) != 0)
if ((actions & ~actionsMask) != 0)
throw new IllegalArgumentException();

this.dropAction = dropAction;
Expand Down