Add mouse grab/lock feature when PCSX2 is in focus #12239
+64
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Changes
This PR adds a new "Mouse Grab" feature to lock the mouse cursor within the PCSX2 window when it is in focus. This functionality is particularly useful for lightgun games that require shooting off the screen to reload, especially when PCSX2 is running in windowed mode or on multi-monitor setups.
The main changes include:
Rationale behind Changes
This feature was requested in issue #11902 to improve the experience for lightgun games, particularly in multi-monitor environments or when PCSX2 is running in windowed mode.
Mouse grab is a common feature in other emulators like RPCS3, Dolphin, and MAME. Implementing it in PCSX2 will provide users with a more consistent and accurate experience for games that rely on this mechanic.
Key Logic for Mouse Grab
The mouse grab feature is enabled only under the following conditions:
If any of these conditions are not met, the mouse grab feature is automatically disabled.
Suggested Testing Steps