Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing functions regarding display refresh rate #2

Merged
merged 1 commit into from Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ objc = "0.2.5"
core-foundation-sys = "0.6.2"
metal = { version = "0.14.0", features = ["private"] }

[dependencies.core-graphics]
version = "0.17.3"
optional = true

[features]
default = [ "display_link", ]
all = [ "display_link", "direct3d", "io_suface", "opengl" ]

display_link = [ "opengl", ]
display_link = [ "opengl", "core-graphics" ]
direct3d = [ ]
io_suface = [ ]
opengl = [ ]
Expand Down
15 changes: 13 additions & 2 deletions src/display_link.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
use crate::core_foundation_sys::base::CFTypeID;
use crate::{
core_foundation_sys::base::CFTypeID,
core_graphics::display::CGDirectDisplayID,
CVReturn, CVTime,
};

#[derive(Debug, Copy, Clone)]
pub enum __CVDisplayLink { }
pub type CVDisplayLinkRef = *mut __CVDisplayLink;

extern "C" {
pub fn CVDisplayLinkGetTypeID() -> CFTypeID;
}
pub fn CVDisplayLinkCreateWithCGDisplay(displayID: CGDirectDisplayID, displayLinkOut: *mut CVDisplayLinkRef) -> CVReturn;
pub fn CVDisplayLinkGetNominalOutputVideoRefreshPeriod(displayLink: CVDisplayLinkRef) -> CVTime;
pub fn CVDisplayLinkRelease(displayLink: CVDisplayLinkRef);
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub use self::metal_texture_cache::*;

cfg_if! {
if #[cfg(feature = "display_link")] {
extern crate core_graphics;

pub mod host_time;
pub mod display_link;

Expand Down