From 47e7d8b7fa5ed67d0e604e3b1dc064a59686694d Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 2 Mar 2024 09:38:54 -0800 Subject: [PATCH 1/4] chore: Use cspell to fix some typos Signed-off-by: John Nunley --- .cspell.json | 13 +++++++++++ project-words.txt | 38 +++++++++++++++++++++++++++++++++ src/platform/wayland.rs | 2 +- src/platform/web.rs | 12 +++++------ src/platform/windows.rs | 4 ++-- src/platform/x11.rs | 4 ++-- src/platform_impl/web/cursor.rs | 8 +++---- src/utils.rs | 2 +- src/window.rs | 10 ++++----- 9 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 .cspell.json create mode 100644 project-words.txt diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000000..2af8d753db --- /dev/null +++ b/.cspell.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", + "version": "0.2", + "dictionaryDefinitions": [ + { + "name": "project-words", + "path": "./project-words.txt", + "addWords": true + } + ], + "dictionaries": ["project-words"], + "ignorePaths": ["/target", "/project-words.txt"] + } \ No newline at end of file diff --git a/project-words.txt b/project-words.txt new file mode 100644 index 0000000000..e6d37bba69 --- /dev/null +++ b/project-words.txt @@ -0,0 +1,38 @@ +adwaita +apartmentthreaded +bitflags +borderless +clipchildren +coinit +crossfont +dbus +dlopen +donotround +dwmwcp +dwmsbt +fullscreen +glutin +hittest +hmenu +hmonitor +hwnd +kwin +mainwindow +noredirectionbitmap +notitle +preedit +randr +repr +roundsmall +rustdoc +systembackdrop +tabbedwindow +transientwindow +winit +xext +xlib +xrandr +xrender +xresources +xpresent +xscrnsaver \ No newline at end of file diff --git a/src/platform/wayland.rs b/src/platform/wayland.rs index 24301ee085..b0ef2de436 100644 --- a/src/platform/wayland.rs +++ b/src/platform/wayland.rs @@ -7,7 +7,7 @@ //! //! ## Client-side decorations //! -//! Winit provides client-side decorations by default, but the behaviour can +//! Winit provides client-side decorations by default, but the behavior can //! be controlled with the following feature flags: //! //! * `wayland-csd-adwaita` (default). diff --git a/src/platform/web.rs b/src/platform/web.rs index fd4982702a..7af1c47c98 100644 --- a/src/platform/web.rs +++ b/src/platform/web.rs @@ -82,7 +82,7 @@ pub trait WindowExtWebSys { /// would prevent that. /// /// Some events are impossible to prevent. E.g. Firefox allows to access the native browser - /// context menu with Shift+Rightclick. + /// context menu with Shift+Right-click. fn set_prevent_default(&self, prevent_default: bool); } @@ -274,7 +274,7 @@ pub trait CustomCursorExtWebSys { /// but browser support for image formats is inconsistent. Using [PNG] is recommended. /// /// [PNG]: https://en.wikipedia.org/wiki/PNG - fn from_url(url: String, hotspot_x: u16, hotspot_y: u16) -> CustomCursorSource; + fn from_url(url: String, hot_spot_x: u16, hot_spot_y: u16) -> CustomCursorSource; /// Crates a new animated cursor from multiple [`CustomCursor`]s. /// Supplied `cursors` can't be empty or other animations. @@ -289,12 +289,12 @@ impl CustomCursorExtWebSys for CustomCursor { self.inner.animation } - fn from_url(url: String, hotspot_x: u16, hotspot_y: u16) -> CustomCursorSource { + fn from_url(url: String, hot_spot_x: u16, hot_spot_y: u16) -> CustomCursorSource { CustomCursorSource { inner: PlatformCustomCursorSource::Url { url, - hotspot_x, - hotspot_y, + hot_spot_x, + hot_spot_y, }, } } @@ -330,7 +330,7 @@ impl fmt::Display for BadAnimation { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Empty => write!(f, "No cursors supplied"), - Self::Animation => write!(f, "A supplied cursor is an animtion"), + Self::Animation => write!(f, "A supplied cursor is an animation"), } } } diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 39e4ee0163..48ae05f09b 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -157,11 +157,11 @@ pub trait EventLoopBuilderExtWindows { /// #[cfg(target_os = "windows")] /// builder.with_msg_hook(|msg|{ /// let msg = msg as *const MSG; - /// # let accels: Vec = Vec::new(); + /// # let accelerators: Vec = Vec::new(); /// let translated = unsafe { /// TranslateAcceleratorW( /// (*msg).hwnd, - /// CreateAcceleratorTableW(accels.as_ptr() as _, 1), + /// CreateAcceleratorTableW(accelerators.as_ptr() as _, 1), /// msg, /// ) == 1 /// }; diff --git a/src/platform/x11.rs b/src/platform/x11.rs index afeb12c248..05935749e5 100644 --- a/src/platform/x11.rs +++ b/src/platform/x11.rs @@ -16,14 +16,14 @@ use crate::dpi::Size; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub enum WindowType { /// A desktop feature. This can include a single window containing desktop icons with the same dimensions as the - /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxying + /// screen, allowing the desktop environment to have full control of the desktop, without the need for proxy-ing /// root window clicks. Desktop, /// A dock or panel feature. Typically a Window Manager would keep such windows on top of all other windows. Dock, /// Toolbar windows. "Torn off" from the main application. Toolbar, - /// Pinnable menu windows. "Torn off" from the main application. + /// Pin-able menu windows. "Torn off" from the main application. Menu, /// A small persistent utility window, such as a palette or toolbox. Utility, diff --git a/src/platform_impl/web/cursor.rs b/src/platform_impl/web/cursor.rs index 2ba08d9649..8fc6d29299 100644 --- a/src/platform_impl/web/cursor.rs +++ b/src/platform_impl/web/cursor.rs @@ -31,8 +31,8 @@ pub(crate) enum CustomCursorSource { Image(CursorImage), Url { url: String, - hotspot_x: u16, - hotspot_y: u16, + hot_spot_x: u16, + hot_spot_y: u16, }, Animation { duration: Duration, @@ -88,8 +88,8 @@ impl CustomCursor { ), CustomCursorSource::Url { url, - hotspot_x, - hotspot_y, + hot_spot_x: hotspot_x, + hot_spot_y: hotspot_y, } => Self::build_spawn( event_loop, from_url(UrlType::Plain(url), hotspot_x, hotspot_y), diff --git a/src/utils.rs b/src/utils.rs index 5bb52a4af2..8e8d25ca7b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,5 +1,5 @@ // A poly-fill for `lazy_cell` -// Replace with std::sync::LazyLock when https://github.com/rust-lang/rust/issues/109736 is stablized. +// Replace with std::sync::LazyLock when https://github.com/rust-lang/rust/issues/109736 is stabilized. // This isn't used on every platform, which can come up as dead code warnings. #![allow(dead_code)] diff --git a/src/window.rs b/src/window.rs index 2aa49dde79..fb1b23cf7e 100644 --- a/src/window.rs +++ b/src/window.rs @@ -70,8 +70,8 @@ pub struct Window { } impl fmt::Debug for Window { - fn fmt(&self, fmtr: &mut fmt::Formatter<'_>) -> fmt::Result { - fmtr.pad("Window { .. }") + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.pad("Window { .. }") } } @@ -1026,7 +1026,7 @@ impl Window { /// Sets whether the window is resizable or not. /// - /// Note that making the window unresizable doesn't exempt you from handling [`WindowEvent::Resized`], as that + /// Note that making the window un-resizable doesn't exempt you from handling [`WindowEvent::Resized`], as that /// event can still be triggered by DPI scaling, entering fullscreen mode, etc. Also, the /// window could still be resized by calling [`Window::request_inner_size`]. /// @@ -1235,7 +1235,7 @@ impl Window { /// Sets the window icon. /// /// On Windows and X11, this is typically the small icon in the top-left - /// corner of the titlebar. + /// corner of the title bar. /// /// ## Platform-specific /// @@ -1375,7 +1375,7 @@ impl Window { /// is already focused. How requesting for user attention manifests is platform dependent, /// see [`UserAttentionType`] for details. /// - /// Providing `None` will unset the request for user attention. Unsetting the request for + /// Providing `None` will unset the request for user attention. Un-setting the request for /// user attention might not be done automatically by the WM when the window receives input. /// /// ## Platform-specific From 4dc88785112a3c47eb73c0afeccb99a4c48f6afc Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 2 Mar 2024 09:40:20 -0800 Subject: [PATCH 2/4] ci: Add spellcheck to CI winit is a large codebase and manually checking for typos is infeasible. This commit adds a spellcheck hook using cspell to the CI. That way we can be sure that there are no typos in our code before we commit. Signed-off-by: John Nunley --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33a2571111..5226872711 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: jobs: fmt: - name: Check formatting + name: Tidy Code runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,6 +16,8 @@ jobs: components: rustfmt - name: Check Formatting run: cargo fmt -- --check + - name: Check Spelling + run: npx -y cspell --no-progress --no-summary '**/*.rs' '**/*.md' tests: name: Test ${{ matrix.toolchain }} ${{ matrix.platform.name }} From 204dd734ddc7e637d056d8c1ad518ccfbb27aa45 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 2 Mar 2024 22:27:45 -0800 Subject: [PATCH 3/4] chore: Fix remaining typos in Rust file Signed-off-by: John Nunley --- .github/workflows/ci.yml | 1 + examples/window.rs | 6 +- project-words.txt | 639 +++++++++++++++++- src/event.rs | 4 +- src/event_loop.rs | 2 +- src/keyboard.rs | 2 +- src/platform/android.rs | 6 +- src/platform/run_on_demand.rs | 2 +- src/platform/scancode.rs | 4 +- src/platform/startup_notify.rs | 2 +- src/platform/wayland.rs | 2 +- src/platform/web.rs | 10 +- src/platform_impl/android/mod.rs | 2 +- src/platform_impl/linux/common/xkb/keymap.rs | 6 +- src/platform_impl/linux/common/xkb/mod.rs | 2 +- src/platform_impl/linux/mod.rs | 2 +- .../linux/wayland/seat/keyboard/mod.rs | 2 +- .../linux/wayland/seat/pointer/mod.rs | 2 +- .../linux/x11/event_processor.rs | 8 +- src/platform_impl/linux/x11/ime/callbacks.rs | 4 +- src/platform_impl/linux/x11/ime/context.rs | 2 +- .../linux/x11/ime/input_method.rs | 2 +- src/platform_impl/linux/x11/util/geometry.rs | 2 +- src/platform_impl/linux/x11/util/mod.rs | 2 +- src/platform_impl/linux/x11/util/wm.rs | 2 +- src/platform_impl/linux/x11/util/xmodmap.rs | 8 +- src/platform_impl/linux/x11/window.rs | 11 +- src/platform_impl/linux/x11/xdisplay.rs | 2 +- src/platform_impl/macos/event.rs | 9 +- src/platform_impl/macos/event_loop.rs | 2 +- src/platform_impl/macos/mod.rs | 2 +- src/platform_impl/macos/view.rs | 4 +- src/platform_impl/macos/window_delegate.rs | 4 +- src/platform_impl/web/cursor.rs | 8 +- src/platform_impl/web/keyboard.rs | 4 +- src/platform_impl/windows/dark_mode.rs | 8 +- src/platform_impl/windows/definitions.rs | 32 +- src/platform_impl/windows/event_loop.rs | 38 +- .../windows/event_loop/runner.rs | 8 +- src/platform_impl/windows/ime.rs | 6 +- src/platform_impl/windows/keyboard.rs | 34 +- src/platform_impl/windows/keyboard_layout.rs | 22 +- src/platform_impl/windows/mod.rs | 18 +- src/platform_impl/windows/raw_input.rs | 14 +- src/platform_impl/windows/window.rs | 6 +- src/platform_impl/windows/window_state.rs | 6 +- 46 files changed, 802 insertions(+), 162 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5226872711..81192494ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: tests: name: Test ${{ matrix.toolchain }} ${{ matrix.platform.name }} runs-on: ${{ matrix.platform.os }} + needs: fmt strategy: fail-fast: false diff --git a/examples/window.rs b/examples/window.rs index 3aa7f99096..3e3326753a 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -244,9 +244,9 @@ impl Application { } WindowEvent::Focused(focused) => { if focused { - println!("Window={window_id:?} fosused"); + println!("Window={window_id:?} focused"); } else { - println!("Window={window_id:?} unfosused"); + println!("Window={window_id:?} unfocused"); } } WindowEvent::ScaleFactorChanged { scale_factor, .. } => { @@ -333,7 +333,7 @@ impl Application { println!("Preedit: {}, with caret at {:?}", text, caret_pos); } Ime::Commit(text) => { - println!("Commited: {}", text); + println!("Committed: {}", text); } Ime::Disabled => println!("IME disabled for Window={window_id:?}"), }, diff --git a/project-words.txt b/project-words.txt index e6d37bba69..ddc2622b8b 100644 --- a/project-words.txt +++ b/project-words.txt @@ -1,38 +1,671 @@ +ABNT +ACCEPTFILES +ALTERASE +APPCOMMAND +APPSTARTING +APPWINDOW +ASYNCWINDOWPOS +ATOK +AZERTY +Abortable +Artur +Autorotate +BACKTAB +BADFLAGS +BADMODE +BADPARAM +BASSBOOST +BITSPERPEL +BKSP +BLURBEHIND +BOTTOMLEFT +BOTTOMRIGHT +BRIGHTNESSDOW +BRIGHTNESSU +BYCOMMAND +Backquote +Bangou +Blackbox +CAEAGL +CANDIDATEFORM +CAPTURECHANGED +CFUUID +CLIPSIBLINGS +CLOEXEC +CLOSECD +COMPATTR +COMPOSITIONFORM +COMPSTR +CREATESTRUCTW +CRSEL +CRTC +CTYPE +CURSORPOS +CUSEL +CXVIRTUALSCREEN +CYCLEWINDOWS +CYVIRTUALSCREEN +Calculater +Codeinput +Colormap +Compiz +Condvar +Crtc +DEADCHAR +DEFAULTSIZE +DEFAULTTONEAREST +DEFAULTTONULL +DEFAULTTOPRIMARY +DELETEFILE +DEVICEINFO +DEVICELALTKEYMASK +DEVICELCMDKEYMASK +DEVICELCTLKEYMASK +DEVICELSHIFTKEYMASK +DEVICENAME +DEVICERALTKEYMASK +DEVICERCMDKEYMASK +DEVICERCTLKEYMASK +DEVICERSHIFTKEYMASK +DEVMODEW +DEVNOTIFY +DISP +DISPLAYFREQUENCY +DPAD +DPICHANGED +DROPEFFECT +DVASPECT +DWMCOMPOSITIONCHANGED +DWMWA +Deque +Dflt +EINVAL +EJECTCD +EJECTCLOSECD +ENDCALL +ENDCOMPOSITION +ENLW +ENTERSIZEMOVE +ERCIM +EREOF +EWMH +EXITSIZEMOVE +EXSEL +EXSTYLE +EXTENDEDKEY +Eisu +Eisuu +Endcall +Endianness +FASTFORWARD +FLASHW +FLASHWINFO +FORMATETC +FORWARDMAIL +FRAMECHANGED +FVWM +GAMEPAD +GETHIGHCONTRAST +GETMINMAXINFO +GIDC +GLES +GWLP +HANGEUL +HANJA +HCURSOR +HDROP +HEADSETHOOK +HGLOBAL +HICON +HIGHCONTRASTA +HIGHCONTRASTON +HIMC +HINSTANCE +HMODULE +HORZ +HRAWINPUT +HTBOTTOM +HTBOTTOMLEFT +HTBOTTOMRIGHT +HTCAPTION +HTCLIENT +HTLEFT +HTRIGHT +HTTOP +HTTOPLEFT +HTTOPRIGHT +HWHEEL +Hanja +Hankaku +Headsethook +Henkan +Himetric +Hotspot +IACE +IBEAM +ICCCM +ICONINFO +IMEs +IMMENABLED +INPUTSINK +INTERNALPAINT +IOYUV +Impls +Ivars +JISHO +JUNJA +Junja +KBDILLUMDOWN +KBDILLUMTOGGLE +KBDILLUMUP +KEYDOWN +KEYFIRST +KEYLAST +KEYMAP +KEYUP +KILLFOCUS +KPJPCOMMA +KPLEFTPAREN +KPPLUSMINUS +KPRIGHTPAREN +Kanna +Keymap +Koho +LALT +LBUTTON +LBUTTONDOWN +LBUTTONUP +LCONTROL +LCTRL +LEFTALIGN +LOADFROMFILE +LOGPIXELSX +LOYA +LRESULT +LSHIFT +LSUPER +LWIN +Lcdfilter +MASSHOU +MAXIMIZABLE +MAXIMIZEBOX +MBUTTON +MBUTTONDOWN +MBUTTONUP +MENUCHAR +MICMUTE +MINIMIZABLE +MINIMIZEBOX +MINMAXINFO +MODECHANGE +MONITORINFO +MONITORINFOEXW +MOUSEHWHEEL +MOUSELEAVE +MOUSEMOVE +MOUSEWHEEL +MOVERESIZE +MSDOS +Massyo +Miniaturizable +Mmap +Modifiermap +Muhenkan +NCACTIVATE +NCCALCSIZE +NCDESTROY +NCHITTEST +NCLBUTTONDOWN +NEXTTRACK +NOACTIVATE +NOMOVE +NONAME +NONCONVERT +NOREMOVE +NOREPOSITION +NOSIZE +NOTCONVERTED +NOTOPMOST +NOZORDER +NTSTATUS +NUMLOCK +Nesw +Nonnull +OSVERSIONINFOW +OVERLAPPEDWINDOW +Overscan +PAUSECD +PCSTR +PCWSTR +PELSHEIGHT +PELSWIDTH +PGDN +PGUP +PINP +PLAYCD +POINTERDOWN +POINTERUP +POINTERUPDATE +POINTL +PQRS +PREVIOUSTRACK +PROCESSKEY +Pboard +Peekable +Pels +Pictsymbols +Pixmap +Premultiply +QERTZ +QWERTZ +RALT +RAWINPUT +RAWINPUTDEVICE +RAWINPUTDEVICELIST +RAWINPUTHEADER +RAWKEYBOARD +RBUTTON +RBUTTONDOWN +RBUTTONUP +RCONTROL +RCTRL +RDWR +RESULTSTR +RETURNCMD +RFKILL +RIDEV +RIDI +RMENU +ROYA +RRRRRGGGGGBBBBB +RRRRRRRRGGGGGGGGBBBBBBBB +RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB +RSHIFT +RSUPER +RUSTDOCFLAGS +RWIN +Raii +Reentrancy +Reparent +Romaji +SCREENSAVE +SCROLLDOWN +SCROLLUP +SENDFILE +SETCONTEXT +SETCURSOR +SETFOCUS +SETICON +SETTINGCHANGE +SHOULDAPPSUSEDARKMODE +SHOWNOACTIVATE +SHOWUICOMPOSITIONWINDOW +SIZEALL +SIZEBOX +SIZENESW +SIZENS +SIZENWSE +SIZEWE +STARTCOMPOSITION +STATDATA +STGMEDIUM +SWITCHVIDEOMODE +SYSCHAR +SYSCOMMAND +SYSDEADCHAR +SYSKEYDOWN +SYSKEYUP +SYSMENU +Smol +Subcompositor +Subviews +Sysrq +THUMBSTICK +TIMERNOFG +TOOLWINDOW +TOPLEFT +TOPRIGHT +TOUCHEVENTF +TOUCHINPUT +TOUROKU +TRACKMOUSEEVENT +TYMED +TYPEHID +TYPEKEYBOARD +TYPEMOUSE +Thumbl +Thumbr +UNICHAR +USEDARKMODECOLORS +UXTHEME +Unadjust +Unadvise +Ungrab +Unminimizing +VKEY +VKEYS +Viewporter +Visualid +Vulkan +WINDOWCOMPOSITIONATTRIB +WINDOWCOMPOSITIONATTRIBDATA +WINDOWEDGE +WINDOWPLACEMENT +WINDOWPOS +WINDOWPOSCHANGED +WINDOWPOSCHANGING +WLAN +WNDPROC +WSCTRL +WXYZ +XBUTTONDOWN +XBUTTONUP +XEMBED +XFER +XKBCH +XKBH +XKBXH +XMODIFIERS +XSETTINGS +XVIRTUALSCREEN +Xcursor +Xdnd +Xfer +Xids +Xorg +Xutf +YVIRTUALSCREEN +Zenkaku +aarch +abortable adwaita +ahash +altgr apartmentthreaded +argb +armv +atleast +attribs +autoreleasepool +autoreleases +autorotate +beachball +behaviour +bfcache +bgra +bindgen bitflags +bitmaprenderer +blackbox +blurregion borderless +busybutclickable +bytemuck +bytewise +calloop +callstack +cdylib +cgfloat +clicky clipchildren +clonable +clsctx +clsid +codepaths coinit +colormap +contextmenu crossfont +crtc +crtcs +curr +darkmode dbus +deminiaturize +deviceid dlopen +docsrs donotround -dwmwcp +doubletap +downscaling +dppx dwmsbt +dwmwcp +elwt +emscripten +endianness +entrancy +entrantly +evdev +eventloop +evlp +evtype +exclam +excludefromcapture +fcitx +forcetouch +fpath +fract +fsecs fullscreen +fullsize +getpid +gettid glutin +hdrop +henkan +hidpi +himc +himetric +hinstance hittest +hiword hmenu hmonitor +horz +hotplug +hotspot +hotx +hredraw +hresult +htotal hwnd +ibus +icrate +impls +initer +inputmethod +ivars +kcav +kchibisov +keybdinput +keybinds +keyeventf +keymap +keypermod +keypresses +keysym +keysyms +kunddaliya kwin +lcddefault +lgid +libc +libwayland +libxkbcommon +lindex +lmenu +longsolidusoverlay +lowline +loword +lparam +lpfn +lpsz +lshift +macbooks +madsmtm +mainloop mainwindow +mapvk +memmap +millihertz +minwindef +mkdid +mkwid +modifierless +modifiermap +msiglreith +muhenkan +nanos +nccreate +netwm +newtype +nodename +nonminimal noredirectionbitmap +notgull notitle +nsec +nsstring +nsview +ntdll +numpad +numpads +objc +offcenter +onpointerrawupdate +opengl +oppsite +orbclient +ossi +overscan +overtyping +pagehide +pageshow +physicalkey +pixmap +pointercancel +pointermove +pointerout +pointerover +pointerrawupdate +polonius +ppmm preedit +premultiply +primarylangid +pthread +qhandle randr +reallocs +rects +reentrancy +reparent +reparenting repr +resizeable +retval +rgrc +rightclick +riid roundsmall +rshift +runloop +rustc rustdoc +rustix +scancode +scancodes +sctk +setlocale +shcore +smol +softbuffer +sourceid +splitn +standardised +stdweb +structfield +subcompositor +subframework +subsec +subviews +syms +syscall systembackdrop +sythesize +sythesized +sythetic tabbedwindow +tabindex +throghout +timespec +titlebar +touchpad +touchstart +trackpad transientwindow +tymed +uapi +uiscreen +uiscreens +unaccel +uncoalesced +unconfine +undropped +unfocusing +ungrab +uninit +uninitialize +unmark +unminimize +unobserve +unparameterised +unref +unresizable +usedefault +userdata +uxtheme +viewporter +visibilitychange +visualid +visualtype +vkey +vredraw +vtbl +vtotal +wakeup +wakeups +wantpalm +wgpu +winapi +windef winit +winuser +wndclassexw +wparam +wrongcompobj +xbutton +xconn +xcursor +xdisplay +xevent xext +xfiltered +xfixes +xhot +ximage +xkbcommon +xkbext xlib +xmodifiers +xmonad +xpresent xrandr xrender xresources -xpresent -xscrnsaver \ No newline at end of file +xscrnsaver +xsettings +xwindow +yeong +yhot diff --git a/src/event.rs b/src/event.rs index ff3a004219..d25a59a4b7 100644 --- a/src/event.rs +++ b/src/event.rs @@ -561,7 +561,7 @@ pub enum WindowEvent { /// The window has been occluded (completely hidden from view). /// /// This is different to window visibility as it depends on whether the window is closed, - /// minimised, set invisible, or fully occluded by another window. + /// minimized, set invisible, or fully occluded by another window. /// /// ## Platform-specific /// @@ -784,7 +784,7 @@ pub struct KeyEvent { /// /// # Example /// - /// In games, you often want to ignore repated key events - this can be + /// In games, you often want to ignore repeated key events - this can be /// done by ignoring events where this property is set. /// /// ``` diff --git a/src/event_loop.rs b/src/event_loop.rs index c1f32da61b..6751317dcc 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -80,7 +80,7 @@ impl EventLoopBuilder { /// ***For cross-platform compatibility, the [`EventLoop`] must be created on the main thread, /// and only once per application.*** /// - /// Calling this function will result in display backend initialisation. + /// Calling this function will result in display backend initialization. /// /// ## Panics /// diff --git a/src/keyboard.rs b/src/keyboard.rs index 4fc9fdb027..be6fe3c28d 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -1229,7 +1229,7 @@ pub enum NamedKey { Dimmer, /// Swap video sources. (`VK_DISPLAY_SWAP`) DisplaySwap, - /// Select Digital Video Rrecorder. (`KEYCODE_DVR`) + /// Select Digital Video Recorder. (`KEYCODE_DVR`) DVR, /// Exit the current application. (`VK_EXIT`) Exit, diff --git a/src/platform/android.rs b/src/platform/android.rs index b6d3c7bc87..6d153f568c 100644 --- a/src/platform/android.rs +++ b/src/platform/android.rs @@ -45,13 +45,13 @@ //! | Base Class | Feature Flag | Notes | //! | :--------------: | :---------------: | :-----: | //! | `NativeActivity` | `android-native-activity` | Built-in to Android - it is possible to use without compiling any Java or Kotlin code. Java or Kotlin code may be needed to subclass `NativeActivity` to access some platform features. It does not derive from the [`AndroidAppCompat`] base class.| -//! | [`GameActivity`] | `android-game-activity` | Derives from [`AndroidAppCompat`], a defacto standard `Activity` base class that helps support a wider range of Android versions. Requires a build system that can compile Java or Kotlin and fetch Android dependencies from a [Maven repository][agdk_jetpack] (or link with an embedded [release][agdk_releases] of [`GameActivity`]) | +//! | [`GameActivity`] | `android-game-activity` | Derives from [`AndroidAppCompat`], a defacto standard `Activity` base class that helps support a wider range of Android versions. Requires a build system that can compile Java or Kotlin and fetch Android dependencies from a [Maven repository][android_jet] (or link with an embedded [release][android_releases] of [`GameActivity`]) | //! //! [`GameActivity`]: https://developer.android.com/games/agdk/game-activity //! [`GameTextInput`]: https://developer.android.com/games/agdk/add-support-for-text-input //! [`AndroidAppCompat`]: https://developer.android.com/reference/androidx/appcompat/app/AppCompatActivity -//! [agdk_jetpack]: https://developer.android.com/jetpack/androidx/releases/games -//! [agdk_releases]: https://developer.android.com/games/agdk/download#agdk-libraries +//! [android_jet]: https://developer.android.com/jetpack/androidx/releases/games +//! [android_releases]: https://developer.android.com/games/agdk/download#agdk-libraries //! [Gradle]: https://developer.android.com/studio/build //! //! For more details, refer to these `android-activity` [example applications](https://github.com/rust-mobile/android-activity/tree/main/examples). diff --git a/src/platform/run_on_demand.rs b/src/platform/run_on_demand.rs index 0010eab886..25e1caf1ba 100644 --- a/src/platform/run_on_demand.rs +++ b/src/platform/run_on_demand.rs @@ -94,7 +94,7 @@ impl ActiveEventLoop { /// /// let mut event_loop = EventLoop::new().unwrap(); /// event_loop.run_on_demand(|_, _| { -/// // Attempt to run the event loop re-entrantly; this must fail. +/// // Attempt to run the event loop in a re-entrant manner; this must fail. /// event_loop.run_on_demand(|_, _| {}); /// }); /// ``` diff --git a/src/platform/scancode.rs b/src/platform/scancode.rs index c175e5b8bf..c162760ee5 100644 --- a/src/platform/scancode.rs +++ b/src/platform/scancode.rs @@ -29,11 +29,11 @@ pub trait PhysicalKeyExtScancode { impl PhysicalKeyExtScancode for PhysicalKey { fn to_scancode(self) -> Option { - crate::platform_impl::physicalkey_to_scancode(self) + crate::platform_impl::physical_key_to_scancode(self) } fn from_scancode(scancode: u32) -> PhysicalKey { - crate::platform_impl::scancode_to_physicalkey(scancode) + crate::platform_impl::scancode_to_physical_key(scancode) } } diff --git a/src/platform/startup_notify.rs b/src/platform/startup_notify.rs index c9047a03b2..1af106bc35 100644 --- a/src/platform/startup_notify.rs +++ b/src/platform/startup_notify.rs @@ -2,7 +2,7 @@ //! //! The [`ActivationToken`] is essential to ensure that your newly //! created window will obtain the focus, otherwise the user could -//! be requered to click on the window. +//! be required to click on the window. //! //! Such token is usually delivered via the environment variable and //! could be read from it with the [`EventLoopExtStartupNotify::read_token_from_env`]. diff --git a/src/platform/wayland.rs b/src/platform/wayland.rs index b0ef2de436..24301ee085 100644 --- a/src/platform/wayland.rs +++ b/src/platform/wayland.rs @@ -7,7 +7,7 @@ //! //! ## Client-side decorations //! -//! Winit provides client-side decorations by default, but the behavior can +//! Winit provides client-side decorations by default, but the behaviour can //! be controlled with the following feature flags: //! //! * `wayland-csd-adwaita` (default). diff --git a/src/platform/web.rs b/src/platform/web.rs index 7af1c47c98..8b3d1a55d7 100644 --- a/src/platform/web.rs +++ b/src/platform/web.rs @@ -82,7 +82,7 @@ pub trait WindowExtWebSys { /// would prevent that. /// /// Some events are impossible to prevent. E.g. Firefox allows to access the native browser - /// context menu with Shift+Right-click. + /// context menu with Shift+Rightclick. fn set_prevent_default(&self, prevent_default: bool); } @@ -274,7 +274,7 @@ pub trait CustomCursorExtWebSys { /// but browser support for image formats is inconsistent. Using [PNG] is recommended. /// /// [PNG]: https://en.wikipedia.org/wiki/PNG - fn from_url(url: String, hot_spot_x: u16, hot_spot_y: u16) -> CustomCursorSource; + fn from_url(url: String, hotspot_x: u16, hotspot_y: u16) -> CustomCursorSource; /// Crates a new animated cursor from multiple [`CustomCursor`]s. /// Supplied `cursors` can't be empty or other animations. @@ -289,12 +289,12 @@ impl CustomCursorExtWebSys for CustomCursor { self.inner.animation } - fn from_url(url: String, hot_spot_x: u16, hot_spot_y: u16) -> CustomCursorSource { + fn from_url(url: String, hotspot_x: u16, hotspot_y: u16) -> CustomCursorSource { CustomCursorSource { inner: PlatformCustomCursorSource::Url { url, - hot_spot_x, - hot_spot_y, + hotspot_x, + hotspot_y, }, } } diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 08dbb6752d..249f6f4847 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -211,7 +211,7 @@ impl EventLoop { where F: FnMut(event::Event, &RootAEL), { - trace!("Mainloop iteration"); + trace!("Main loop iteration"); let cause = self.cause; let mut pending_redraw = self.pending_redraw; diff --git a/src/platform_impl/linux/common/xkb/keymap.rs b/src/platform_impl/linux/common/xkb/keymap.rs index 26f1179256..43dcd71dcf 100644 --- a/src/platform_impl/linux/common/xkb/keymap.rs +++ b/src/platform_impl/linux/common/xkb/keymap.rs @@ -24,13 +24,13 @@ use crate::platform_impl::common::xkb::{XkbContext, XKBH}; /// /// X11-style keycodes are offset by 8 from the keycodes the Linux kernel uses. pub fn raw_keycode_to_physicalkey(keycode: u32) -> PhysicalKey { - scancode_to_physicalkey(keycode.saturating_sub(8)) + scancode_to_physical_key(keycode.saturating_sub(8)) } /// Map the linux scancode to Keycode. /// /// Both X11 and Wayland use keys with `+ 8` offset to linux scancode. -pub fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey { +pub fn scancode_to_physical_key(scancode: u32) -> PhysicalKey { // The keycode values are taken from linux/include/uapi/linux/input-event-codes.h, as // libxkbcommon's documentation seems to suggest that the keycode values we're interested in // are defined by the Linux kernel. If Winit programs end up being run on other Unix-likes, @@ -287,7 +287,7 @@ pub fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey { }) } -pub fn physicalkey_to_scancode(key: PhysicalKey) -> Option { +pub fn physical_key_to_scancode(key: PhysicalKey) -> Option { let code = match key { PhysicalKey::Code(code) => code, PhysicalKey::Unidentified(code) => { diff --git a/src/platform_impl/linux/common/xkb/mod.rs b/src/platform_impl/linux/common/xkb/mod.rs index 734e344cad..6e91235012 100644 --- a/src/platform_impl/linux/common/xkb/mod.rs +++ b/src/platform_impl/linux/common/xkb/mod.rs @@ -29,7 +29,7 @@ use keymap::XkbKeymap; #[cfg(x11_platform)] pub use keymap::raw_keycode_to_physicalkey; -pub use keymap::{physicalkey_to_scancode, scancode_to_physicalkey}; +pub use keymap::{physical_key_to_scancode, scancode_to_physical_key}; pub use state::XkbState; // TODO: Wire this up without using a static `AtomicBool`. diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index bd5e606687..4cff5569aa 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -34,7 +34,7 @@ use crate::{ }, }; -pub(crate) use self::common::xkb::{physicalkey_to_scancode, scancode_to_physicalkey}; +pub(crate) use self::common::xkb::{physical_key_to_scancode, scancode_to_physical_key}; pub(crate) use crate::cursor::OnlyCursorImageSource as PlatformCustomCursorSource; pub(crate) use crate::icon::RgbaIcon as PlatformIcon; pub(crate) use crate::platform_impl::Fullscreen; diff --git a/src/platform_impl/linux/wayland/seat/keyboard/mod.rs b/src/platform_impl/linux/wayland/seat/keyboard/mod.rs index c471c61c57..9212104553 100644 --- a/src/platform_impl/linux/wayland/seat/keyboard/mod.rs +++ b/src/platform_impl/linux/wayland/seat/keyboard/mod.rs @@ -94,7 +94,7 @@ impl Dispatch for WinitState { WlKeyboardEvent::Leave { surface, .. } => { let window_id = wayland::make_wid(&surface); - // NOTE: we should drop the repeat regardless whethere it was for the present + // NOTE: we should drop the repeat regardless whether it was for the present // window of for the window which just went gone. let keyboard_state = seat_state.keyboard_state.as_mut().unwrap(); keyboard_state.current_repeat = None; diff --git a/src/platform_impl/linux/wayland/seat/pointer/mod.rs b/src/platform_impl/linux/wayland/seat/pointer/mod.rs index e9dee8f21f..24b834bfc1 100644 --- a/src/platform_impl/linux/wayland/seat/pointer/mod.rs +++ b/src/platform_impl/linux/wayland/seat/pointer/mod.rs @@ -207,7 +207,7 @@ impl PointerHandler for WinitState { pointer_data.phase = phase; // Mice events have both pixel and discrete delta's at the same time. So prefer - // the descrite values if they are present. + // the discrete values if they are present. let delta = if has_discrete_scroll { // XXX Wayland sign convention is the inverse of winit. MouseScrollDelta::LineDelta( diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs index 0feb56f63c..65ce360b7f 100644 --- a/src/platform_impl/linux/x11/event_processor.rs +++ b/src/platform_impl/linux/x11/event_processor.rs @@ -981,13 +981,13 @@ impl EventProcessor { // Always update the modifiers when we're not replaying. if !replay { - self.udpate_mods_from_core_event(window_id, xev.state as u16, &mut callback); + self.update_mods_from_core_event(window_id, xev.state as u16, &mut callback); } if keycode != 0 && !self.is_composing { // Don't alter the modifiers state from replaying. if replay { - self.send_synthic_modifier_from_core(window_id, xev.state as u16, &mut callback); + self.send_synthetic_modifier_from_core(window_id, xev.state as u16, &mut callback); } if let Some(mut key_processor) = self.xkb_context.key_context() { @@ -1037,7 +1037,7 @@ impl EventProcessor { } } - fn send_synthic_modifier_from_core( + fn send_synthetic_modifier_from_core( &mut self, window_id: crate::window::WindowId, state: u16, @@ -1778,7 +1778,7 @@ impl EventProcessor { self.send_modifiers(window_id, mods.into(), true, &mut callback) } - pub fn udpate_mods_from_core_event( + pub fn update_mods_from_core_event( &mut self, window_id: crate::window::WindowId, state: u16, diff --git a/src/platform_impl/linux/x11/ime/callbacks.rs b/src/platform_impl/linux/x11/ime/callbacks.rs index 02e26410a6..09a80a2377 100644 --- a/src/platform_impl/linux/x11/ime/callbacks.rs +++ b/src/platform_impl/linux/x11/ime/callbacks.rs @@ -166,7 +166,7 @@ unsafe fn replace_im(inner: *mut ImeInner) -> Result<(), ReplaceImError> { pub unsafe extern "C" fn xim_instantiate_callback( _display: *mut ffi::Display, client_data: ffi::XPointer, - // This field is unsupplied. + // This field is un-supplied. _call_data: ffi::XPointer, ) { let inner: *mut ImeInner = client_data as _; @@ -193,7 +193,7 @@ pub unsafe extern "C" fn xim_instantiate_callback( pub unsafe extern "C" fn xim_destroy_callback( _xim: ffi::XIM, client_data: ffi::XPointer, - // This field is unsupplied. + // This field is un-supplied. _call_data: ffi::XPointer, ) { let inner: *mut ImeInner = client_data as _; diff --git a/src/platform_impl/linux/x11/ime/context.rs b/src/platform_impl/linux/x11/ime/context.rs index 565748f007..65418e822c 100644 --- a/src/platform_impl/linux/x11/ime/context.rs +++ b/src/platform_impl/linux/x11/ime/context.rs @@ -87,7 +87,7 @@ extern "C" fn preedit_draw_callback( call_data.chg_first as usize..(call_data.chg_first + call_data.chg_length) as usize; if chg_range.start > client_data.text.len() || chg_range.end > client_data.text.len() { tracing::warn!( - "invalid chg range: buffer length={}, but chg_first={} chg_lengthg={}", + "invalid chg range: buffer length={}, but chg_first={} chg_length={}", client_data.text.len(), call_data.chg_first, call_data.chg_length diff --git a/src/platform_impl/linux/x11/ime/input_method.rs b/src/platform_impl/linux/x11/ime/input_method.rs index 44cb8164d3..5bce4b6782 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 representing -// the availabile XIM servers. For instance, if you're using ibus, it would contain an atom named +// the available 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 // modifiers, since we don't want a user who's looking at logs to ask "am I supposed to set diff --git a/src/platform_impl/linux/x11/util/geometry.rs b/src/platform_impl/linux/x11/util/geometry.rs index 0a95c4188c..9210b9b697 100644 --- a/src/platform_impl/linux/x11/util/geometry.rs +++ b/src/platform_impl/linux/x11/util/geometry.rs @@ -44,7 +44,7 @@ impl AaRect { pub struct Geometry { pub root: xproto::Window, // If you want positions relative to the root window, use translate_coords. - // Note that the overwhelming majority of window managers are reparenting WMs, thus the window + // Note that the overwhelming majority of window managers are re-parenting WMs, thus the window // ID we get from window creation is for a nested window used as the window's client area. If // you call get_geometry with that window ID, then you'll get the position of that client area // window relative to the parent it's nested in (the frame), which isn't helpful if you want diff --git a/src/platform_impl/linux/x11/util/mod.rs b/src/platform_impl/linux/x11/util/mod.rs index f97005ce8a..fb9b0c9747 100644 --- a/src/platform_impl/linux/x11/util/mod.rs +++ b/src/platform_impl/linux/x11/util/mod.rs @@ -48,7 +48,7 @@ where } impl XConnection { - // This is impoartant, so pay attention! + // This is important, so pay attention! // Xlib has an output buffer, and tries to hide the async nature of X from you. // This buffer contains the requests you make, and is flushed under various circumstances: // 1. `XPending`, `XNextEvent`, and `XWindowEvent` flush "as needed" diff --git a/src/platform_impl/linux/x11/util/wm.rs b/src/platform_impl/linux/x11/util/wm.rs index 6c96ff143c..db2af4457e 100644 --- a/src/platform_impl/linux/x11/util/wm.rs +++ b/src/platform_impl/linux/x11/util/wm.rs @@ -54,7 +54,7 @@ impl XConnection { // Mutter/Muffin/Budgie doesn't have _NET_SUPPORTING_WM_CHECK in its _NET_SUPPORTED, despite // it working and being supported. This has been reported upstream, but due to the - // inavailability of time machines, we'll just try to get _NET_SUPPORTING_WM_CHECK + // unavailability of time machines, we'll just try to get _NET_SUPPORTING_WM_CHECK // regardless of whether or not the WM claims to support it. // // Blackbox 0.70 also incorrectly reports not supporting this, though that appears to be fixed diff --git a/src/platform_impl/linux/x11/util/xmodmap.rs b/src/platform_impl/linux/x11/util/xmodmap.rs index 523a582970..565fd7291a 100644 --- a/src/platform_impl/linux/x11/util/xmodmap.rs +++ b/src/platform_impl/linux/x11/util/xmodmap.rs @@ -16,7 +16,7 @@ const NUM_MODS: usize = 8; #[derive(Debug, Default)] pub struct ModifierKeymap { // Maps keycodes to modifiers - modifers: HashSet, + modifiers: HashSet, } impl ModifierKeymap { @@ -25,7 +25,7 @@ impl ModifierKeymap { } pub fn is_modifier(&self, keycode: XKeyCode) -> bool { - self.modifers.contains(&keycode) + self.modifiers.contains(&keycode) } pub fn reload_from_x_connection(&mut self, xconn: &super::XConnection) { @@ -48,9 +48,9 @@ impl ModifierKeymap { let keys = unsafe { slice::from_raw_parts(keymap.modifiermap as *const _, keys_per_mod * NUM_MODS) }; - self.modifers.clear(); + self.modifiers.clear(); for key in keys { - self.modifers.insert(*key); + self.modifiers.insert(*key); } } } diff --git a/src/platform_impl/linux/x11/window.rs b/src/platform_impl/linux/x11/window.rs index 70cc254ef6..9375c274bc 100644 --- a/src/platform_impl/linux/x11/window.rs +++ b/src/platform_impl/linux/x11/window.rs @@ -391,7 +391,7 @@ impl UnownedWindow { } { - // Enable drag and drop (TODO: extend API to make this toggleable) + // Enable drag and drop (TODO: extend API to make this toggle-able) { let dnd_aware_atom = atoms[XdndAware]; let version = &[5u32]; // Latest version; hasn't changed since 2002 @@ -1038,9 +1038,10 @@ impl UnownedWindow { let vert_atom = atoms[_NET_WM_STATE_MAXIMIZED_VERT]; match state { Ok(atoms) => { - let horz_maximized = atoms.iter().any(|atom: &xproto::Atom| *atom == horz_atom); + let horizontal_maximized = + atoms.iter().any(|atom: &xproto::Atom| *atom == horz_atom); let vert_maximized = atoms.iter().any(|atom: &xproto::Atom| *atom == vert_atom); - horz_maximized && vert_maximized + horizontal_maximized && vert_maximized } _ => false, } @@ -1048,10 +1049,10 @@ impl UnownedWindow { fn set_maximized_inner(&self, maximized: bool) -> Result, X11Error> { let atoms = self.xconn.atoms(); - let horz_atom = atoms[_NET_WM_STATE_MAXIMIZED_HORZ]; + let horizontal_atom = atoms[_NET_WM_STATE_MAXIMIZED_HORZ]; let vert_atom = atoms[_NET_WM_STATE_MAXIMIZED_VERT]; - self.set_netwm(maximized.into(), (horz_atom, vert_atom, 0, 0)) + self.set_netwm(maximized.into(), (horizontal_atom, vert_atom, 0, 0)) } #[inline] diff --git a/src/platform_impl/linux/x11/xdisplay.rs b/src/platform_impl/linux/x11/xdisplay.rs index 16706fcf2e..dd46cbee1e 100644 --- a/src/platform_impl/linux/x11/xdisplay.rs +++ b/src/platform_impl/linux/x11/xdisplay.rs @@ -159,7 +159,7 @@ impl XConnection { // Get PropertyNotify events from the XSETTINGS window. // TODO: The XSETTINGS window here can change. In the future, listen for DestroyNotify on this window - // in order to accomodate for a changed window here. + // in order to accommodate for a changed window here. let selector_window = xcb .get_selection_owner(xsettings_screen) .ok()? diff --git a/src/platform_impl/macos/event.rs b/src/platform_impl/macos/event.rs index 103eae38b2..3c6d250ea2 100644 --- a/src/platform_impl/macos/event.rs +++ b/src/platform_impl/macos/event.rs @@ -113,7 +113,8 @@ pub(crate) fn create_key_event( let state = if is_press { Pressed } else { Released }; let scancode = unsafe { ns_event.keyCode() }; - let mut physical_key = key_override.unwrap_or_else(|| scancode_to_physicalkey(scancode as u32)); + let mut physical_key = + key_override.unwrap_or_else(|| scancode_to_physical_key(scancode as u32)); // NOTE: The logical key should heed both SHIFT and ALT if possible. // For instance: @@ -150,7 +151,7 @@ pub(crate) fn create_key_event( let logical_key = match text_with_all_modifiers.as_ref() { // Only checking for ctrl and cmd here, not checking for alt because we DO want to - // include its effect in the key. For example if -on the Germay layout- one + // include its effect in the key. For example if -on the Germany layout- one // presses alt+8, the logical key should be "{" // Also not checking if this is a release event because then this issue would // still affect the key release. @@ -415,7 +416,7 @@ pub(super) fn dummy_event() -> Option> { } } -pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option { +pub(crate) fn physical_key_to_scancode(physical_key: PhysicalKey) -> Option { let code = match physical_key { PhysicalKey::Code(code) => code, PhysicalKey::Unidentified(_) => return None, @@ -537,7 +538,7 @@ pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option } } -pub(crate) fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey { +pub(crate) fn scancode_to_physical_key(scancode: u32) -> PhysicalKey { PhysicalKey::Code(match scancode { 0x00 => KeyCode::KeyA, 0x01 => KeyCode::KeyS, diff --git a/src/platform_impl/macos/event_loop.rs b/src/platform_impl/macos/event_loop.rs index 1e0e34ee37..6361634c26 100644 --- a/src/platform_impl/macos/event_loop.rs +++ b/src/platform_impl/macos/event_loop.rs @@ -60,7 +60,7 @@ impl PanicInfo { self.inner.set(inner); result } - /// Overwrites the curret state if the current state is not panicking + /// Overwrites the current state if the current state is not panicking pub fn set_panic(&self, p: Box) { if !self.is_panicking() { self.inner.set(Some(p)); diff --git a/src/platform_impl/macos/mod.rs b/src/platform_impl/macos/mod.rs index 2d0d306e7f..83d58bd002 100644 --- a/src/platform_impl/macos/mod.rs +++ b/src/platform_impl/macos/mod.rs @@ -18,7 +18,7 @@ mod window_delegate; use std::fmt; pub(crate) use self::{ - event::{physicalkey_to_scancode, scancode_to_physicalkey, KeyEventExtra}, + event::{physical_key_to_scancode, scancode_to_physical_key, KeyEventExtra}, event_loop::{ ActiveEventLoop, EventLoop, EventLoopProxy, OwnedDisplayHandle, PlatformSpecificEventLoopAttributes, diff --git a/src/platform_impl/macos/view.rs b/src/platform_impl/macos/view.rs index 99ea42b309..e65ef3b86e 100644 --- a/src/platform_impl/macos/view.rs +++ b/src/platform_impl/macos/view.rs @@ -23,7 +23,7 @@ use super::app_delegate::ApplicationDelegate; use super::cursor::{default_cursor, invisible_cursor}; use super::event::{ code_to_key, code_to_location, create_key_event, event_mods, lalt_pressed, ralt_pressed, - scancode_to_physicalkey, + scancode_to_physical_key, }; use super::window::WinitWindow; use super::{util, DEVICE_ID}; @@ -918,7 +918,7 @@ impl WinitView { 'send_event: { if is_flags_changed_event && unsafe { ns_event.keyCode() } != 0 { let scancode = unsafe { ns_event.keyCode() }; - let physical_key = scancode_to_physicalkey(scancode as u32); + let physical_key = scancode_to_physical_key(scancode as u32); // We'll correct the `is_press` later. let mut event = create_key_event(ns_event, false, false, Some(physical_key)); diff --git a/src/platform_impl/macos/window_delegate.rs b/src/platform_impl/macos/window_delegate.rs index d00257f4cc..8af408a320 100644 --- a/src/platform_impl/macos/window_delegate.rs +++ b/src/platform_impl/macos/window_delegate.rs @@ -594,7 +594,7 @@ fn new_window(attrs: &WindowAttributes, mtm: MainThreadMarker) -> Option Self::build_spawn( event_loop, from_url(UrlType::Plain(url), hotspot_x, hotspot_y), diff --git a/src/platform_impl/web/keyboard.rs b/src/platform_impl/web/keyboard.rs index 6f8d69c760..924d112d6c 100644 --- a/src/platform_impl/web/keyboard.rs +++ b/src/platform_impl/web/keyboard.rs @@ -321,8 +321,8 @@ impl Key { } impl PhysicalKey { - pub fn from_key_code_attribute_value(kcav: &str) -> Self { - PhysicalKey::Code(match kcav { + pub fn from_key_code_attribute_value(k_code: &str) -> Self { + PhysicalKey::Code(match k_code { "Backquote" => KeyCode::Backquote, "Backslash" => KeyCode::Backslash, "BracketLeft" => KeyCode::BracketLeft, diff --git a/src/platform_impl/windows/dark_mode.rs b/src/platform_impl/windows/dark_mode.rs index 11b6977657..b459994af7 100644 --- a/src/platform_impl/windows/dark_mode.rs +++ b/src/platform_impl/windows/dark_mode.rs @@ -117,13 +117,13 @@ fn set_dark_mode_for_window(hwnd: HWND, is_dark_mode: bool) -> bool { if let Some(set_window_composition_attribute) = *SET_WINDOW_COMPOSITION_ATTRIBUTE { unsafe { - // SetWindowCompositionAttribute needs a bigbool (i32), not bool. - let mut is_dark_mode_bigbool = BOOL::from(is_dark_mode); + // SetWindowCompositionAttribute needs a big_bool (i32), not bool. + let mut is_dark_mode_big_bool = BOOL::from(is_dark_mode); let mut data = WINDOWCOMPOSITIONATTRIBDATA { Attrib: WCA_USEDARKMODECOLORS, - pvData: &mut is_dark_mode_bigbool as *mut _ as _, - cbData: std::mem::size_of_val(&is_dark_mode_bigbool) as _, + pvData: &mut is_dark_mode_big_bool as *mut _ as _, + cbData: std::mem::size_of_val(&is_dark_mode_big_bool) as _, }; let status = set_window_composition_attribute(hwnd, &mut data); diff --git a/src/platform_impl/windows/definitions.rs b/src/platform_impl/windows/definitions.rs index b4a461c947..60ab9a29f2 100644 --- a/src/platform_impl/windows/definitions.rs +++ b/src/platform_impl/windows/definitions.rs @@ -17,7 +17,7 @@ use windows_sys::{ pub struct IUnknownVtbl { pub QueryInterface: unsafe extern "system" fn( This: *mut IUnknown, - riid: *const GUID, + r_iid: *const GUID, ppvObject: *mut *mut c_void, ) -> HRESULT, pub AddRef: unsafe extern "system" fn(This: *mut IUnknown) -> u32, @@ -29,43 +29,45 @@ pub struct IDataObjectVtbl { pub parent: IUnknownVtbl, pub GetData: unsafe extern "system" fn( This: *mut IDataObject, - pformatetcIn: *const FORMATETC, - pmedium: *mut STGMEDIUM, + p_format_etc_In: *const FORMATETC, + p_medium: *mut STGMEDIUM, ) -> HRESULT, pub GetDataHere: unsafe extern "system" fn( This: *mut IDataObject, - pformatetc: *const FORMATETC, - pmedium: *mut STGMEDIUM, + p_format_etc: *const FORMATETC, + p_medium: *mut STGMEDIUM, + ) -> HRESULT, + QueryGetData: unsafe extern "system" fn( + This: *mut IDataObject, + p_format_etc: *const FORMATETC, ) -> HRESULT, - QueryGetData: - unsafe extern "system" fn(This: *mut IDataObject, pformatetc: *const FORMATETC) -> HRESULT, pub GetCanonicalFormatEtc: unsafe extern "system" fn( This: *mut IDataObject, - pformatetcIn: *const FORMATETC, - pformatetcOut: *mut FORMATETC, + p_format_etc_In: *const FORMATETC, + p_format_etc_Out: *mut FORMATETC, ) -> HRESULT, pub SetData: unsafe extern "system" fn( This: *mut IDataObject, - pformatetc: *const FORMATETC, - pformatetcOut: *const FORMATETC, + p_format_etc: *const FORMATETC, + p_format_etcOut: *const FORMATETC, fRelease: BOOL, ) -> HRESULT, pub EnumFormatEtc: unsafe extern "system" fn( This: *mut IDataObject, dwDirection: u32, - ppenumFormatEtc: *mut *mut IEnumFORMATETC, + pp_enumFormatEtc: *mut *mut IEnumFORMATETC, ) -> HRESULT, pub DAdvise: unsafe extern "system" fn( This: *mut IDataObject, - pformatetc: *const FORMATETC, - advf: u32, + p_format_etc: *const FORMATETC, + a_dvf: u32, pAdvSInk: *const IAdviseSink, pdwConnection: *mut u32, ) -> HRESULT, pub DUnadvise: unsafe extern "system" fn(This: *mut IDataObject, dwConnection: u32) -> HRESULT, pub EnumDAdvise: unsafe extern "system" fn( This: *mut IDataObject, - ppenumAdvise: *const *const IEnumSTATDATA, + pp_enumAdvise: *const *const IEnumSTATDATA, ) -> HRESULT, } diff --git a/src/platform_impl/windows/event_loop.rs b/src/platform_impl/windows/event_loop.rs index 50bf022e59..581595cad7 100644 --- a/src/platform_impl/windows/event_loop.rs +++ b/src/platform_impl/windows/event_loop.rs @@ -1021,10 +1021,10 @@ pub(super) unsafe extern "system" fn public_window_callback( let userdata_ptr = match (userdata, msg) { (0, WM_NCCREATE) => { - let createstruct = unsafe { &mut *(lparam as *mut CREATESTRUCTW) }; - let initdata = unsafe { &mut *(createstruct.lpCreateParams as *mut InitData<'_>) }; + let create_struct = unsafe { &mut *(lparam as *mut CREATESTRUCTW) }; + let init_data = unsafe { &mut *(create_struct.lpCreateParams as *mut InitData<'_>) }; - let result = match unsafe { initdata.on_nccreate(window) } { + let result = match unsafe { init_data.on_nccreate(window) } { Some(userdata) => unsafe { super::set_window_long(window, GWL_USERDATA, userdata as _); DefWindowProcW(window, msg, wparam, lparam) @@ -1038,11 +1038,11 @@ pub(super) unsafe extern "system" fn public_window_callback( // but we'll make window creation fail here just in case. (0, WM_CREATE) => return -1, (_, WM_CREATE) => unsafe { - let createstruct = &mut *(lparam as *mut CREATESTRUCTW); - let initdata = createstruct.lpCreateParams; - let initdata = &mut *(initdata as *mut InitData<'_>); + let create_struct = &mut *(lparam as *mut CREATESTRUCTW); + let init_data = create_struct.lpCreateParams; + let init_data = &mut *(init_data as *mut InitData<'_>); - initdata.on_create(); + init_data.on_create(); return DefWindowProcW(window, msg, wparam, lparam); }, (0, _) => return unsafe { DefWindowProcW(window, msg, wparam, lparam) }, @@ -1147,7 +1147,7 @@ unsafe fn public_window_callback_inner( // on all 4 borders would result in the caption getting drawn by the DWM. // // Another option would be to allow the DWM to paint inside the client area. - // Unfortunately this results in janky resize behavior, where the compositor is + // Unfortunately this results in inconsistent resize behavior, where the compositor is // ahead of the window surface. Currently, there seems no option to achieve this // with the Windows API. params.rgrc[0].top += 1; @@ -1312,10 +1312,10 @@ unsafe fn public_window_callback_inner( WM_WINDOWPOSCHANGED => { use crate::event::WindowEvent::Moved; - let windowpos = lparam as *const WINDOWPOS; - if unsafe { (*windowpos).flags & SWP_NOMOVE != SWP_NOMOVE } { + let window_pos = lparam as *const WINDOWPOS; + if unsafe { (*window_pos).flags & SWP_NOMOVE != SWP_NOMOVE } { let physical_position = - unsafe { PhysicalPosition::new((*windowpos).x, (*windowpos).y) }; + unsafe { PhysicalPosition::new((*window_pos).x, (*window_pos).y) }; userdata.send_event(Event::WindowEvent { window_id: RootWindowId(WindowId(window)), event: Moved(physical_position), @@ -1817,18 +1817,18 @@ unsafe fn public_window_callback_inner( } WM_TOUCH => { - let pcount = super::loword(wparam as u32) as usize; - let mut inputs = Vec::with_capacity(pcount); - let htouch = lparam; + let p_count = super::loword(wparam as u32) as usize; + let mut inputs = Vec::with_capacity(p_count); + let h_touch = lparam; if unsafe { GetTouchInputInfo( - htouch, - pcount as u32, + h_touch, + p_count as u32, inputs.as_mut_ptr(), mem::size_of::() as i32, ) > 0 } { - unsafe { inputs.set_len(pcount) }; + unsafe { inputs.set_len(p_count) }; for input in &inputs { let mut location = POINT { x: input.x / 100, @@ -1862,7 +1862,7 @@ unsafe fn public_window_callback_inner( }); } } - unsafe { CloseTouchInputHandle(htouch) }; + unsafe { CloseTouchInputHandle(h_touch) }; result = ProcResult::Value(0); } @@ -2557,7 +2557,7 @@ unsafe fn handle_raw_input(userdata: &ThreadMsgTargetData, data: RAWINPUT) { } enum PointerMoveKind { - /// Pointer enterd to the window. + /// Pointer entered to the window. Enter, /// Pointer leaved the window client area. Leave, diff --git a/src/platform_impl/windows/event_loop/runner.rs b/src/platform_impl/windows/event_loop/runner.rs index b7130b5790..3fd6e7eeba 100644 --- a/src/platform_impl/windows/event_loop/runner.rs +++ b/src/platform_impl/windows/event_loop/runner.rs @@ -399,19 +399,19 @@ impl BufferedEvent { match self { Self::Event(event) => dispatch(event), Self::ScaleFactorChanged(window_id, scale_factor, new_inner_size) => { - let user_new_innner_size = Arc::new(Mutex::new(new_inner_size)); + let user_new_inner_size = Arc::new(Mutex::new(new_inner_size)); dispatch(Event::WindowEvent { window_id, event: WindowEvent::ScaleFactorChanged { scale_factor, inner_size_writer: InnerSizeWriter::new(Arc::downgrade( - &user_new_innner_size, + &user_new_inner_size, )), }, }); - let inner_size = *user_new_innner_size.lock().unwrap(); + let inner_size = *user_new_inner_size.lock().unwrap(); - drop(user_new_innner_size); + drop(user_new_inner_size); if inner_size != new_inner_size { let window_flags = unsafe { diff --git a/src/platform_impl/windows/ime.rs b/src/platform_impl/windows/ime.rs index fc48046938..e9ceef606f 100644 --- a/src/platform_impl/windows/ime.rs +++ b/src/platform_impl/windows/ime.rs @@ -45,12 +45,12 @@ impl ImeContext { let mut boundary_before_char = 0; for (attr, chr) in attrs.into_iter().zip(text.chars()) { - let char_is_targetted = + let char_is_targeted = attr as u32 == ATTR_TARGET_CONVERTED || attr as u32 == ATTR_TARGET_NOTCONVERTED; - if first.is_none() && char_is_targetted { + if first.is_none() && char_is_targeted { first = Some(boundary_before_char); - } else if first.is_some() && last.is_none() && !char_is_targetted { + } else if first.is_some() && last.is_none() && !char_is_targeted { last = Some(boundary_before_char); } diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs index 8c101816c7..0753bacec4 100644 --- a/src/platform_impl/windows/keyboard.rs +++ b/src/platform_impl/windows/keyboard.rs @@ -42,7 +42,7 @@ use crate::{ platform_impl::platform::{ event_loop::ProcResult, keyboard_layout::{Layout, LayoutCache, WindowsModifiers, LAYOUT_CACHE}, - loword, primarylangid, KeyEventExtra, + loword, primary_lang_id, KeyEventExtra, }, }; @@ -106,13 +106,13 @@ impl KeyEventBuilder { let mut matcher = || -> MatchResult { match msg_kind { WM_SETFOCUS => { - // synthesize keydown events + // synthesize key down events let kbd_state = get_async_kbd_state(); let key_events = Self::synthesize_kbd_state(ElementState::Pressed, &kbd_state); MatchResult::MessagesToDispatch(self.pending.complete_multi(key_events)) } WM_KILLFOCUS => { - // sythesize keyup events + // synthesize keyup events let kbd_state = get_kbd_state(); let key_events = Self::synthesize_kbd_state(ElementState::Released, &kbd_state); MatchResult::MessagesToDispatch(self.pending.complete_multi(key_events)) @@ -230,7 +230,7 @@ impl KeyEventBuilder { .unwrap_or(false); if more_char_coming { // No need to produce an event just yet, because there are still more characters that - // need to appended to this keyobard event + // need to appended to this keyboard event MatchResult::TokenToRemove(pending_token) } else { let mut event_info = self.event_info.lock().unwrap(); @@ -328,7 +328,7 @@ impl KeyEventBuilder { } } - // Allowing nominimal_bool lint because the `is_key_pressed` macro triggers this warning + // Allowing nonminimal_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( @@ -454,7 +454,7 @@ impl KeyEventBuilder { return None; } let scancode = scancode as ExScancode; - let physical_key = scancode_to_physicalkey(scancode as u32); + let physical_key = scancode_to_physical_key(scancode as u32); let mods = if caps_lock_on { WindowsModifiers::CAPS_LOCK } else { @@ -499,7 +499,7 @@ enum PartialText { enum PartialLogicalKey { /// Use the text provided by the WM_CHAR messages and report that as a `Character` variant. If - /// the text consists of multiple grapheme clusters (user-precieved characters) that means that + /// the text consists of multiple grapheme clusters (user-perceived characters) that means that /// dead key could not be combined with the second input, and in that case we should fall back /// to using what would have without a dead-key input. TextOr(Key), @@ -544,7 +544,7 @@ impl PartialKeyEventInfo { } else { new_ex_scancode(lparam_struct.scancode, lparam_struct.extended) }; - let physical_key = scancode_to_physicalkey(scancode as u32); + let physical_key = scancode_to_physical_key(scancode as u32); let location = get_location(scancode, layout.hkl as HKL); let kbd_state = get_kbd_state(); @@ -589,7 +589,7 @@ impl PartialKeyEventInfo { // We convert dead keys into their character. // The reason for this is that `key_without_modifiers` is designed for key-bindings, // but the US International layout treats `'` (apostrophe) as a dead key and the - // reguar US layout treats it a character. In order for a single binding + // regular US layout treats it a character. In order for a single binding // configuration to work with both layouts, we forward each dead key as a character. Key::Dead(k) => { if let Some(ch) = k { @@ -741,15 +741,15 @@ fn get_async_kbd_state() -> [u8; 256] { /// 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. -fn is_current_fake(curr_info: &PartialKeyEventInfo, next_msg: MSG, layout: &Layout) -> bool { - let curr_is_ctrl = matches!( - curr_info.logical_key, +fn is_current_fake(current_info: &PartialKeyEventInfo, next_msg: MSG, layout: &Layout) -> bool { + let current_is_ctrl = matches!( + current_info.logical_key, PartialLogicalKey::This(Key::Named(NamedKey::Control)) ); if layout.has_alt_graph { let next_code = ex_scancode_from_lparam(next_msg.lParam); let next_is_altgr = next_code == 0xE038; // 0xE038 is right alt - if curr_is_ctrl && next_is_altgr { + if current_is_ctrl && next_is_altgr { return true; } } @@ -942,12 +942,12 @@ fn get_location(scancode: ExScancode, hkl: HKL) -> KeyLocation { } } -pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option { - // See `scancode_to_physicalkey` for more info +pub(crate) fn physical_key_to_scancode(physical_key: PhysicalKey) -> Option { + // See `scancode_to_physical_key` for more info let hkl = unsafe { GetKeyboardLayout(0) }; - let primary_lang_id = primarylangid(loword(hkl as u32)); + let primary_lang_id = primary_lang_id(loword(hkl as u32)); let is_korean = primary_lang_id as u32 == LANG_KOREAN; let code = match physical_key { @@ -1124,7 +1124,7 @@ pub(crate) fn physicalkey_to_scancode(physical_key: PhysicalKey) -> Option } } -pub(crate) fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey { +pub(crate) fn scancode_to_physical_key(scancode: u32) -> PhysicalKey { // See: https://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html // and: https://www.w3.org/TR/uievents-code/ // and: The widget/NativeKeyToDOMCodeName.h file in the firefox source diff --git a/src/platform_impl/windows/keyboard_layout.rs b/src/platform_impl/windows/keyboard_layout.rs index 31a15e49c5..dd446ee607 100644 --- a/src/platform_impl/windows/keyboard_layout.rs +++ b/src/platform_impl/windows/keyboard_layout.rs @@ -53,7 +53,7 @@ use windows_sys::Win32::{ use crate::{ keyboard::{Key, KeyCode, ModifiersState, NamedKey, NativeKey, PhysicalKey}, - platform_impl::{loword, primarylangid, scancode_to_physicalkey}, + platform_impl::{loword, primary_lang_id, scancode_to_physical_key}, }; pub(crate) static LAYOUT_CACHE: Lazy> = @@ -121,12 +121,12 @@ impl WindowsModifiers { let rshift = key_state[VK_RSHIFT as usize] & 0x80 != 0; let control = key_state[VK_CONTROL as usize] & 0x80 != 0; - let lcontrol = key_state[VK_LCONTROL as usize] & 0x80 != 0; - let rcontrol = key_state[VK_RCONTROL as usize] & 0x80 != 0; + let l_control = key_state[VK_LCONTROL as usize] & 0x80 != 0; + let r_control = key_state[VK_RCONTROL as usize] & 0x80 != 0; let alt = key_state[VK_MENU as usize] & 0x80 != 0; - let lalt = key_state[VK_LMENU as usize] & 0x80 != 0; - let ralt = key_state[VK_RMENU as usize] & 0x80 != 0; + let l_alt = key_state[VK_LMENU as usize] & 0x80 != 0; + let r_alt = key_state[VK_RMENU as usize] & 0x80 != 0; let caps = key_state[VK_CAPITAL as usize] & 0x01 != 0; @@ -134,10 +134,10 @@ impl WindowsModifiers { if shift || lshift || rshift { result.insert(WindowsModifiers::SHIFT); } - if control || lcontrol || rcontrol { + if control || l_control || r_control { result.insert(WindowsModifiers::CONTROL); } - if alt || lalt || ralt { + if alt || l_alt || r_alt { result.insert(WindowsModifiers::ALT); } if caps { @@ -335,7 +335,7 @@ impl LayoutCache { if scancode == 0 { continue; } - let keycode = match scancode_to_physicalkey(scancode) { + let keycode = match scancode_to_physical_key(scancode) { PhysicalKey::Code(code) => code, // TODO: validate that we can skip on unidentified keys (probably never occurs?) _ => continue, @@ -387,7 +387,7 @@ impl LayoutCache { } let native_code = NativeKey::Windows(vk as VIRTUAL_KEY); - let key_code = match scancode_to_physicalkey(scancode) { + let key_code = match scancode_to_physical_key(scancode) { PhysicalKey::Code(code) => code, // TODO: validate that we can skip on unidentified keys (probably never occurs?) _ => continue, @@ -542,7 +542,7 @@ fn is_numpad_specific(vk: VIRTUAL_KEY) -> bool { } fn keycode_to_vkey(keycode: KeyCode, hkl: u64) -> VIRTUAL_KEY { - let primary_lang_id = primarylangid(loword(hkl as u32)); + let primary_lang_id = primary_lang_id(loword(hkl as u32)); let is_korean = primary_lang_id as u32 == LANG_KOREAN; let is_japanese = primary_lang_id as u32 == LANG_JAPANESE; @@ -763,7 +763,7 @@ fn vkey_to_non_char_key( // List of the Web key names and their corresponding platform-native key names: // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values - let primary_lang_id = primarylangid(loword(hkl as u32)); + let primary_lang_id = primary_lang_id(loword(hkl as u32)); let is_korean = primary_lang_id as u32 == LANG_KOREAN; let is_japanese = primary_lang_id as u32 == LANG_JAPANESE; diff --git a/src/platform_impl/windows/mod.rs b/src/platform_impl/windows/mod.rs index 8b5ad9d7bf..ad5c21bbb6 100644 --- a/src/platform_impl/windows/mod.rs +++ b/src/platform_impl/windows/mod.rs @@ -12,7 +12,7 @@ pub(crate) use self::{ PlatformSpecificEventLoopAttributes, }, icon::{SelectedCursor, WinIcon}, - keyboard::{physicalkey_to_scancode, scancode_to_physicalkey}, + keyboard::{physical_key_to_scancode, scancode_to_physical_key}, monitor::{MonitorHandle, VideoModeHandle}, window::Window, }; @@ -148,7 +148,7 @@ const fn get_y_lparam(x: u32) -> i16 { } #[inline(always)] -pub(crate) const fn primarylangid(lgid: u16) -> u16 { +pub(crate) const fn primary_lang_id(lgid: u16) -> u16 { lgid & 0x3FF } @@ -163,24 +163,26 @@ const fn hiword(x: u32) -> u16 { } #[inline(always)] -unsafe fn get_window_long(hwnd: HWND, nindex: WINDOW_LONG_PTR_INDEX) -> isize { +unsafe fn get_window_long(hwnd: HWND, n_index: WINDOW_LONG_PTR_INDEX) -> isize { #[cfg(target_pointer_width = "64")] - return unsafe { windows_sys::Win32::UI::WindowsAndMessaging::GetWindowLongPtrW(hwnd, nindex) }; + return unsafe { + windows_sys::Win32::UI::WindowsAndMessaging::GetWindowLongPtrW(hwnd, n_index) + }; #[cfg(target_pointer_width = "32")] return unsafe { - windows_sys::Win32::UI::WindowsAndMessaging::GetWindowLongW(hwnd, nindex) as isize + windows_sys::Win32::UI::WindowsAndMessaging::GetWindowLongW(hwnd, n_index) as isize }; } #[inline(always)] -unsafe fn set_window_long(hwnd: HWND, nindex: WINDOW_LONG_PTR_INDEX, dwnewlong: isize) -> isize { +unsafe fn set_window_long(hwnd: HWND, n_index: WINDOW_LONG_PTR_INDEX, new_long: isize) -> isize { #[cfg(target_pointer_width = "64")] return unsafe { - windows_sys::Win32::UI::WindowsAndMessaging::SetWindowLongPtrW(hwnd, nindex, dwnewlong) + windows_sys::Win32::UI::WindowsAndMessaging::SetWindowLongPtrW(hwnd, n_index, new_long) }; #[cfg(target_pointer_width = "32")] return unsafe { - windows_sys::Win32::UI::WindowsAndMessaging::SetWindowLongW(hwnd, nindex, dwnewlong as i32) + windows_sys::Win32::UI::WindowsAndMessaging::SetWindowLongW(hwnd, n_index, new_long as i32) as isize }; } diff --git a/src/platform_impl/windows/raw_input.rs b/src/platform_impl/windows/raw_input.rs index a53a9b67f6..29ae4babda 100644 --- a/src/platform_impl/windows/raw_input.rs +++ b/src/platform_impl/windows/raw_input.rs @@ -27,7 +27,7 @@ use windows_sys::Win32::{ }, }; -use super::scancode_to_physicalkey; +use super::scancode_to_physical_key; use crate::{ event::ElementState, event_loop::DeviceEvents, @@ -152,7 +152,7 @@ pub fn register_all_mice_and_keyboards_for_raw_input( mut window_handle: HWND, filter: DeviceEvents, ) -> bool { - // RIDEV_DEVNOTIFY: receive hotplug events + // RIDEV_DEVNOTIFY: receive hot-plug events // RIDEV_INPUTSINK: receive events even if we're not in the foreground // RIDEV_REMOVE: don't receive device events (requires NULL hwndTarget) let flags = match filter { @@ -249,16 +249,16 @@ pub fn get_keyboard_physical_key(keyboard: RAWKEYBOARD) -> Option { if scancode == 0xE11D || scancode == 0xE02A { // At the hardware (or driver?) level, pressing the Pause key is equivalent to pressing // Ctrl+NumLock. - // This equvalence means that if the user presses Pause, the keyboard will emit two - // subsequent keypresses: + // This equivalence means that if the user presses Pause, the keyboard will emit two + // subsequent key presses: // 1, 0xE11D - Which is a left Ctrl (0x1D) with an extension flag (0xE100) // 2, 0x0045 - Which on its own can be interpreted as Pause // // There's another combination which isn't quite an equivalence: - // PrtSc used to be Shift+Asterisk. This means that on some keyboards, presssing + // PrtSc used to be Shift+Asterisk. This means that on some keyboards, pressing // PrtSc (print screen) produces the following sequence: // 1, 0xE02A - Which is a left shift (0x2A) with an extension flag (0xE000) - // 2, 0xE037 - Which is a numpad multiply (0x37) with an exteion flag (0xE000). This on + // 2, 0xE037 - Which is a numpad multiply (0x37) with an extension flag (0xE000). This on // its own it can be interpreted as PrtSc // // For this reason, if we encounter the first keypress, we simply ignore it, trusting @@ -284,7 +284,7 @@ pub fn get_keyboard_physical_key(keyboard: RAWKEYBOARD) -> Option { // https://devblogs.microsoft.com/oldnewthing/20080211-00/?p=23503 PhysicalKey::Code(KeyCode::NumLock) } else { - scancode_to_physicalkey(scancode as u32) + scancode_to_physical_key(scancode as u32) }; if keyboard.VKey == VK_SHIFT { if let PhysicalKey::Code(code) = physical_key { diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 1153000505..336bbbd6d5 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -1406,7 +1406,7 @@ unsafe fn init( let menu = attributes.platform_specific.menu; let fullscreen = attributes.fullscreen.clone(); let maximized = attributes.maximized; - let mut initdata = InitData { + let mut init_data = InitData { event_loop, attributes, window_flags, @@ -1427,7 +1427,7 @@ unsafe fn init( parent.unwrap_or(0), menu.unwrap_or(0), util::get_instance_handle(), - &mut initdata as *mut _ as *mut _, + &mut init_data as *mut _ as *mut _, ) }; @@ -1442,7 +1442,7 @@ unsafe fn init( // If the handle is non-null, then window creation must have succeeded, which means // that we *must* have populated the `InitData.window` field. - let win = initdata.window.unwrap(); + let win = init_data.window.unwrap(); // Need to set FULLSCREEN or MAXIMIZED after CreateWindowEx // This is because if the size is changed in WM_CREATE, the restored size will be stored in that size. diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index a37a2383aa..80f9b81c1e 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -416,7 +416,7 @@ impl WindowFlags { 0, ); - // This condition is necessary to avoid having an unrestorable window + // This condition is necessary to avoid having an un-restorable window if !new.contains(WindowFlags::MINIMIZED) { SetWindowLongW(window, GWL_STYLE, style as i32); SetWindowLongW(window, GWL_EXSTYLE, style_ex as i32); @@ -450,7 +450,7 @@ impl WindowFlags { let mut style = GetWindowLongW(hwnd, GWL_STYLE) as u32; let style_ex = GetWindowLongW(hwnd, GWL_EXSTYLE) as u32; - // Frameless style implemented by manually overriding the non-client area in `WM_NCCALCSIZE`. + // Frame-less style implemented by manually overriding the non-client area in `WM_NCCALCSIZE`. if !self.contains(WindowFlags::MARKER_DECORATIONS) { style &= !(WS_CAPTION | WS_SIZEBOX); } @@ -525,7 +525,7 @@ impl CursorFlags { // We do this check because calling `set_cursor_clip` incessantly will flood the event // loop with `WM_MOUSEMOVE` events, and `refresh_os_cursor` is called by `set_cursor_flags` - // which at times gets called once every iteration of the eventloop. + // which at times gets called once every iteration of the event loop. if active_cursor_clip != cursor_clip.map(rect_to_tuple) { util::set_cursor_clip(cursor_clip)?; } From 0871c849ef7a2870a2d4713e74e68d6c0584bdbb Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 2 Mar 2024 22:30:34 -0800 Subject: [PATCH 4/4] chore: Add words from markdown files Signed-off-by: John Nunley --- project-words.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/project-words.txt b/project-words.txt index ddc2622b8b..de28dd7622 100644 --- a/project-words.txt +++ b/project-words.txt @@ -33,6 +33,8 @@ CFUUID CLIPSIBLINGS CLOEXEC CLOSECD +CODEOWNERS +COLORSYNC COMPATTR COMPOSITIONFORM COMPSTR @@ -79,6 +81,7 @@ DWMCOMPOSITIONCHANGED DWMWA Deque Dflt +EINTR EINVAL EJECTCD EJECTCLOSECD @@ -186,6 +189,7 @@ LSHIFT LSUPER LWIN Lcdfilter +Libera MASSHOU MAXIMIZABLE MAXIMIZEBOX @@ -206,11 +210,13 @@ MOUSEMOVE MOUSEWHEEL MOVERESIZE MSDOS +MSRV Massyo Miniaturizable Mmap Modifiermap Muhenkan +Multitouch NCACTIVATE NCCALCSIZE NCDESTROY @@ -231,6 +237,7 @@ NTSTATUS NUMLOCK Nesw Nonnull +Nunley OSVERSIONINFOW OVERLAPPEDWINDOW Overscan @@ -273,6 +280,7 @@ RDWR RESULTSTR RETURNCMD RFKILL +RGBA RIDEV RIDI RMENU @@ -300,6 +308,8 @@ SETTINGCHANGE SHOULDAPPSUSEDARKMODE SHOWNOACTIVATE SHOWUICOMPOSITIONWINDOW +SIGILL +SIGSEGV SIZEALL SIZEBOX SIZENESW @@ -317,7 +327,9 @@ SYSKEYDOWN SYSKEYUP SYSMENU Smol +Sonoma Subcompositor +Sublayer Subviews Sysrq THUMBSTICK @@ -335,6 +347,7 @@ TYPEKEYBOARD TYPEMOUSE Thumbl Thumbr +Tomiĉo UNICHAR USEDARKMODECOLORS UXTHEME @@ -390,6 +403,7 @@ autoreleasepool autoreleases autorotate beachball +beforeunload behaviour bfcache bgra @@ -448,10 +462,13 @@ fpath fract fsecs fullscreen +fullscreened fullsize +gamepads getpid gettid glutin +gotchyas hdrop henkan hidpi @@ -475,11 +492,13 @@ icrate impls initer inputmethod +isize ivars kcav kchibisov keybdinput keybinds +keyevent keyeventf keymap keypermod @@ -495,6 +514,7 @@ libwayland libxkbcommon lindex lmenu +longjmp longsolidusoverlay lowline loword @@ -505,6 +525,7 @@ lshift macbooks madsmtm mainloop +maintainership mainwindow mapvk memmap @@ -516,6 +537,7 @@ modifierless modifiermap msiglreith muhenkan +multitouch nanos nccreate netwm @@ -526,6 +548,7 @@ noredirectionbitmap notgull notitle nsec +nsscreen nsstring nsview ntdll @@ -562,9 +585,11 @@ rects reentrancy reparent reparenting +replugs repr resizeable retval +rgba rgrc rightclick riid @@ -577,14 +602,18 @@ rustix scancode scancodes sctk +serde +setjmp setlocale shcore +smithay smol softbuffer sourceid splitn standardised stdweb +struct structfield subcompositor subframework @@ -609,15 +638,19 @@ tymed uapi uiscreen uiscreens +ulong unaccel +unaccelerated uncoalesced unconfine undropped unfocusing ungrab +ungrabs uninit uninitialize unmark +unmaximized unminimize unobserve unparameterised @@ -632,8 +665,10 @@ visualid visualtype vkey vredraw +vsync vtbl vtotal +vulkano wakeup wakeups wantpalm @@ -647,6 +682,7 @@ wparam wrongcompobj xbutton xconn +xconnection xcursor xdisplay xevent