Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window maximizes with single click (should be double click) #637

Open
rkeen-siemens opened this issue Jan 9, 2023 · 6 comments
Open

Window maximizes with single click (should be double click) #637

rkeen-siemens opened this issue Jan 9, 2023 · 6 comments

Comments

@rkeen-siemens
Copy link

On Linux (at least CentOS with Gnome 3) single clicking the header of the main frame will maximize/restore the frame. This should only happen on a double click.

The problem seems to be that sometimes the click event is sent to the FlatTitlePane.Handler and sometimes it isn't. This only seems to be an issue when using a trackpad with tap to click on a single tap. Clicking the trackpad or using a mouse seem to work as expected. Here are the events passed to the handler's mousePressed and mouseClicked methods for the various input methods. In case it makes a difference, I'm testing this via HP ZCentral Remote Boost to a remote linux instance using a Mac OS 13.1 client with a Magic Trackpad (original, not the 2nd).

Trackpad Single Tap

pressed at 1673293639029 with e.getClickCount 1 and clickCount 1
clicked at 1673293639040 with e.getClickCount 1 // <-- This click event triggers the maximize/restore erroneously

Trackpad Single Click

pressed at 1673293654677 with e.getClickCount 1 and clickCount 1
// No click event sent to the handler

Mouse Single Click

pressed at 1673293672853 with e.getClickCount 1 and clickCount 1
// No click event sent to the handler

Trackpad Double Tap

pressed at 1673293689761 with e.getClickCount 1 and clickCount 1
clicked at 1673293689762 with e.getClickCount 1 // <-- This click event triggers the maximize/restore early
// Only if the title bar stays at the top will you get the second press/click events
pressed at 1673293689907 with e.getClickCount 2 and clickCount 2
clicked at 1673293689908 with e.getClickCount 2

Trackpad Double Click

pressed at 1673293708430 with e.getClickCount 1 and clickCount 1
pressed at 1673293708625 with e.getClickCount 2 and clickCount 2
clicked at 1673293708740 with e.getClickCount 2

Mouse Double Click

pressed at 1673293731535 with e.getClickCount 1 and clickCount 1
pressed at 1673293731707 with e.getClickCount 2 and clickCount 2
clicked at 1673293731807 with e.getClickCount 2

@remcopoelstra
Copy link

Does this only happen when using FlatLaf?

I have also had issues (see #621) where a Mac trackpad is causing invalid mouse events, but this is unrelated to FlatLaf.

@rkeen-siemens
Copy link
Author

I've only seen it with FlatLaf.

@rkeen-siemens
Copy link
Author

rkeen-siemens commented Jan 31, 2023

Some more data points:

  • I do not see the issue at all with the application running on Windows 10
  • I also see it when connecting via VNC (haven't tried with a local Linux machine)
  • I also see it when single clicking the title bar with a mouse (not a trackpad) when another application is active. Clicking with a mouse while the application is active works as expected (i.e. it is only maximized on a double click).
  • I see the same behavior with the mouse when using a Windows client to VNC to a Linux machine running the application, but it doesn't seem to be as reliably reproducible. A Windows trackpad (at least the built in one on my Dell laptop) behaves the same way as the mouse click (i.e. it only maximizes when clicked when the application is inactive).

@DevCharly
Copy link
Collaborator

Thanks for the detailed information 👍

Tried to reproduce, but works for me. I'm running CentOS in VirtualBox on Win11 using Magic Trackpad Model 2011 connected to Win11 via https://magicutilities.net/.

Maybe it is related to VNC/remote access...

Could you please check, for trackpad single tap, the return value of FlatNativeLinuxLibrary.moveOrResizeWindow() in this line:

linuxNativeMove = FlatNativeLinuxLibrary.moveOrResizeWindow( window, e, FlatNativeLinuxLibrary.MOVE );

I'm also interested in the value of field linuxNativeMove in mouseClicked().

Maybe changing this line:

if( SystemInfo.isLinux && FlatNativeLinuxLibrary.isWMUtilsSupported( window ) ) {

to if( linuxNativeMove && SystemInfo.isLinux && ... fixes the issue?

DevCharly added a commit that referenced this issue Mar 3, 2023
…fully started before maximizing window in mouseClicked() (issue #637)
@DevCharly
Copy link
Collaborator

I've added suggested change from previous post to main branch.

Could you please try latest 3.1-SNAPSHOT: https://github.com/JFormDesigner/FlatLaf#snapshots

@rkeen-siemens
Copy link
Author

Looks like it is still an issue. I may have some time at the end of next week to look further into this (since I can easily reproduce).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants