--- old/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java 2015-11-06 02:13:02.891227005 -0500 +++ new/src/java.desktop/unix/classes/sun/awt/X11/XDragSourceContextPeer.java 2015-11-06 02:13:02.731147007 -0500 @@ -83,6 +83,8 @@ private long[] sourceFormats = null; /* The XID of the root subwindow that contains the current target. */ private long targetRootSubwindow = 0; + /* window scale factor */ + int windowScale = 1; /* The pointer location. */ private int xRoot = 0; private int yRoot = 0; @@ -130,8 +132,8 @@ long xcursor = 0; long rootWindow = 0; - long dragWindow = 0; long timeStamp = 0; + windowScale = wpeer.getScale(); /* Retrieve the X cursor for the drag operation. */ { @@ -156,8 +158,6 @@ rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); } - dragWindow = XWindow.getXAWTRootWindow().getWindow(); - timeStamp = XToolkit.getCurrentServerTime(); int dropActions = getDragSourceContext().getSourceActions(); @@ -441,8 +441,8 @@ private void updateTargetWindow(XMotionEvent xmotion) { assert XToolkit.isAWTLockHeldByCurrentThread(); - int x = xmotion.get_x_root(); - int y = xmotion.get_y_root(); + int x = scaleDown(xmotion.get_x_root()); + int y = scaleDown(xmotion.get_y_root()); long time = xmotion.get_time(); long subwindow = xmotion.get_subwindow(); @@ -498,9 +498,13 @@ if (!dragInProgress) { return; } - if (xRoot != xmotion.get_x_root() || yRoot != xmotion.get_y_root()) { - xRoot = xmotion.get_x_root(); - yRoot = xmotion.get_y_root(); + + int motionXRoot = scaleDown(xmotion.get_x_root()); + int motionYRoot = scaleDown(xmotion.get_y_root()); + + if (xRoot != motionXRoot || yRoot != motionYRoot) { + xRoot = motionXRoot; + yRoot = motionYRoot; postDragSourceDragEvent(targetAction, XWindow.getModifiers(xmotion.get_state(),0,0), @@ -519,8 +523,8 @@ updateTargetWindow(xmotion); if (dragProtocol != null) { - dragProtocol.sendMoveMessage(xmotion.get_x_root(), - xmotion.get_y_root(), + dragProtocol.sendMoveMessage(scaleDown(xmotion.get_x_root()), + scaleDown(xmotion.get_y_root()), sourceAction, sourceActions, xmotion.get_time()); } @@ -528,8 +532,8 @@ private void processDrop(XButtonEvent xbutton) { try { - dragProtocol.initiateDrop(xbutton.get_x_root(), - xbutton.get_y_root(), + dragProtocol.initiateDrop(scaleDown(xbutton.get_x_root()), + scaleDown(xbutton.get_y_root()), sourceAction, sourceActions, xbutton.get_time()); } catch (XException e) { @@ -805,4 +809,12 @@ dndInProgress = false; cleanup(XConstants.CurrentTime); } + + public int scaleUp(int x) { + return x * windowScale; + } + + public int scaleDown(int x) { + return x / windowScale; + } }