Bug 90437

Summary: [GTK] Don't show accel labels in context menu items
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch mrobinson: review+

Description Carlos Garcia Campos 2012-07-03 01:12:41 PDT
When a context menu item is created with a GtkMenuItem that has been created from a GtkAction, if the action has an accelerator, it's shown in the menu item label, like menu items in a menu bar. In that case we should reset the accel closure of the menu item label, like GtkUIManager does for popup menus, to make sure the accelerator is not shown. This isn't needed for all other ContextMenuIem constructors, because the GtkAction is created without accelerator by webkit in those cases.
Comment 1 Carlos Garcia Campos 2012-07-03 01:15:59 PDT
Created attachment 150554 [details]
Patch
Comment 2 Martin Robinson 2012-07-03 08:06:30 PDT
Comment on attachment 150554 [details]
Patch

I'm not totally sure I understand the patch. Is the issue that accelerator labels are still showing up or that they are both showing up and active? Does gtk_accel_label_set_accel_closure have the side effect of hiding accelerator labels and disabling the accelerator?
Comment 3 Carlos Garcia Campos 2012-07-03 08:31:49 PDT
(In reply to comment #2)
> (From update of attachment 150554 [details])
> I'm not totally sure I understand the patch. Is the issue that accelerator labels are still showing up or that they are both showing up and active? Does gtk_accel_label_set_accel_closure have the side effect of hiding accelerator labels and disabling the accelerator?

This doesn't affect the action accelerator which is not active while the context menu is shown. For example, if you create a GtkAction for Paste with CTRL+V as shortcut, and _Paste as label. When the context menu is not active you can do CTRL+V to trigger the paste action. When the context menu is active you can just press 'p' to trigger the action, but CTRL+V won't work. When the context menu is built, GTK+ doesn't know whether the menu is part of a menubar or a popup, and the shortcut (CTRL + V) is shown at the right of the menu item. To avoid it, we can simply reset the accel closure of the label contained in the menu item (in case it's an accel label, of course).
Comment 4 Carlos Garcia Campos 2012-07-03 23:18:40 PDT
Committed r121829: <http://trac.webkit.org/changeset/121829>