mcaselector icon indicating copy to clipboard operation
mcaselector copied to clipboard

When used in a tiling window manager, the menus close immediately after left click is released

Open yxnan opened this issue 2 years ago • 5 comments

Environment

  • OS: Linux Mint 19.3 Tricia
  • Kernel: 5.4.0-65-generic x86_64
  • Window Manager: XMonad 0.13
  • Java version: zulu16.30.15-ca-fx-jdk16.0.1-linux_x64
  • Version of MCA Selector: 1.17

Describe the bug

If user clicks on the menu bar and holds the left mouse, the menu items show up, but they close immediately after the left mouse button is released. If you keep the left button pressed, the menu stays open, but the menu items cannot be selected or clicked, which causes all of the menus entirely unusable, however, the hotkeys can still be triggered so generally this is not big trouble. Also, using the Alt key can select the menubar, but cannot open the submenus.

Peek 2021-11-17 22-55

This behavior occurs on most tiling window managers and only on them. I tried XMoand/QTile/i3wm/bspwm, all of them have the exactly same problem, whereas the program functions well in a typical full desktop environment (such as GNOME or MATE)

Maybe useful for relation

There is another JavaFX project has the very similar problem, relating issues: https://github.com/JabRef/jabref/issues/5867, and https://github.com/JabRef/jabref/issues/5526. The difference is that, only the upper half of menu is broken in JabRef, but mcaselector's menu is evenly inaccessible.

There is also a bug report in the javafx version 14: https://bugs.openjdk.java.net/browse/JDK-8251240

Personal Guess

There is a gap between the menubar and the submenu (I don't know why), so when the submenu is open, it loses the focus immediately therefore gets closed. Because in a tiling window manager, you lose the focus instantly by moving the mouse pointer outside the window, instead of by manually clicking on another window.

Tries to fix

In JabRef's issue someone mentioned a workaroud for that app (https://github.com/JabRef/jabref/issues/5526#issuecomment-547281967), to make the submenus act as a floating window instead of a regular one, thus prevents it from being organized by the layout system.

Following this idea, I wrote a ManageHook to make all of the MCA selector's window go floating by filtering out the windows where WM_CLASS = "net.querz.mcaselector.ui.Window". This rule did make the Main window/About dialog/Setting utility go floating, but the menu is still broken. I also tried the classname javafx.scene.control.Menu but the same.

I tried using xprop and wmctrl -l to find the class of the submenu but failed, simply no output, maybe in the newer JavaFX the submenu is no longer implemented as a standalone window instance (I don't write Java and cannot understand the JavaFX docs so this is only my inaccurate guess)

debug.log

[02:54:54.887] os.name:                      Linux
[02:54:54.888] os.version:                   5.4.0-65-generic
[02:54:54.889] user.dir:                     /home/<user_name>
[02:54:54.890] jar.dir:                      /home/<user_name>/.bin/opt/mcaselector
[02:54:54.891] cache.dir:                    /home/<user_name>/.cache/mcaselector
[02:54:54.892] config.file:                  /home/<user_name>/.mcaselector/mcaselector/settings.ini
[02:54:54.893] log.file                      /home/<user_name>/.local/share/mcaselector/debug.log
[02:54:54.894] proc.cores:                   4
[02:54:54.895] java.version:                 16.0.1
[02:54:54.895] java.vm.specification.vendor: Oracle Corporation
[02:54:54.896] jvm.max.mem:                  2879389696
[02:54:55.678] cancelled 0 jobs in process queue
[02:54:55.679] cancelled 0 jobs in save queue
[02:54:55.680] canceleld 0 jobs in parser queue
[02:54:55.685] created data processor ThreadPoolExecutor with 2 threads
[02:54:55.687] created data save ThreadPoolExecutor with 4 threads
[02:54:55.688] created data parser ThreadPoolExecutor with 1 threads
[02:54:57.818] resizing to 802.0 NaN
[02:54:57.819] resizing to 802.0 629.0
[02:54:57.859] resizing to 956.0 629.0
[02:54:57.859] resizing to 956.0 1052.0
[02:55:00.710] resizing to 956.0 348.0
[02:55:02.283] resizing to 956.0 1052.0
[02:55:34.123] resizing to 956.0 348.0
[02:55:37.485] resizing to 956.0 1052.0

yxnan avatar Nov 17 '21 19:11 yxnan

What wm is this? Looks like dwm, I'm here on awesomewm, haven't tried to reproduce yet.

karimrir1 avatar Nov 21 '21 15:11 karimrir1

What wm is this? Looks like dwm, I'm here on awesomewm, haven't tried to reproduce yet.

It's XMonad. I haven't tried awesomewm, but maybe it also has this problem

yxnan avatar Nov 23 '21 23:11 yxnan

What wm is this? Looks like dwm, I'm here on awesomewm, haven't tried to reproduce yet.

It's XMonad. I haven't tried awesomewm, but maybe it also has this problem

I don't think it has that problem since by default it uses the floating layout.

karimrir1 avatar Nov 26 '21 10:11 karimrir1

Using the -Djdk.gtk.version=2 java launch argument as proposed by this comment in the JDK bug tracker seems to work around the issue, at least on i3.

Hnaguski avatar Jun 19 '22 22:06 Hnaguski

I can also confirm this with i3. The launch argument trick does seem to fix the issue as well.

Insprill avatar Dec 17 '22 20:12 Insprill