< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java

Print this page




  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.X11;
  27 
  28 import java.awt.Component;
  29 import java.awt.Cursor;
  30 import java.awt.Window;
  31 
  32 import java.awt.datatransfer.DataFlavor;
  33 import java.awt.datatransfer.Transferable;
  34 
  35 import java.awt.dnd.DnDConstants;
  36 import java.awt.dnd.DragGestureEvent;
  37 import java.awt.dnd.InvalidDnDOperationException;
  38 
  39 import java.util.*;
  40 

  41 import sun.util.logging.PlatformLogger;
  42 
  43 import sun.awt.dnd.SunDragSourceContextPeer;
  44 import sun.awt.dnd.SunDropTargetContextPeer;
  45 import sun.awt.SunToolkit;
  46 import sun.awt.AWTAccessor;
  47 
  48 /**
  49  * The XDragSourceContextPeer class is the class responsible for handling
  50  * the interaction between the XDnD/Motif DnD subsystem and Java drag sources.
  51  *
  52  * @since 1.5
  53  */
  54 public final class XDragSourceContextPeer
  55     extends SunDragSourceContextPeer implements XDragSourceProtocolListener {
  56     private static final PlatformLogger logger =
  57         PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer");
  58 
  59     /* The events selected on the root window when the drag begins. */
  60     private static final int ROOT_EVENT_MASK = (int)XConstants.ButtonMotionMask |


 794     public void handleDragFinished(boolean success) {
 795         /* Assume that the performed drop action is the latest drop action
 796            accepted by the drop target. */
 797         handleDragFinished(true, targetAction);
 798     }
 799 
 800     public void handleDragFinished(boolean success, int action) {
 801         // NOTE: we have to use the current pointer location, since
 802         // the target didn't specify the coordinates for the reply.
 803         handleDragFinished(success, action, xRoot, yRoot);
 804     }
 805 
 806     public void handleDragFinished(boolean success, int action, int x, int y) {
 807         dragDropFinished(success, action, x, y);
 808 
 809         dndInProgress = false;
 810         cleanup(XConstants.CurrentTime);
 811     }
 812 
 813     public int scaleUp(int x) {
 814         return x * windowScale;
 815     }
 816 
 817     public int scaleDown(int x) {
 818         return x / windowScale;
 819     }
 820 }


  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.X11;
  27 
  28 import java.awt.Component;
  29 import java.awt.Cursor;
  30 import java.awt.Window;
  31 
  32 import java.awt.datatransfer.DataFlavor;
  33 import java.awt.datatransfer.Transferable;
  34 
  35 import java.awt.dnd.DnDConstants;
  36 import java.awt.dnd.DragGestureEvent;
  37 import java.awt.dnd.InvalidDnDOperationException;
  38 
  39 import java.util.*;
  40 
  41 import sun.java2d.pipe.Region;
  42 import sun.util.logging.PlatformLogger;
  43 
  44 import sun.awt.dnd.SunDragSourceContextPeer;
  45 import sun.awt.dnd.SunDropTargetContextPeer;
  46 import sun.awt.SunToolkit;
  47 import sun.awt.AWTAccessor;
  48 
  49 /**
  50  * The XDragSourceContextPeer class is the class responsible for handling
  51  * the interaction between the XDnD/Motif DnD subsystem and Java drag sources.
  52  *
  53  * @since 1.5
  54  */
  55 public final class XDragSourceContextPeer
  56     extends SunDragSourceContextPeer implements XDragSourceProtocolListener {
  57     private static final PlatformLogger logger =
  58         PlatformLogger.getLogger("sun.awt.X11.xembed.xdnd.XDragSourceContextPeer");
  59 
  60     /* The events selected on the root window when the drag begins. */
  61     private static final int ROOT_EVENT_MASK = (int)XConstants.ButtonMotionMask |


 795     public void handleDragFinished(boolean success) {
 796         /* Assume that the performed drop action is the latest drop action
 797            accepted by the drop target. */
 798         handleDragFinished(true, targetAction);
 799     }
 800 
 801     public void handleDragFinished(boolean success, int action) {
 802         // NOTE: we have to use the current pointer location, since
 803         // the target didn't specify the coordinates for the reply.
 804         handleDragFinished(success, action, xRoot, yRoot);
 805     }
 806 
 807     public void handleDragFinished(boolean success, int action, int x, int y) {
 808         dragDropFinished(success, action, x, y);
 809 
 810         dndInProgress = false;
 811         cleanup(XConstants.CurrentTime);
 812     }
 813 
 814     public int scaleUp(int x) {
 815         return Region.clipRound(x * (double)windowScale);
 816     }
 817 
 818     public int scaleDown(int x) {
 819         return Region.clipRound(x / (double)windowScale);
 820     }
 821 }
< prev index next >