JDK-6339087 : Robot.mouseWheel() doesn't work on solaris
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: solaris
  • CPU: generic
  • Submitted: 2005-10-19
  • Updated: 2011-01-19
  • Resolved: 2005-11-01
Related Reports
Relates :  
Platform[s]         : Fails On:   Solaris (amd/sparc/ia)
Failing Test [s]    : java/awt/Choice/WheelEventsConsumed/WheelEventsConsumed.html

    Test source location:

    jtr file location:

    How to reproduce:
    - Set JAVA_HOME to Mustang b56 solaris-i586
    - cd /net/cady/export/jdk1.6.0/latest/ws/j2se/test/java/awt/Choice/WheelEventsConsumed
    - /net/koori.sfbay/onestop/jct-tools/2.1.6/archive/fcs/binaries/solaris/bin/jtreg -r:/tmp -w:/tmp ./WheelEventsConsumed.html

    Test output:
java.lang.RuntimeException: Test failed. Exception thrown: java.lang.RuntimeException: Test failed. Choice should generate MOUSE_WHEEL events.1
        at WheelEventsConsumed.start(WheelEventsConsumed.java:64)
        at com.sun.javatest.regtest.AppletWrapper$AppletThread.run(AppletWrapper.java:133)
        at java.lang.Thread.run(Thread.java:611)

SUGGESTED FIX Add a line to X server configuration file (/usr/openwin/server/etc/OWconfig): class="XINPUT" name="IMOUSE" ... + buttons="5" ...

EVALUATION After some investigation I have found that the problem is not with Java, a native test can be easily written to demonstrate the same behaviour. So something wrong with X server or XInput extension configuration. I have contacted XSun server development team and found that by default XInput assumes all the mice have 3 buttons. That leads to AWT can't use mouse buttons 4 and 5 (used for wheel emulation). That can be easily fixed, see suggested fix for details.

EVALUATION The test fails on solaris because Robot.mouseWheel(int) doesn't produce any kind of events. Likely it's a bug in robot implementation on solaris(XToolkit/MToolkit both). I've verified that if I scroll the mouse by hand then it produces needed scrolling MouseEvents in the case with Choice on solaris. So far we probably need to look into robot. I also checked that its not a regression because this API appeared in JDK1.4 and from that time it doesn't work well. I wonder may be the reason in misconfigured environment even I could scroll native application (xterm) with the scroll wheel though. On linux that API works just fine so I believe it's because of native API that Robot uses. From: http://www.xfree86.org/current/xtestlib.html XTestFakeButtonEvent(display, button, is_press, delay) Display *display; unsigned int button; Bool is_press; unsigned long delay; ?__ If the extension is supported, XTestFakeButtonEvent requests the server to simulate either a ButtonPress (if is_press is True) or a ButtonRelease (if is_press is False) of the logical button numbered by the specified button; otherwise, the request is ignored. If the extension is supported, the simulated event will not be processed until delay milliseconds after the request is received (if delay is CurrentTime, then this is interpreted as no delay at all). No other requests from this client will be processed until this delay, if any, has expired and subsequent processing of the simulated event has been completed. So it something wrong with button numbers: Xtest seems can't accept buttons 4 and 5.