Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-11-08 11:18:59 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-11-08 11:18:59 +0300
commit4320b8f7111c482c7ba4dae35102d6b31629202c (patch)
treed84f9f4448b9da2c2e4b08b56fec68ade5322173 /src/slic3r/GUI/Mouse3DController.cpp
parent68d6a458150ea194a9202853b106bc8d4b286ca6 (diff)
3Dconnexion devices -> Fix into Mouse3DController::handle_packet_button
Diffstat (limited to 'src/slic3r/GUI/Mouse3DController.cpp')
-rw-r--r--src/slic3r/GUI/Mouse3DController.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slic3r/GUI/Mouse3DController.cpp b/src/slic3r/GUI/Mouse3DController.cpp
index 96ef4f664..352a5bf69 100644
--- a/src/slic3r/GUI/Mouse3DController.cpp
+++ b/src/slic3r/GUI/Mouse3DController.cpp
@@ -602,7 +602,6 @@ bool Mouse3DController::handle_packet(const DataPacket& packet)
}
case 3: // Button
{
- unsigned int size = packet.size();
if (handle_packet_button(packet, packet.size() - 1))
return true;
@@ -708,7 +707,12 @@ bool Mouse3DController::handle_packet_rotation(const DataPacket& packet, unsigne
bool Mouse3DController::handle_packet_button(const DataPacket& packet, unsigned int packet_size)
{
- unsigned int data = packet[1] | packet[2] << 8 | packet[3] << 16 | packet[4] << 24;
+ unsigned int data = 0;
+ for (unsigned int i = 1; i < packet_size; ++i)
+ {
+ data |= packet[i] << 8 * (i - 1);
+ }
+
const std::bitset<32> data_bits{ data };
for (size_t i = 0; i < data_bits.size(); ++i)
{