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

@ -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<MonitorId>` 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.

View file

@ -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 {

View file

@ -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;

View file

@ -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() => {

View file

@ -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") => {

View file

@ -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),

View file

@ -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>) -> u32 {

View file

@ -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))]

View file

@ -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<f64>),
}
/// 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<u32>,

View file

@ -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.

View file

@ -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.
///

View file

@ -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

View file

@ -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)

View file

@ -61,7 +61,7 @@ pub enum WindowType {
pub type XlibErrorHook =
Box<dyn Fn(*mut std::ffi::c_void, *mut std::ffi::c_void) -> 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`].
///

View file

@ -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();

View file

@ -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");
}

View file

@ -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;

View file

@ -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,
}

View file

@ -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,

View file

@ -94,7 +94,7 @@ impl Dispatch<ZwpTextInputV3, TextInputData, WinitState> 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,

View file

@ -60,7 +60,7 @@ pub struct WinitState {
/// The pool where custom cursors are allocated.
pub custom_cursor_pool: Arc<Mutex<SlotPool>>,
/// 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<Mutex<EventSink>>,
/// The update for the `windows` comming from the compositor.
/// The update for the `windows` coming from the compositor.
pub window_compositor_updates: Vec<WindowCompositorUpdate>,
/// 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.

View file

@ -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<WinitState>,
/// Theme varaint.
/// Theme variant.
theme: Option<Theme>,
/// The current window title.
@ -218,7 +218,7 @@ impl WindowState {
}
/// Apply closure on the given pointer.
fn apply_on_poiner<F: Fn(&ThemedPointer<WinitPointerData>, &WinitPointerData)>(
fn apply_on_pointer<F: Fn(&ThemedPointer<WinitPointerData>, &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<u32>) {
// 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.

View file

@ -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<T: 'static, F: FnMut(&RootELW, Event<T>)>(
&self,
modifiers: ModifiersState,

View file

@ -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<ImeContextClientData>,
}

View file

@ -170,7 +170,7 @@ impl From<util::GetPropertyError> 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

View file

@ -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::<T, u8>(new_value),
)
.map_err(Into::into)

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;

View file

@ -489,7 +489,7 @@ impl Window {
pub fn raw_window_handle_rwh_06(&self) -> Result<rwh_06::RawWindowHandle, rwh_06::HandleError> {
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))
}

View file

@ -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
}
}

View file

@ -427,7 +427,7 @@ impl<T: 'static> EventLoop<T> {
// 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<T: 'static> EventLoop<T> {
// 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)
},

View file

@ -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.

View file

@ -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)
}

View file

@ -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.
///