netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Double-clicking on entries in the Projects window does not work with Magic Mouse

Open ljnelson opened this issue 6 months ago • 8 comments

Apache NetBeans version

Apache NetBeans 26

What happened

I am fully aware of how crazy this sounds but I know what I'm seeing.

I am using an (Apple silicon) Mac with a Magic Mouse.

Most, but not all, of the time if I double click on a folder in the Projects window it does not work. Right clicking and selecting Open works fine.

Using the built in trackpad works fine (!).

I have noticed that if I double click near the top edge of the project "row" (maybe right on the top of its bounding box?) I can occasionally get the double-click to register.

Double-clicking with the Magic Mouse works sporadically in other areas as well, but not all of them. For example, double-clicking on any entry in the Breakpoints window works fine. The Files window appears to suffer from the same sort of thing. Trying to set a breakpoint in the left "gutter" doesn't always work.

See https://github.com/apache/netbeans/discussions/8580.

Language / Project Type / NetBeans Component

Any

How to reproduce

Open the Projects window. Try double clicking on a folder icon, or its row, to expand the entry. Observe that nothing happens. Try again many times, with the mouse pointer right near the top edge of the row. Observe that eventually? maybe? the row will expand. Note that none of this happens with the built-in trackpad.

Did this work correctly in an earlier version?

No / Don't know

Operating System

Sequoia 15.5

JDK

24.0.1; OpenJDK 64-Bit Server VM 24.0.1+9

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

ljnelson avatar Jun 21 '25 22:06 ljnelson

Every so often, but not predictably, I see this in the IDE log:

WARNING [org.openide.util.ImageUtilities]: loadImage(URI) called with unusual URI: ergoloc:/org/netbeans/modules/ide/ergonomics/enterprise/org-netbeans-modules-websvc-core-client-resources-ws_client_16.png
WARNING [null]: Last record repeated again.
WARNING [org.openide.util.ImageUtilities]: loadImage(URI) called with unusual URI: ergoloc:/org/netbeans/modules/ide/ergonomics/enterprise/org-netbeans-modules-websvc-core-client-resources-ws_client_16.png
WARNING [null]: Last record repeated again.
INFO [org.netbeans.modules.gsf.testrunner.ui.api.UICommonUtils]: File cannot be found for selected node: Source Packages.
INFO [null]: Last record repeated again.
INFO [org.netbeans.modules.gsf.testrunner.ui.api.UICommonUtils]: File cannot be found for selected node: Source Packages.
INFO [null]: Last record repeated again.
WARNING [null]: Note - org.netbeans.modules.java.module.graph.GraphTopComponent ought to override getPersistenceType() rather than using the client property or accepting the default.
WARNING [null]: Note - org.netbeans.modules.java.module.graph.GraphTopComponent ought to override getPersistenceType() rather than using the client property or accepting the default.

ljnelson avatar Jun 21 '25 22:06 ljnelson

Other observations:

  • Sometimes there's a flicker as the (Git) branch name is updated asynchronously (to what it was before (!)). This seems to correlate with a successful double-click operation happening shortly afterwards.
  • Similar behavior is seen in the Navigator pane, the Files pane and the Services pane.

ljnelson avatar Jun 21 '25 22:06 ljnelson

I don't own a mac, but this does not sound like a java problem. Please check if this helps:

https://discussions.apple.com/thread/253457279?sortBy=rank

matthiasblaesing avatar Jun 22 '25 05:06 matthiasblaesing

Aware of that; NetBeans is the only program that exhibits this behavior.

ljnelson avatar Jun 22 '25 07:06 ljnelson

can you run this and check if it works:

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;

public class Mavenproject1 {

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(500, 500);
        frame.setTitle("double click me");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                frame.setTitle("clicks: " + e.getClickCount());
            }
        });
        frame.setVisible(true);
    }
}

it should say clicks: 2 in the title if you double click on it.

mbien avatar Jun 23 '25 12:06 mbien

Indeed that would seem to be the culprit. Sometimes it doesn't register, sometimes it says 1, sometimes it says 2, sometimes it says 3, 4….

ljnelson avatar Jun 23 '25 16:06 ljnelson

ok, thanks. I guess this confirms that this is likely a JDK issue connected with the magic mouse hardware.

mbien avatar Jun 23 '25 16:06 mbien

Thinking the culprit is probably in here: https://github.com/openjdk/jdk/blob/master/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java#L71-L79

For example, in the XWindows implementation, there is a built-in "smudge factor" (!): https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java#L71-L75 This does not seem to exist in the Mac stuff.

ljnelson avatar Jun 23 '25 16:06 ljnelson

https://issues.apache.org/jira/browse/NETBEANS-4286 old jira issue (read only)

mbien avatar Sep 16 '25 09:09 mbien

https://issues.apache.org/jira/browse/NETBEANS-4286 old jira issue (read only)

Not a problem. JetBrains' JVMs seem to be handling this without issue.

instancezero avatar Sep 16 '25 13:09 instancezero

There is an existing a JDK bug report. https://bugs.openjdk.org/browse/JDK-8218421

Looks like JEtBrains IntelliJ works around the issue with a custom click listener https://github.com/JetBrains/intellij-community/blob/master/platform/util/ui/src/com/intellij/ui/ClickListener.java

oyarzun avatar Sep 17 '25 11:09 oyarzun