GNOME Bugzilla – Bug 794935
Notebook popup got misplaced on Wayland after port to GMenu
Last modified: 2018-04-04 07:09:56 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.
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.
Created attachment 370492 [details] [review] window: Don't misplace the notebook popup on Wayland
Created attachment 370493 [details] [review] window: Remove redundant function call
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 on attachment 370492 [details] [review] window: Don't misplace the notebook popup on Wayland Master and 3-28, please. Thanks!
Comment on attachment 370493 [details] [review] window: Remove redundant function call Master and 3-28, please. Thanks!
We're talking about this issue, correct? https://askubuntu.com/q/1001629/398785
Pushed to both master and gnome-3-28. Thanks for the review.
(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.