mouse_types/button.rs
1/// Identifies a button of a mouse controller.
2///
3/// ## Platform-specific
4///
5/// The first three buttons should be supported on all platforms.
6/// [`Self::Back`] and [`Self::Forward`] are supported on most platforms
7/// (when using a compatible mouse).
8///
9/// - **Android, iOS:** Currently not supported.
10/// - **Orbital:** Only left/right/middle buttons are supported at this time.
11/// - **Web, Windows:** Supports left/right/middle/back/forward buttons.
12/// - **Wayland:** Supports buttons 0..=15.
13/// - **macOS:** Supports all button variants.
14/// - **X11:** Technically supports further buttons than this (0..=250), these are emitted in
15/// `ButtonSource::Unknown`.
16#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
17#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
18#[repr(u8)]
19pub enum MouseButton {
20 /// The primary (usually left) button
21 Left = 0,
22 /// The secondary (usually right) button
23 Right = 1,
24 /// The tertiary (usually middle) button
25 Middle = 2,
26 /// The first side button, frequently assigned a back function
27 Back = 3,
28 /// The second side button, frequently assigned a forward function
29 Forward = 4,
30 /// The sixth button
31 Button6 = 5,
32 /// The seventh button
33 Button7 = 6,
34 /// The eighth button
35 Button8 = 7,
36 /// The ninth button
37 Button9 = 8,
38 /// The tenth button
39 Button10 = 9,
40 /// The eleventh button
41 Button11 = 10,
42 /// The twelfth button
43 Button12 = 11,
44 /// The thirteenth button
45 Button13 = 12,
46 /// The fourteenth button
47 Button14 = 13,
48 /// The fifteenth button
49 Button15 = 14,
50 /// The sixteenth button
51 Button16 = 15,
52 Button17 = 16,
53 Button18 = 17,
54 Button19 = 18,
55 Button20 = 19,
56 Button21 = 20,
57 Button22 = 21,
58 Button23 = 22,
59 Button24 = 23,
60 Button25 = 24,
61 Button26 = 25,
62 Button27 = 26,
63 Button28 = 27,
64 Button29 = 28,
65 Button30 = 29,
66 Button31 = 30,
67 Button32 = 31,
68}