Auto merge of #541 - joshleeb:joshleeb-graphics-tap_post_event, r=jdm
Add binding for CGEventTapPostEvent This change adds the binding for CGEventTapPostEvent and adds a wrapper function CGEvent::post_from_tap to call the core-graphics function.
This commit is contained in:
@@ -607,12 +607,16 @@ impl CGEvent {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn location(&self) -> CGPoint {
|
||||
pub fn post_from_tap(&self, tap_proxy: CGEventTapProxy) {
|
||||
unsafe {
|
||||
CGEventGetLocation(self.as_ptr())
|
||||
CGEventTapPostEvent(tap_proxy, self.as_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn location(&self) -> CGPoint {
|
||||
unsafe { CGEventGetLocation(self.as_ptr()) }
|
||||
}
|
||||
|
||||
#[cfg(feature = "elcapitan")]
|
||||
pub fn post_to_pid(&self, pid: libc::pid_t) {
|
||||
unsafe {
|
||||
@@ -734,6 +738,8 @@ extern {
|
||||
/// taps.
|
||||
fn CGEventPost(tapLocation: CGEventTapLocation, event: ::sys::CGEventRef);
|
||||
|
||||
fn CGEventTapPostEvent(tapProxy: CGEventTapProxy, event: ::sys::CGEventRef);
|
||||
|
||||
#[cfg(feature = "elcapitan")]
|
||||
/// Post an event to a specified process ID
|
||||
fn CGEventPostToPid(pid: libc::pid_t, event: ::sys::CGEventRef);
|
||||
|
||||
Reference in New Issue
Block a user