Fix cursor not captured in headless sessions#690
Fix cursor not captured in headless sessions#690ilCosmico wants to merge 1 commit intoFlaUI:masterfrom
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.
|
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: |
|
@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. |
|
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.