Mouse cursor position relative to the window changes when moving a window between displays with different scaling
Affected version
Fedora 35 Workstation
Mutter 41.1
Wayland only (because GNOME doesn't support per-display scaling in Xorg)
Bug summary
When moving a window from a display with 200% scaling to a display with 100% scaling, by dragging the title bar, the size and the content of the window will change from 200% to 100% at a certain point when it crosses the border (it seems to be when a larger part of the window is in the second display). A use case is moving windows from a high DPI laptop display to a connected projector with low DPI.
However, the resizing of the window is relative to the top left corner of the window (the top left corner is fixed), and the position of the mouse cursor relative to the window is then changed. For example, if I start dragging the window with the cursor in the right half of the title bar, after the window resizes to 100%, the cursor will be completely outside of the window. This is very confusing. A consequent problem is that it's often impossible to move the window to the desired position on the second display, because the cursor would hit the edge of it. Here is a schematic drawing showing this issue:
Steps to reproduce
- Have two displays with one set to 200% scaling and another set to 100% scaling.
- Open a window, e.g. gedit, on the 200% display and move it to the 100% display by dragging the title bar.
What happened
As described in the summary.
What did you expect to happen
The mouse cursor's relative position to the window should not change. There might be many different approaches to this.
In KDE, when the window is on the border of the two displays, each part of the window has the same scaling as the display it's in, so there isn't any obvious resizing, see the following schematic: However, when the window is being moved in the opposite direction, from a 100% to 200%, the content in the 200% part of the window will be blurry until the whole window is within the 200% display. MacOS is similar to KDE but the window will only be visible in one display but not in both simultaneously.
In Windows, the window also resizes like in GNOME, except that the resizing of the window is relative to the cursor position. In this way, the point where the window is grabbed remains the same:
I think any of these approaches is ok and easier to understand than the current behavior in GNOME. But KDE's method seems the best to me.