| 2207 | } |
| 2208 | |
| 2209 | void Viewer::initSpaceMouseHandler_() |
| 2210 | { |
| 2211 | spaceMouseHandler_.reset(); |
| 2212 | #ifndef __EMSCRIPTEN__ |
| 2213 | #ifdef __APPLE__ |
| 2214 | // try to use the official driver first |
| 2215 | auto driverHandler = std::make_unique<SpaceMouse::Handler3dxMacDriver>(); |
| 2216 | driverHandler->setClientName( MR_PROJECT_NAME ); |
| 2217 | if ( driverHandler->initialize() ) |
| 2218 | { |
| 2219 | spaceMouseHandler_ = std::move( driverHandler ); |
| 2220 | spdlog::info( "SpaceMouse::Handler3dxMacDriver initialized" ); |
| 2221 | return; |
| 2222 | } |
| 2223 | |
| 2224 | // fallback to the HIDAPI implementation |
| 2225 | spdlog::warn( "Failed to find or use the 3DxWare driver; falling back to the HIDAPI implementation" ); |
| 2226 | #endif |
| 2227 | #ifdef _WIN32 |
| 2228 | auto winEventsHandler = std::make_unique<SpaceMouse::HandlerWinEvents>(); |
| 2229 | if ( winEventsHandler->initialize() ) |
| 2230 | { |
| 2231 | spaceMouseHandler_ = std::move( winEventsHandler ); |
| 2232 | spdlog::info( "SpaceMouse::HandlerWinEvents initialized" ); |
| 2233 | return; |
| 2234 | } |
| 2235 | |
| 2236 | // fallback to the HIDAPI implementation |
| 2237 | spdlog::warn( "Failed to init Windows Raw Input handeler for SpaceMouse; falling back to the HIDAPI implementation" ); |
| 2238 | #endif |
| 2239 | spaceMouseHandler_ = std::make_unique<SpaceMouse::HandlerHidapi>(); |
| 2240 | if ( spaceMouseHandler_->initialize() ) |
| 2241 | { |
| 2242 | spdlog::info( "SpaceMouse::HandlerHidapi initialized" ); |
| 2243 | } |
| 2244 | else |
| 2245 | { |
| 2246 | spdlog::warn( "Failed to initialize SpaceMouseHandlerHidapi" ); |
| 2247 | } |
| 2248 | #endif |
| 2249 | } |
| 2250 | |
| 2251 | bool Viewer::windowShouldClose() |
| 2252 | { |
nothing calls this directly
no test coverage detected