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

Print this page

        

*** 570,583 **** postEventToEventQueue(event); } } static int getModifiers(int state, int button, int keyCode) { - return getModifiers(state, button, keyCode, 0, false); - } - - static int getModifiers(int state, int button, int keyCode, int type, boolean wheel_mouse) { int modifiers = 0; if (((state & XConstants.ShiftMask) != 0) ^ (keyCode == KeyEvent.VK_SHIFT)) { modifiers |= InputEvent.SHIFT_DOWN_MASK; } --- 570,579 ----
*** 604,621 **** // 1) current button is now still in PRESSED state (means that user just pressed mouse but not released yet) or // 2) if Xsystem reports that "state" represents that button was just released. This only happens on RELEASE with 1,2,3 buttons. // ONLY one of these conditions should be TRUE to add that modifier. if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){ //exclude wheel buttons from adding their numbers as modifiers ! if (!wheel_mouse) { modifiers |= InputEvent.getMaskForButton(i+1); } } } return modifiers; } static int getXModifiers(AWTKeyStroke stroke) { int mods = stroke.getModifiers(); int res = 0; if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) { res |= XConstants.ShiftMask; --- 600,622 ---- // 1) current button is now still in PRESSED state (means that user just pressed mouse but not released yet) or // 2) if Xsystem reports that "state" represents that button was just released. This only happens on RELEASE with 1,2,3 buttons. // ONLY one of these conditions should be TRUE to add that modifier. if (((state & XlibUtil.getButtonMask(i + 1)) != 0) != (button == XConstants.buttons[i])){ //exclude wheel buttons from adding their numbers as modifiers ! if (!isWheel(XConstants.buttons[i])) { modifiers |= InputEvent.getMaskForButton(i+1); } } } return modifiers; } + static boolean isWheel(int button) { + // 4 and 5 buttons are usually considered assigned to a first wheel + return button == XConstants.buttons[3] || button == XConstants.buttons[4]; + } + static int getXModifiers(AWTKeyStroke stroke) { int mods = stroke.getModifiers(); int res = 0; if ((mods & (InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK)) != 0) { res |= XConstants.ShiftMask;
*** 651,661 **** } long when; int modifiers; boolean popupTrigger = false; int button=0; - boolean wheel_mouse = false; int lbutton = xbe.get_button(); /* * Ignore the buttons above 20 due to the bit limit for * InputEvent.BUTTON_DOWN_MASK. * One more bit is reserved for FIRST_HIGH_BIT. --- 652,661 ----
*** 704,730 **** */ popupTrigger = (lbutton == 3); } button = XConstants.buttons[lbutton - 1]; - // 4 and 5 buttons are usually considered assigned to a first wheel - if (lbutton == XConstants.buttons[3] || - lbutton == XConstants.buttons[4]) { - wheel_mouse = true; - } // mapping extra buttons to numbers starting from 4. if ((button > XConstants.buttons[4]) && (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled())){ return; } if (button > XConstants.buttons[4]){ button -= 2; } ! modifiers = getModifiers(xbe.get_state(),button,0, type, wheel_mouse); ! if (!wheel_mouse) { MouseEvent me = new MouseEvent(getEventSource(), type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED, jWhen,modifiers, x, y, xbe.get_x_root(), xbe.get_y_root(), --- 704,725 ---- */ popupTrigger = (lbutton == 3); } button = XConstants.buttons[lbutton - 1]; // mapping extra buttons to numbers starting from 4. if ((button > XConstants.buttons[4]) && (!Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled())){ return; } if (button > XConstants.buttons[4]){ button -= 2; } ! modifiers = getModifiers(xbe.get_state(),button,0); ! if (!isWheel(lbutton)) { MouseEvent me = new MouseEvent(getEventSource(), type == XConstants.ButtonPress ? MouseEvent.MOUSE_PRESSED : MouseEvent.MOUSE_RELEASED, jWhen,modifiers, x, y, xbe.get_x_root(), xbe.get_y_root(),