Fix various typos

Mainly fix typos in comments, but also some minor code changes:

* Rename `apply_on_poiner` to `apply_on_pointer`.
* Rename `ImeState::Commited` to `ImeState::Committed`
* Correct `cfg_attr` usage: `wayland_platfrom` -> `wayland_platform`.
This commit is contained in:
Bruce Mitchener 2024-02-19 11:58:44 +07:00 committed by GitHub
parent 542d1938ce
commit c4310af83c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 94 additions and 94 deletions

View file

@ -177,7 +177,7 @@ impl ApplicationDelegate {
}
/// If `pump_events` is called to progress the event loop then we
/// bootstrap the event loop via `-[NSAppplication run]` but will use
/// bootstrap the event loop via `-[NSApplication run]` but will use
/// `CFRunLoopRunInMode` for subsequent calls to `pump_events`.
pub fn set_stop_on_launch(&self) {
self.ivars().stop_on_launch.set(true);
@ -538,7 +538,7 @@ fn window_activation_hack(app: &NSApplication) {
// TODO: Proper ordering of the windows
app.windows().into_iter().for_each(|window| {
// Call `makeKeyAndOrderFront` if it was called on the window in `WinitWindow::new`
// This way we preserve the user's desired initial visiblity status
// This way we preserve the user's desired initial visibility status
// TODO: Also filter on the type/"level" of the window, and maybe other things?
if window.isVisible() {
log::trace!("Activating visible window");

View file

@ -169,8 +169,8 @@ fn map_user_event<T: 'static>(
pub struct EventLoop<T: 'static> {
/// Store a reference to the application for convenience.
///
/// We intentially don't store `WinitApplication` since we want to have
/// the possiblity of swapping that out at some point.
/// We intentionally don't store `WinitApplication` since we want to have
/// the possibility of swapping that out at some point.
app: Id<NSApplication>,
/// The application delegate that we've registered.
///

View file

@ -35,7 +35,7 @@ pub fn initialize(app: &NSApplication) {
let services_item = menu_item(mtm, ns_string!("Services"), None, None);
services_item.setSubmenu(Some(&services_menu));
// Seperator menu item
// Separator menu item
let sep_first = NSMenuItem::separatorItem(mtm);
// Hide application menu item
@ -71,7 +71,7 @@ pub fn initialize(app: &NSApplication) {
None,
);
// Seperator menu item
// Separator menu item
let sep = NSMenuItem::separatorItem(mtm);
// Quit application menu item

View file

@ -65,8 +65,8 @@ enum ImeState {
/// The IME is in preedit.
Preedit,
/// The text was just commited, so the next input from the keyboard must be ignored.
Commited,
/// The text was just committed, so the next input from the keyboard must be ignored.
Committed,
}
bitflags::bitflags! {
@ -397,7 +397,7 @@ declare_class!(
if unsafe { self.hasMarkedText() } && self.is_ime_enabled() && !is_control {
self.queue_event(WindowEvent::Ime(Ime::Preedit(String::new(), None)));
self.queue_event(WindowEvent::Ime(Ime::Commit(string)));
self.ivars().ime_state.set(ImeState::Commited);
self.ivars().ime_state.set(ImeState::Committed);
}
}
@ -406,10 +406,10 @@ declare_class!(
#[method(doCommandBySelector:)]
fn do_command_by_selector(&self, _command: Sel) {
trace_scope!("doCommandBySelector:");
// We shouldn't forward any character from just commited text, since we'll end up sending
// We shouldn't forward any character from just committed text, since we'll end up sending
// it twice with some IMEs like Korean one. We'll also always send `Enter` in that case,
// which is not desired given it was used to confirm IME input.
if self.ivars().ime_state.get() == ImeState::Commited {
if self.ivars().ime_state.get() == ImeState::Committed {
return;
}
@ -452,8 +452,8 @@ declare_class!(
let events_for_nsview = NSArray::from_slice(&[&*event]);
unsafe { self.interpretKeyEvents(&events_for_nsview) };
// If the text was commited we must treat the next keyboard event as IME related.
if self.ivars().ime_state.get() == ImeState::Commited {
// If the text was committed we must treat the next keyboard event as IME related.
if self.ivars().ime_state.get() == ImeState::Committed {
// Remove any marked text, so normal input can continue.
*self.ivars().marked_text.borrow_mut() = NSMutableAttributedString::new();
}
@ -462,7 +462,7 @@ declare_class!(
self.update_modifiers(&event, false);
let had_ime_input = match self.ivars().ime_state.get() {
ImeState::Commited => {
ImeState::Committed => {
// Allow normal input after the commit.
self.ivars().ime_state.set(ImeState::Ground);
true
@ -924,7 +924,7 @@ impl WinitView {
let mut event = create_key_event(ns_event, false, false, Some(physical_key));
let key = code_to_key(physical_key, scancode);
// Ignore processing of unkown modifiers because we can't determine whether
// Ignore processing of unknown modifiers because we can't determine whether
// it was pressed or release reliably.
let Some(event_modifier) = key_to_modifier(&key) else {
break 'send_event;

View file

@ -300,12 +300,12 @@ declare_class!(
/// Invoked when fail to enter fullscreen
///
/// When this window launch from a fullscreen app (e.g. launch from VS Code
/// terminal), it creates a new virtual destkop and a transition animation.
/// terminal), it creates a new virtual desktop and a transition animation.
/// This animation takes one second and cannot be disable without
/// elevated privileges. In this animation time, all toggleFullscreen events
/// will be failed. In this implementation, we will try again by using
/// performSelector:withObject:afterDelay: until window_did_enter_fullscreen.
/// It should be fine as we only do this at initialzation (i.e with_fullscreen
/// It should be fine as we only do this at initialization (i.e with_fullscreen
/// was set).
///
/// From Apple doc:
@ -1128,7 +1128,7 @@ impl WindowDelegate {
pub(crate) fn is_zoomed(&self) -> bool {
// because `isZoomed` doesn't work if the window's borderless,
// we make it resizable temporalily.
// we make it resizable temporarily.
let curr_mask = self.window().styleMask();
let required = NSWindowStyleMaskTitled | NSWindowStyleMaskResizable;