United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5076635 : Double click speed is not honored in KDE linux

Details
Type:
Bug
Submit Date:
2004-07-21
Status:
Closed
Updated Date:
2010-07-09
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
linux
Sub-Component:
java.awt
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0,6
Fixed Versions:

Related Reports
Relates:

Sub Tasks

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
                                     
2008-08-06
EVALUATION

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

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

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

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

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang


                                     
2004-09-22
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
                                     
2004-07-21



Hardware and Software, Engineered to Work Together