ValveSoftware / Dota-2

Tracker for issues specific to Linux and Mac in the Reborn client. If you have a general issue or non-system-specific feature request please go to dev.dota2.com
470 stars 38 forks source link

[Linux] Game not capturing mouse on multi-monitor setup #2705

Open eeceebee opened 3 months ago

eeceebee commented 3 months ago

Your system information

Please describe your issue in as much detail as possible:

On a multi-monitor setup (Wayland, Mesa, Gnome, OpenSUSE tumbleweed) the mouse is not being captured by the game window when using "Desktop-Friendly Fullscreen".

The mouse is free to move from the primary monitor (using DisplayPort) onto the second monitor (using HDMI).

What should happen is: the mouse should be free to leave the game window while on the menu, but then be captured by the game window (and not allowed to leave) once a game has started.

Additionally: The mouse IS being captured when using "Borderless Window" however the game will only launch on the second monitor and cannot be moved to the correct (main) monitor. Changing "-sdl_displayindex" or adding "-phased_window_create" has no effect.

I've seen a few semi-related issues from the past, but they generally are the reverse: Borderless Window doesn't capture the mouse. The proposed solutions are generally to try adding -phased_window_create to launch options.

Steps for reproducing this issue:

  1. Launch Dota 2
  2. Create a custom lobby (or join a game)
  3. Move cursor out of the game window and onto the second monitor.
Strykar commented 3 months ago

Same issue on Arch Linux with two monitors. I have to disable and turn off the secondary monitor or the mouse is unplayable.

Steam sysinfo - https://gist.github.com/Strykar/12b6dfdd413b9708e728fba8c199be0d

ivakam commented 3 months ago

I'm having similar issues to @Strykar . Mouse is "locked" to the left half of the screen when in-game, seems to be that the mouse region is not positioned correctly in relation to where the game window actually is. Borderless/exclusive does not seem to matter.

gomes1876 commented 3 months ago

im with the same problem :(

geez0x1 commented 3 months ago

Same as @ivakam , since updating to Ubuntu 24.04 from 23.10. Three monitor setup (1080p, 1440p, 1080p) with the game on the middle one. Once I click in the left, say, 25% of the game, the cursor gets stuck there. Unfocusing the window or moving it onto another monitor fixes it until I click there again. Tried running the game at different resolutions, on other monitors, and with different window options, to no avail.

Dannflower commented 2 months ago

Echoing what @ivakam & @geez0x1 are seeing. My second monitor is positioned to the left of my primary monitor. If I were to take a guess, @ivakam is right on the money with their assessment. The region that the mouse gets "locked" to on my primary monitor is roughly 1/4 of the screen which would would track as 2560 - 1920 = 640 (the horizontal difference in resolution on my monitors). I suspect the size of the mouse capture zone is correct, but it's starting from the left-most monitor instead of the monitor the game is display on.

Also, I am seeing this in most games run via Steam when in fullscreen mode. So it's not exclusive to Dota 2.

Might be related to:

My setup: Ubuntu 24.04 Gnome (Wayland) Nvidia drivers: 555.52.04

Kwaadpepper commented 2 months ago

If anyone is seeing this, I use %command% -sdl_displayindex 1 dota_mouse_window_lock 1 as launch parameters on steam to allow me to play on multi monitor setup Ubuntu 24.04 (PopOs) with wayland

The mouse will be able to quit the screen out of a match, but when in an actual match, it will fit the monitor it is running on.

eeceebee commented 2 months ago

Small update on this:

I was still having issues with this, however as a workaround moving my secondary monitor to the right of the primary monitor fixes the issue.

This seems to specifically be related to secondary monitors located to the left of the primary monitor.

geez0x1 commented 2 months ago

@Kwaadpepper's solution doesn't work on my setup, which is quite possibly of what @eeceebee described; my left-most monitor is 1080p while the middle one is 1440p. (yes I tried changing the index). When on the left-most screen, the mouse actually gets stuck at the bottom (which is even more odd - no screen has smaller than 1080p vertical resolution)

Dannflower commented 1 month ago

Since I've been seeing this bug in quite a few games, I've opened a separate issue on the Proton side as well as it's unclear to me if it's a Wayland, Wine, or Proton quirk.

SQalliT commented 1 month ago

Since I've been seeing this bug in quite a few games, I've opened a separate issue on the Proton side as well as it's unclear to me if it's a Wayland, Wine, or Proton quirk.

* [Incorrect mouse capture area with fullscreen games when secondary monitor is left of the primary monitor Proton#7902](https://github.com/ValveSoftware/Proton/issues/7902)

You cant play dota under proton, it doesnt let you queue for games, so I doubt its a proton issue.

Dannflower commented 1 month ago

You cant play dota under proton, it doesnt let you queue for games, so I doubt its a proton issue.

Ah, bad assumption on my part when I opened that issue. Thanks for pointing it out. For what it's worth, I ended up switching over to Fedora 40 and this issue is not present.