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

修复光标移动到叠加层或其他窗口时有时会跳跃的问题 #866

Merged
merged 2 commits into from
Mar 30, 2024

Conversation

Blinue
Copy link
Owner

@Blinue Blinue commented Mar 30, 2024

在调试过程中,我发现 SetCursorPos 无法可靠移动光标,虽然调用之后立刻查询光标位置没有问题,但经过一段时间后再次查询会发现光标位置又回到了设置之前。我怀疑这是因为 OS 异步处理硬件输入队列,SetCursorPos 时队列中仍有旧事件尚未处理。

现在使用 SendInput 将移动光标的事件插入输入队列,然后等待系统处理到该事件,避免了并发问题。如果设置不成功则多次尝试。这里旨在尽最大努力,因为这是 OS 的 bug,我怀疑是否有完美的解决方案。

经过测试,新方案似乎解决了问题,我没有再遇到光标跳跃的问题。

@Blinue Blinue added the bug Something isn't working label Mar 30, 2024
@Blinue Blinue merged commit fc54423 into render-system Mar 30, 2024
4 checks passed
@Blinue Blinue deleted the fix/cursor-jump branch March 30, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant