GNOME Bugzilla – Bug 772507
context menu is cropped by screen edge on wayland
Last modified: 2016-10-12 10:39:32 UTC
Created attachment 337061 [details] context menu cropped on wayland On Wayland, quite often the context menu is displayed in such a position that it is cropped by screen edge. Unlike on X11, where it always shows the context menu in such position that it fits on the screen. See screenshot. gnome-shell-3.22.0-1.fc25.x86_64 gtk3-3.22.0-2.fc25.x86_64 mutter-3.22.0-2.fc25.x86_64 nautilus-3.22.0-1.fc25.x86_64
Created attachment 337062 [details] the same menu fitting the screen on X11
moving to gtk+, nautilus didn't change anything here and it works in X11
we use gtk_menu_popup with not much parameters. The corresponding code is in: https://git.gnome.org/browse/nautilus/tree/src/nautilus-ui-utilities.c#n200
You probably want to try using `gtk_menu_popup_at_pointer()` (new in GTK+ 3.22) or `gtk_menu_popup_at_widget()`, given that `gtk_menu_popup()` with only NULL arguments may make it unreliable on windowing systems without global coordinates like Wayland. See also: https://blog.gtk.org/2016/07/15/future-of-relative-window-positioning/
(In reply to Emmanuele Bassi (:ebassi) from comment #4) > You probably want to try using `gtk_menu_popup_at_pointer()` (new in GTK+ > 3.22) or `gtk_menu_popup_at_widget()`, given that `gtk_menu_popup()` with > only NULL arguments may make it unreliable on windowing systems without > global coordinates like Wayland. > > See also: > https://blog.gtk.org/2016/07/15/future-of-relative-window-positioning/ I see. Shouldn't gtk_menu_popup be deprecated if it doesn't work correctly in wayland?
Created attachment 337072 [details] [review] ui-utilities: use gtk_menu_popup_at_pointer instead of gtk_popup_menu We were using gtk_popup_menu which is problematic in backends with no global coordinates like wayland. To fix it, we can use gtk_menu_popup_at_pointer which uses the event relative coordinates. Also, seems the custom handling we were doing for the popup menu in that code is obsoleted, so there is not need to specify the button.
Created attachment 337073 [details] [review] ui-utilities: use gtk_menu_popup_at_pointer instead of gtk_popup_menu We were using gtk_popup_menu which is problematic in backends with no global coordinates like wayland. To fix it, we can use gtk_menu_popup_at_pointer which uses the event relative coordinates. Also, seems the custom handling we were doing for the popup menu in that code is obsoleted, so there is not need to specify the button.
Moving back to nautilus, IIUIC.
(In reply to Kamil Páral from comment #8) > Moving back to nautilus, IIUIC. yeah thanks, this is the gtk+ bug for deprecating gtk_menu_popup https://bugzilla.gnome.org/show_bug.cgi?id=772552
Emmanuele, since you are here... could you review my patch for Nautilus at comment 7? There is some warning as comment there for some fragility at gtk+, I believe that's obsoleted right? At least I couldn't reproduce if I understood correctly what it's supposed to happen.
You want Jonas, not me, for a review — as well as feedback on whether gtk_menu_popup() is not working correctly.
What's interesting is that I cannot reproduce this for the bottom edge, but only for the right edge.
Let's commit this for 3.22.1 Attachment 337073 [details] pushed as 1f57c5b - ui-utilities: use gtk_menu_popup_at_pointer instead of gtk_popup_menu
gtk_menu_popup is problematic indeed. Maybe we can try to make it use the new API internally in more places, but we it should rather be deprecated. The patch that was just pushed looks good to me.
(In reply to Jonas Ådahl from comment #14) > gtk_menu_popup is problematic indeed. Maybe we can try to make it use the > new API internally in more places, but we it should rather be deprecated. > The patch that was just pushed looks good to me. I see, I reported https://bugzilla.gnome.org/show_bug.cgi?id=772552 for deprecating it. Also, thanks for looking at the patch, do you know why of that warning in the code? Is that fragility gone?