gpui: Impl Default for ClickEvent (#35751)
While default for ClickEvent shouldn't be used much this is helpful for other projects using gpui besides Zed. Mainly because the orphan rule prevents those projects from implementing their own default trait cc: @huacnlee Release Notes: - N/A
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user