Add some more functions and make geometry structs #[repr(C)]
This commit is contained in:
@@ -11,6 +11,11 @@
|
||||
|
||||
use libc;
|
||||
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
pub type boolean_t = i32;
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
pub type boolean_t = u32;
|
||||
|
||||
// TODO: this is actually a libc::c_float on 32bit
|
||||
pub type CGFloat = libc::c_double;
|
||||
pub type CGError = libc::int32_t;
|
||||
|
||||
+28
-1
@@ -10,17 +10,44 @@
|
||||
// this file defines CGFloat, as well as stubbed data types.
|
||||
|
||||
use libc;
|
||||
use base::CGError;
|
||||
use base::{CGError, boolean_t};
|
||||
use geometry::{CGRect, CGPoint, CGSize};
|
||||
|
||||
pub type CGDirectDisplayID = libc::uint32_t;
|
||||
|
||||
#[link(name = "ApplicationServices", kind = "framework")]
|
||||
extern {
|
||||
pub fn CGMainDisplayID() -> CGDirectDisplayID;
|
||||
pub fn CGDisplayIsActive(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsAsleep(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsBuiltin(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsInHWMirrorSet(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsInMirrorSet(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsMain(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsOnline(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayIsStereo(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayMirrorsDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
|
||||
pub fn CGDisplayPrimaryDisplay(display: CGDirectDisplayID) -> CGDirectDisplayID;
|
||||
pub fn CGDisplayRotation(display: CGDirectDisplayID) -> libc::c_double;
|
||||
pub fn CGDisplayScreenSize(display: CGDirectDisplayID) -> CGSize;
|
||||
pub fn CGDisplaySerialNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> boolean_t;
|
||||
pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGGetActiveDisplayList(max_displays: libc::uint32_t,
|
||||
active_displays: *mut CGDirectDisplayID,
|
||||
display_count: *mut libc::uint32_t) -> CGError;
|
||||
pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> libc::uint32_t;
|
||||
pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t;
|
||||
pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t;
|
||||
pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
|
||||
|
||||
// mouse stuff
|
||||
pub fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError;
|
||||
pub fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError;
|
||||
pub fn CGDisplayMoveCursorToPoint(display: CGDirectDisplayID, point: CGPoint) -> CGError;
|
||||
pub fn CGWarpMouseCursorPosition(point: CGPoint) -> CGError;
|
||||
pub fn CGAssociateMouseAndMouseCursorPosition(connected: bool) -> CGError;
|
||||
|
||||
}
|
||||
|
||||
@@ -9,16 +9,19 @@
|
||||
|
||||
use base::CGFloat;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct CGSize {
|
||||
pub width: CGFloat,
|
||||
pub height: CGFloat,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct CGPoint {
|
||||
pub x: CGFloat,
|
||||
pub y: CGFloat,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct CGRect {
|
||||
pub origin: CGPoint,
|
||||
pub size: CGSize
|
||||
|
||||
Reference in New Issue
Block a user