| Summary: | [GTK3] Menu.getBounds() returns wrong x & y coordinate | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Michael Seele <mseele> | ||||||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||||
| Status: | CLOSED WORKSFORME | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | ericwill, loskutov | ||||||||
| Version: | 4.7.1a | Keywords: | triaged | ||||||||
| Target Milestone: | --- | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| See Also: |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431423 https://git.eclipse.org/r/110226 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e399c9b546c0ab82a8a635dabb3449cc0d38afdc https://git.eclipse.org/r/110253 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d850566f615e2e8ceaf4c0ad1c77b40e77ccad55 |
||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 271018 [details]
screenshot of the executed snippet (shows the problem)
Related to the bug 431423? I'm a bit unsure as to how this snippet works. Here is the output I got:
getBounds: Rectangle {216, 319, 102, 32}
-----------------------------------------
210 314 6 5 102 32
allocation: 6 5 102 32
bounds: Rectangle {216, 319, 102, 32}
-----------------------------------------
correct bounds: Rectangle {216, 319, 102, 32}
As you can see, the allocation is being added to the bounds, but the "correct bounds" line prints the same bounds as the previous line. This is contrary to what is posted in your screenshot. AFAICT this is still demonstrating the bug, right?
The menu is still appearing at the pointer. BUT, this might help us debug bug 431423.
Created attachment 271019 [details]
Correct snippet to reproduce the bug
I'm sorry, here is the correct snippet (calculation in line 59 & 60 was wrong).
(In reply to Michael Seele from comment #4) > Created attachment 271019 [details] > Correct snippet to reproduce the bug > > I'm sorry, here is the correct snippet (calculation in line 59 & 60 was > wrong). Okay, I can reproduce the issue. New Gerrit change created: https://git.eclipse.org/r/110226 Gerrit change https://git.eclipse.org/r/110226 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e399c9b546c0ab82a8a635dabb3449cc0d38afdc (In reply to Eclipse Genie from comment #7) > Gerrit change https://git.eclipse.org/r/110226 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=e399c9b546c0ab82a8a635dabb3449cc0d38afdc Merged the snippet to reproduce the issue into the platform specific tests repo. New Gerrit change created: https://git.eclipse.org/r/110253 Gerrit change https://git.eclipse.org/r/110253 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d850566f615e2e8ceaf4c0ad1c77b40e77ccad55 (In reply to Michael Seele from comment #0) > The implementation adds allocation.x & allocation.y, which is > wrong. What makes you say that? I ask because AFAICT the addition of allocation.x and allocation.y has been around for awhile even in GTK2 days. This is pretty much the crux of the issue, if there is no good reason to be adding it we can probably just remove it. (In reply to Eric Williams from comment #11) > (In reply to Michael Seele from comment #0) > > The implementation adds allocation.x & allocation.y, which is > > wrong. > > What makes you say that? I ask because AFAICT the addition of allocation.x > and allocation.y has been around for awhile even in GTK2 days. > > This is pretty much the crux of the issue, if there is no good reason to be > adding it we can probably just remove it. I just say that the values between GTK2 and GTK3 differs (so for me, allocation.x & allocation.y in GTK3 is "wrong" comparing to the GTK2 implementation). What we need is a fix, that SWT returns the correct and same coordinates in GTK2 AND GTK3. I'm not into gtk development, so i cannot say which implementation is correct. So GTK2 support has been dropped, does that mean we should close this ticket? There is no more inconsistency since technically there is nothing to compare it to. Thoughts? (In reply to Eric Williams from comment #13) > So GTK2 support has been dropped, does that mean we should close this > ticket? There is no more inconsistency since technically there is nothing to > compare it to. > > Thoughts? ok for me (In reply to Michael Seele from comment #14) > (In reply to Eric Williams from comment #13) > > So GTK2 support has been dropped, does that mean we should close this > > ticket? There is no more inconsistency since technically there is nothing to > > compare it to. > > > > Thoughts? > > ok for me Thanks for the feedback, marking this one as closed. |
Created attachment 271017 [details] Snippet to reproduce the bug Method org.eclipse.swt.widgets.Menu.getBounds() returns wrong x & y coordinates. The implementation adds allocation.x & allocation.y, which is wrong. Please see my attached snippet (you have to run it and do a right-click to open the popup menu). If you run the snippet with GTK2, it works. Because allocation.x & allocation.y are 0. Under GTK3, allocation.x & allocation.y have positive values and therefore the x and y coordinates of menu are wrong. We've tested and reproduced this under Ubuntu 16.04 (gtk3.18.9) and CentOS 7 (gtk3.22.10).