Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork412
Fix cursor not captured in headless sessions#690
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Fix for cursor capture failure in headless environments or after session lock/unlock.This adds a minimal synthetic mouse move using mouse_event to force Windows to redraw the cursor, preventing GetCursorInfo from returning null or CURSOR_SUPPRESSED.Based on a solution tested in FlaUI usage with automated UI testing on Windows Server and Windows 11.
t4m45 commentedApr 15, 2025
Just a comment from another user.. You're moving the mouse without checking if it's actually needed. That said, I don't think this workaround belongs inside the capture method itself. There might already be tests relying on it to return null when the cursor is hidden. Also, keep in mind: this breaks the system idle time, and there won’t be a clear indication of what caused it. You should probably make your own extension method for this behavior. Something like: |
ilCosmico commentedApr 16, 2025
@t4m45 Thanks for the helpful suggestion. I tried the approach and it works great! I understand your point about not modifying If you think it's reasonable, I’d be happy to revise the PR accordingly to include it as a separate helper or extension method. |
ilCosmico commentedJul 29, 2025
Hi@Roemer, just following up on this after a few months. I’d be interested to hear your point of view on this workaround. Do you think a method like Happy to adjust the PR if needed. Let me know what you think! 😊 |
Fix for cursor capture failure in headless environments or after session lock/unlock. This adds a minimal synthetic mouse move using mouse_event to force Windows to redraw the cursor, preventing GetCursorInfo from returning null or CURSOR_SUPPRESSED. Based on a solution tested in FlaUI usage with automated UI testing on Windows Server and Windows 11.