Switch from using the key window to the main window mac platform API
When the help menu is open, the help menu's search field is the key window, and this was causing menu item action resolution to fail co-authored-by: Max <max@zed.dev>
This commit is contained in:
parent
9398de6a57
commit
adf94a1681
6 changed files with 12 additions and 12 deletions
|
@ -604,12 +604,12 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn key_window_id() -> Option<usize> {
|
||||
pub fn main_window_id() -> Option<usize> {
|
||||
unsafe {
|
||||
let app = NSApplication::sharedApplication(nil);
|
||||
let key_window: id = msg_send![app, keyWindow];
|
||||
if msg_send![key_window, isKindOfClass: WINDOW_CLASS] {
|
||||
let id = get_window_state(&*key_window).borrow().id;
|
||||
let main_window: id = msg_send![app, mainWindow];
|
||||
if msg_send![main_window, isKindOfClass: WINDOW_CLASS] {
|
||||
let id = get_window_state(&*main_window).borrow().id;
|
||||
Some(id)
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue