mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Fix runloop entry (#2480)
Introduced in https://github.com/rust-windowing/winit/pull/2479; turns out the definitions were not entirely equal, the `kCFRunLoopEntry` that we were using previously was defined as `0` while the correct value is `1` (which meant the `unimplemented!()` branch suddenly started triggering)
This commit is contained in:
parent
d8c0ee733b
commit
fec52b028e
|
@ -10,10 +10,9 @@ use std::{
|
||||||
use core_foundation::base::{CFIndex, CFRelease};
|
use core_foundation::base::{CFIndex, CFRelease};
|
||||||
use core_foundation::runloop::{
|
use core_foundation::runloop::{
|
||||||
kCFRunLoopAfterWaiting, kCFRunLoopBeforeWaiting, kCFRunLoopCommonModes, kCFRunLoopDefaultMode,
|
kCFRunLoopAfterWaiting, kCFRunLoopBeforeWaiting, kCFRunLoopCommonModes, kCFRunLoopDefaultMode,
|
||||||
kCFRunLoopEntry, kCFRunLoopExit, CFRunLoopActivity, CFRunLoopAddObserver, CFRunLoopAddSource,
|
kCFRunLoopExit, CFRunLoopActivity, CFRunLoopAddObserver, CFRunLoopAddSource, CFRunLoopGetMain,
|
||||||
CFRunLoopGetMain, CFRunLoopObserverCreate, CFRunLoopObserverRef, CFRunLoopSourceContext,
|
CFRunLoopObserverCreate, CFRunLoopObserverRef, CFRunLoopSourceContext, CFRunLoopSourceCreate,
|
||||||
CFRunLoopSourceCreate, CFRunLoopSourceInvalidate, CFRunLoopSourceRef, CFRunLoopSourceSignal,
|
CFRunLoopSourceInvalidate, CFRunLoopSourceRef, CFRunLoopSourceSignal, CFRunLoopWakeUp,
|
||||||
CFRunLoopWakeUp,
|
|
||||||
};
|
};
|
||||||
use objc2::runtime::Object;
|
use objc2::runtime::Object;
|
||||||
use objc2::{class, msg_send, ClassType};
|
use objc2::{class, msg_send, ClassType};
|
||||||
|
@ -236,7 +235,6 @@ fn setup_control_flow_observers() {
|
||||||
#[allow(non_upper_case_globals)]
|
#[allow(non_upper_case_globals)]
|
||||||
match activity {
|
match activity {
|
||||||
kCFRunLoopAfterWaiting => app_state::handle_wakeup_transition(),
|
kCFRunLoopAfterWaiting => app_state::handle_wakeup_transition(),
|
||||||
kCFRunLoopEntry => unimplemented!(), // not expected to ever happen
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +286,7 @@ fn setup_control_flow_observers() {
|
||||||
|
|
||||||
let begin_observer = CFRunLoopObserverCreate(
|
let begin_observer = CFRunLoopObserverCreate(
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
kCFRunLoopEntry | kCFRunLoopAfterWaiting,
|
kCFRunLoopAfterWaiting,
|
||||||
1, // repeat = true
|
1, // repeat = true
|
||||||
CFIndex::min_value(),
|
CFIndex::min_value(),
|
||||||
control_flow_begin_handler,
|
control_flow_begin_handler,
|
||||||
|
|
|
@ -15,8 +15,8 @@ use crate::platform_impl::platform::{
|
||||||
use core_foundation::base::{CFIndex, CFOptionFlags, CFRelease};
|
use core_foundation::base::{CFIndex, CFOptionFlags, CFRelease};
|
||||||
use core_foundation::date::CFAbsoluteTimeGetCurrent;
|
use core_foundation::date::CFAbsoluteTimeGetCurrent;
|
||||||
use core_foundation::runloop::{
|
use core_foundation::runloop::{
|
||||||
kCFRunLoopAfterWaiting, kCFRunLoopBeforeWaiting, kCFRunLoopCommonModes, kCFRunLoopEntry,
|
kCFRunLoopAfterWaiting, kCFRunLoopBeforeWaiting, kCFRunLoopCommonModes, kCFRunLoopExit,
|
||||||
kCFRunLoopExit, CFRunLoopActivity, CFRunLoopAddObserver, CFRunLoopAddTimer, CFRunLoopGetMain,
|
CFRunLoopActivity, CFRunLoopAddObserver, CFRunLoopAddTimer, CFRunLoopGetMain,
|
||||||
CFRunLoopObserverCallBack, CFRunLoopObserverContext, CFRunLoopObserverCreate,
|
CFRunLoopObserverCallBack, CFRunLoopObserverContext, CFRunLoopObserverCreate,
|
||||||
CFRunLoopObserverRef, CFRunLoopRef, CFRunLoopTimerCreate, CFRunLoopTimerInvalidate,
|
CFRunLoopObserverRef, CFRunLoopRef, CFRunLoopTimerCreate, CFRunLoopTimerInvalidate,
|
||||||
CFRunLoopTimerRef, CFRunLoopTimerSetNextFireDate,
|
CFRunLoopTimerRef, CFRunLoopTimerSetNextFireDate,
|
||||||
|
@ -57,7 +57,6 @@ extern "C" fn control_flow_begin_handler(
|
||||||
AppState::wakeup(panic_info);
|
AppState::wakeup(panic_info);
|
||||||
//trace!("Completed `CFRunLoopAfterWaiting`");
|
//trace!("Completed `CFRunLoopAfterWaiting`");
|
||||||
}
|
}
|
||||||
kCFRunLoopEntry => unimplemented!(), // not expected to ever happen
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -126,7 +125,7 @@ pub fn setup_control_flow_observers(panic_info: Weak<PanicInfo>) {
|
||||||
};
|
};
|
||||||
let run_loop = RunLoop::get();
|
let run_loop = RunLoop::get();
|
||||||
run_loop.add_observer(
|
run_loop.add_observer(
|
||||||
kCFRunLoopEntry | kCFRunLoopAfterWaiting,
|
kCFRunLoopAfterWaiting,
|
||||||
CFIndex::min_value(),
|
CFIndex::min_value(),
|
||||||
control_flow_begin_handler,
|
control_flow_begin_handler,
|
||||||
&mut context as *mut _,
|
&mut context as *mut _,
|
||||||
|
|
Loading…
Reference in a new issue