[gtk/gtk-3-24: 1/2] gdk/wayland: Properly calculate coordinates for show_window_menu()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] gdk/wayland: Properly calculate coordinates for show_window_menu()
- Date: Mon, 1 Apr 2019 11:11:23 +0000 (UTC)
commit 35c4627fac119a7259fc0450e26091ea58173069
Author: Robert Mader <robert mader posteo de>
Date: Fri Mar 29 22:38:32 2019 +0100
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
gdk/wayland/gdkwindow-wayland.c | 6 ++++++
1 file changed, 6 insertions(+)
---
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]