JDK-5076635 : Double click speed is not honored in KDE linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0,6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2004-07-21
  • Updated: 2010-07-09
  • Resolved: 2011-03-07
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.
JDK 7
7 b48Fixed
Related Reports
Relates :  
Description
Name: gm110360			Date: 07/21/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

Also a problem with 1.4.2.

ADDITIONAL OS VERSION INFORMATION :
Linux gaz 2.4.18 #18 SMP Mon Feb 24 11:42:05 EST 2003 i686 unknown
KDE 3.2.0

A DESCRIPTION OF THE PROBLEM :
Double click speed on Linux KDE in swing components does not follow preferences set in the KDE Control panel.  This works fine for Solaris CDE, so it is not a UNIX issue.  No matter what speed I set the double-click interval to, the double click speed recognized by swing is much much faster (too fast).  This is a big problem because users think that their double clicks on tree nodes are getting ignored.  Java appears to always be picking up that the system setting is 200 ms even when it has been set to something else.   I have seen this behavior in both JTables and JTrees (assuming that it affects everything).

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the app below.  Note that when you run it, the double click speed from system properties is printed to system out.

Twist open a node in the tree and Double click on the sub-nodes with varying speed.  Note that only really fast double clicks are recognized (there is a println in mouseReleased when an event is a doubleClick event).

Close the app and set your system pref for double click speed to be really really slow and then try again.  There is no difference.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected that the double-click speed would be controlled by the system pref set in the KDE control panel like it is in WIndows and CDE Solaris.
ACTUAL -
Double click speed is always really fast no matter what it is set to in KDE prefs.  Setting the pref has no effect on the double click speed.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.*;

public class TestDoubleClickInterval
{
    private JTree fTree;
    private DefaultTreeModel fModel;
    private DefaultMutableTreeNode fTopNode;

    public TestDoubleClickInterval()
    {
        JFrame f = new JFrame("Test Tree Click Behavior");
        fTopNode = new DefaultMutableTreeNode("Top Level");
        DefaultMutableTreeNode treeNode;

        for (int i = 0; i < 10; i++)
        {
            treeNode = new DefaultMutableTreeNode("test"+i);
            treeNode.add(new DefaultMutableTreeNode("foo"));
            treeNode.add(new DefaultMutableTreeNode("bar"));
            treeNode.add(new DefaultMutableTreeNode("test"));
            fTopNode.add(treeNode);
        }
        fTree = new JTree();
        fTree.setLargeModel(true);
        fTree.setRowHeight(20);
        fModel =  new DefaultTreeModel(fTopNode);
        fTree.setModel(fModel);
        fTree.setRootVisible(false);  //make top node invisible
        fTree.setShowsRootHandles(true); //show tree lines
        fTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
        fTree.addMouseListener(new MyMouseAdapter());
        JScrollPane sp = new JScrollPane(fTree);
        f.getContentPane().add(sp);
        f.setSize(200,200);
        f.setLocation(300,300);
        f.setVisible(true);

        System.out.println("Multi Click interval " +((Integer) Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval")).intValue());


    }

     private class MyMouseAdapter extends MouseAdapter
    {
        public void mouseReleased(MouseEvent event)
        {
                if (event.getClickCount() == 2)
                    System.out.println("Mouse event is a double click event");
        }
     }



    public static void main(String[] args)
    {
        new TestDoubleClickInterval();
    }

}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
The only workaround is really hacky and bound to lead to problems down the road.  This would be to keep track of time between mouse clicks and when they occur within a randomly chosen threshhold (bigger than 200 ms) then the click is interpreted as a double click.
(Incident Review ID: 285909) 
======================================================================

Comments
EVALUATION We may introduce some other piece of code that checks the property value if XToolkit's XGetDefault fails. Finally, if even GTK approach fails, return some default value. There are actually a pretty much code which deals with gtk within JDK tree such as src/solaris/native/sun/awt/gtk2_interface.h|c and src/share/classes/com/sun/java/swing/plaf/gtk/GTKEngine.java
06-08-2008

SUGGESTED FIX http://spbweb.russia.sun.com/~ad153231/gnome-dblclick/webrev/index.html
17-07-2008

EVALUATION We may pick the machinery of the GTK LaF up and query the gtk-double-click-time property value.
17-07-2008

WORK AROUND Add the line *.multiClickTime: 500 to the file ~/.Xdefaults and run xrdb -merge ~/.Xdefaults
07-07-2008

EVALUATION Reproducible on Ubuntu's GNOME. The XToolkit.initializeMultiClickTime() method fails to query a valid property value by the XGetDefault() function.
04-07-2008

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
22-09-2004

EVALUATION In fact we try to get double click time from XSetting and this is works for Gnome. It looks like KDE doesn't set XSetting as we expected. Should investigate this in next release. ###@###.### 2004-07-21
21-07-2004