gtk/main: Make coords out of surface when rewriting events for grabs
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 14 Mar 2022 12:29:11 +0000 (13:29 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 15 Mar 2022 13:29:16 +0000 (14:29 +0100)
commitaa43d97a80ffd07afa3e30d538bf1ebbd4d94e81
treeb3826884a8a06333beb87ee9027c5d182c9e0751
parenteb599653e653ca185648fef3131ad65e3597fd2d
gtk/main: Make coords out of surface when rewriting events for grabs

If a grab is held on a toplevel surface tree, and events happen on a
different surface tree from another toplevel/window group, we rewrite
these events so they look like generated on the window group that
holds the grab, but it missed that coordinates would fail to be
translated, so these would stay unchanged and "pointing" to random
parts of the toplevel that is holding the grab and handling the events.

Since off-surface coordinates are not specially meaningful, and in
fact impossible to obtain in some backends, just fake the coordinates
making it sure that all rewritten events point outside the surface.

The grabbing window will still handle the events, but the coordinates
in these will be harmlessly moot.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4760
gtk/gtkmain.c