diff options
author | Robert Mader <robert.mader@posteo.de> | 2019-03-29 22:38:32 +0100 |
---|---|---|
committer | Robert Mader <robert.mader@posteo.de> | 2019-04-01 11:11:12 +0200 |
commit | 35c4627fac119a7259fc0450e26091ea58173069 (patch) | |
tree | 3c2ca58b8d6c44cbbbba61c9ff0e671de04c8ce3 | |
parent | 59a272fdeffd6375840f4db3ff95e0f66af4f834 (diff) | |
download | gtk+-35c4627fac119a7259fc0450e26091ea58173069.tar.gz |
gdk/wayland: Properly calculate coordinates for show_window_menu()
The event received in `gdk_wayland_window_show_window_menu()` can
come from widgets with a GdkWindow. In those cases the coordinates
are relative to the widget, not the root window.
This results in a misplaced window menu.
Properly calculate the coordinates by iterating to the toplevel
window as suggested by Carlos Garnacho.
https://gitlab.gnome.org/GNOME/gtk/merge_requests/684
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 70f1044d9b..7007f30ce3 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -4478,6 +4478,12 @@ gdk_wayland_window_show_window_menu (GdkWindow *window, seat = gdk_wayland_device_get_wl_seat (GDK_DEVICE (device)); gdk_event_get_coords (event, &x, &y); + while (gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL) + { + gdk_window_coords_to_parent (window, x, y, &x, &y); + window = gdk_window_get_effective_parent (window); + } + serial = _gdk_wayland_device_get_implicit_grab_serial (device, event); switch (display_wayland->shell_variant) |