From 5dd11bf1389fc8e5378c26a44b909845183bacf4 Mon Sep 17 00:00:00 2001 From: Ayush Amawate <97389618+Ayush2k02@users.noreply.github.com> Date: Mon, 12 Jan 2026 04:01:15 +0530 Subject: [PATCH] Ignore out-of-range mouse button values using from_bits_truncate (#3541) * fix: ignore out-of-range mouse button values using from_bits_truncate * Apply suggestion from @TrueDoctor * Fix formatting --------- Co-authored-by: Dennis Kobert --- editor/src/messages/input_mapper/utility_types/input_mouse.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/src/messages/input_mapper/utility_types/input_mouse.rs b/editor/src/messages/input_mapper/utility_types/input_mouse.rs index 7d4d197d..6fba5027 100644 --- a/editor/src/messages/input_mapper/utility_types/input_mouse.rs +++ b/editor/src/messages/input_mapper/utility_types/input_mouse.rs @@ -76,7 +76,8 @@ pub struct EditorMouseState { impl EditorMouseState { pub fn from_keys_and_editor_position(keys: u8, editor_position: EditorPosition) -> Self { - let mouse_keys = MouseKeys::from_bits(keys).expect("Invalid decoding of MouseKeys"); + // TODO: Some graphic tablets send key codes not mentioned in the spec. In the future we would like to support these as well. + let mouse_keys = MouseKeys::from_bits_truncate(keys); Self { editor_position,