< prev index next >

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

Print this page

        

*** 81,90 **** --- 81,92 ---- /* The data formats supported by the drag source for the current drag operation. */ 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; /* Keyboard modifiers state. */ private int eventState = 0;
*** 128,139 **** "Cannot find top-level for the drag source component"); } long xcursor = 0; long rootWindow = 0; - long dragWindow = 0; long timeStamp = 0; /* Retrieve the X cursor for the drag operation. */ { Cursor cursor = getCursor(); if (cursor != null) { --- 130,141 ---- "Cannot find top-level for the drag source component"); } long xcursor = 0; long rootWindow = 0; long timeStamp = 0; + windowScale = wpeer.getScale(); /* Retrieve the X cursor for the drag operation. */ { Cursor cursor = getCursor(); if (cursor != null) {
*** 154,165 **** { long screen = XlibWrapper.XScreenNumberOfScreen(wpeer.getScreen()); rootWindow = XlibWrapper.RootWindow(XToolkit.getDisplay(), screen); } - dragWindow = XWindow.getXAWTRootWindow().getWindow(); - timeStamp = XToolkit.getCurrentServerTime(); int dropActions = getDragSourceContext().getSourceActions(); Iterator<XDragSourceProtocol> dragProtocols = --- 156,165 ----
*** 439,450 **** } private void updateTargetWindow(XMotionEvent xmotion) { assert XToolkit.isAWTLockHeldByCurrentThread(); ! int x = xmotion.get_x_root(); ! int y = xmotion.get_y_root(); long time = xmotion.get_time(); long subwindow = xmotion.get_subwindow(); /* * If this event had occurred before the pointer was grabbed, --- 439,450 ---- } private void updateTargetWindow(XMotionEvent xmotion) { assert XToolkit.isAWTLockHeldByCurrentThread(); ! int x = scaleDown(xmotion.get_x_root()); ! int y = scaleDown(xmotion.get_y_root()); long time = xmotion.get_time(); long subwindow = xmotion.get_subwindow(); /* * If this event had occurred before the pointer was grabbed,
*** 496,508 **** */ private void processMouseMove(XMotionEvent xmotion) { if (!dragInProgress) { return; } ! if (xRoot != xmotion.get_x_root() || yRoot != xmotion.get_y_root()) { ! xRoot = xmotion.get_x_root(); ! yRoot = xmotion.get_y_root(); postDragSourceDragEvent(targetAction, XWindow.getModifiers(xmotion.get_state(),0,0), xRoot, yRoot, DISPATCH_MOUSE_MOVED); } --- 496,512 ---- */ private void processMouseMove(XMotionEvent xmotion) { if (!dragInProgress) { return; } ! ! 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), xRoot, yRoot, DISPATCH_MOUSE_MOVED); }
*** 517,537 **** } updateTargetWindow(xmotion); if (dragProtocol != null) { ! dragProtocol.sendMoveMessage(xmotion.get_x_root(), ! xmotion.get_y_root(), sourceAction, sourceActions, xmotion.get_time()); } } private void processDrop(XButtonEvent xbutton) { try { ! dragProtocol.initiateDrop(xbutton.get_x_root(), ! xbutton.get_y_root(), sourceAction, sourceActions, xbutton.get_time()); } catch (XException e) { cleanup(xbutton.get_time()); } --- 521,541 ---- } updateTargetWindow(xmotion); if (dragProtocol != null) { ! dragProtocol.sendMoveMessage(scaleDown(xmotion.get_x_root()), ! scaleDown(xmotion.get_y_root()), sourceAction, sourceActions, xmotion.get_time()); } } private void processDrop(XButtonEvent xbutton) { try { ! dragProtocol.initiateDrop(scaleDown(xbutton.get_x_root()), ! scaleDown(xbutton.get_y_root()), sourceAction, sourceActions, xbutton.get_time()); } catch (XException e) { cleanup(xbutton.get_time()); }
*** 803,808 **** --- 807,820 ---- dragDropFinished(success, action, x, y); dndInProgress = false; cleanup(XConstants.CurrentTime); } + + public int scaleUp(int x) { + return x * windowScale; + } + + public int scaleDown(int x) { + return x / windowScale; + } }
< prev index next >