From cf05beff0814b70154c74ce84c9fbf0adb9f083f Mon Sep 17 00:00:00 2001 From: Louis Beaumont Date: Fri, 13 Dec 2024 12:36:04 -0800 Subject: [PATCH] Update event_source.rs Signed-off-by: Louis Beaumont --- core-graphics/src/event_source.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core-graphics/src/event_source.rs b/core-graphics/src/event_source.rs index ff8dc290..31a85ab9 100644 --- a/core-graphics/src/event_source.rs +++ b/core-graphics/src/event_source.rs @@ -34,6 +34,10 @@ impl CGEventSource { } } } + + pub unsafe fn get_location(&self) -> CGPoint { + CGEventSourceGetLocation(self.as_ptr() as *mut _) + } } #[cfg_attr(feature = "link", link(name = "CoreGraphics", kind = "framework"))] @@ -45,4 +49,6 @@ extern "C" { /// Return a Quartz event source created with a specified source state. fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> crate::sys::CGEventSourceRef; + + fn CGEventSourceGetLocation(source: *mut sys::CGEventSource) -> CGPoint; }