fix(macOS): windows frozen when starting in fullscreen (#727)

This commit is contained in:
Ngo Iok Ui (Wu Yu Wei)
2023-05-04 19:38:41 +08:00
committed by GitHub
parent c5d606dffe
commit 7159466743
2 changed files with 7 additions and 12 deletions

View File

@@ -0,0 +1,6 @@
---
"tao": patch
---
On macOS, fix window frozed when starting with fullscreen.

View File

@@ -341,18 +341,7 @@ extern "C" fn window_will_close(this: &Object, _: Sel, _: id) {
extern "C" fn window_did_resize(this: &Object, _: Sel, _: id) {
trace!("Triggered `windowDidResize:`");
with_state(this, |state| {
// If window is entering/exiting, resize and move event will be emitted in
// window_did_enter_fullscreen & window_did_exit_fullscreen.
let in_fullscreen_transition = state
.with_window(|window| {
trace!("Locked shared state in `window_did_resize`");
let shared_state = window.shared_state.lock().unwrap();
trace!("Unlocked shared state in `window_did_resize`");
shared_state.in_fullscreen_transition
})
.unwrap_or(false);
if !state.is_checking_zoomed_in && !in_fullscreen_transition {
if !state.is_checking_zoomed_in {
state.emit_resize_event();
state.emit_move_event();
}