/** * determine the drop action from the event */ protected int mapDragOperationFromModifiers(MouseEvent e) { int mods = e.getModifiersEx(); int btns = mods & ButtonMask; // Prohibit multi-button drags. if (!(btns == InputEvent.BUTTON1_DOWN_MASK || btns == InputEvent.BUTTON2_DOWN_MASK || btns == InputEvent.BUTTON3_DOWN_MASK)) { return DnDConstants.ACTION_NONE; } return SunDragSourceContextPeer.convertModifiersToDropAction(mods, getSourceActions()); }
/** * determine the drop action from the event */ protected int mapDragOperationFromModifiers(MouseEvent e) { int mods = e.getModifiersEx(); int btns = mods & ButtonMask; // Do not allow right mouse button drag since Motif DnD does not // terminate drag operation on right mouse button release. if (!(btns == InputEvent.BUTTON1_DOWN_MASK || btns == InputEvent.BUTTON2_DOWN_MASK)) { return DnDConstants.ACTION_NONE; } return SunDragSourceContextPeer.convertModifiersToDropAction(mods, getSourceActions()); }
public void handleDragReply(int action, int x, int y, int modifiers) { if (action == DnDConstants.ACTION_NONE && targetAction != DnDConstants.ACTION_NONE) { dragExit(x, y); } else if (action != DnDConstants.ACTION_NONE) { int type = 0; if (targetAction == DnDConstants.ACTION_NONE) { type = SunDragSourceContextPeer.DISPATCH_ENTER; } else { type = SunDragSourceContextPeer.DISPATCH_MOTION; } // Note that we use the modifiers state a postDragSourceDragEvent(action, modifiers, x, y, type); } targetAction = action; }
boolean filterAndCheckEvent(AWTEvent event) { boolean eventOK = true; synchronized (eventFilters) { for (int i = eventFilters.size() - 1; i >= 0; i--) { EventFilter f = eventFilters.get(i); EventFilter.FilterAction accept = f.acceptEvent(event); if (accept == EventFilter.FilterAction.REJECT) { eventOK = false; break; } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { break; } } } return eventOK && SunDragSourceContextPeer.checkEvent(event); }