mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
parent
7daf146801
commit
44af4f4f52
|
@ -37,9 +37,10 @@ pub struct EventLoop<T: 'static> {
|
||||||
|
|
||||||
/// Target that associates windows with an `EventLoop`.
|
/// Target that associates windows with an `EventLoop`.
|
||||||
///
|
///
|
||||||
/// This type exists to allow you to create new windows while Winit executes your callback.
|
/// This type exists to allow you to create new windows while Winit executes
|
||||||
/// `EventLoop` will coerce into this type, so functions that take this as a parameter can also
|
/// your callback. `EventLoop` will coerce into this type (`impl<T> Deref for
|
||||||
/// take `&EventLoop`.
|
/// EventLoop<T>`), so functions that take this as a parameter can also take
|
||||||
|
/// `&EventLoop`.
|
||||||
pub struct EventLoopWindowTarget<T: 'static> {
|
pub struct EventLoopWindowTarget<T: 'static> {
|
||||||
pub(crate) p: platform_impl::EventLoopWindowTarget<T>,
|
pub(crate) p: platform_impl::EventLoopWindowTarget<T>,
|
||||||
pub(crate) _marker: ::std::marker::PhantomData<*mut ()>, // Not Send nor Sync
|
pub(crate) _marker: ::std::marker::PhantomData<*mut ()>, // Not Send nor Sync
|
||||||
|
|
|
@ -577,9 +577,9 @@ impl EventLoopWaker {
|
||||||
fn new(rl: CFRunLoopRef) -> EventLoopWaker {
|
fn new(rl: CFRunLoopRef) -> EventLoopWaker {
|
||||||
extern "C" fn wakeup_main_loop(_timer: CFRunLoopTimerRef, _info: *mut c_void) {}
|
extern "C" fn wakeup_main_loop(_timer: CFRunLoopTimerRef, _info: *mut c_void) {}
|
||||||
unsafe {
|
unsafe {
|
||||||
// create a timer with a 1microsec interval (1ns does not work) to mimic polling.
|
// Create a timer with a 0.1µs interval (1ns does not work) to mimic polling.
|
||||||
// it is initially setup with a first fire time really far into the
|
// It is initially setup with a first fire time really far into the
|
||||||
// future, but that gets changed to fire immediatley in did_finish_launching
|
// future, but that gets changed to fire immediately in did_finish_launching
|
||||||
let timer = CFRunLoopTimerCreate(
|
let timer = CFRunLoopTimerCreate(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
std::f64::MAX,
|
std::f64::MAX,
|
||||||
|
|
|
@ -163,7 +163,7 @@ impl<T> Drop for EventLoopProxy<T> {
|
||||||
impl<T> EventLoopProxy<T> {
|
impl<T> EventLoopProxy<T> {
|
||||||
fn new(sender: Sender<T>) -> EventLoopProxy<T> {
|
fn new(sender: Sender<T>) -> EventLoopProxy<T> {
|
||||||
unsafe {
|
unsafe {
|
||||||
// just wakeup the eventloop
|
// just wake up the eventloop
|
||||||
extern "C" fn event_loop_proxy_handler(_: *mut c_void) {}
|
extern "C" fn event_loop_proxy_handler(_: *mut c_void) {}
|
||||||
|
|
||||||
// adding a Source to the main CFRunLoop lets us wake it up and
|
// adding a Source to the main CFRunLoop lets us wake it up and
|
||||||
|
|
|
@ -120,7 +120,7 @@ unsafe impl<T> Sync for Proxy<T> {}
|
||||||
impl<T> Proxy<T> {
|
impl<T> Proxy<T> {
|
||||||
fn new(sender: mpsc::Sender<T>) -> Self {
|
fn new(sender: mpsc::Sender<T>) -> Self {
|
||||||
unsafe {
|
unsafe {
|
||||||
// just wakeup the eventloop
|
// just wake up the eventloop
|
||||||
extern "C" fn event_loop_proxy_handler(_: *mut c_void) {}
|
extern "C" fn event_loop_proxy_handler(_: *mut c_void) {}
|
||||||
|
|
||||||
// adding a Source to the main CFRunLoop lets us wake it up and
|
// adding a Source to the main CFRunLoop lets us wake it up and
|
||||||
|
|
|
@ -204,9 +204,9 @@ impl Default for EventLoopWaker {
|
||||||
fn default() -> EventLoopWaker {
|
fn default() -> EventLoopWaker {
|
||||||
extern "C" fn wakeup_main_loop(_timer: CFRunLoopTimerRef, _info: *mut c_void) {}
|
extern "C" fn wakeup_main_loop(_timer: CFRunLoopTimerRef, _info: *mut c_void) {}
|
||||||
unsafe {
|
unsafe {
|
||||||
// create a timer with a 1µs interval (1ns does not work) to mimic polling.
|
// Create a timer with a 0.1µs interval (1ns does not work) to mimic polling.
|
||||||
// it is initially setup with a first fire time really far into the
|
// It is initially setup with a first fire time really far into the
|
||||||
// future, but that gets changed to fire immediatley in did_finish_launching
|
// future, but that gets changed to fire immediately in did_finish_launching
|
||||||
let timer = CFRunLoopTimerCreate(
|
let timer = CFRunLoopTimerCreate(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
std::f64::MAX,
|
std::f64::MAX,
|
||||||
|
|
Loading…
Reference in a new issue