Prepared winit for glutin porting
This commit is contained in:
parent
1f170264ed
commit
f5daac771e
4 changed files with 33 additions and 9 deletions
9
src/api/cocoa/mod.rs
Normal file → Executable file
9
src/api/cocoa/mod.rs
Normal file → Executable file
|
|
@ -11,22 +11,15 @@ use os::macos::ActivationPolicy;
|
|||
use objc::runtime::{Class, Object, Sel, BOOL, YES, NO};
|
||||
use objc::declare::ClassDecl;
|
||||
|
||||
use cgl::{CGLEnable, kCGLCECrashOnRemovedFunctions, CGLSetParameter, kCGLCPSurfaceOpacity};
|
||||
|
||||
use cocoa::base::{id, nil};
|
||||
use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize,
|
||||
NSString, NSUInteger};
|
||||
use cocoa::appkit::{self, NSApplication, NSEvent, NSOpenGLContext, NSOpenGLPixelFormat, NSView, NSWindow};
|
||||
|
||||
use core_foundation::base::TCFType;
|
||||
use core_foundation::string::CFString;
|
||||
use core_foundation::bundle::{CFBundleGetBundleWithIdentifier, CFBundleGetFunctionPointerForName};
|
||||
use cocoa::appkit::{self, NSApplication, NSEvent, NSView, NSWindow};
|
||||
|
||||
use core_graphics::display::{CGAssociateMouseAndMouseCursorPosition, CGMainDisplayID, CGDisplayPixelsHigh, CGWarpMouseCursorPosition};
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::collections::VecDeque;
|
||||
use std::str::FromStr;
|
||||
use std::str::from_utf8;
|
||||
use std::sync::Mutex;
|
||||
use std::ops::Deref;
|
||||
|
|
|
|||
|
|
@ -717,6 +717,16 @@ impl Window {
|
|||
self.x.display.display as *mut libc::c_void
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_xlib_screen_id(&self) -> *mut libc::c_void {
|
||||
self.x.screen_id as *mut libc::c_void
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_xlib_xconnection(&self) -> Arc<XConnection> {
|
||||
self.x.display.clone()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||
self.x.display.display as *mut libc::c_void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue