Attempt to fix #3479

This commit is contained in:
Enrico Turri 2020-01-08 12:30:42 +01:00
parent 5a63b9a6a0
commit 7a8251b626
2 changed files with 10 additions and 7 deletions

View File

@ -631,13 +631,16 @@ bool Mouse3DController::connect_device()
if (m_device != nullptr)
{
std::vector<wchar_t> manufacturer(1024, 0);
hid_get_manufacturer_string(m_device, manufacturer.data(), 1024);
m_device_str = boost::nowide::narrow(manufacturer.data());
wchar_t buffer[1024];
hid_get_manufacturer_string(m_device, buffer, 1024);
m_device_str = boost::nowide::narrow(buffer);
// #3479 seems to show that sometimes an extra whitespace is added, so we remove it
boost::algorithm::trim(m_device_str);
std::vector<wchar_t> product(1024, 0);
hid_get_product_string(m_device, product.data(), 1024);
m_device_str += "/" + boost::nowide::narrow(product.data());
hid_get_product_string(m_device, buffer, 1024);
m_device_str += "/" + boost::nowide::narrow(buffer);
// #3479 seems to show that sometimes an extra whitespace is added, so we remove it
boost::algorithm::trim(m_device_str);
BOOST_LOG_TRIVIAL(info) << "Connected 3DConnexion device:";
BOOST_LOG_TRIVIAL(info) << "Manufacturer/product: " << m_device_str;

View File

@ -68,7 +68,7 @@ class Mouse3DController
CustomParameters<double> m_translation_params;
CustomParameters<float> m_rotation_params;
#if ENABLE_3DCONNEXION_Y_AS_ZOOM
CustomParameters<float> m_zoom_params;
CustomParameters<double> m_zoom_params;
#endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
// When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.