Skip to content

Introduce SpaceMouse::HandlerWinEvents#5650

Merged
Grantim merged 6 commits intomasterfrom
Introduce_SpaceMouse__HandlerWinEvents
Jan 28, 2026
Merged

Introduce SpaceMouse::HandlerWinEvents#5650
Grantim merged 6 commits intomasterfrom
Introduce_SpaceMouse__HandlerWinEvents

Conversation

@Grantim
Copy link
Contributor

@Grantim Grantim commented Jan 27, 2026

  • Introduce new Handler for SpaceMouse based on windows raw input events
  • remove excessive deviceSignal and replace it with telemetry signal
  • make initSpaceMouseHandler private (there is no more need to keep it public)

@Grantim Grantim requested review from Fedr, MaxRayskiy and oitel January 27, 2026 17:21
if ( deviceSignal_ && localDevicesIt->usage == HID_USAGE_GENERIC_MULTI_AXIS_CONTROLLER && localDevicesIt->usage_page == HID_USAGE_PAGE_GENERIC )
deviceSignal_( fmt::format( "HID API device {:04x}:{:04x} found: {}:{}", vendorId, localDevicesIt->product_id,
wideToUtf8( localDevicesIt->manufacturer_string ), wideToUtf8( localDevicesIt->product_string ) ) );
TelemetrySignal( fmt::format( "HID API device {:04x}:{:04x} found: {}:{}", vendorId, localDevicesIt->product_id,
Copy link
Contributor

Choose a reason for hiding this comment

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

Are usage/usage_page filters not required anymore?

if ( auto handler = std::dynamic_pointer_cast< SpaceMouse::HandlerHidapi >( getViewerInstance().getSpaceMouseHandler() ) )
return handler->hasValidDeviceConnected();
auto handler = getViewerInstance().getSpaceMouseHandler();
if ( handler )
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably if ( !handler )?


}
#endif
#include "MRSpaceMouseHandlerWinEvents.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

Move to the top of the file.

auto handler = Win32MessageHandler::getHandler( winHndl );
if ( !handler || !handler->isValid() )
{
assert( false && "invalid Win32MessageHandler while trying to initialize SpaceMouse::HandlerWinEvents" );
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert( false && "invalid Win32MessageHandler while trying to initialize SpaceMouse::HandlerWinEvents" );
assert( !"invalid Win32MessageHandler while trying to initialize SpaceMouse::HandlerWinEvents" );

GetRawInputDeviceInfo( rawInput.header.hDevice, RIDI_DEVICENAME, name.data(), &nameSize ); // get name

spdlog::info( "SpaceMouse connected: {:04x}:{:04x}, path={}", vId, pId, wideToUtf8( name.c_str() ) );
TelemetrySignal( fmt::format( "WIN API device {:04x}:{:04x} opened", vId, pId ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

please pass device's name in telemetry as well

@Grantim Grantim merged commit 060fad9 into master Jan 28, 2026
34 checks passed
@Grantim Grantim deleted the Introduce_SpaceMouse__HandlerWinEvents branch January 28, 2026 11:29
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.

3 participants