swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.12k stars 1.08k forks source link

Mouse input coordinates messed up in Iron Harvest with multiple outputs #5753

Open emersion opened 3 years ago

emersion commented 3 years ago

Steam with Proton 5.13.

It seems the game fullscreens itself before mapping on the left output. However X11 doesn't have a "fullscreen output" hint, the window position is used instead to tell the WM which output to pick. We ignore the position right now.

The window sends a bunch of configure requests at position 0,0, and we send back some configure notify events at 1680,0.

00:00:37.164 [DEBUG] [xwayland/xwm.c:926] XCB_CONFIGURE_REQUEST (37748737) [1680x1050+0,0]
00:00:37.164 [sway/desktop/xwayland.c:244] configure 1680.000000 0.000000 2194x1234

We could extract the output from the position when the window is mapped, however I'm not sure all X11 clients set the position properly when mapping (we don't want to open all X11 fullscreen windows on the left output when the user has the right output focused). Ultimately I think the game is just buggy and should handle configure events even if they don't match its expectations.

emersion commented 3 years ago

There's also _NET_WM_FULLSCREEN_MONITORS that we ignore, but seems unused by winex11.

Additionally, clients specify a mask in their configure requests, maybe we could check if the x/y bits are set there to know if the client requested a particular position.

Hermitter commented 3 years ago

This seems to be affecting other games as well. Clicks on some of my games only work on the left monitor or left side of my right widescreen monitor. Tested on Grim Dawn and The Outer Worlds

BrknRobot commented 3 years ago

I'm experiencing this bug with Realm Of The Mad God. This one is free to play, which might make it a good one to test with. It's also built with the Unity Game Engine, which makes me suspect all Unity games may trigger this bug.

ErikReider commented 3 years ago

Had this issue with Phasmophobia (a Unity game). Fixed it by unplugging my left monitor and plugging it back in. If this doesn't work for anyone else, this may be a different issue to this one

RobinMcCorkell commented 3 years ago

I saw a similar issue with Starcraft 2 as well, the cursor has an offset between the clicked/hovered position and where the cursor is rendered.