Bug 210603 - [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
Summary: [GTK][X11] REGRESSION(r259944): Wrong position of select popup menu in X11
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk, Regression
Depends on:
Blocks:
 
Reported: 2020-04-16 06:28 PDT by Carlos Garcia Campos
Modified: 2020-04-17 08:25 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.47 KB, patch)
2020-04-17 06:18 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2020-04-16 06:28:41 PDT
It works in Wayland, but fails in X11.
Comment 1 Carlos Garcia Campos 2020-04-16 07:30:40 PDT
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.
Comment 2 Michael Catanzaro 2020-04-16 08:27:11 PDT
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....
Comment 3 Adrian Perez 2020-04-16 16:18:44 PDT
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 🤔️
Comment 4 Carlos Garcia Campos 2020-04-17 06:18:18 PDT
Created attachment 396761 [details]
Patch

Managed to make it work in the end.
Comment 5 Michael Catanzaro 2020-04-17 08:09:38 PDT
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.
Comment 6 EWS 2020-04-17 08:25:00 PDT
Committed r260252: <https://trac.webkit.org/changeset/260252>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396761 [details].