Description: I have an extension and want to add a top-level menu (so it's own entry in the menu bar itself), with the menu provided by a PopupMenuController. This works on Windows (last I tested in late 2019) and with the gen VCL plugin on Linux. It does not work with the gtk VCL plugin. For the latter, the menu bar has the extra item, but the menu is unpopulated and the menu controller isn't "fired". I'm using this in https://github.com/lernapparat/lotranslate/ but as this has C extension module dependencies, it is a bit harder to get to run than the BookmarksMenu extension, which shows the same phenomenon: https://github.com/hanya/BookmarksMenu I have yet to make sure if it is the top-level aspect specifically or if it is generally with popup menus (although this might not gone unnoticed, given LibreOffice's internal use of popup menus). Steps to Reproduce: Install the bookmarks menu extension linked above (it has not been updated recently, but it works on November git libreoffice) and look at the "Bookmarks" heading. Setting with "SAL_USE_VCLPLUGIN=gtk3 ./instdir/program/soffice", the bookmark menu only has the "<no selection possible>" placeholder, with SAL_USE_VCLPLUGIN=gen, the menu appears. Actual Results: Depending on the backend, the menu is present or not. Expected Results: Always get the menu. Reproducible: Always User Profile Reset: Yes Additional Info: Debian seems to use the gen backend by default, which works. Windows seems to work, too. A self-built git checkout seems to use gtk by default, which doesn't work, but forcing gen works. I didn't check other backends.
I think I found the root cause of my problem. VCL GTK (in contrast to X11 and apparently Windows) pre-activates popup menus in GtkSalMenu::UpdateFull by calling GtkSalMenu::ActivateAllSubmenus defined here: https://git.libreoffice.org/core/+/406e1d123500b1c40a32055c3876ab06e88370e8/vcl/unx/gtk3/gtk3gtksalmenu.cxx#1206 This roughly does (excuse my using of Python as pseudocode): def activate_all_submenus(self): for i in self.menuitems: if i.has_submenu: activate(i.submenu) i.submenu.activate_all_submenus() but this, called on the main menu, does not activate the main menu itself! Changing the logic to def activate_all_submenus(self): activate(self) for i in self.menuitems: if i.has_submenu: i.submenu.activate_all_submenus() makes my usecase work. I'll submit a patch changing this. I haven't discovered yet where the VCL tests would live, so I'm not entirely sure how I would design a test case and where I would put it.
A similar update would apply to the VCL Qt5 plugin in Qt5Menu::DoFullMenuUpdate .
My attempt at a fix: https://gerrit.libreoffice.org/c/core/+/106454
Thomas Viehmann committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/cbc18cc904c652a936c4b68fba4d975bd89b5abd tdf#138425 vcl/gtk activate main menu in UpdateFull It will be available in 7.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thomas Viehmann committed a patch related to this issue. It has been pushed to "libreoffice-7-1": https://git.libreoffice.org/core/commit/5270d6901ba69f411b595fa9e2d123169905ab72 tdf#138425 vcl/gtk activate main menu in UpdateFull It will be available in 7.1.0.0.beta2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
A polite ping to Thomas Viehmann: Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing? Thanks
GTK is fixed, I forget if there was some other toolkit also not getting the menus.