Bug 75357

Summary: [GTK] Context menu is hidden right after showing it when first menu item is not disabled
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: gustavo, pnormand
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Patch mrobinson: review+

Description Carlos Garcia Campos 2011-12-29 08:18:52 PST
It can be reproduced by right clicking on a link, the popup menu is deactivated right after showing it unless mouse button is not released. The problem is that we are passing GDK_CURRENT_TIME (which is 0) to gtk_popup_menu, because the eventas are async and gtk_get_current_event will be NULL when calling gtk_menu_popup. GtkMenu has a timeout to decide whether the press-release was fast enough and ignore the button release event in that case. That way, a normal right click shows the menu while a long press hides the menuwhen the button is released. So, we need to know the real time when the right button was pressed and pass it to gtk_popup_menu.
Comment 1 Carlos Garcia Campos 2011-12-29 08:23:39 PST
Created attachment 120751 [details]
Patch
Comment 2 Carlos Garcia Campos 2011-12-29 08:26:29 PST
Ah!, and the reason why it works when the first item is not disabled is because when the timeout is passed, the button release event is also ignored if the first menu item (that receives the release event) is not sentitive.
Comment 3 Martin Robinson 2011-12-29 08:32:26 PST
Comment on attachment 120751 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=120751&action=review

Nice!

> Source/WebKit2/UIProcess/WebPageProxy.h:595
> +    // WebPopupMenuProxy::Client

If you leave a comment here, I think it should be a full  sentence here. "Called by WebPopupMenuProxy::Client." for instance.
Comment 4 Carlos Garcia Campos 2011-12-29 08:37:21 PST
(In reply to comment #3)
> (From update of attachment 120751 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=120751&action=review
> 
> Nice!
> 
> > Source/WebKit2/UIProcess/WebPageProxy.h:595
> > +    // WebPopupMenuProxy::Client
> 
> If you leave a comment here, I think it should be a full  sentence here. "Called by WebPopupMenuProxy::Client." for instance.

It's an existing comment, just copied, see:

http://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/WebPageProxy.h#L600

And it means that those methods are the implementation of the WebPopupMenuProxy::Client virtual methods.
Comment 5 Carlos Garcia Campos 2011-12-29 08:39:26 PST
Committed r103802: <http://trac.webkit.org/changeset/103802>