Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 505992

Summary: [Gtk] Replace deprecated gtk_menu_popup
Product: [Eclipse Project] Platform Reporter: Leo Ufimtsev <lufimtse>
Component: SWTAssignee: Ian Pun <ipun>
Status: VERIFIED FIXED QA Contact: Leo Ufimtsev <lufimtse>
Severity: normal    
Priority: P2 CC: akurtako, arunkumar.thondapu, ericwill, gautier.desaintmartinlacaze, ipun, lufimtse, peter
Version: 4.6   
Target Milestone: 4.8   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/98030
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=7714fdbf1ce0110744da9c164486c12254d5bd6f
Whiteboard:
Bug Depends on:    
Bug Blocks: 496923, 516841    
Attachments:
Description Flags
Modified snippet for testing of asynchronous calls to Menu none

Description Leo Ufimtsev CLA 2016-10-14 10:18:17 EDT
As Eric discovered,  gtk_menu_popup was deprecated in master gtk branch:
https://bugzilla.gnome.org/show_bug.cgi?id=772552

The reason is it caused positioning issues on non-x11 backends (like Wayland..).

It's currently not listed as 'deprecated' in the documentation, but upon the next release it will be.
https://developer.gnome.org/gtk3/unstable/GtkMenu.html#gtk-menu-popup

We use the call in setVisible(..), we should replace that function call.
Comment 1 Arun Thondapu CLA 2017-05-25 09:26:25 EDT
gtk_menu_popup has been deprecated officially now (since version 3.22). We should fix this in 4.8.
Comment 2 Ian Pun CLA 2017-05-25 16:57:50 EDT
I'll take a look at this, looks like popup is being called outside of a trigger event, which is required by the new methods.
Comment 3 Eclipse Genie CLA 2017-05-26 09:43:51 EDT
New Gerrit change created: https://git.eclipse.org/r/98030
Comment 4 Ian Pun CLA 2017-06-06 18:11:22 EDT
Current implementation of how gtk_menu_popup is done is that everything is hooked to a event stack inside Display. However, the new implementation of using gtk_menu_popup_at_pointer() requires it to be done within a gtkEvent. This is difficult to do as many applications use setVisible() on the Menu widget, which is gtkEvent independent. We would need to figure out a situation on how to support setVisible() to somehow generate a gtkEvent in which we can attach our gtk_menu_popup_at_pointer() function from.
Comment 5 Ian Pun CLA 2017-06-19 16:22:19 EDT
Created attachment 268963 [details]
Modified snippet for testing of asynchronous calls to Menu
Comment 6 Ian Pun CLA 2017-06-19 16:27:46 EDT
attached snippet was used to test if the patch will work with asynchronous calls to menu
Comment 7 Leo Ufimtsev CLA 2017-06-20 11:26:38 EDT
@Ian, btw, if time permits, could you also investigate deprecated gtk_im_multicontext_append_menuitems()?
Comment 9 Leo Ufimtsev CLA 2017-06-20 14:20:53 EDT
Thank you for patch.