From c4310af83ca2844ac4044e017b7ff41d27366929 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 19 Feb 2024 11:58:44 +0700 Subject: [PATCH] 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`. --- CHANGELOG.md | 16 +++++----- examples/child_window.rs | 2 +- examples/control_flow.rs | 2 +- examples/fullscreen.rs | 2 +- examples/handling_close.rs | 2 +- examples/multithreaded.rs | 2 +- examples/window_debug.rs | 4 +-- src/dpi.rs | 2 +- src/event.rs | 8 ++--- src/event_loop.rs | 2 +- src/keyboard.rs | 10 +++--- src/platform/scancode.rs | 2 +- src/platform/wayland.rs | 2 +- src/platform/x11.rs | 4 +-- src/platform_impl/ios/app_state.rs | 2 +- src/platform_impl/ios/event_loop.rs | 2 +- src/platform_impl/ios/mod.rs | 2 +- src/platform_impl/linux/wayland/seat/mod.rs | 2 +- .../linux/wayland/seat/pointer/mod.rs | 2 +- .../linux/wayland/seat/text_input/mod.rs | 2 +- src/platform_impl/linux/wayland/state.rs | 6 ++-- .../linux/wayland/window/state.rs | 32 +++++++++---------- .../linux/x11/event_processor.rs | 2 +- src/platform_impl/linux/x11/ime/context.rs | 2 +- .../linux/x11/ime/input_method.rs | 2 +- .../linux/x11/util/window_property.rs | 2 +- src/platform_impl/macos/app_delegate.rs | 4 +-- src/platform_impl/macos/event_loop.rs | 4 +-- src/platform_impl/macos/menu.rs | 4 +-- src/platform_impl/macos/view.rs | 18 +++++------ src/platform_impl/macos/window_delegate.rs | 6 ++-- src/platform_impl/orbital/window.rs | 2 +- src/platform_impl/windows/drop_handler.rs | 4 +-- src/platform_impl/windows/event_loop.rs | 10 +++--- src/platform_impl/windows/keyboard.rs | 4 +-- src/platform_impl/windows/keyboard_layout.rs | 8 ++--- src/window.rs | 6 ++-- 37 files changed, 94 insertions(+), 94 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e12b62c..289c921d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -133,7 +133,7 @@ Unreleased` header. # 0.29.3 - On Wayland, apply correct scale to `PhysicalSize` passed in `WindowBuilder::with_inner_size` when possible. -- On Wayland, fix `RedrawRequsted` being always sent without decorations and `sctk-adwaita` feature. +- On Wayland, fix `RedrawRequested` being always sent without decorations and `sctk-adwaita` feature. - On Wayland, ignore resize requests when the window is fully tiled. - On Wayland, use `configure_bounds` to constrain `with_inner_size` when compositor wants users to pick size. - On Windows, fix deadlock when accessing the state during `Cursor{Enter,Leave}`. @@ -385,7 +385,7 @@ Unreleased` header. - **Breaking:**: Removed deprecated method `platform::unix::WindowExtUnix::is_ready`. - Removed `parking_lot` dependency. - **Breaking:** On macOS, add support for two-finger touchpad magnification and rotation gestures with new events `WindowEvent::TouchpadMagnify` and `WindowEvent::TouchpadRotate`. Also add support for touchpad smart-magnification gesture with a new event `WindowEvent::SmartMagnify`. -- **Breaking:** On web, the `WindowBuilderExtWebSys::with_prevent_default` setting (enabled by default), now additionally prevents scrolling of the webpage in mobile browsers, previously it only disabled scrolling on desktop. +- **Breaking:** On Web, the `WindowBuilderExtWebSys::with_prevent_default` setting (enabled by default), now additionally prevents scrolling of the webpage in mobile browsers, previously it only disabled scrolling on desktop. - On Wayland, `wayland-csd-adwaita` now uses `ab_glyph` instead of `crossfont` to render the title for decorations. - On Wayland, a new `wayland-csd-adwaita-crossfont` feature was added to use `crossfont` instead of `ab_glyph` for decorations. - On Wayland, if not otherwise specified use upstream automatic CSD theme selection. @@ -405,7 +405,7 @@ Unreleased` header. - Added `Window::set_transparent` to provide a hint about transparency of the window on Wayland and macOS. - On macOS, fix the mouse buttons other than left/right/middle being reported as middle. - On Wayland, support fractional scaling via the wp-fractional-scale protocol. -- On web, fix removal of mouse event listeners from the global object upon window distruction. +- On Web, fix removal of mouse event listeners from the global object upon window destruction. - Add WindowAttributes getter to WindowBuilder to allow introspection of default values. - Added `Window::set_ime_purpose` for setting the IME purpose, currently implemented on Wayland only. @@ -511,7 +511,7 @@ Unreleased` header. - On Web, add `with_prevent_default` and `with_focusable` to `WindowBuilderExtWebSys` to control whether events should be propagated. - On Windows, fix focus events being sent to inactive windows. - **Breaking**, update `raw-window-handle` to `v0.5` and implement `HasRawDisplayHandle` for `Window` and `EventLoopWindowTarget`. -- On X11, add function `register_xlib_error_hook` into `winit::platform::unix` to subscribe for errors comming from Xlib. +- On X11, add function `register_xlib_error_hook` into `winit::platform::unix` to subscribe for errors coming from Xlib. - On Android, upgrade `ndk` and `ndk-glue` dependencies to the recently released `0.7.0`. - All platforms can now be relied on to emit a `Resumed` event. Applications are recommended to lazily initialize graphics state and windows on first resume for portability. - **Breaking:**: Reverse horizontal scrolling sign in `MouseScrollDelta` to match the direction of vertical scrolling. A positive X value now means moving the content to the right. The meaning of vertical scrolling stays the same: a positive Y value means moving the content down. @@ -810,7 +810,7 @@ Unreleased` header. - On Windows, fix handling of surrogate pairs when dispatching `ReceivedCharacter`. - On macOS 10.15, fix freeze upon exiting exclusive fullscreen mode. - On iOS, fix panic upon closing the app. -- On X11, allow setting mulitple `XWindowType`s. +- On X11, allow setting multiple `XWindowType`s. - On iOS, fix null window on initial `HiDpiFactorChanged` event. - On Windows, fix fullscreen window shrinking upon getting restored to a normal window. - On macOS, fix events not being emitted during modal loops, such as when windows are being resized @@ -963,7 +963,7 @@ and `WindowEvent::HoveredFile`. - On Windows, hiding the cursor no longer hides the cursor for all Winit windows - just the one `hide_cursor` was called on. - On Windows, cursor grabs used to get perpetually canceled when the grabbing window lost focus. Now, cursor grabs automatically get re-initialized when the window regains focus and the mouse moves over the client area. - On Windows, only vertical mouse wheel events were handled. Now, horizontal mouse wheel events are also handled. -- On Windows, ignore the AltGr key when populating the `ModifersState` type. +- On Windows, ignore the AltGr key when populating the `ModifiersState` type. # Version 0.18.1 (2018-12-30) @@ -1243,7 +1243,7 @@ _Yanked_ # Version 0.8.2 (2017-09-28) -- Uniformize keyboard scancode values accross Wayland and X11 (#297). +- Uniformize keyboard scancode values across Wayland and X11 (#297). - Internal rework of the wayland event loop - Added method `os::linux::WindowExt::is_ready` @@ -1257,7 +1257,7 @@ _Yanked_ - Added `Window::set_maximized`, `WindowAttributes::maximized` and `WindowBuilder::with_maximized`. - Added `Window::set_fullscreen`. - Changed `with_fullscreen` to take a `Option` instead of a `MonitorId`. -- Removed `MonitorId::get_native_identifer()` in favor of platform-specific traits in the `os` +- Removed `MonitorId::get_native_identifier()` in favor of platform-specific traits in the `os` module. - Changed `get_available_monitors()` and `get_primary_monitor()` to be methods of `EventsLoop` instead of stand-alone methods. diff --git a/examples/child_window.rs b/examples/child_window.rs index b9e28313..5d7f7add 100644 --- a/examples/child_window.rs +++ b/examples/child_window.rs @@ -64,7 +64,7 @@ fn main() -> Result<(), impl std::error::Error> { // On x11, println when the cursor entered in a window even if the child window is created // by some key inputs. // the child windows are always placed at (0, 0) with size (200, 200) in the parent window, - // so we also can see this log when we move the cursor arround (200, 200) in parent window. + // so we also can see this log when we move the cursor around (200, 200) in parent window. println!("cursor entered in the window {window_id:?}"); } WindowEvent::KeyboardInput { diff --git a/examples/control_flow.rs b/examples/control_flow.rs index 1154b33f..cff46a00 100644 --- a/examples/control_flow.rs +++ b/examples/control_flow.rs @@ -70,7 +70,7 @@ fn main() -> Result<(), impl std::error::Error> { }, .. } => match key.as_ref() { - // WARNING: Consider using `key_without_modifers()` if available on your platform. + // WARNING: Consider using `key_without_modifiers()` if available on your platform. // See the `key_binding` example Key::Character("1") => { mode = Mode::Wait; diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs index 979b216f..02243323 100644 --- a/examples/fullscreen.rs +++ b/examples/fullscreen.rs @@ -66,7 +66,7 @@ fn main() -> Result<(), impl std::error::Error> { .. } => match key { Key::Named(NamedKey::Escape) => elwt.exit(), - // WARNING: Consider using `key_without_modifers()` if available on your platform. + // WARNING: Consider using `key_without_modifiers()` if available on your platform. // See the `key_binding` example Key::Character(ch) => match ch.to_lowercase().as_str() { "f" | "b" if window.fullscreen().is_some() => { diff --git a/examples/handling_close.rs b/examples/handling_close.rs index da15d657..f44d6dee 100644 --- a/examples/handling_close.rs +++ b/examples/handling_close.rs @@ -51,7 +51,7 @@ fn main() -> Result<(), impl std::error::Error> { }, .. } => { - // WARNING: Consider using `key_without_modifers()` if available on your platform. + // WARNING: Consider using `key_without_modifiers()` if available on your platform. // See the `key_binding` example match key.as_ref() { Key::Character("y") => { diff --git a/examples/multithreaded.rs b/examples/multithreaded.rs index e38bb53d..cda35482 100644 --- a/examples/multithreaded.rs +++ b/examples/multithreaded.rs @@ -78,7 +78,7 @@ fn main() -> Result<(), impl std::error::Error> { } println!("Picking video mode: {}", video_modes[video_mode_id]); } - // WARNING: Consider using `key_without_modifers()` if available on your platform. + // WARNING: Consider using `key_without_modifiers()` if available on your platform. // See the `key_binding` example Key::Character(ch) => match ch.to_lowercase().as_str() { "1" => window.set_window_level(WindowLevel::AlwaysOnTop), diff --git a/examples/window_debug.rs b/examples/window_debug.rs index 3f219d05..74c5e8ff 100644 --- a/examples/window_debug.rs +++ b/examples/window_debug.rs @@ -27,7 +27,7 @@ fn main() -> Result<(), impl std::error::Error> { eprintln!("debugging keys:"); eprintln!(" (E) Enter exclusive fullscreen"); eprintln!(" (F) Toggle borderless fullscreen"); - eprintln!(" (P) Toggle borderless fullscreen on system's preffered monitor"); + eprintln!(" (P) Toggle borderless fullscreen on system's preferred monitor"); eprintln!(" (M) Toggle minimized"); eprintln!(" (Q) Quit event loop"); eprintln!(" (V) Toggle visibility"); @@ -76,7 +76,7 @@ fn main() -> Result<(), impl std::error::Error> { }, .. } => match key_str.as_ref() { - // WARNING: Consider using `key_without_modifers()` if available on your platform. + // WARNING: Consider using `key_without_modifiers()` if available on your platform. // See the `key_binding` example "e" => { fn area(size: PhysicalSize) -> u32 { diff --git a/src/dpi.rs b/src/dpi.rs index 3c99251a..3d7b7b23 100644 --- a/src/dpi.rs +++ b/src/dpi.rs @@ -168,7 +168,7 @@ pub fn validate_scale_factor(scale_factor: f64) -> bool { /// A position represented in logical pixels. /// /// The position is stored as floats, so please be careful. Casting floats to integers truncates the -/// fractional part, which can cause noticable issues. To help with that, an `Into<(i32, i32)>` +/// fractional part, which can cause noticeable issues. To help with that, an `Into<(i32, i32)>` /// implementation is provided which does the rounding for you. #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Default, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] diff --git a/src/event.rs b/src/event.rs index 4da049c4..fbd55610 100644 --- a/src/event.rs +++ b/src/event.rs @@ -309,7 +309,7 @@ pub enum WindowEvent { /// The activation token was delivered back and now could be used. /// #[cfg_attr( - not(any(x11_platform, wayland_platfrom)), + not(any(x11_platform, wayland_platform)), allow(rustdoc::broken_intra_doc_links) )] /// Delivered in response to [`request_activation_token`]. @@ -473,7 +473,7 @@ pub enum WindowEvent { /// The event is general enough that its generating gesture is allowed to vary /// across platforms. It could also be generated by another device. /// - /// Unfortunatly, neither [Windows](https://support.microsoft.com/en-us/windows/touch-gestures-for-windows-a9d28305-4818-a5df-4e2b-e5590f850741) + /// Unfortunately, neither [Windows](https://support.microsoft.com/en-us/windows/touch-gestures-for-windows-a9d28305-4818-a5df-4e2b-e5590f850741) /// nor [Wayland](https://wayland.freedesktop.org/libinput/doc/latest/gestures.html) /// support this gesture or any other gesture with the same effect. /// @@ -1112,7 +1112,7 @@ pub enum MouseScrollDelta { PixelDelta(PhysicalPosition), } -/// Handle to synchroniously change the size of the window from the +/// Handle to synchronously change the size of the window from the /// [`WindowEvent`]. #[derive(Debug, Clone)] pub struct InnerSizeWriter { @@ -1125,7 +1125,7 @@ impl InnerSizeWriter { Self { new_inner_size } } - /// Try to request inner size which will be set synchroniously on the window. + /// Try to request inner size which will be set synchronously on the window. pub fn request_inner_size( &mut self, new_inner_size: PhysicalSize, diff --git a/src/event_loop.rs b/src/event_loop.rs index b8dd1a21..a4b5ecec 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -513,7 +513,7 @@ pub enum DeviceEvents { /// This could be used to identify the async request once it's done /// and a specific action must be taken. /// -/// One of the handling scenarious could be to maintain a working list +/// One of the handling scenarios could be to maintain a working list /// containing [`AsyncRequestSerial`] and some closure associated with it. /// Then once event is arriving the working list is being traversed and a job /// executed and removed from the list. diff --git a/src/keyboard.rs b/src/keyboard.rs index 5f5ba50b..4fc9fdb0 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -20,7 +20,7 @@ // the W3C short notice apply to the `Key` and `KeyCode` enums and their variants and the // documentation attached to their variants. -// --------- BEGGINING OF W3C LICENSE -------------------------------------------------------------- +// --------- BEGINNING OF W3C LICENSE -------------------------------------------------------------- // // License // @@ -55,7 +55,7 @@ // // --------- END OF W3C LICENSE -------------------------------------------------------------------- -// --------- BEGGINING OF W3C SHORT NOTICE --------------------------------------------------------- +// --------- BEGINNING OF W3C SHORT NOTICE --------------------------------------------------------- // // winit: https://github.com/rust-windowing/winit // @@ -744,7 +744,7 @@ pub enum KeyCode { /// - The `Super` variant here, is named `Meta` in the aforementioned specification. (There's /// another key which the specification calls `Super`. That does not exist here.) /// - The `Space` variant here, can be identified by the character it generates in the -/// specificaiton. +/// specification. /// /// [`KeyboardEvent.key`]: https://w3c.github.io/uievents-key/ #[non_exhaustive] @@ -914,7 +914,7 @@ pub enum NamedKey { Standby, /// The WakeUp key. (`KEYCODE_WAKEUP`) WakeUp, - /// Initate the multi-candidate mode. + /// Initiate the multi-candidate mode. AllCandidates, Alphanumeric, /// Initiate the Code Input mode to allow characters to be entered by @@ -1459,7 +1459,7 @@ pub enum NamedKey { /// This is a superset of the UI Events Specification's [`KeyboardEvent.key`] with /// additions: /// - All simple variants are wrapped under the `Named` variant -/// - The `Unidentified` variant here, can still identifiy a key through it's `NativeKeyCode`. +/// - The `Unidentified` variant here, can still identify a key through it's `NativeKeyCode`. /// - The `Dead` variant here, can specify the character which is inserted when pressing the /// dead-key twice. /// diff --git a/src/platform/scancode.rs b/src/platform/scancode.rs index 35d101da..c175e5b8 100644 --- a/src/platform/scancode.rs +++ b/src/platform/scancode.rs @@ -9,7 +9,7 @@ use crate::keyboard::{KeyCode, PhysicalKey}; pub trait PhysicalKeyExtScancode { /// The raw value of the platform-specific physical key identifier. /// - /// Returns `Some(key_id)` if the conversion was succesful; returns `None` otherwise. + /// Returns `Some(key_id)` if the conversion was successful; returns `None` otherwise. /// /// ## Platform-specific /// - **Windows:** A 16bit extended scancode diff --git a/src/platform/wayland.rs b/src/platform/wayland.rs index e8f3fd5d..985e0e1d 100644 --- a/src/platform/wayland.rs +++ b/src/platform/wayland.rs @@ -55,7 +55,7 @@ pub trait WindowBuilderExtWayland { /// Build window with the given name. /// /// The `general` name sets an application ID, which should match the `.desktop` - /// file destributed with your program. The `instance` is a `no-op`. + /// file distributed with your program. The `instance` is a `no-op`. /// /// For details about application ID conventions, see the /// [Desktop Entry Spec](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#desktop-file-id) diff --git a/src/platform/x11.rs b/src/platform/x11.rs index 7dc3e8cd..ee2375d7 100644 --- a/src/platform/x11.rs +++ b/src/platform/x11.rs @@ -61,7 +61,7 @@ pub enum WindowType { pub type XlibErrorHook = Box bool + Send + Sync>; -/// A unique identifer for an X11 visual. +/// A unique identifier for an X11 visual. pub type XVisualID = u32; /// A unique identifier for an X11 window. @@ -69,7 +69,7 @@ pub type XWindow = u32; /// Hook to winit's xlib error handling callback. /// -/// This method is provided as a safe way to handle the errors comming from X11 +/// This method is provided as a safe way to handle the errors coming from X11 /// when using xlib in external crates, like glutin for GLX access. Trying to /// handle errors by speculating with `XSetErrorHandler` is [`unsafe`]. /// diff --git a/src/platform_impl/ios/app_state.rs b/src/platform_impl/ios/app_state.rs index eac89365..cb1a9202 100644 --- a/src/platform_impl/ios/app_state.rs +++ b/src/platform_impl/ios/app_state.rs @@ -551,7 +551,7 @@ pub fn did_finish_launching(mtm: MainThreadMarker) { // // relevant iOS log: // ``` - // [ApplicationLifecycle] Windows were created before application initialzation + // [ApplicationLifecycle] Windows were created before application initialization // completed. This may result in incorrect visual appearance. // ``` let screen = window.screen(); diff --git a/src/platform_impl/ios/event_loop.rs b/src/platform_impl/ios/event_loop.rs index 1df992cc..fe635545 100644 --- a/src/platform_impl/ios/event_loop.rs +++ b/src/platform_impl/ios/event_loop.rs @@ -76,7 +76,7 @@ impl EventLoopWindowTarget { pub(crate) fn exit(&self) { // https://developer.apple.com/library/archive/qa/qa1561/_index.html - // it is not possible to quit an iOS app gracefully and programatically + // it is not possible to quit an iOS app gracefully and programmatically log::warn!("`ControlFlow::Exit` ignored on iOS"); } diff --git a/src/platform_impl/ios/mod.rs b/src/platform_impl/ios/mod.rs index 7f8c23fc..aefad6f7 100644 --- a/src/platform_impl/ios/mod.rs +++ b/src/platform_impl/ios/mod.rs @@ -85,7 +85,7 @@ pub(crate) use crate::platform_impl::Fullscreen; /// There is no way to detect which device that performed a certain event in /// UIKit (i.e. you can't differentiate between different external keyboards, -/// or wether it was the main touchscreen, assistive technologies, or some +/// or whether it was the main touchscreen, assistive technologies, or some /// other pointer device that caused a touch event). #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct DeviceId; diff --git a/src/platform_impl/linux/wayland/seat/mod.rs b/src/platform_impl/linux/wayland/seat/mod.rs index 2e2fa438..6ddda26b 100644 --- a/src/platform_impl/linux/wayland/seat/mod.rs +++ b/src/platform_impl/linux/wayland/seat/mod.rs @@ -54,7 +54,7 @@ pub struct WinitSeatState { /// The current modifiers state on the seat. modifiers: ModifiersState, - /// Wether we have pending modifiers. + /// Whether we have pending modifiers. modifiers_pending: bool, } diff --git a/src/platform_impl/linux/wayland/seat/pointer/mod.rs b/src/platform_impl/linux/wayland/seat/pointer/mod.rs index 3b62bae1..e9dee8f2 100644 --- a/src/platform_impl/linux/wayland/seat/pointer/mod.rs +++ b/src/platform_impl/linux/wayland/seat/pointer/mod.rs @@ -196,7 +196,7 @@ impl PointerHandler for WinitState { TouchPhase::Ended } else { match pointer_data.phase { - // Descrete scroll only results in moved events. + // Discrete scroll only results in moved events. _ if has_discrete_scroll => TouchPhase::Moved, TouchPhase::Started | TouchPhase::Moved => TouchPhase::Moved, _ => TouchPhase::Started, diff --git a/src/platform_impl/linux/wayland/seat/text_input/mod.rs b/src/platform_impl/linux/wayland/seat/text_input/mod.rs index cff18dff..69cdb4b9 100644 --- a/src/platform_impl/linux/wayland/seat/text_input/mod.rs +++ b/src/platform_impl/linux/wayland/seat/text_input/mod.rs @@ -94,7 +94,7 @@ impl Dispatch for TextInputState { let window_id = wayland::make_wid(&surface); // XXX this check is essential, because `leave` could have a - // refence to nil surface... + // reference to nil surface... let mut window = match windows.get(&window_id) { Some(window) => window.lock().unwrap(), None => return, diff --git a/src/platform_impl/linux/wayland/state.rs b/src/platform_impl/linux/wayland/state.rs index add461d7..cf805c1b 100644 --- a/src/platform_impl/linux/wayland/state.rs +++ b/src/platform_impl/linux/wayland/state.rs @@ -60,7 +60,7 @@ pub struct WinitState { /// The pool where custom cursors are allocated. pub custom_cursor_pool: Arc>, - /// The XDG shell that is used for widnows. + /// The XDG shell that is used for windows. pub xdg_shell: XdgShell, /// The currently present windows. @@ -72,7 +72,7 @@ pub struct WinitState { /// The events that were generated directly from the window. pub window_events_sink: Arc>, - /// The update for the `windows` comming from the compositor. + /// The update for the `windows` coming from the compositor. pub window_compositor_updates: Vec, /// Currently handled seats. @@ -395,7 +395,7 @@ impl ProvidesRegistryState for WinitState { sctk::registry_handlers![OutputState, SeatState]; } -// The window update comming from the compositor. +// The window update coming from the compositor. #[derive(Debug, Clone, Copy)] pub struct WindowCompositorUpdate { /// The id of the window this updates belongs to. diff --git a/src/platform_impl/linux/wayland/window/state.rs b/src/platform_impl/linux/wayland/window/state.rs index 4a59a074..b47c8a6f 100644 --- a/src/platform_impl/linux/wayland/window/state.rs +++ b/src/platform_impl/linux/wayland/window/state.rs @@ -74,7 +74,7 @@ pub struct WindowState { selected_cursor: SelectedCursor, - /// Wether the cursor is visible. + /// Whether the cursor is visible. pub cursor_visible: bool, /// Pointer constraints to lock/confine pointer. @@ -83,7 +83,7 @@ pub struct WindowState { /// Queue handle. pub queue_handle: QueueHandle, - /// Theme varaint. + /// Theme variant. theme: Option, /// The current window title. @@ -218,7 +218,7 @@ impl WindowState { } /// Apply closure on the given pointer. - fn apply_on_poiner, &WinitPointerData)>( + fn apply_on_pointer, &WinitPointerData)>( &self, callback: F, ) { @@ -402,7 +402,7 @@ impl WindowState { let xdg_toplevel = self.window.xdg_toplevel(); // TODO(kchibisov) handle touch serials. - self.apply_on_poiner(|_, data| { + self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat(); xdg_toplevel.resize(seat, serial, direction.into()); @@ -415,7 +415,7 @@ impl WindowState { pub fn drag_window(&self) -> Result<(), ExternalError> { let xdg_toplevel = self.window.xdg_toplevel(); // TODO(kchibisov) handle touch serials. - self.apply_on_poiner(|_, data| { + self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat(); xdg_toplevel._move(seat, serial); @@ -710,7 +710,7 @@ impl WindowState { return; } - self.apply_on_poiner(|pointer, _| { + self.apply_on_pointer(|pointer, _| { if pointer.set_cursor(&self.connection, cursor_icon).is_err() { warn!("Failed to set cursor to {:?}", cursor_icon); } @@ -745,7 +745,7 @@ impl WindowState { } fn apply_custom_cursor(&self, cursor: &CustomCursor) { - self.apply_on_poiner(|pointer, _| { + self.apply_on_pointer(|pointer, _| { let surface = pointer.surface(); let scale = surface @@ -850,21 +850,21 @@ impl WindowState { match old_mode { CursorGrabMode::None => (), - CursorGrabMode::Confined => self.apply_on_poiner(|_, data| { + CursorGrabMode::Confined => self.apply_on_pointer(|_, data| { data.unconfine_pointer(); }), CursorGrabMode::Locked => { - self.apply_on_poiner(|_, data| data.unlock_pointer()); + self.apply_on_pointer(|_, data| data.unlock_pointer()); } } let surface = self.window.wl_surface(); match mode { - CursorGrabMode::Locked => self.apply_on_poiner(|pointer, data| { + CursorGrabMode::Locked => self.apply_on_pointer(|pointer, data| { let pointer = pointer.pointer(); data.lock_pointer(pointer_constraints, surface, pointer, &self.queue_handle) }), - CursorGrabMode::Confined => self.apply_on_poiner(|pointer, data| { + CursorGrabMode::Confined => self.apply_on_pointer(|pointer, data| { let pointer = pointer.pointer(); data.confine_pointer(pointer_constraints, surface, pointer, &self.queue_handle) }), @@ -878,7 +878,7 @@ impl WindowState { pub fn show_window_menu(&self, position: LogicalPosition) { // TODO(kchibisov) handle touch serials. - self.apply_on_poiner(|_, data| { + self.apply_on_pointer(|_, data| { let serial = data.latest_button_serial(); let seat = data.seat(); self.window.show_window_menu(seat, serial, position.into()); @@ -891,7 +891,7 @@ impl WindowState { return Err(ExternalError::NotSupported(NotSupportedError::new())); } - // Positon can be set only for locked cursor. + // Position can be set only for locked cursor. if self.cursor_grab_mode.current_grab_mode != CursorGrabMode::Locked { return Err(ExternalError::Os(os_error!( crate::platform_impl::OsError::Misc( @@ -900,7 +900,7 @@ impl WindowState { ))); } - self.apply_on_poiner(|_, data| { + self.apply_on_pointer(|_, data| { data.set_locked_cursor_position(position.x, position.y); }); @@ -1055,7 +1055,7 @@ impl WindowState { /// Set the window title to a new value. /// - /// This will autmatically truncate the title to something meaningfull. + /// This will automatically truncate the title to something meaningful. pub fn set_title(&mut self, mut title: String) { // Truncate the title to at most 1024 bytes, so that it does not blow up the protocol // messages @@ -1147,7 +1147,7 @@ impl GrabState { /// The state of the frame callback. #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] pub enum FrameCallbackState { - /// No frame callback was requsted. + /// No frame callback was requested. #[default] None, /// The frame callback was requested, but not yet arrived, the redraw events are throttled. diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs index 2f01b93b..e9bab0d7 100644 --- a/src/platform_impl/linux/x11/event_processor.rs +++ b/src/platform_impl/linux/x11/event_processor.rs @@ -1692,7 +1692,7 @@ impl EventProcessor { /// Send modifiers for the active window. /// - /// The event won't be send when the `modifiers` match the previosly `sent` modifiers value. + /// The event won't be sent when the `modifiers` match the previously `sent` modifiers value. fn send_modifiers)>( &self, modifiers: ModifiersState, diff --git a/src/platform_impl/linux/x11/ime/context.rs b/src/platform_impl/linux/x11/ime/context.rs index e04f74b1..1214a1a7 100644 --- a/src/platform_impl/linux/x11/ime/context.rs +++ b/src/platform_impl/linux/x11/ime/context.rs @@ -195,7 +195,7 @@ pub struct ImeContext { pub(crate) ic: ffi::XIC, pub(crate) ic_spot: ffi::XPoint, pub(crate) style: Style, - // Since the data is passed shared between X11 XIM callbacks, but couldn't be direclty free from + // Since the data is passed shared between X11 XIM callbacks, but couldn't be directly free from // there we keep the pointer to automatically deallocate it. _client_data: Box, } diff --git a/src/platform_impl/linux/x11/ime/input_method.rs b/src/platform_impl/linux/x11/ime/input_method.rs index faad41ef..87bf708f 100644 --- a/src/platform_impl/linux/x11/ime/input_method.rs +++ b/src/platform_impl/linux/x11/ime/input_method.rs @@ -170,7 +170,7 @@ impl From for GetXimServersError { } } -// The root window has a property named XIM_SERVERS, which contains a list of atoms represeting +// The root window has a property named XIM_SERVERS, which contains a list of atoms representing // the availabile XIM servers. For instance, if you're using ibus, it would contain an atom named // "@server=ibus". It's possible for this property to contain multiple atoms, though presumably // rare. Note that we replace "@server=" with "@im=" in order to match the format of locale diff --git a/src/platform_impl/linux/x11/util/window_property.rs b/src/platform_impl/linux/x11/util/window_property.rs index 2a2ed523..1f6a6b4c 100644 --- a/src/platform_impl/linux/x11/util/window_property.rs +++ b/src/platform_impl/linux/x11/util/window_property.rs @@ -73,7 +73,7 @@ impl XConnection { new_value .len() .try_into() - .expect("too many items for propery"), + .expect("too many items for property"), bytemuck::cast_slice::(new_value), ) .map_err(Into::into) diff --git a/src/platform_impl/macos/app_delegate.rs b/src/platform_impl/macos/app_delegate.rs index ee3ac878..226cd621 100644 --- a/src/platform_impl/macos/app_delegate.rs +++ b/src/platform_impl/macos/app_delegate.rs @@ -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"); diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs index 59c6e2b4..bccb0486 100644 --- a/src/platform_impl/macos/event_loop.rs +++ b/src/platform_impl/macos/event_loop.rs @@ -169,8 +169,8 @@ fn map_user_event( pub struct EventLoop { /// 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, /// The application delegate that we've registered. /// diff --git a/src/platform_impl/macos/menu.rs b/src/platform_impl/macos/menu.rs index 2e65abc5..6d6142d9 100644 --- a/src/platform_impl/macos/menu.rs +++ b/src/platform_impl/macos/menu.rs @@ -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 diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index a202e44f..2ca8cf24 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -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; diff --git a/src/platform_impl/macos/window_delegate.rs b/src/platform_impl/macos/window_delegate.rs index 118e6da8..9a496aee 100644 --- a/src/platform_impl/macos/window_delegate.rs +++ b/src/platform_impl/macos/window_delegate.rs @@ -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; diff --git a/src/platform_impl/orbital/window.rs b/src/platform_impl/orbital/window.rs index 7f9e7fa4..155abea7 100644 --- a/src/platform_impl/orbital/window.rs +++ b/src/platform_impl/orbital/window.rs @@ -489,7 +489,7 @@ impl Window { pub fn raw_window_handle_rwh_06(&self) -> Result { let handle = rwh_06::OrbitalWindowHandle::new({ let window = self.window_socket.fd as *mut _; - std::ptr::NonNull::new(window).expect("orbital fd shoul never be null") + std::ptr::NonNull::new(window).expect("orbital fd should never be null") }); Ok(rwh_06::RawWindowHandle::Orbital(handle)) } diff --git a/src/platform_impl/windows/drop_handler.rs b/src/platform_impl/windows/drop_handler.rs index ced6629a..f7a646c2 100644 --- a/src/platform_impl/windows/drop_handler.rs +++ b/src/platform_impl/windows/drop_handler.rs @@ -214,10 +214,10 @@ impl FileDropHandler { } else if get_data_result == DV_E_FORMATETC { // If the dropped item is not a file this error will occur. // In this case it is OK to return without taking further action. - debug!("Error occured while processing dropped/hovered item: item is not a file."); + debug!("Error occurred while processing dropped/hovered item: item is not a file."); None } else { - debug!("Unexpected error occured while processing dropped/hovered item."); + debug!("Unexpected error occurred while processing dropped/hovered item."); None } } diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 21ca4c03..7b34ad12 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -427,7 +427,7 @@ impl EventLoop { // The Windows API has no documented requirement for bitwise // initializing a `MSG` struct (it can be uninitialized memory for the C // API) and there's no API to construct or initialize a `MSG`. This - // is the simplest way avoid unitialized memory in Rust + // is the simplest way avoid uninitialized memory in Rust let mut msg = unsafe { mem::zeroed() }; let msg_status = wait_for_msg(&mut msg, timeout); @@ -475,7 +475,7 @@ impl EventLoop { // The Windows API has no documented requirement for bitwise // initializing a `MSG` struct (it can be uninitialized memory for the C // API) and there's no API to construct or initialize a `MSG`. This - // is the simplest way avoid unitialized memory in Rust + // is the simplest way avoid uninitialized memory in Rust let mut msg = unsafe { mem::zeroed() }; loop { @@ -1102,7 +1102,7 @@ unsafe fn public_window_callback_inner( .unwrap_or_else(|| result = ProcResult::Value(-1)); // I decided to bind the closure to `callback` and pass it to catch_unwind rather than passing - // the closure to catch_unwind directly so that the match body indendation wouldn't change and + // the closure to catch_unwind directly so that the match body indentation wouldn't change and // the git blame and history would be preserved. let callback = || match msg { WM_NCCALCSIZE => { @@ -2381,7 +2381,7 @@ unsafe extern "system" fn thread_event_target_callback( let mut userdata_removed = false; // I decided to bind the closure to `callback` and pass it to catch_unwind rather than passing - // the closure to catch_unwind directly so that the match body indendation wouldn't change and + // the closure to catch_unwind directly so that the match body indentation wouldn't change and // the git blame and history would be preserved. let callback = || match msg { WM_NCDESTROY => { @@ -2391,7 +2391,7 @@ unsafe extern "system" fn thread_event_target_callback( } WM_PAINT => unsafe { ValidateRect(window, ptr::null()); - // Default WM_PAINT behaviour. This makes sure modals and popups are shown immediatly when opening them. + // Default WM_PAINT behaviour. This makes sure modals and popups are shown immediately when opening them. DefWindowProcW(window, msg, wparam, lparam) }, diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs index 05d108ea..00b985b2 100644 --- a/src/platform_impl/windows/keyboard.rs +++ b/src/platform_impl/windows/keyboard.rs @@ -328,7 +328,7 @@ impl KeyEventBuilder { } } - // Alowing nominimal_bool lint because the `is_key_pressed` macro triggers this warning + // Allowing nominimal_bool lint because the `is_key_pressed` macro triggers this warning // and I don't know of another way to resolve it and also keeping the macro #[allow(clippy::nonminimal_bool)] fn synthesize_kbd_state( @@ -737,7 +737,7 @@ fn get_async_kbd_state() -> [u8; 256] { /// On windows, AltGr == Ctrl + Alt /// -/// Due to this equivalence, the system generates a fake Ctrl key-press (and key-release) preceeding +/// Due to this equivalence, the system generates a fake Ctrl key-press (and key-release) preceding /// every AltGr key-press (and key-release). We check if the current event is a Ctrl event and if /// the next event is a right Alt (AltGr) event. If this is the case, the current event must be the /// fake Ctrl event. diff --git a/src/platform_impl/windows/keyboard_layout.rs b/src/platform_impl/windows/keyboard_layout.rs index a0fdb956..ac2a3444 100644 --- a/src/platform_impl/windows/keyboard_layout.rs +++ b/src/platform_impl/windows/keyboard_layout.rs @@ -192,7 +192,7 @@ pub(crate) struct Layout { /// Maps numpad keys from Windows virtual key to a `Key`. /// - /// This is useful because some numpad keys generate different charcaters based on the locale. + /// This is useful because some numpad keys generate different characters based on the locale. /// For example `VK_DECIMAL` is sometimes "." and sometimes ",". Note: numpad-specific virtual /// keys are only produced by Windows when the NumLock is active. /// @@ -790,7 +790,7 @@ fn vkey_to_non_char_key( //VK_HANGEUL => Key::Named(NamedKey::HangulMode), // Deprecated in favour of VK_HANGUL // VK_HANGUL and VK_KANA are defined as the same constant, therefore - // we use appropriate conditions to differentate between them + // we use appropriate conditions to differentiate between them VK_HANGUL if is_korean => Key::Named(NamedKey::HangulMode), VK_KANA if is_japanese => Key::Named(NamedKey::KanaMode), @@ -798,7 +798,7 @@ fn vkey_to_non_char_key( VK_FINAL => Key::Named(NamedKey::FinalMode), // VK_HANJA and VK_KANJI are defined as the same constant, therefore - // we use appropriate conditions to differentate between them + // we use appropriate conditions to differentiate between them VK_HANJA if is_korean => Key::Named(NamedKey::HanjaMode), VK_KANJI if is_japanese => Key::Named(NamedKey::KanjiMode), @@ -983,7 +983,7 @@ fn vkey_to_non_char_key( // This matches IE and Firefox behaviour according to // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values // At the time of writing, there is no `NamedKey::Finish` variant as - // Finish is not mentionned at https://w3c.github.io/uievents-key/ + // Finish is not mentioned at https://w3c.github.io/uievents-key/ // Also see: https://github.com/pyfisch/keyboard-types/issues/9 Key::Unidentified(native_code) } diff --git a/src/window.rs b/src/window.rs index fb3f435b..6cce1179 100644 --- a/src/window.rs +++ b/src/window.rs @@ -662,7 +662,7 @@ impl Window { /// // Notify winit that we're about to submit buffer to the windowing system. /// window.pre_present_notify(); /// - /// // Sumbit buffer to the windowing system. + /// // Submit buffer to the windowing system. /// swap_buffers(); /// ``` /// @@ -793,7 +793,7 @@ impl Window { /// may not be generated. /// /// On platforms where resizing is disallowed by the windowing system, the current - /// inner size is returned immidiatelly, and the user one is ignored. + /// inner size is returned immediately, and the user one is ignored. /// /// When `None` is returned, it means that the request went to the display system, /// and the actual size will be delivered later with the [`WindowEvent::Resized`]. @@ -938,7 +938,7 @@ impl Window { /// Change the window transparency state. /// /// This is just a hint that may not change anything about - /// the window transparency, however doing a missmatch between + /// the window transparency, however doing a mismatch between /// the content of your window and this hint may result in /// visual artifacts. ///