JDK-8080676 : Mouse drag does not work for extra buttons on Linux
  • Type: Bug
  • Component: client-libs
  • Affected Version: 10,11
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • Submitted: 2015-05-19
  • Updated: 2023-10-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
The test  test/java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java fails on Linux for extra mouse buttons.

This is because Xsystem is not set state for the extra button event.
See the comment for the XWindow.handleMotionNotify(XEvent) method:
---------------------------
        //this doesn't work for extra buttons because Xsystem is sending state==0 for every extra button event.
        // we can't correct it in MouseEvent class as we done it with modifiers, because exact type (DRAG|MOVE)
        // should be passed from XWindow.
        final int buttonsNumber = XToolkit.getNumberOfButtonsForMask();

        for (int i = 0; i < buttonsNumber; i++){
            // TODO : here is the bug in WM: extra buttons doesn't have state!=0 as they should.
            if ((i != 4) && (i != 5)) {
                mouseKeyState = mouseKeyState | (xme.get_state() & XlibUtil.getButtonMask(i + 1));
            }
        }
---------------------------

Comments
Still fails on Ubuntu 16.04 with JDK 11 ----------System.out:(0/0)---------- ----------System.err:(14/896)---------- java.lang.RuntimeException: Mouse button 4 is not dragged at MouseDraggedTest.testMouseDrag(MouseDraggedTest.java:83) at MouseDraggedTest.main(MouseDraggedTest.java:54) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:115) at java.base/java.lang.Thread.run(Thread.java:832) JavaTest Message: Test threw exception: java.lang.RuntimeException: Mouse button 4 is not dragged JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Mouse button 4 is not dragged
11-05-2018