@@ -150,7 +150,7 @@ pub struct MouseClickEvent {
}
/// A click event that was generated by a keyboard button being pressed and released.
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, Default)]
pub struct KeyboardClickEvent {
/// The keyboard button that was pressed to trigger the click.
pub button: KeyboardButton,
@@ -168,6 +168,12 @@ pub enum ClickEvent {
Keyboard(KeyboardClickEvent),
}
+impl Default for ClickEvent {
+ fn default() -> Self {
+ ClickEvent::Keyboard(KeyboardClickEvent::default())
+ }
+}
+
impl ClickEvent {
/// Returns the modifiers that were held during the click event
///
@@ -256,9 +262,10 @@ impl ClickEvent {
}
/// An enum representing the keyboard button that was pressed for a click event.
-#[derive(Hash, PartialEq, Eq, Copy, Clone, Debug)]
+#[derive(Hash, PartialEq, Eq, Copy, Clone, Debug, Default)]
pub enum KeyboardButton {
/// Enter key was clicked
+ #[default]
Enter,
/// Space key was clicked
Space,