From: Matthias Clasen Date: Sun, 17 May 2020 06:05:32 +0000 (-0400) Subject: windowhandle: Take surface transform into account X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~17^2~24^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d2913b81cb3008caf9d1141c8c99d94eb2776306;p=gtk4.git windowhandle: Take surface transform into account --- diff --git a/gtk/gtkwindowhandle.c b/gtk/gtkwindowhandle.c index 9f4960c370..3e411465b5 100644 --- a/gtk/gtkwindowhandle.c +++ b/gtk/gtkwindowhandle.c @@ -28,7 +28,7 @@ #include "gtkgestureprivate.h" #include "gtkintl.h" #include "gtkmodelbuttonprivate.h" -#include "gtknative.h" +#include "gtknativeprivate.h" #include "gtkpopovermenuprivate.h" #include "gtkprivate.h" #include "gtkseparator.h" @@ -219,13 +219,17 @@ do_popup_fallback (GtkWindowHandle *self, if (device) { + GtkNative *native; GdkSurface *surface; double px, py; + int nx, ny; - surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self))); + native = gtk_widget_get_native (GTK_WIDGET (self)); + surface = gtk_native_get_surface (native); gdk_surface_get_device_position (surface, device, &px, &py, NULL); - rect.x = round (px); - rect.y = round (py); + gtk_native_get_surface_transform (native, &nx, &ny); + rect.x = round (px) - nx; + rect.y = round (py) - ny; gtk_widget_translate_coordinates (GTK_WIDGET (gtk_widget_get_native (GTK_WIDGET (self))), GTK_WIDGET (self),