Bug 252873 - x11-wm/twm menubar/menus fail to open
Summary: x11-wm/twm menubar/menus fail to open
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: freebsd-desktop (Team)
Depends on:
Reported: 2021-01-21 02:56 UTC by anthony.elizondo+freebsd
Modified: 2021-05-05 03:52 UTC (History)
3 users (show)

See Also:
tcberner: maintainer-feedback+

pkg info (20.72 KB, text/plain)
2021-01-21 02:56 UTC, anthony.elizondo+freebsd
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description anthony.elizondo+freebsd 2021-01-21 02:56:31 UTC
Created attachment 221776 [details]
pkg info

On some GUI applications menus will fail to open. On first attempt they may open, but after some number of successful attempts, eventually it will fail. This happens for on both www/chromium and editors/vscode. It happens both if the applications have been installed from ports, or via pkg. It happens on bare metal hardware and in a VMware Fusion VM.

Steps to reproduce:
1. Start from a stock 12.2-RELEASE installation.
2. Install chromium from ports or via pkg
3. Click on kebab ("more options") icon. 

Here is a video recording of the bug in action. On the first open of chromium the menu does not open at all. On a subsequent attempt it opens the first time, but then later does not open.


This bug also occurs with Visual Studio Code, clicking on the menubar ("File, Edit, etc.") Hence, my filing this bug under a common library, x11-toolkits/gtk30. If the bug does not lie in x11-toolkits/gtk30 feel free to rename/reassign. 

uname -a:
FreeBSD pepper 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC  amd64
Comment 1 anthony.elizondo+freebsd 2021-01-21 15:12:12 UTC
Tested other GUI applications, and the bug does not occur with Audacity or Firefox.

It has been suggested that twm may be the source of the bug, and maybe related to focus follow? https://old.reddit.com/r/freebsd/comments/l1pm1g/bug_where_menus_will_not_open_chromium_vs_code/gk0xyx1/

I also found https://community.oracle.com/tech/developers/discussion/3547864/rhel-6-4-using-twm-and-vnc-issue-with-mouse-clicks-in-java-fx-2-2-app which describes similar behavior.

I tried out ctwm and I cannot get the bug to occur. All menus open fine.
Comment 2 Tobias C. Berner freebsd_committer 2021-01-21 20:50:23 UTC
(In reply to anthony.elizondo+freebsd from comment #1)
Moin moin 

I would recommend, that you test whether it works with a different window manager for you. If so, then it is a twm issue, if not, we can investigate further.

mfg Tobias
Comment 3 anthony.elizondo+freebsd 2021-01-21 21:48:26 UTC
> I tried out ctwm and I cannot get the bug to occur. All menus open fine.
Comment 4 Tobias C. Berner freebsd_committer 2021-01-21 22:05:04 UTC
(In reply to anthony.elizondo+freebsd from comment #3)

You might be able to set an environment variable suggesting that you are running a desktop like gnome or kde, and see if it works then in twm, for example XDG_CURRENT_DESKTOP 

mfg Tobias
Comment 5 anthony.elizondo+freebsd 2021-01-22 00:16:08 UTC
In twm I tried setting XDG_CURRENT_DESKTOP to "kde" first, then tried "GNOME". Neither had any effect on either VSCode or Chromium.
Comment 6 anthony.elizondo+freebsd 2021-02-01 19:38:56 UTC
Title updated.

I posted to https://old.reddit.com/r/freebsd/comments/l1pm1g/bug_where_menus_will_not_open_chromium_vs_code/ and confirmed others can reproduce.
Comment 7 Tobias C. Berner freebsd_committer 2021-02-08 18:59:06 UTC
(In reply to anthony.elizondo+freebsd from comment #6)
Moin moin 

Have you tried the patch attached in redit?

mfg Tobias
Comment 8 commit-hook freebsd_committer 2021-05-04 23:11:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1c31059e3d1233fdbaee9b89ff041365f1710d17

commit 1c31059e3d1233fdbaee9b89ff041365f1710d17
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-05-04 10:12:41 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-05-04 23:10:26 +0000

    x11-wm/twm: generate synthetic WM hints when needed

    This is based on a patch from Reddit -- the patch on Reddit is in
    context-diff form and contains a bunch of cruft, so it's been
    re-done (in add_window.c ; the util.c part is used unchanged).
    Tested by running Chrome in previous twm -- no drop-downs at
    all -- and in this lightly patched one, where it does behave.

    PR:             252873
    Obtained from:  Reddit

 x11-wm/twm/Makefile                            |  1 +
 x11-wm/twm/files/patch-src_add__window.c (new) | 12 +++++++
 x11-wm/twm/files/patch-src_util.c (new)        | 47 ++++++++++++++++++++++++++
 x11-wm/twm/files/patch-src_util.h (new)        | 11 ++++++
 4 files changed, 71 insertions(+)
Comment 9 Adriaan de Groot freebsd_committer 2021-05-04 23:28:34 UTC
The Reddit patch had a bunch of duplication and the latter part (of the patch to add_window.c) seemed to be duplicate code with lots of unsure-comments, so I left it out. Testing with Chromium shows that the issue -- at least the one I could see in the video -- is resolved.