diff --git a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java index 1c797a090b7e..776a9ba6ea68 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeEventQueue.java @@ -324,7 +324,19 @@ public class IdeEventQueue extends EventQueue { } @Override - public void dispatchEvent(final AWTEvent e) { + public void dispatchEvent(AWTEvent e) { + if (SystemInfo.isXWindow && e instanceof MouseEvent && ((MouseEvent)e).getButton() > 3) { + MouseEvent src = (MouseEvent)e; + if (src.getButton() < 6) { + 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 { + 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); + } + } boolean wasInputEvent = myIsInInputEvent; myIsInInputEvent = e instanceof InputEvent || e instanceof InputMethodEvent || e instanceof WindowEvent || e instanceof ActionEvent; AWTEvent oldEvent = myCurrentEvent;