Implicitly confine the cursor when it can't leave to another display #5210
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.
Previously, moving the mouse outside the window in fullscreen would warp it and give back control to the OS. The OS would then warp the cursor back into the game window. In this short period, the cursor would jitter between being inside and outside the window.
The solution provided is not perfect, the cursor can still jitter if
Sensitivity < 1
:Eg. on a 1920x1080 display, it can go down to 1079.9999999999, but will warp to 1079 flat. Importantly, it'll never leave the window.
This can probably be fixed by checking if there are adjacent displays, and then warping if
> 1079
instead of>= 1080
, but it's not really that important. (Always checking for> 1079
would leave the cursor in an invalid position when it's in-between two displays—potentially preventing it from escaping the window.)