[fix] restore null-handle cursors on Windows without a mouse, refs #130

This commit is contained in:
dijunkun
2026-10-29 10:15:32 +08:00
parent d989df275b
commit 273cbc0adf
@@ -17,9 +17,9 @@
namespace crossdesk { namespace crossdesk {
// Used by both ordinary and secure-desktop capture. Device absence is only a // Used by both ordinary and secure-desktop capture. Confirmed device absence
// compatibility hint: a hidden cursor with a null handle, or touch/pen // permits a controller-side locator even when no cursor handle is available.
// suppression, must retain the application's normal hiding behavior. // Touch/pen suppression and cursors already in the frame retain precedence.
class WindowsCursorState { class WindowsCursorState {
public: public:
void Sample(const CURSORINFO& info, bool embedded, CursorState* state) { void Sample(const CURSORINFO& info, bool embedded, CursorState* state) {
@@ -34,15 +34,18 @@ class WindowsCursorState {
if (!showing && !embedded) { if (!showing && !embedded) {
state->hidden_reason = (info.flags & CURSOR_SUPPRESSED) state->hidden_reason = (info.flags & CURSOR_SUPPRESSED)
? CursorHiddenReason::system_suppressed ? CursorHiddenReason::system_suppressed
: info.hCursor && NoPointingDevice() : NoPointingDevice()
? CursorHiddenReason::no_pointing_device ? CursorHiddenReason::no_pointing_device
: CursorHiddenReason::system_hidden; : CursorHiddenReason::system_hidden;
} }
} }
private: private:
// Query only for potentially recoverable hidden cursors, at most once per // A null cursor handle cannot distinguish application hiding from a desktop
// second. Require two successful absent observations. Query failures, RDP // without a mouse. Use device presence to gate the locator; the controller
// still requires remote pointer input before displaying it.
// Query hidden, unsuppressed cursors at most once per second and require two
// successful absent observations. Query failures, RDP
// (whose devices may be absent from Raw Input), and present mice all disallow // (whose devices may be absent from Raw Input), and present mice all disallow
// fallback and break the sequence of absent observations. // fallback and break the sequence of absent observations.
bool NoPointingDevice() { bool NoPointingDevice() {