Skip to content

Commit

Permalink
fix(macOS): windows frozen when starting in fullscreen (#727)
Browse files Browse the repository at this point in the history
  • Loading branch information
wusyong committed May 4, 2023
1 parent c5d606d commit 7159466
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .changes/fullscreen-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tao": patch
---

On macOS, fix window frozed when starting with fullscreen.

13 changes: 1 addition & 12 deletions src/platform_impl/macos/window_delegate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7159466

Please sign in to comment.