Device screen view bugs out in tiling WMs
Environment
- OS: Arch Linux
- scrcpy version: 1.17.r3.ged130e0-1
- installation method: AUR
- device model: Samsung Galaxy S21 Ultra 5G SM-G998B/DS
- Android version: 12
Describe the bug
On a tiling window manager such as i3, where the window size is forced, scrcpy is unable to properly handle when the device rotates. When the device rotates from landscape to portrait, the device screen moves over to the left of the window like this:
And when it goes from portrait to landscape it goes into the bottom left corner like this

In either of these states the device screen does not register mouse clicks properly or at all. This is fixed by toggling the window between full screen and not full screen.
Unfortunately, I'd say this is a problem/limitation in SDL (the library used by scrcpy for windowing/rendering): scrcpy requests the window to be resized, but if it is actually tiled, the state is inconsistent, and if I'm not mistaken, scrcpy can't know.
Maybe something could be done on the scrcpy side, but I don't know.