It works in Wayland, but fails in X11.
Does anybody know how to make gdk_window_move_to_rect() work in X11? It seems we need to convert the coordinates somehow, but I don't know exactly how. gtk_window_move() works fine in X11, so if I can't make gdk_window_move_to_rect() work for both I'll use it only under wayland.
Jonas says: "i don't understand the question. that API is used internally in gtk by both wayland and x11" (In reply to Carlos Garcia Campos from comment #1) > gtk_window_move() works fine in X11, so if I can't make > gdk_window_move_to_rect() work for both I'll use it only under wayland. I learned a Finnish proverb from Adrian: "the reindeer will go where the fence is the lowest." The reindeer are wise....
Maybe the long-term solution for this is using GtkPopover[Menu], like I just did for bug #170553 — then we can let GTK do the positioning work using gtk_popover_set_pointing_to(widget, rect) and gtk_popover_set_position(widget, GTK_POS_BOTTOM) to make the popover appear below the button. If we want to remove the arrow that would point to the button or change the appearance I *think* there are some CSS classes we can set. As for making the popover width at least as long as the button, I think *maybe* we could use a GtkSizeGroup, but maybe if we end up using a popover there is not much point in doing that 🤔️
Created attachment 396761 [details] Patch Managed to make it work in the end.
Comment on attachment 396761 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=396761&action=review > Source/WebKit/ChangeLog:9 > + gdk_window_move_to_rect expects the given rectangle in coordinates relative to the top-left corner of the window > + that the popup window is transient for. We were using screen coordinates. Yup.
Committed r260252: <https://trac.webkit.org/changeset/260252> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396761 [details].