Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Scrub on windows #4847

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

fix: Scrub on windows #4847

wants to merge 6 commits into from

Conversation

istarkov
Copy link
Member

@istarkov istarkov commented Feb 9, 2025

Description

https://discord.com/channels/955905230107738152/1337534586707644416

There are other bugs I see on Windows on my machine - requestPointerLock seems too buggy.

  1. In my case, wrap-around is not working.
  2. Fast clicks and movements can cause pointerup to not be intercepted (because of the fix above).

Here’s how I see the issue:

  • requestPointerLock is asynchronous.
  • During requestPointerLock, we might get a lostpointercapture event.
  • This has a very low probability of happening on Mac.
  • On Windows, the probability is very high (it can be caused by calling requestPointerLock itself, depending on the machine).
  • On Mac, if this happens, the pointerup event will most likely be lost.
  • On Windows, the pointerup event is usually preserved but can be lost as well.

Currently, on Windows, instead of cleanup, we assume everything will be fine.
On Mac, we perform cleanup on the lostpointercapture event.

Windows' behavior is buggy, but I haven’t found a proper way to fix it.
There's no way to detect event.buttons on move, and this happens independently of the pointerleave event.
Using body as lock target etc doesn't work too.

My suggestion - if this causes new bugs - is to remove requestPointerLock entirely on Windows.

Steps for reproduction

  1. click button
  2. expect xyz

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 0000)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env file

@istarkov istarkov marked this pull request as ready for review February 10, 2025 05:27
@istarkov istarkov requested a review from kof February 10, 2025 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants