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

Bug 530059

Summary: [Wayland] Show In menu appears in the wrong place
Product: [Eclipse Project] Platform Reporter: Eric Williams <ericwill>
Component: SWTAssignee: Eric Williams <ericwill>
Status: VERIFIED FIXED QA Contact: Eric Williams <ericwill>
Severity: normal    
Priority: P3 CC: gautier.desaintmartinlacaze
Version: 4.8   
Target Milestone: 4.8 M6   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=517147
https://git.eclipse.org/r/116068
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=931aef681a2316e9fe2a414072464b0126f40ff8
https://git.eclipse.org/r/116462
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=0c0152a2978914808aeafa295b48dc521dd5603f
Whiteboard:
Bug Depends on:    
Bug Blocks: 516841    

Description Eric Williams CLA 2018-01-19 15:53:00 EST
In the "Open Resource" dialog, the "Show In" and "Open With" buttons spawn their menus in the wrong place, every time without fail. This is due to Wayland not having global coordinates.

I think their is a way around this but I'll have to investigate further. Note there is no relation to bug 431423, this is a separate issue.
Comment 1 Eric Williams CLA 2018-01-23 12:57:08 EST
The following warning pops up when hitting the "Show In" or "Open With" buttons:

(Eclipse:12994): Gdk-WARNING **: Tried to map a popup with a non-top most parent

Creating a menu on a non-toplevel window is forbidden on Wayland. See: https://bugzilla.gnome.org/show_bug.cgi?id=770745

I'll continue to investigate.
Comment 2 Eric Williams CLA 2018-01-25 14:48:10 EST
More investigation: the bug stems from Menu._setVisible(), which grabs the current GDK event and uses it to pop-the menu up. The GdkWindow attached to this event has the wrong coordinates on Wayland.

The fix is to grab the location of the mouse and pop-up the menu there. This is really the only reliable way to do this on Wayland as absolute coordinates are missing and setLocation() has no effect for now (see bug 530204).
Comment 4 Eric Williams CLA 2018-01-26 15:21:02 EST
(In reply to Eclipse Genie from comment #3)
> Gerrit change https://git.eclipse.org/r/116068 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=931aef681a2316e9fe2a414072464b0126f40ff8

Patch is in master now.
Comment 5 Eclipse Genie CLA 2018-01-31 13:23:00 EST
New Gerrit change created: https://git.eclipse.org/r/116462
Comment 7 Eric Williams CLA 2018-01-31 13:43:24 EST
(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/116462 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=0c0152a2978914808aeafa295b48dc521dd5603f

Added some missing break statements.
Comment 8 Eric Williams CLA 2018-03-06 10:04:28 EST
Verified in I20180305-2000.