mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Query isKeyWindow
on windowDidBecomeKey
or windowDidResignKey
Before we were assuming that receiving a callback meant that the window was in that "key" state accordingly, but with popups that's not always the case. In particular, there was a bug that caused an unrelated window to receive `windowDidBecomeKey` when making an `NSPanel` the key window.
This commit is contained in:
parent
ea00a00028
commit
66d13cf42c
1 changed files with 5 additions and 10 deletions
|
@ -1070,17 +1070,12 @@ fn window_fullscreen_changed(this: &Object, is_fullscreen: bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn window_did_change_key_status(this: &Object, selector: Sel, _: id) {
|
extern "C" fn window_did_change_key_status(this: &Object, _: Sel, _: id) {
|
||||||
let is_active = if selector == sel!(windowDidBecomeKey:) {
|
|
||||||
true
|
|
||||||
} else if selector == sel!(windowDidResignKey:) {
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
unreachable!();
|
|
||||||
};
|
|
||||||
|
|
||||||
let window_state = unsafe { get_window_state(this) };
|
let window_state = unsafe { get_window_state(this) };
|
||||||
let executor = window_state.as_ref().borrow().executor.clone();
|
let window_state_borrow = window_state.borrow();
|
||||||
|
let is_active = unsafe { window_state_borrow.native_window.isKeyWindow() };
|
||||||
|
let executor = window_state_borrow.executor.clone();
|
||||||
|
drop(window_state_borrow);
|
||||||
executor
|
executor
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let mut window_state_borrow = window_state.as_ref().borrow_mut();
|
let mut window_state_borrow = window_state.as_ref().borrow_mut();
|
||||||
|
|
Loading…
Reference in a new issue