After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 794935 - Notebook popup got misplaced on Wayland after port to GMenu
Notebook popup got misplaced on Wayland after port to GMenu
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: general
3.28.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-04-03 15:44 UTC by Debarshi Ray
Modified: 2018-04-04 07:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
window: Don't misplace the notebook popup on Wayland (3.50 KB, patch)
2018-04-03 16:59 UTC, Debarshi Ray
committed Details | Review
window: Remove redundant function call (1.18 KB, patch)
2018-04-03 17:00 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2018-04-03 15:44:43 UTC
Since the port to GMenu, the popup menu triggered by right-clicking a notebook tab doesn't show up at the expected location. On an LTR locale with 2 monitors, it shows up quite a bit outside the right edge of the window.

Commit 0820b3853a3b7c62 consolidated the GtkWidget::popup-menu and GtkWidget::button-press-event handlers. As a result gtk_menu_popup is now called with position_menu_under_widget as the GtkMenuPositionFunc in both cases. As far as I can tell, this was only working so far because the GtkWidget::popup-menu handler was never (?) invoked. Hence the GtkMenuPositionFunc wasn't getting used. Now that it's also being used by the GtkWidget::button-press-event handler, the problem is more visible.
Comment 1 Debarshi Ray 2018-04-03 16:45:06 UTC
Using a GtkMenuPositionFunc leads to the legacy GtkMenu positioning code (ie. gtk_menu_position_legacy, see bug 756579) being used which uses gtk_window_move to position the popup window. This doesn't work on Wayland because Wayland clients don't have access to the global co-ordinate system.

How about not using a GtkMenuPositionFunc and letting GtkMenu:attach-widget do the placement? This seems to have worked well for the GtkWidget::button-press-event handler so far.
Comment 2 Debarshi Ray 2018-04-03 16:59:57 UTC
Created attachment 370492 [details] [review]
window: Don't misplace the notebook popup on Wayland
Comment 3 Debarshi Ray 2018-04-03 17:00:30 UTC
Created attachment 370493 [details] [review]
window: Remove redundant function call
Comment 4 Egmont Koblinger 2018-04-03 18:42:33 UTC
Hooray!

I saw a couple of bugreports, can't remember if I could reproduce it myself, I automatically assumed it was a GTK+ bug.
Comment 5 Christian Persch 2018-04-03 18:52:23 UTC
Comment on attachment 370492 [details] [review]
window: Don't misplace the notebook popup on Wayland

Master and 3-28, please. Thanks!
Comment 6 Christian Persch 2018-04-03 18:52:32 UTC
Comment on attachment 370493 [details] [review]
window: Remove redundant function call

Master and 3-28, please. Thanks!
Comment 7 Egmont Koblinger 2018-04-03 18:54:12 UTC
We're talking about this issue, correct?

https://askubuntu.com/q/1001629/398785
Comment 8 Debarshi Ray 2018-04-04 07:02:13 UTC
Pushed to both master and gnome-3-28. Thanks for the review.
Comment 9 Debarshi Ray 2018-04-04 07:08:39 UTC
(In reply to Egmont Koblinger from comment #7)
> We're talking about this issue, correct?
> 
> https://askubuntu.com/q/1001629/398785

That looks like a different problem. In this case, only the position of the popup menu is wrong, but the menu itself is not oversized or cut-off.