diff --git a/src/event.rs b/src/event.rs index 3ddac10..6f4ed71 100644 --- a/src/event.rs +++ b/src/event.rs @@ -81,9 +81,9 @@ pub enum CGMouseButton { #[repr(C)] #[derive(Clone, Copy, Debug)] pub enum CGEventTapLocation { - HIDEventTap, - SessionEventTap, - AnnotatedSessionEventTap, + HID, + Session, + AnnotatedSession, } #[repr(C)] @@ -166,13 +166,13 @@ impl CGEvent { pub fn new_mouse_event( source: CGEventSource, - mouseType: CGEventType, - mouseCursorPosition: CGPoint, - mouseButton: CGMouseButton + mouse_type: CGEventType, + mouse_cursor_position: CGPoint, + mouse_button: CGMouseButton ) -> Result { unsafe { - let event_ref = CGEventCreateMouseEvent(source.as_concrete_TypeRef(), mouseType, - mouseCursorPosition, mouseButton); + let event_ref = CGEventCreateMouseEvent(source.as_concrete_TypeRef(), mouse_type, + mouse_cursor_position, mouse_button); if event_ref != ptr::null() { Ok(TCFType::wrap_under_create_rule(event_ref)) } else { @@ -181,9 +181,9 @@ impl CGEvent { } } - pub fn post(&self, tapLocation: CGEventTapLocation) { + pub fn post(&self, tap_location: CGEventTapLocation) { unsafe { - CGEventPost(tapLocation, self.as_concrete_TypeRef()); + CGEventPost(tap_location, self.as_concrete_TypeRef()); } } diff --git a/src/event_source.rs b/src/event_source.rs index 16fa86b..32bbaef 100644 --- a/src/event_source.rs +++ b/src/event_source.rs @@ -1,6 +1,5 @@ use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType}; -use libc; use std::mem; use std::ptr; @@ -76,9 +75,9 @@ impl TCFType for CGEventSource { } impl CGEventSource { - pub fn new(stateID: CGEventSourceStateID) -> Result { + pub fn new(state_id: CGEventSourceStateID) -> Result { unsafe { - let event_source_ref = CGEventSourceCreate(stateID); + let event_source_ref = CGEventSourceCreate(state_id); if event_source_ref != ptr::null() { Ok(TCFType::wrap_under_create_rule(event_source_ref)) } else {