ec58e74cc5
The previous logic tried to keep the position of the top left corner of the window relative to the top left corner of the monitor. This allowed the window to move out of the target monitor. This change keeps the proportions of the distance between the window and the monitor borders instead if possible. Otherwise it keeps the relative position of the center of the window clamped to [0,1] to make sure the window lands on the right output. This also slightly changes what monitor is considered to be on: the monitor which contains the center of the window and, if the center is on no monitor, the monitor wich overlaps the most with the window. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2591>