Use initialFirstResponder instead of makeFirstResponder (#1920)

As recommended by the documentation: https://developer.apple.com/documentation/appkit/nswindow/1419366-makefirstresponder?language=objc
This commit is contained in:
Mads Marquart 2021-04-29 12:52:41 +02:00 committed by GitHub
parent e8cdf8b092
commit 45aacd8407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,8 +131,6 @@ unsafe fn create_view(
ns_view.setWantsLayer(YES);
}
ns_window.setContentView_(*ns_view);
ns_window.makeFirstResponder_(*ns_view);
(ns_view, cursor_state)
})
}
@ -377,6 +375,12 @@ impl UnownedWindow {
os_error!(OsError::CreationError("Couldn't create `NSView`"))
})?;
// Configure the new view as the "key view" for the window
unsafe {
ns_window.setContentView_(*ns_view);
ns_window.setInitialFirstResponder_(*ns_view);
}
let input_context = unsafe { util::create_input_context(*ns_view) };
let scale_factor = unsafe { NSWindow::backingScaleFactor(*ns_window) as f64 };