aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/script/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/shared/script/lib.rs')
-rw-r--r--components/shared/script/lib.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs
index e6901be54b6..60f7abba6d6 100644
--- a/components/shared/script/lib.rs
+++ b/components/shared/script/lib.rs
@@ -535,6 +535,31 @@ pub struct WheelDelta {
pub mode: WheelMode,
}
+/// The types of clipboard events
+#[derive(Clone, Debug, Deserialize, Serialize)]
+pub enum ClipboardEventType {
+ /// Contents of the system clipboard are changed
+ Change,
+ /// Copy
+ Copy,
+ /// Cut
+ Cut,
+ /// Paste
+ Paste(String),
+}
+
+impl ClipboardEventType {
+ /// Convert to event name
+ pub fn as_str(&self) -> &str {
+ match *self {
+ ClipboardEventType::Change => "clipboardchange",
+ ClipboardEventType::Copy => "copy",
+ ClipboardEventType::Cut => "cut",
+ ClipboardEventType::Paste(..) => "paste",
+ }
+ }
+}
+
/// Events from the compositor that the script thread needs to know about
#[derive(Debug, Deserialize, Serialize)]
pub enum CompositorEvent {
@@ -574,6 +599,8 @@ pub enum CompositorEvent {
IMEDismissedEvent,
/// Connected gamepad state updated
GamepadEvent(GamepadEvent),
+ /// A clipboard action was requested
+ ClipboardEvent(ClipboardEventType),
}
impl From<&CompositorEvent> for CompositorEventVariant {
@@ -588,6 +615,7 @@ impl From<&CompositorEvent> for CompositorEventVariant {
CompositorEvent::CompositionEvent(..) => CompositorEventVariant::CompositionEvent,
CompositorEvent::IMEDismissedEvent => CompositorEventVariant::IMEDismissedEvent,
CompositorEvent::GamepadEvent(..) => CompositorEventVariant::GamepadEvent,
+ CompositorEvent::ClipboardEvent(..) => CompositorEventVariant::ClipboardEvent,
}
}
}