Unlocks platform-specific attributes
This commit is contained in:
parent
86dd75f7e9
commit
ec76d991ad
13 changed files with 92 additions and 17 deletions
|
|
@ -65,6 +65,11 @@ impl MonitorId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PlatformSpecificWindowBuilderAttributes;
|
||||
#[derive(Default)]
|
||||
pub struct PlatformSpecificHeadlessBuilderAttributes;
|
||||
|
||||
pub struct PollEventsIterator<'a> {
|
||||
window: &'a Window,
|
||||
}
|
||||
|
|
@ -116,7 +121,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
|||
|
||||
impl Window {
|
||||
pub fn new(win_attribs: &WindowAttributes, pf_reqs: &PixelFormatRequirements,
|
||||
opengl: &GlAttributes<&Window>) -> Result<Window, CreationError>
|
||||
opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes)
|
||||
-> Result<Window, CreationError>
|
||||
{
|
||||
use std::{mem, ptr};
|
||||
|
||||
|
|
@ -302,7 +308,9 @@ pub struct HeadlessContext(EglContext);
|
|||
impl HeadlessContext {
|
||||
/// See the docs in the crate root file.
|
||||
pub fn new(dimensions: (u32, u32), pf_reqs: &PixelFormatRequirements,
|
||||
opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError>
|
||||
opengl: &GlAttributes<&HeadlessContext>,
|
||||
_: &PlatformSpecificHeadlessBuilderAttributes)
|
||||
-> Result<HeadlessContext, CreationError>
|
||||
{
|
||||
let opengl = opengl.clone().map_sharing(|c| &c.0);
|
||||
let context = try!(EglContext::new(egl::ffi::egl::Egl, pf_reqs, &opengl,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ use cocoa::appkit::*;
|
|||
use PixelFormat;
|
||||
use api::cocoa::helpers;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PlatformSpecificHeadlessBuilderAttributes;
|
||||
|
||||
pub struct HeadlessContext {
|
||||
width: u32,
|
||||
height: u32,
|
||||
|
|
@ -21,7 +24,9 @@ pub struct HeadlessContext {
|
|||
|
||||
impl HeadlessContext {
|
||||
pub fn new((width, height): (u32, u32), pf_reqs: &PixelFormatRequirements,
|
||||
opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError>
|
||||
opengl: &GlAttributes<&HeadlessContext>,
|
||||
_: &PlatformSpecificHeadlessBuilderAttributes)
|
||||
-> Result<HeadlessContext, CreationError>
|
||||
{
|
||||
let context = unsafe {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#![cfg(target_os = "macos")]
|
||||
|
||||
pub use self::headless::HeadlessContext;
|
||||
|
||||
use {CreationError, Event, MouseCursor, CursorState};
|
||||
use CreationError::OsError;
|
||||
use libc;
|
||||
|
|
@ -50,6 +48,8 @@ use events::MouseButton;
|
|||
use events;
|
||||
|
||||
pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor};
|
||||
pub use self::headless::HeadlessContext;
|
||||
pub use self::headless::PlatformSpecificHeadlessBuilderAttributes;
|
||||
|
||||
mod monitor;
|
||||
mod event;
|
||||
|
|
@ -179,6 +179,9 @@ impl Drop for WindowDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PlatformSpecificWindowBuilderAttributes;
|
||||
|
||||
pub struct Window {
|
||||
view: IdRef,
|
||||
window: IdRef,
|
||||
|
|
@ -264,7 +267,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
|||
|
||||
impl Window {
|
||||
pub fn new(win_attribs: &WindowAttributes, pf_reqs: &PixelFormatRequirements,
|
||||
opengl: &GlAttributes<&Window>) -> Result<Window, CreationError>
|
||||
opengl: &GlAttributes<&Window>, _: &PlatformSpecificWindowBuilderAttributes)
|
||||
-> Result<Window, CreationError>
|
||||
{
|
||||
if opengl.sharing.is_some() {
|
||||
unimplemented!()
|
||||
|
|
|
|||
|
|
@ -177,10 +177,14 @@ impl MonitorId {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PlatformSpecificWindowBuilderAttributes;
|
||||
|
||||
impl Window {
|
||||
|
||||
pub fn new(builder: &WindowAttributes, _: &PixelFormatRequirements, _: &GlAttributes<&Window>) -> Result<Window, CreationError> {
|
||||
pub fn new(builder: &WindowAttributes, _: &PixelFormatRequirements, _: &GlAttributes<&Window>,
|
||||
_: &PlatformSpecificWindowBuilderAttributes) -> Result<Window, CreationError>
|
||||
{
|
||||
unsafe {
|
||||
if setjmp(mem::transmute(&mut jmpbuf)) != 0 {
|
||||
let app: id = msg_send![Class::get("UIApplication").unwrap(), sharedApplication];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue