<AWT Dev> [9] Review request for 6624085: Fourth mouse button (wheel) is treated like second button - isPopupTrigger returns true
Alex Henrie
alexhenrie24 at gmail.com
Tue Sep 2 18:04:30 UTC 2014
Thank you for pushing my patch to JDK 9! Can this fix be backported to
Java 8 and Java 7 as well? The diff below applies cleanly to
jdk8u-dev/jdk and jdk7u-dev/jdk.
-Alex
diff --git a/src/solaris/classes/sun/awt/X11/XWindow.java b/src/solaris/classes/sun/awt/X11/XWindow.java
--- a/src/solaris/classes/sun/awt/X11/XWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java
@@ -50,17 +50,16 @@ public class XWindow extends XBaseWindow
private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.X11.focus.XWindow");
private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XWindow");
/* If a motion comes in while a multi-click is pending,
* allow a smudge factor so that moving the mouse by a small
* amount does not wipe out the multi-click state variables.
*/
private final static int AWT_MULTICLICK_SMUDGE = 4;
// ButtonXXX events stuff
- static int rbutton = 0;
static int lastX = 0, lastY = 0;
static long lastTime = 0;
static long lastButton = 0;
static WeakReference lastWindowRef = null;
static int clickCount = 0;
// used to check if we need to re-create surfaceData.
int oldWidth = -1;
@@ -627,33 +626,16 @@ public class XWindow extends XBaseWindow
res |= XToolkit.metaMask;
}
if ((mods & (InputEvent.ALT_GRAPH_DOWN_MASK | InputEvent.ALT_GRAPH_MASK)) != 0) {
res |= XToolkit.modeSwitchMask;
}
return res;
}
- /**
- * Returns true if this event is disabled and shouldn't be passed to Java.
- * Default implementation returns false for all events.
- */
- static int getRightButtonNumber() {
- if (rbutton == 0) { // not initialized yet
- XToolkit.awtLock();
- try {
- rbutton = XlibWrapper.XGetPointerMapping(XToolkit.getDisplay(), XlibWrapper.ibuffer, 3);
- }
- finally {
- XToolkit.awtUnlock();
- }
- }
- return rbutton;
- }
-
static int getMouseMovementSmudge() {
//TODO: It's possible to read corresponding settings
return AWT_MULTICLICK_SMUDGE;
}
public void handleButtonPressRelease(XEvent xev) {
super.handleButtonPressRelease(xev);
XButtonEvent xbe = xev.get_xbutton();
@@ -711,21 +693,17 @@ public class XWindow extends XBaseWindow
lastY = y;
}
lastTime = when;
/*
Check for popup trigger !!
*/
- if (lbutton == getRightButtonNumber() || lbutton > 2) {
- popupTrigger = true;
- } else {
- popupTrigger = false;
- }
+ 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;
}
More information about the awt-dev
mailing list