RetroArch icon indicating copy to clipboard operation
RetroArch copied to clipboard

Mouse grab off leaves mouse confined to single monitor (Windows)

Open bbbradsmith opened this issue 1 year ago • 3 comments

Description

When mouse grab is released, the mouse cursor re-appears, but if you have multiple screens it will not be able to leave the current screen until you can focus a window besides RetroArch.

This is likely specific to the Windows mouse ungrab implementation.

Expected behavior

When mouse grab is released, the released mouse cursor should be able to move to another screen.

Actual behavior

When mouse grab is released, the mouse cursor is confined to the current screen while RetroArch remains focused.

Steps to reproduce the bug

  1. Start portable Retroarch, default settings, should be windowed.
  2. Launch any game.
  3. Press F11 to grab the mouse.
  4. Press F11 to ungrab the mouse.
  5. Observe that the mouse cursor is now trapped inside the current monitor screen.

Bisect Results

Has been present since at least 1.16.0. but probably goes much further back. (I would guess 1.9.1 based on the blame of the relevant code.)

Version/Commit

  • RetroArch: 1.17.0 (64-bit Windows)

Environment information

  • OS: Windows 10
  • Drivers: (should be default)
    • Menu: ozone
    • Video: d3d11
    • Input: dinput

bbbradsmith avatar May 01 '24 22:05 bbbradsmith

I strongly suspect the problem is here: https://github.com/libretro/RetroArch/blob/7d57f00be35bc2fecab09eb415e71efc0e26450e/gfx/common/win32_common.c#L1963

If turning mouse grab off, ClipCursor should use a NULL parameter. Instead of releasing the mouse, we've used GetDesktopWindow() to create a confinement to the current screen.

bbbradsmith avatar May 01 '24 22:05 bbbradsmith

Created a PR to fix this: #16488

bbbradsmith avatar May 01 '24 23:05 bbbradsmith

Identifying a problem, debugging it and then submitting a PR to fix it. You get a gold star for good citizenship. :)

hizzlekizzle avatar May 01 '24 23:05 hizzlekizzle