Verified Commit 34a264f9 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

0.3.23 - add clipboard event

parent ce12f5b9
[package]
name = "orbclient"
version = "0.3.22"
version = "0.3.23"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
description = "The Orbital Client Library"
documentation = "https://docs.rs/orbclient"
......
......@@ -11,6 +11,7 @@ pub const EVENT_FOCUS: i64 = 6;
pub const EVENT_MOVE: i64 = 7;
pub const EVENT_RESIZE: i64 = 8;
pub const EVENT_SCREEN: i64 = 9;
pub const EVENT_CLIPBOARD: i64 = 10;
/// An optional event
#[derive(Copy, Clone, Debug)]
......@@ -33,6 +34,8 @@ pub enum EventOption {
Resize(ResizeEvent),
/// A screen report event
Screen(ScreenEvent),
/// A clipboard event
Clipboard(ClipboardEvent),
/// An unknown event
Unknown(Event),
/// No event
......@@ -72,6 +75,7 @@ impl Event {
EVENT_MOVE => EventOption::Move(MoveEvent::from_event(self)),
EVENT_RESIZE => EventOption::Resize(ResizeEvent::from_event(self)),
EVENT_SCREEN => EventOption::Screen(ScreenEvent::from_event(self)),
EVENT_CLIPBOARD => EventOption::Clipboard(ClipboardEvent::from_event(self)),
_ => EventOption::Unknown(self),
}
}
......@@ -447,3 +451,31 @@ impl ScreenEvent {
}
}
}
pub const CLIPBOARD_COPY: u8 = 0;
pub const CLIPBOARD_CUT: u8 = 1;
pub const CLIPBOARD_PASTE: u8 = 2;
/// A clipboard event
#[derive(Copy, Clone, Debug)]
pub struct ClipboardEvent {
pub kind: u8,
pub size: usize,
}
impl ClipboardEvent {
pub fn to_event(&self) -> Event {
Event {
code: EVENT_CLIPBOARD,
a: self.kind as i64,
b: self.size as i64,
}
}
pub fn from_event(event: Event) -> ClipboardEvent {
ClipboardEvent {
kind: event.a as u8,
size: event.b as usize,
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment