XWayland: Handle Monitor Hotplugging better.
I have a dual monitor setup, and my primary display has a broken implementation of DP deep sleep, that causes my PC to think it's unplugged.
When the monitor is plugged in the monitor gets a new name, for example:
on login with Sway, I See:
❯ xrandr --listmonitors
Monitors: 2
0: +*XWAYLAND0 2560/700x1440/390+1080+0 XWAYLAND0
1: +XWAYLAND1 1080/510x1920/290+0+0 XWAYLAND1
After my monitor goes a sleep:
Note that my 2560x1440 display is no longer the primary display, and has a new name.
❯ xrandr --listmonitors
Monitors: 2
0: +XWAYLAND1 1080/510x1920/290+0+0 XWAYLAND1
1: +XWAYLAND2 2560/700x1440/390+1080+0 XWAYLAND2
After several sleeps my display will have the name XWAYLAND12.
This breaks the ability for X apps to discover the correct screen for full screen resolution, and will create highly distorted, 9:16, 1080x1920 pictures on my non-primary display if the app supports it, and Windows games will refuse to select higher than 1024x768 most of the time.
This means every time before I launch a game, I have to run xrandr --output XWAYLAND<X> --primary
to get the game to correctly display.