use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use crate::*;
#[deprecated]
#[inline]
pub unsafe extern "C-unwind" fn AXAPIEnabled() -> bool {
extern "C-unwind" {
fn AXAPIEnabled() -> Boolean;
}
let ret = unsafe { AXAPIEnabled() };
ret != 0
}
#[inline]
pub unsafe extern "C-unwind" fn AXIsProcessTrustedWithOptions(
options: Option<&CFDictionary>,
) -> bool {
extern "C-unwind" {
fn AXIsProcessTrustedWithOptions(options: Option<&CFDictionary>) -> Boolean;
}
let ret = unsafe { AXIsProcessTrustedWithOptions(options) };
ret != 0
}
extern "C" {
pub static kAXTrustedCheckOptionPrompt: &'static CFString;
}
#[inline]
pub unsafe extern "C-unwind" fn AXIsProcessTrusted() -> bool {
extern "C-unwind" {
fn AXIsProcessTrusted() -> Boolean;
}
let ret = unsafe { AXIsProcessTrusted() };
ret != 0
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated]
pub fn AXMakeProcessTrusted(executable_path: &CFString) -> AXError;
}
#[doc(alias = "AXUIElementRef")]
#[repr(C)]
pub struct AXUIElement {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl AXUIElement {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__AXUIElement"> for AXUIElement {}
);
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct AXCopyMultipleAttributeOptions(pub u32);
bitflags::bitflags! {
impl AXCopyMultipleAttributeOptions: u32 {
#[doc(alias = "kAXCopyMultipleAttributeOptionStopOnError")]
const StopOnError = 0x1;
}
}
#[cfg(feature = "objc2")]
unsafe impl Encode for AXCopyMultipleAttributeOptions {
const ENCODING: Encoding = u32::ENCODING;
}
#[cfg(feature = "objc2")]
unsafe impl RefEncode for AXCopyMultipleAttributeOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
unsafe impl ConcreteType for AXUIElement {
#[doc(alias = "AXUIElementGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn AXUIElementGetTypeID() -> CFTypeID;
}
unsafe { AXUIElementGetTypeID() }
}
}
impl AXUIElement {
#[doc(alias = "AXUIElementCopyAttributeNames")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_attribute_names(&self, names: NonNull<*const CFArray>) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyAttributeNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
unsafe { AXUIElementCopyAttributeNames(self, names) }
}
#[doc(alias = "AXUIElementCopyAttributeValue")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_attribute_value(
&self,
attribute: &CFString,
value: NonNull<*const CFType>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyAttributeValue(
element: &AXUIElement,
attribute: &CFString,
value: NonNull<*const CFType>,
) -> AXError;
}
unsafe { AXUIElementCopyAttributeValue(self, attribute, value) }
}
#[doc(alias = "AXUIElementGetAttributeValueCount")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn attribute_value_count(
&self,
attribute: &CFString,
count: NonNull<CFIndex>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementGetAttributeValueCount(
element: &AXUIElement,
attribute: &CFString,
count: NonNull<CFIndex>,
) -> AXError;
}
unsafe { AXUIElementGetAttributeValueCount(self, attribute, count) }
}
#[doc(alias = "AXUIElementCopyAttributeValues")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_attribute_values(
&self,
attribute: &CFString,
index: CFIndex,
max_values: CFIndex,
values: NonNull<*const CFArray>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyAttributeValues(
element: &AXUIElement,
attribute: &CFString,
index: CFIndex,
max_values: CFIndex,
values: NonNull<*const CFArray>,
) -> AXError;
}
unsafe { AXUIElementCopyAttributeValues(self, attribute, index, max_values, values) }
}
#[doc(alias = "AXUIElementIsAttributeSettable")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn is_attribute_settable(
&self,
attribute: &CFString,
settable: NonNull<Boolean>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementIsAttributeSettable(
element: &AXUIElement,
attribute: &CFString,
settable: NonNull<Boolean>,
) -> AXError;
}
unsafe { AXUIElementIsAttributeSettable(self, attribute, settable) }
}
#[doc(alias = "AXUIElementSetAttributeValue")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn set_attribute_value(&self, attribute: &CFString, value: &CFType) -> AXError {
extern "C-unwind" {
fn AXUIElementSetAttributeValue(
element: &AXUIElement,
attribute: &CFString,
value: &CFType,
) -> AXError;
}
unsafe { AXUIElementSetAttributeValue(self, attribute, value) }
}
#[doc(alias = "AXUIElementCopyMultipleAttributeValues")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_multiple_attribute_values(
&self,
attributes: &CFArray,
options: AXCopyMultipleAttributeOptions,
values: NonNull<*const CFArray>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyMultipleAttributeValues(
element: &AXUIElement,
attributes: &CFArray,
options: AXCopyMultipleAttributeOptions,
values: NonNull<*const CFArray>,
) -> AXError;
}
unsafe { AXUIElementCopyMultipleAttributeValues(self, attributes, options, values) }
}
#[doc(alias = "AXUIElementCopyParameterizedAttributeNames")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_parameterized_attribute_names(
&self,
names: NonNull<*const CFArray>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyParameterizedAttributeNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
unsafe { AXUIElementCopyParameterizedAttributeNames(self, names) }
}
#[doc(alias = "AXUIElementCopyParameterizedAttributeValue")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_parameterized_attribute_value(
&self,
parameterized_attribute: &CFString,
parameter: &CFType,
result: NonNull<*const CFType>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyParameterizedAttributeValue(
element: &AXUIElement,
parameterized_attribute: &CFString,
parameter: &CFType,
result: NonNull<*const CFType>,
) -> AXError;
}
unsafe {
AXUIElementCopyParameterizedAttributeValue(
self,
parameterized_attribute,
parameter,
result,
)
}
}
#[doc(alias = "AXUIElementCopyActionNames")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_action_names(&self, names: NonNull<*const CFArray>) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyActionNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
unsafe { AXUIElementCopyActionNames(self, names) }
}
#[doc(alias = "AXUIElementCopyActionDescription")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_action_description(
&self,
action: &CFString,
description: NonNull<*const CFString>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyActionDescription(
element: &AXUIElement,
action: &CFString,
description: NonNull<*const CFString>,
) -> AXError;
}
unsafe { AXUIElementCopyActionDescription(self, action, description) }
}
#[doc(alias = "AXUIElementPerformAction")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn perform_action(&self, action: &CFString) -> AXError {
extern "C-unwind" {
fn AXUIElementPerformAction(element: &AXUIElement, action: &CFString) -> AXError;
}
unsafe { AXUIElementPerformAction(self, action) }
}
#[doc(alias = "AXUIElementCopyElementAtPosition")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn copy_element_at_position(
&self,
x: c_float,
y: c_float,
element: NonNull<*const AXUIElement>,
) -> AXError {
extern "C-unwind" {
fn AXUIElementCopyElementAtPosition(
application: &AXUIElement,
x: c_float,
y: c_float,
element: NonNull<*const AXUIElement>,
) -> AXError;
}
unsafe { AXUIElementCopyElementAtPosition(self, x, y, element) }
}
#[doc(alias = "AXUIElementCreateApplication")]
#[cfg(feature = "libc")]
#[inline]
pub unsafe fn new_application(pid: libc::pid_t) -> CFRetained<AXUIElement> {
extern "C-unwind" {
fn AXUIElementCreateApplication(pid: libc::pid_t) -> Option<NonNull<AXUIElement>>;
}
let ret = unsafe { AXUIElementCreateApplication(pid) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXUIElementCreateSystemWide")]
#[inline]
pub unsafe fn new_system_wide() -> CFRetained<AXUIElement> {
extern "C-unwind" {
fn AXUIElementCreateSystemWide() -> Option<NonNull<AXUIElement>>;
}
let ret = unsafe { AXUIElementCreateSystemWide() };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXUIElementGetPid")]
#[cfg(all(feature = "AXError", feature = "libc"))]
#[inline]
pub unsafe fn pid(&self, pid: NonNull<libc::pid_t>) -> AXError {
extern "C-unwind" {
fn AXUIElementGetPid(element: &AXUIElement, pid: NonNull<libc::pid_t>) -> AXError;
}
unsafe { AXUIElementGetPid(self, pid) }
}
#[doc(alias = "AXUIElementSetMessagingTimeout")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn set_messaging_timeout(&self, timeout_in_seconds: c_float) -> AXError {
extern "C-unwind" {
fn AXUIElementSetMessagingTimeout(
element: &AXUIElement,
timeout_in_seconds: c_float,
) -> AXError;
}
unsafe { AXUIElementSetMessagingTimeout(self, timeout_in_seconds) }
}
#[doc(alias = "AXUIElementPostKeyboardEvent")]
#[cfg(all(feature = "AXError", feature = "objc2-core-graphics"))]
#[deprecated]
#[inline]
pub unsafe fn post_keyboard_event(
&self,
key_char: CGCharCode,
virtual_key: CGKeyCode,
key_down: bool,
) -> AXError {
extern "C-unwind" {
fn AXUIElementPostKeyboardEvent(
application: &AXUIElement,
key_char: CGCharCode,
virtual_key: CGKeyCode,
key_down: Boolean,
) -> AXError;
}
unsafe { AXUIElementPostKeyboardEvent(self, key_char, virtual_key, key_down as _) }
}
}
#[doc(alias = "AXTextMarkerRef")]
#[repr(C)]
pub struct AXTextMarker {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl AXTextMarker {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__AXTextMarker"> for AXTextMarker {}
);
unsafe impl ConcreteType for AXTextMarker {
#[doc(alias = "AXTextMarkerGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn AXTextMarkerGetTypeID() -> CFTypeID;
}
unsafe { AXTextMarkerGetTypeID() }
}
}
impl AXTextMarker {
#[doc(alias = "AXTextMarkerCreate")]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
bytes: NonNull<u8>,
length: CFIndex,
) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerCreate(
allocator: Option<&CFAllocator>,
bytes: NonNull<u8>,
length: CFIndex,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerCreate(allocator, bytes, length) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXTextMarkerGetLength")]
#[inline]
pub unsafe fn length(&self) -> CFIndex {
extern "C-unwind" {
fn AXTextMarkerGetLength(marker: &AXTextMarker) -> CFIndex;
}
unsafe { AXTextMarkerGetLength(self) }
}
#[doc(alias = "AXTextMarkerGetBytePtr")]
#[inline]
pub unsafe fn byte_ptr(&self) -> NonNull<u8> {
extern "C-unwind" {
fn AXTextMarkerGetBytePtr(the_text_marker: &AXTextMarker) -> Option<NonNull<u8>>;
}
let ret = unsafe { AXTextMarkerGetBytePtr(self) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
}
#[doc(alias = "AXTextMarkerRangeRef")]
#[repr(C)]
pub struct AXTextMarkerRange {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl AXTextMarkerRange {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__AXTextMarkerRange"> for AXTextMarkerRange {}
);
unsafe impl ConcreteType for AXTextMarkerRange {
#[doc(alias = "AXTextMarkerRangeGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn AXTextMarkerRangeGetTypeID() -> CFTypeID;
}
unsafe { AXTextMarkerRangeGetTypeID() }
}
}
impl AXTextMarkerRange {
#[doc(alias = "AXTextMarkerRangeCreate")]
#[inline]
pub unsafe fn new(
allocator: Option<&CFAllocator>,
start_marker: &AXTextMarker,
end_marker: &AXTextMarker,
) -> CFRetained<AXTextMarkerRange> {
extern "C-unwind" {
fn AXTextMarkerRangeCreate(
allocator: Option<&CFAllocator>,
start_marker: &AXTextMarker,
end_marker: &AXTextMarker,
) -> Option<NonNull<AXTextMarkerRange>>;
}
let ret = unsafe { AXTextMarkerRangeCreate(allocator, start_marker, end_marker) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXTextMarkerRangeCreateWithBytes")]
#[inline]
pub unsafe fn with_bytes(
allocator: Option<&CFAllocator>,
start_marker_bytes: NonNull<u8>,
start_marker_length: CFIndex,
end_marker_bytes: NonNull<u8>,
end_marker_length: CFIndex,
) -> CFRetained<AXTextMarkerRange> {
extern "C-unwind" {
fn AXTextMarkerRangeCreateWithBytes(
allocator: Option<&CFAllocator>,
start_marker_bytes: NonNull<u8>,
start_marker_length: CFIndex,
end_marker_bytes: NonNull<u8>,
end_marker_length: CFIndex,
) -> Option<NonNull<AXTextMarkerRange>>;
}
let ret = unsafe {
AXTextMarkerRangeCreateWithBytes(
allocator,
start_marker_bytes,
start_marker_length,
end_marker_bytes,
end_marker_length,
)
};
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXTextMarkerRangeCopyStartMarker")]
#[inline]
pub unsafe fn start_marker(&self) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerRangeCopyStartMarker(
text_marker_range: &AXTextMarkerRange,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerRangeCopyStartMarker(self) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[doc(alias = "AXTextMarkerRangeCopyEndMarker")]
#[inline]
pub unsafe fn end_marker(&self) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerRangeCopyEndMarker(
text_marker_range: &AXTextMarkerRange,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerRangeCopyEndMarker(self) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
}
#[doc(alias = "AXObserverRef")]
#[repr(C)]
pub struct AXObserver {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl AXObserver {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__AXObserver"> for AXObserver {}
);
pub type AXObserverCallback = Option<
unsafe extern "C-unwind" fn(
NonNull<AXObserver>,
NonNull<AXUIElement>,
NonNull<CFString>,
*mut c_void,
),
>;
pub type AXObserverCallbackWithInfo = Option<
unsafe extern "C-unwind" fn(
NonNull<AXObserver>,
NonNull<AXUIElement>,
NonNull<CFString>,
NonNull<CFDictionary>,
*mut c_void,
),
>;
unsafe impl ConcreteType for AXObserver {
#[doc(alias = "AXObserverGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn AXObserverGetTypeID() -> CFTypeID;
}
unsafe { AXObserverGetTypeID() }
}
}
impl AXObserver {
#[doc(alias = "AXObserverCreate")]
#[cfg(all(feature = "AXError", feature = "libc"))]
#[inline]
pub unsafe fn create(
application: libc::pid_t,
callback: AXObserverCallback,
out_observer: NonNull<*mut AXObserver>,
) -> AXError {
extern "C-unwind" {
fn AXObserverCreate(
application: libc::pid_t,
callback: AXObserverCallback,
out_observer: NonNull<*mut AXObserver>,
) -> AXError;
}
unsafe { AXObserverCreate(application, callback, out_observer) }
}
#[doc(alias = "AXObserverCreateWithInfoCallback")]
#[cfg(all(feature = "AXError", feature = "libc"))]
#[inline]
pub unsafe fn create_with_info_callback(
application: libc::pid_t,
callback: AXObserverCallbackWithInfo,
out_observer: NonNull<*mut AXObserver>,
) -> AXError {
extern "C-unwind" {
fn AXObserverCreateWithInfoCallback(
application: libc::pid_t,
callback: AXObserverCallbackWithInfo,
out_observer: NonNull<*mut AXObserver>,
) -> AXError;
}
unsafe { AXObserverCreateWithInfoCallback(application, callback, out_observer) }
}
#[doc(alias = "AXObserverAddNotification")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn add_notification(
&self,
element: &AXUIElement,
notification: &CFString,
refcon: *mut c_void,
) -> AXError {
extern "C-unwind" {
fn AXObserverAddNotification(
observer: &AXObserver,
element: &AXUIElement,
notification: &CFString,
refcon: *mut c_void,
) -> AXError;
}
unsafe { AXObserverAddNotification(self, element, notification, refcon) }
}
#[doc(alias = "AXObserverRemoveNotification")]
#[cfg(feature = "AXError")]
#[inline]
pub unsafe fn remove_notification(
&self,
element: &AXUIElement,
notification: &CFString,
) -> AXError {
extern "C-unwind" {
fn AXObserverRemoveNotification(
observer: &AXObserver,
element: &AXUIElement,
notification: &CFString,
) -> AXError;
}
unsafe { AXObserverRemoveNotification(self, element, notification) }
}
#[doc(alias = "AXObserverGetRunLoopSource")]
#[inline]
pub unsafe fn run_loop_source(&self) -> CFRetained<CFRunLoopSource> {
extern "C-unwind" {
fn AXObserverGetRunLoopSource(
observer: &AXObserver,
) -> Option<NonNull<CFRunLoopSource>>;
}
let ret = unsafe { AXObserverGetRunLoopSource(self) };
let ret =
ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_attribute_names`"]
pub fn AXUIElementCopyAttributeNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_attribute_value`"]
pub fn AXUIElementCopyAttributeValue(
element: &AXUIElement,
attribute: &CFString,
value: NonNull<*const CFType>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::attribute_value_count`"]
pub fn AXUIElementGetAttributeValueCount(
element: &AXUIElement,
attribute: &CFString,
count: NonNull<CFIndex>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_attribute_values`"]
pub fn AXUIElementCopyAttributeValues(
element: &AXUIElement,
attribute: &CFString,
index: CFIndex,
max_values: CFIndex,
values: NonNull<*const CFArray>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::is_attribute_settable`"]
pub fn AXUIElementIsAttributeSettable(
element: &AXUIElement,
attribute: &CFString,
settable: NonNull<Boolean>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::set_attribute_value`"]
pub fn AXUIElementSetAttributeValue(
element: &AXUIElement,
attribute: &CFString,
value: &CFType,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_multiple_attribute_values`"]
pub fn AXUIElementCopyMultipleAttributeValues(
element: &AXUIElement,
attributes: &CFArray,
options: AXCopyMultipleAttributeOptions,
values: NonNull<*const CFArray>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_parameterized_attribute_names`"]
pub fn AXUIElementCopyParameterizedAttributeNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_parameterized_attribute_value`"]
pub fn AXUIElementCopyParameterizedAttributeValue(
element: &AXUIElement,
parameterized_attribute: &CFString,
parameter: &CFType,
result: NonNull<*const CFType>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_action_names`"]
pub fn AXUIElementCopyActionNames(
element: &AXUIElement,
names: NonNull<*const CFArray>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_action_description`"]
pub fn AXUIElementCopyActionDescription(
element: &AXUIElement,
action: &CFString,
description: NonNull<*const CFString>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::perform_action`"]
pub fn AXUIElementPerformAction(element: &AXUIElement, action: &CFString) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::copy_element_at_position`"]
pub fn AXUIElementCopyElementAtPosition(
application: &AXUIElement,
x: c_float,
y: c_float,
element: NonNull<*const AXUIElement>,
) -> AXError;
}
#[cfg(feature = "libc")]
#[deprecated = "renamed to `AXUIElement::new_application`"]
#[inline]
pub unsafe extern "C-unwind" fn AXUIElementCreateApplication(
pid: libc::pid_t,
) -> CFRetained<AXUIElement> {
extern "C-unwind" {
fn AXUIElementCreateApplication(pid: libc::pid_t) -> Option<NonNull<AXUIElement>>;
}
let ret = unsafe { AXUIElementCreateApplication(pid) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[deprecated = "renamed to `AXUIElement::new_system_wide`"]
#[inline]
pub unsafe extern "C-unwind" fn AXUIElementCreateSystemWide() -> CFRetained<AXUIElement> {
extern "C-unwind" {
fn AXUIElementCreateSystemWide() -> Option<NonNull<AXUIElement>>;
}
let ret = unsafe { AXUIElementCreateSystemWide() };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
extern "C-unwind" {
#[cfg(all(feature = "AXError", feature = "libc"))]
#[deprecated = "renamed to `AXUIElement::pid`"]
pub fn AXUIElementGetPid(element: &AXUIElement, pid: NonNull<libc::pid_t>) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXUIElement::set_messaging_timeout`"]
pub fn AXUIElementSetMessagingTimeout(
element: &AXUIElement,
timeout_in_seconds: c_float,
) -> AXError;
}
#[cfg(all(feature = "AXError", feature = "objc2-core-graphics"))]
#[deprecated = "renamed to `AXUIElement::post_keyboard_event`"]
#[inline]
pub unsafe extern "C-unwind" fn AXUIElementPostKeyboardEvent(
application: &AXUIElement,
key_char: CGCharCode,
virtual_key: CGKeyCode,
key_down: bool,
) -> AXError {
extern "C-unwind" {
fn AXUIElementPostKeyboardEvent(
application: &AXUIElement,
key_char: CGCharCode,
virtual_key: CGKeyCode,
key_down: Boolean,
) -> AXError;
}
unsafe { AXUIElementPostKeyboardEvent(application, key_char, virtual_key, key_down as _) }
}
#[deprecated = "renamed to `AXTextMarker::new`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerCreate(
allocator: Option<&CFAllocator>,
bytes: NonNull<u8>,
length: CFIndex,
) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerCreate(
allocator: Option<&CFAllocator>,
bytes: NonNull<u8>,
length: CFIndex,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerCreate(allocator, bytes, length) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
extern "C-unwind" {
#[deprecated = "renamed to `AXTextMarker::length`"]
pub fn AXTextMarkerGetLength(marker: &AXTextMarker) -> CFIndex;
}
#[deprecated = "renamed to `AXTextMarker::byte_ptr`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerGetBytePtr(
the_text_marker: &AXTextMarker,
) -> NonNull<u8> {
extern "C-unwind" {
fn AXTextMarkerGetBytePtr(the_text_marker: &AXTextMarker) -> Option<NonNull<u8>>;
}
let ret = unsafe { AXTextMarkerGetBytePtr(the_text_marker) };
ret.expect("function was marked as returning non-null, but actually returned NULL")
}
#[deprecated = "renamed to `AXTextMarkerRange::new`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerRangeCreate(
allocator: Option<&CFAllocator>,
start_marker: &AXTextMarker,
end_marker: &AXTextMarker,
) -> CFRetained<AXTextMarkerRange> {
extern "C-unwind" {
fn AXTextMarkerRangeCreate(
allocator: Option<&CFAllocator>,
start_marker: &AXTextMarker,
end_marker: &AXTextMarker,
) -> Option<NonNull<AXTextMarkerRange>>;
}
let ret = unsafe { AXTextMarkerRangeCreate(allocator, start_marker, end_marker) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[deprecated = "renamed to `AXTextMarkerRange::with_bytes`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerRangeCreateWithBytes(
allocator: Option<&CFAllocator>,
start_marker_bytes: NonNull<u8>,
start_marker_length: CFIndex,
end_marker_bytes: NonNull<u8>,
end_marker_length: CFIndex,
) -> CFRetained<AXTextMarkerRange> {
extern "C-unwind" {
fn AXTextMarkerRangeCreateWithBytes(
allocator: Option<&CFAllocator>,
start_marker_bytes: NonNull<u8>,
start_marker_length: CFIndex,
end_marker_bytes: NonNull<u8>,
end_marker_length: CFIndex,
) -> Option<NonNull<AXTextMarkerRange>>;
}
let ret = unsafe {
AXTextMarkerRangeCreateWithBytes(
allocator,
start_marker_bytes,
start_marker_length,
end_marker_bytes,
end_marker_length,
)
};
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[deprecated = "renamed to `AXTextMarkerRange::start_marker`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerRangeCopyStartMarker(
text_marker_range: &AXTextMarkerRange,
) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerRangeCopyStartMarker(
text_marker_range: &AXTextMarkerRange,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerRangeCopyStartMarker(text_marker_range) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
#[deprecated = "renamed to `AXTextMarkerRange::end_marker`"]
#[inline]
pub unsafe extern "C-unwind" fn AXTextMarkerRangeCopyEndMarker(
text_marker_range: &AXTextMarkerRange,
) -> CFRetained<AXTextMarker> {
extern "C-unwind" {
fn AXTextMarkerRangeCopyEndMarker(
text_marker_range: &AXTextMarkerRange,
) -> Option<NonNull<AXTextMarker>>;
}
let ret = unsafe { AXTextMarkerRangeCopyEndMarker(text_marker_range) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::from_raw(ret) }
}
extern "C-unwind" {
#[cfg(all(feature = "AXError", feature = "libc"))]
#[deprecated = "renamed to `AXObserver::create`"]
pub fn AXObserverCreate(
application: libc::pid_t,
callback: AXObserverCallback,
out_observer: NonNull<*mut AXObserver>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(all(feature = "AXError", feature = "libc"))]
#[deprecated = "renamed to `AXObserver::create_with_info_callback`"]
pub fn AXObserverCreateWithInfoCallback(
application: libc::pid_t,
callback: AXObserverCallbackWithInfo,
out_observer: NonNull<*mut AXObserver>,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXObserver::add_notification`"]
pub fn AXObserverAddNotification(
observer: &AXObserver,
element: &AXUIElement,
notification: &CFString,
refcon: *mut c_void,
) -> AXError;
}
extern "C-unwind" {
#[cfg(feature = "AXError")]
#[deprecated = "renamed to `AXObserver::remove_notification`"]
pub fn AXObserverRemoveNotification(
observer: &AXObserver,
element: &AXUIElement,
notification: &CFString,
) -> AXError;
}
#[deprecated = "renamed to `AXObserver::run_loop_source`"]
#[inline]
pub unsafe extern "C-unwind" fn AXObserverGetRunLoopSource(
observer: &AXObserver,
) -> CFRetained<CFRunLoopSource> {
extern "C-unwind" {
fn AXObserverGetRunLoopSource(observer: &AXObserver) -> Option<NonNull<CFRunLoopSource>>;
}
let ret = unsafe { AXObserverGetRunLoopSource(observer) };
let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
unsafe { CFRetained::retain(ret) }
}