lxqt / lxqt-qtplugin

LXQt Qt platform integration plugin
https://lxqt.github.io
GNU Lesser General Public License v2.1
24 stars 14 forks source link

Added an option to show context menus on releasing mouse button #79

Closed tsujan closed 8 months ago

tsujan commented 10 months ago

It brings the behavior of MS Windows to Qt apps. The key is context_menu_on_mouse_release under the [General] section of ~/.config/lxqt/lxqt.conf, and it can be true or false (false by default).

Pros:

  1. With this option enabled, the user can right click without fearing that a menu-item might be activated by mistake. Many users have experienced unintentional activation.
  2. It makes right click be a real click (= press + release) and consistent with left click.
  3. LXQt might be the first Linux DE providing its users with this option. That could motivate others to take it seriously. In particular, Qt might become more self-consistent about it.

Cons:

  1. Running apps can't see its toggling. App restart — or preferably, session restart — is needed.
  2. There's a hidden problem in libqtxdg (inherited from a similar problem in Qt) and another one in lxqt-panel's main menu. But they can be fixed easily.
  3. Of course, nothing can be done about non-Qt apps.

NOTE: It can't be confusing to users because context menus are already shown on mouse release in notification area (an inconsistency not noticed by many).

tsujan commented 9 months ago

I should have added this to the "Cons" list:

Sadly, there's an inconsistency (or a group of related bugs) in Qt: Although ContextMenuOnMouseRelease exists, Qt doesn't treat it as a real parameter. Instead, it assumes that it should be true only under MS Windows.

For example, under Linux, QAbstractItemView will activate items on right clicking by default if they're activated by single clicking. This behavior can be seen in Qt's default file dialog. Some apps (like libfm-qt) may avoid it by chance; others just inherit it. The fact that all codes could override it wouldn't make it less serious.

stefonarch commented 8 months ago

I noticed that multiple selection of files (pressing ctrl) is weird with this setting in single click mode: it opens the file too.

tsujan commented 8 months ago

I noticed that multiple selection of files (pressing ctrl) is weird with this setting

In the one month that I used it, I saw no problem other than what I mentioned above. But I'd also applied two other patches related to it (although none of them was in libfm-qt).

Anyway, I stopped using it after a month, because Qt itself wasn't self-consistent about it (→ my previous comment). Therefore, I see no reason to keep this PR open. Its comments can serve as a source of info though

tsujan commented 8 months ago

Although I closed this, it's a lifesaver on Wayland :) Because it's the only workaround for an old Qt issue (from which Qt6 suffers too). See https://github.com/tsujan/Kvantum/discussions/911 for the reason.

In short, only with context menus being shown on releasing mouse button, if an inactive Qt window is right clicked on Wayland, it'll be properly activated before showing a context menu.