603 xclient.get_window(), x, y);
604
605 if (receiver != 0) {
606 XBaseWindow xbasewindow = XToolkit.windowToXWindow(receiver);
607 if (xbasewindow instanceof XWindow) {
608 xwindow = (XWindow)xbasewindow;
609 }
610 }
611 }
612
613 if (xwindow != null) {
614 /* Translate mouse position from root coordinates
615 to the target window coordinates. */
616 Point p = xwindow.toLocal(x, y);
617 x = p.x;
618 y = p.y;
619 }
620
621 /* Time stamp - new in XDnD version 1. */
622 if (sourceProtocolVersion > 0) {
623 time_stamp = xclient.get_data(3);
624 }
625
626 /* User action - new in XDnD version 2. */
627 if (sourceProtocolVersion > 1) {
628 xdnd_action = xclient.get_data(4);
629 } else {
630 /* The default action is XdndActionCopy */
631 xdnd_action = XDnDConstants.XA_XdndActionCopy.getAtom();
632 }
633
634 java_action = XDnDConstants.getJavaActionForXDnDAction(xdnd_action);
635
636 if (trackSourceActions) {
637 sourceActions |= java_action;
638 }
639
640 if (xwindow == null) {
641 if (targetXWindow != null) {
642 notifyProtocolListener(targetXWindow, x, y,
643 DnDConstants.ACTION_NONE, xclient,
850 throw new IllegalArgumentException();
851 }
852
853 return XDnDConstants.XDnDSelection.getData(format, time_stamp);
854 }
855
856 public boolean sendDropDone(long ctxt, boolean success, int dropAction) {
857 XClientMessageEvent xclient = new XClientMessageEvent(ctxt);
858
859 if (xclient.get_message_type() !=
860 XDnDConstants.XA_XdndDrop.getAtom()) {
861 return false;
862 }
863
864 /*
865 * The XDnD protocol recommends that the target requests the special
866 * target DELETE in case if the drop action is XdndActionMove.
867 */
868 if (dropAction == DnDConstants.ACTION_MOVE && success) {
869
870 long time_stamp = xclient.get_data(2);
871 long xdndSelectionAtom =
872 XDnDConstants.XDnDSelection.getSelectionAtom().getAtom();
873
874 XToolkit.awtLock();
875 try {
876 XlibWrapper.XConvertSelection(XToolkit.getDisplay(),
877 xdndSelectionAtom,
878 XAtom.get("DELETE").getAtom(),
879 XAtom.get("XAWT_SELECTION").getAtom(),
880 XWindow.getXAWTRootWindow().getWindow(),
881 time_stamp);
882 } finally {
883 XToolkit.awtUnlock();
884 }
885 }
886
887 XClientMessageEvent msg = new XClientMessageEvent();
888 try {
889 msg.set_type(XConstants.ClientMessage);
890 msg.set_window(xclient.get_data(0));
|
603 xclient.get_window(), x, y);
604
605 if (receiver != 0) {
606 XBaseWindow xbasewindow = XToolkit.windowToXWindow(receiver);
607 if (xbasewindow instanceof XWindow) {
608 xwindow = (XWindow)xbasewindow;
609 }
610 }
611 }
612
613 if (xwindow != null) {
614 /* Translate mouse position from root coordinates
615 to the target window coordinates. */
616 Point p = xwindow.toLocal(x, y);
617 x = p.x;
618 y = p.y;
619 }
620
621 /* Time stamp - new in XDnD version 1. */
622 if (sourceProtocolVersion > 0) {
623 time_stamp = xclient.get_data(3) & 0xFFFFFFFFL;
624 }
625
626 /* User action - new in XDnD version 2. */
627 if (sourceProtocolVersion > 1) {
628 xdnd_action = xclient.get_data(4);
629 } else {
630 /* The default action is XdndActionCopy */
631 xdnd_action = XDnDConstants.XA_XdndActionCopy.getAtom();
632 }
633
634 java_action = XDnDConstants.getJavaActionForXDnDAction(xdnd_action);
635
636 if (trackSourceActions) {
637 sourceActions |= java_action;
638 }
639
640 if (xwindow == null) {
641 if (targetXWindow != null) {
642 notifyProtocolListener(targetXWindow, x, y,
643 DnDConstants.ACTION_NONE, xclient,
850 throw new IllegalArgumentException();
851 }
852
853 return XDnDConstants.XDnDSelection.getData(format, time_stamp);
854 }
855
856 public boolean sendDropDone(long ctxt, boolean success, int dropAction) {
857 XClientMessageEvent xclient = new XClientMessageEvent(ctxt);
858
859 if (xclient.get_message_type() !=
860 XDnDConstants.XA_XdndDrop.getAtom()) {
861 return false;
862 }
863
864 /*
865 * The XDnD protocol recommends that the target requests the special
866 * target DELETE in case if the drop action is XdndActionMove.
867 */
868 if (dropAction == DnDConstants.ACTION_MOVE && success) {
869
870 long time_stamp = xclient.get_data(2) & 0xFFFFFFFFL;
871 long xdndSelectionAtom =
872 XDnDConstants.XDnDSelection.getSelectionAtom().getAtom();
873
874 XToolkit.awtLock();
875 try {
876 XlibWrapper.XConvertSelection(XToolkit.getDisplay(),
877 xdndSelectionAtom,
878 XAtom.get("DELETE").getAtom(),
879 XAtom.get("XAWT_SELECTION").getAtom(),
880 XWindow.getXAWTRootWindow().getWindow(),
881 time_stamp);
882 } finally {
883 XToolkit.awtUnlock();
884 }
885 }
886
887 XClientMessageEvent msg = new XClientMessageEvent();
888 try {
889 msg.set_type(XConstants.ClientMessage);
890 msg.set_window(xclient.get_data(0));
|