From 68d6a458150ea194a9202853b106bc8d4b286ca6 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Fri, 8 Nov 2019 08:47:57 +0100 Subject: [PATCH] 3D connexion devides -> Added handling of 3 bytes long button packets --- src/slic3r/GUI/Mouse3DController.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp index 78c0b62276..96ef4f664a 100644 --- a/src/slic3r/GUI/Mouse3DController.cpp +++ b/src/slic3r/GUI/Mouse3DController.cpp @@ -569,6 +569,9 @@ void Mouse3DController::collect_input() updated = handle_packet(packet); else if (res == 13) updated = handle_wireless_packet(packet); + else if ((res == 3) && (packet[0] == 3)) + // On Mac button packets can be 3 bytes long + updated = handle_packet(packet); #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT else if (res > 0) std::cout << "Got unknown data packet of length: " << res << ", code:" << (int)packet[0] << std::endl; @@ -599,7 +602,8 @@ bool Mouse3DController::handle_packet(const DataPacket& packet) } case 3: // Button { - if (handle_packet_button(packet, 6)) + unsigned int size = packet.size(); + if (handle_packet_button(packet, packet.size() - 1)) return true; break;