Skip to content

Conversation

tstokes22
Copy link

Description

This PR implements a dynamic fix that listens for the DBT_DEVNODES_CHANGED message.

It hooks into the WM_DEVICECHANGE window message in main.cpp. When triggered, it calls a new function, platf::check_and_force_cursor_visibility(), which safely checks if a mouse is present.

If no mouse is detected, it toggles the Windows "Mouse Keys" accessibility feature. This forces a system-wide cursor redraw, making the cursor visible on the stream again without affecting user settings.

This same function is now also used at stream startup to unify the cursor handling logic.

Screenshot

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

@tstokes22 tstokes22 force-pushed the fix/windows-dynamic-mousekeys branch 3 times, most recently from b674e9f to 37fb41d Compare July 13, 2025 21:02
@ReenigneArcher ReenigneArcher force-pushed the fix/windows-dynamic-mousekeys branch from 37fb41d to 1b707b0 Compare July 13, 2025 21:33
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 11.31%. Comparing base (35f0b30) to head (1b707b0).

Files with missing lines Patch % Lines
src/platform/windows/misc.cpp 0.00% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4071      +/-   ##
==========================================
- Coverage   11.31%   11.31%   -0.01%     
==========================================
  Files          92       92              
  Lines       17571    17573       +2     
  Branches     8239     8239              
==========================================
  Hits         1989     1989              
- Misses      14901    14903       +2     
  Partials      681      681              
Flag Coverage Δ
Linux-AppImage 11.02% <ø> (ø)
Windows-AMD64 12.45% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/windows/misc.cpp 3.75% <0.00%> (-0.01%) ⬇️

src/main.cpp Outdated
{
// Check if devices change
if (wParam == DBT_DEVNODES_CHANGED) {
platf::check_and_force_cursor_visibility();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should only enable this behavior if we're actually streaming.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, updated the PR to include a check is_streaming.

@tstokes22 tstokes22 force-pushed the fix/windows-dynamic-mousekeys branch from 1b707b0 to 99407e1 Compare July 15, 2025 04:08
@tstokes22 tstokes22 force-pushed the fix/windows-dynamic-mousekeys branch from 99407e1 to e3beac6 Compare July 15, 2025 04:18
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
7 New issues
7 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

2 participants