mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (method extracted; dead code dropped)
This commit is contained in:
@@ -52,7 +52,6 @@ import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
@@ -322,20 +321,8 @@ public class IdeEventQueue extends EventQueue {
|
||||
|
||||
@Override
|
||||
public void dispatchEvent(AWTEvent e) {
|
||||
if (SystemInfo.isXWindow && e instanceof MouseEvent && ((MouseEvent)e).getButton() > 3) {
|
||||
MouseEvent src = (MouseEvent)e;
|
||||
if (src.getButton() < 6) {//Convert these events(buttons 4&5 in are produced by touchpad, they must be converted to horizontal scrolling events
|
||||
e = new MouseWheelEvent(src.getComponent(), src.getID(), src.getWhen(),
|
||||
src.getModifiers() | InputEvent.SHIFT_DOWN_MASK, src.getX(), src.getY(),
|
||||
0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, src.getClickCount(), src.getButton() == 4 ? -1 : 1);
|
||||
}
|
||||
else {
|
||||
//Here we "shift" events with buttons 6 and 7 to similar events with buttons 4 and 5
|
||||
//See java.awt.InputEvent#BUTTON_DOWN_MASK, 1<<14 is 4th physical button, 1<<15 is 5th.
|
||||
e = new MouseEvent(src.getComponent(), src.getID(), src.getWhen(), src.getModifiers() | (1 << 8 + src.getButton()),
|
||||
src.getX(), src.getY(), 1, src.isPopupTrigger(), src.getButton() - 2);
|
||||
}
|
||||
}
|
||||
e = mapEvent(e);
|
||||
|
||||
boolean wasInputEvent = myIsInInputEvent;
|
||||
myIsInInputEvent = e instanceof InputEvent || e instanceof InputMethodEvent || e instanceof WindowEvent || e instanceof ActionEvent;
|
||||
AWTEvent oldEvent = myCurrentEvent;
|
||||
@@ -363,25 +350,26 @@ public class IdeEventQueue extends EventQueue {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"ALL"})
|
||||
private static String toDebugString(final AWTEvent e) {
|
||||
if (e instanceof InvocationEvent) {
|
||||
try {
|
||||
final Field f = InvocationEvent.class.getDeclaredField("runnable");
|
||||
f.setAccessible(true);
|
||||
Object runnable = f.get(e);
|
||||
|
||||
return "Invoke Later[" + runnable.toString() + "]";
|
||||
private static AWTEvent mapEvent(AWTEvent e) {
|
||||
if (SystemInfo.isXWindow && e instanceof MouseEvent && ((MouseEvent)e).getButton() > 3) {
|
||||
MouseEvent src = (MouseEvent)e;
|
||||
if (src.getButton() < 6) {
|
||||
// Convert these events(buttons 4&5 in are produced by touchpad, they must be converted to horizontal scrolling events
|
||||
e = new MouseWheelEvent(src.getComponent(), src.getID(), src.getWhen(),
|
||||
src.getModifiers() | InputEvent.SHIFT_DOWN_MASK, src.getX(), src.getY(),
|
||||
0, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, src.getClickCount(), src.getButton() == 4 ? -1 : 1);
|
||||
}
|
||||
catch (NoSuchFieldException e1) {
|
||||
}
|
||||
catch (IllegalAccessException e1) {
|
||||
else {
|
||||
// Here we "shift" events with buttons 6 and 7 to similar events with buttons 4 and 5
|
||||
// See java.awt.InputEvent#BUTTON_DOWN_MASK, 1<<14 is 4th physical button, 1<<15 is 5th.
|
||||
//noinspection MagicConstant
|
||||
e = new MouseEvent(src.getComponent(), src.getID(), src.getWhen(), src.getModifiers() | (1 << 8 + src.getButton()),
|
||||
src.getX(), src.getY(), 1, src.isPopupTrigger(), src.getButton() - 2);
|
||||
}
|
||||
}
|
||||
return e.toString();
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
public void _dispatchEvent(@NotNull AWTEvent e, boolean typeAheadFlushing) {
|
||||
if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
|
||||
DnDManagerImpl dndManager = (DnDManagerImpl)DnDManager.getInstance();
|
||||
|
||||
Reference in New Issue
Block a user