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

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