/** * Updates the source action according to the specified state. * * @returns true if the source */ private boolean updateSourceAction(int state) { int action = SunDragSourceContextPeer.convertModifiersToDropAction( XWindow.getModifiers(state, 0, 0), sourceActions); if (sourceAction == action) { return false; } sourceAction = action; return true; }
/* * DO NOT USE is_hint field of xmotion since it could not be set when we * convert XKeyEvent or XButtonRelease to XMotionEvent. */ 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); } if (eventState != xmotion.get_state()) { if (updateSourceAction(xmotion.get_state()) && dragProtocol != null) { postDragSourceDragEvent( targetAction, XWindow.getModifiers(xmotion.get_state(), 0, 0), xRoot, yRoot, DISPATCH_CHANGED); } eventState = xmotion.get_state(); } updateTargetWindow(xmotion); if (dragProtocol != null) { dragProtocol.sendMoveMessage( xmotion.get_x_root(), xmotion.get_y_root(), sourceAction, sourceActions, xmotion.get_time()); } }
public void handleDragReply(int action, int x, int y) { // NOTE: we have to use the current modifiers state, since // the target didn't specify the modifiers state for the reply. handleDragReply(action, xRoot, yRoot, XWindow.getModifiers(eventState, 0, 0)); }