[Libreoffice-bugs] [Bug 138425] Adding a menu bar entry given by a PopupMenuController in an extension doesn't work with GTK

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Mon Nov 23 19:34:34 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=138425

--- Comment #1 from Thomas Viehmann <tv.bugs.freedesktop.org at beamnet.de> ---
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20201123/23a65624/attachment.htm>


More information about the Libreoffice-bugs mailing list