x11: Read window position relative to root window rather than parent

This fixes monitor enter and leave events on X11, and probably other
things.  Previously, it looks like the coordinates were relative to the
top left corner of the window shadow and so never changed.
This commit is contained in:
Ben Mather
2024-02-19 11:17:09 +00:00
parent a2b84fc98a
commit cb652c7f0f

View File

@@ -2655,6 +2655,7 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
{
GdkX11Surface *impl;
Window root;
Window child;
int tx;
int ty;
guint twidth;
@@ -2669,7 +2670,11 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
root, 0, 0, &tx, &ty, &child);
if (x)
*x = tx / impl->surface_scale;
if (y)