{"record":{"id":"0aa1a855448fef76","repo":"linebender/druid","slug":"unexpected-mouse-wheel-button","errorCode":null,"errorMessage":"unexpected mouse wheel button: {}","messagePattern":"unexpected mouse wheel button: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"druid-shell/src/backend/x11/window.rs","lineNumber":1155,"sourceCode":"        self.with_handler(|h| h.mouse_up(&mouse_event));\n        Ok(())\n    }\n\n    pub fn handle_wheel(&self, event: &xproto::ButtonPressEvent) -> Result<(), Error> {\n        let button = event.detail;\n        let mods = key_mods(event.state);\n        let scale = self.scale.get();\n\n        // We use a delta of 120 per tick to match the behavior of Windows.\n        let is_shift = mods.shift();\n        let delta = match button {\n            4 if is_shift => (-120.0, 0.0),\n            4 => (0.0, -120.0),\n            5 if is_shift => (120.0, 0.0),\n            5 => (0.0, 120.0),\n            6 => (-120.0, 0.0),\n            7 => (120.0, 0.0),\n            _ => return Err(anyhow!(\"unexpected mouse wheel button: {}\", button)),\n        };\n        let mouse_event = MouseEvent {\n            pos: Point::new(event.event_x as f64, event.event_y as f64).to_dp(scale),\n            buttons: mouse_buttons(event.state),\n            mods: key_mods(event.state),\n            count: 0,\n            focus: false,\n            button: MouseButton::None,\n            wheel_delta: delta.into(),\n        };\n\n        self.with_handler(|h| h.wheel(&mouse_event));\n        Ok(())\n    }\n\n    pub fn handle_motion_notify(\n        &self,\n        motion_notify: &xproto::MotionNotifyEvent,","sourceCodeStart":1137,"sourceCodeEnd":1173,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-shell/src/backend/x11/window.rs#L1137-L1173","documentation":"When translating X11 button-press events for scroll wheels into `WheelEvent` deltas, druid-shell maps only X11 button codes 4–7 (vertical, horizontal, and shifted variants). Any other button arriving in a wheel-handling context hits the wildcard arm and returns this error, meaning an unexpected hardware/pointer button (e.g. tilt-wheel, extra mouse buttons) was routed to the scroll handler.","triggerScenarios":"An X11 ButtonPress event with `detail` outside 4..=7 (e.g. buttons 8/9 from side buttons, unusual drivers, or remapped input devices) is dispatched through the wheel-event translation code in the X11 window backend.","commonSituations":"Gaming mice or keyboards with extra buttons, exotic input drivers or emulator/virtualization environments emitting non-standard button codes, custom XInput mappings (xinput set-button-map) that shift button numbers.","solutions":["Check the device's button mapping with `xinput get-button-map` and remap extra buttons away from the wheel-handling range.","Update druid/druid-shell — newer versions may map more buttons or ignore unknown ones gracefully.","If this is your build, change the `_ =>` arm to ignore unknown buttons instead of erroring (or map them to wheel deltas as needed).","Reproduce with `xev` to see the actual button detail code your device sends and handle it explicitly."],"exampleFix":"// before\n_ => return Err(anyhow!(\"unexpected mouse wheel button: {}\", button)),\n// after\n_ => {\n    log::debug!(\"ignoring unexpected mouse wheel button: {}\", button);\n    return Ok(());\n}","handlingStrategy":"validation","validationCode":"// check button codes your device emits before relying on wheel handling\n// $ xev -event button  # observe 'button <n>' in ButtonPress events\n// only buttons 4-7 are treated as wheel events by druid-shell x11 backend","typeGuard":"fn is_wheel_button(detail: u8) -> bool {\n    matches!(detail, 4..=7)\n}","tryCatchPattern":null,"preventionTips":["Run `xinput get-button-map` to confirm your mouse's button numbering","Remap extra side buttons (8/9+) to actions outside the wheel path","Use `xev` to inspect raw button detail codes for exotic devices","Prefer patched/newer druid-shell that ignores unknown wheel buttons instead of erroring"],"tags":["x11","input","mouse-wheel","druid-shell"],"backgroundTag":"invalid-enum-value","analyzedSha":"0f8b1195e4e073f9597f2865299c3d18f8e4005f","analyzedAt":"2026-09-10T14:27:34.582Z","contentChangedAt":"2026-09-10T14:27:34.582Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}