diff --git a/core-graphics/src/event.rs b/core-graphics/src/event.rs index 8cf9c62..01d8f0f 100644 --- a/core-graphics/src/event.rs +++ b/core-graphics/src/event.rs @@ -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);