2020-02-28 13:34:34 +11:00
|
|
|
//! Hoists some type definitions in a way that I personally find cleaner than what's in the Servo
|
|
|
|
//! code.
|
|
|
|
|
2020-03-01 10:34:07 +11:00
|
|
|
use cocoa::foundation::NSUInteger;
|
2020-02-28 13:34:34 +11:00
|
|
|
|
2020-03-01 10:34:07 +11:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
pub enum EventModifierFlag {
|
|
|
|
CapsLock,
|
|
|
|
Control,
|
|
|
|
Option,
|
|
|
|
Command,
|
|
|
|
DeviceIndependentFlagsMask
|
|
|
|
}
|
2020-02-28 13:34:34 +11:00
|
|
|
|
2020-03-01 10:34:07 +11:00
|
|
|
impl From<EventModifierFlag> for NSUInteger {
|
|
|
|
fn from(flag: EventModifierFlag) -> NSUInteger {
|
|
|
|
match flag {
|
|
|
|
EventModifierFlag::CapsLock => 1 << 16,
|
|
|
|
EventModifierFlag::Control => 1 << 18,
|
|
|
|
EventModifierFlag::Option => 1 << 19,
|
|
|
|
EventModifierFlag::Command => 1 << 20,
|
|
|
|
EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-28 13:34:34 +11:00
|
|
|
|
2020-03-01 10:34:07 +11:00
|
|
|
impl From<&EventModifierFlag> for NSUInteger {
|
|
|
|
fn from(flag: &EventModifierFlag) -> NSUInteger {
|
|
|
|
match flag {
|
|
|
|
EventModifierFlag::CapsLock => 1 << 16,
|
|
|
|
EventModifierFlag::Control => 1 << 18,
|
|
|
|
EventModifierFlag::Option => 1 << 19,
|
|
|
|
EventModifierFlag::Command => 1 << 20,
|
|
|
|
EventModifierFlag::DeviceIndependentFlagsMask => 0xffff0000
|
|
|
|
}
|
|
|
|
}
|
2020-02-28 13:34:34 +11:00
|
|
|
}
|
|
|
|
|
2020-03-01 10:34:07 +11:00
|
|
|
pub enum EventType {
|
|
|
|
KeyDown
|
2020-02-28 13:34:34 +11:00
|
|
|
}
|