From 61c97492efc335233bc81b83e6985cf5e9ef26f6 Mon Sep 17 00:00:00 2001 From: bmh129 Date: Mon, 26 Oct 2026 17:00:22 -0500 Subject: [PATCH 01/10] W30: Linux: hand the launcher's activation token back from the first window eframe never gives winit an activation token, so with StartupNotify=true GNOME kept its busy cursor for 15 seconds after the window appeared, and a Wayland window opened without focus. The first window created without a token now takes the one the launcher put in the environment (XDG_ACTIVATION_TOKEN on Wayland, DESKTOP_STARTUP_ID on X11) and hands it back as a token given through with_activation_token would be. Later windows don't reuse the spent token, and an empty or oversized (over 1,024 bytes) token is ignored. The variable is left in the environment, unlike reset_activation_token_env: changing the environment while other threads may read it is unsound. Port of PdfCraft's vendored winit patch (14), from storytold/cadcraft#2030. Co-Authored-By: Claude Opus 5.5 --- PATCHES.md | 1 + src/platform/startup_notify.rs | 4 +- src/platform_impl/linux/mod.rs | 15 ++- src/platform_impl/linux/startup_token.rs | 115 +++++++++++++++++++++++ 4 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 src/platform_impl/linux/startup_token.rs diff --git a/PATCHES.md b/PATCHES.md index c100c83d..6a54a854 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -34,6 +34,7 @@ input lives in `craft-tablet`). | W25 | `eb4007da` | X11/Wayland: `platform::latin_layout::KeyEventExtLatinLayout`, the key on the first Latin layout group for shortcuts on non-Latin layouts | none; to be proposed | upstream release with an equivalent | storytold/winit PR #5; craft-libs#198 (K2) | | W26 | `2b9cd1cf` | macOS: replaced text is deleted by UTF-8 byte count with the commit (`WindowExtMacOS::take_ime_delete_surrounding`, same shape as W27) | master: `Ime::DeleteSurrounding` (a new `Ime` variant breaks 0.30 matchers) | the egui → 0.31 move | storytold/winit PR #6 (`d103edae`) | | W27 | `f40c76a2` | Wayland: text-input-v3 surrounding text (`WindowExtWayland::set_ime_surrounding_text`, `set_ime_surrounding_text_with_change_cause`, `clear_ime_surrounding_text`), delete-surrounding attached to the commit (`take_ime_delete_surrounding` → `ImeDeleteSurrounding { before_bytes, after_bytes }`), per-seat preedit ownership and outgoing state waiting for a matching `done` (E21b) | master has both as core API (`Ime::DeleteSurrounding`) | the egui → 0.31 move | storytold/winit PR #7; craft-libs#198 (I7) | +| W30 | this commit | Linux: the first window created without an activation token takes the launcher's (`XDG_ACTIVATION_TOKEN` on Wayland, `DESKTOP_STARTUP_ID` on X11) and hands it back as one given through `with_activation_token` would be (`platform_impl/linux/startup_token.rs`), so GNOME drops the busy cursor and a Wayland window opens focused; later windows don't reuse the spent token, an empty or oversized (over 1,024 bytes) token is ignored, and the variable stays in the environment (changing it while other threads may read it is unsound) | none; to be proposed | upstream release that hands the launcher's token to the first window | pdfcraft vendor patch (14); cadcraft#2030 (`tests/winit_startup_token.rs`) | Conflict resolved by hand: `wayland/seat/mod.rs` `remove_seat` keeps all three cleanups — cancel a file drag (W15), remove the seat from winit's clipboard (W15), destroy the seat's text input (W2). diff --git a/src/platform/startup_notify.rs b/src/platform/startup_notify.rs index 6fab284e..e8f4287f 100644 --- a/src/platform/startup_notify.rs +++ b/src/platform/startup_notify.rs @@ -28,10 +28,10 @@ use crate::event_loop::{ActiveEventLoop, AsyncRequestSerial}; use crate::window::{ActivationToken, Window, WindowAttributes}; /// The variable which is used mostly on X11. -const X11_VAR: &str = "DESKTOP_STARTUP_ID"; +pub(crate) const X11_VAR: &str = "DESKTOP_STARTUP_ID"; /// The variable which is used mostly on Wayland. -const WAYLAND_VAR: &str = "XDG_ACTIVATION_TOKEN"; +pub(crate) const WAYLAND_VAR: &str = "XDG_ACTIVATION_TOKEN"; pub trait EventLoopExtStartupNotify { /// Read the token from the environment. diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index 1d6262ac..a45b86ee 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -25,6 +25,7 @@ use crate::event_loop::{ use crate::icon::Icon; use crate::keyboard::Key; use crate::platform::pump_events::PumpStatus; +use crate::platform::startup_notify; #[cfg(x11_platform)] use crate::platform::x11::{WindowType as XWindowType, XlibErrorHook}; use crate::window::{ @@ -38,6 +39,7 @@ pub(crate) use crate::icon::RgbaIcon as PlatformIcon; pub(crate) use crate::platform_impl::Fullscreen; pub(crate) mod common; +mod startup_token; #[cfg(wayland_platform)] pub(crate) mod wayland; #[cfg(x11_platform)] @@ -290,16 +292,23 @@ impl Window { #[inline] pub(crate) fn new( window_target: &ActiveEventLoop, - attribs: WindowAttributes, + mut attribs: WindowAttributes, ) -> Result { + let given = attribs.platform_specific.activation_token.take(); match *window_target { #[cfg(wayland_platform)] ActiveEventLoop::Wayland(ref window_target) => { - wayland::Window::new(window_target, attribs).map(Window::Wayland) + startup_token::with_token(given, startup_notify::WAYLAND_VAR, |token| { + attribs.platform_specific.activation_token = token; + wayland::Window::new(window_target, attribs).map(Window::Wayland) + }) }, #[cfg(x11_platform)] ActiveEventLoop::X(ref window_target) => { - x11::Window::new(window_target, attribs).map(Window::X) + startup_token::with_token(given, startup_notify::X11_VAR, |token| { + attribs.platform_specific.activation_token = token; + x11::Window::new(window_target, attribs).map(Window::X) + }) }, } } diff --git a/src/platform_impl/linux/startup_token.rs b/src/platform_impl/linux/startup_token.rs new file mode 100644 index 00000000..726c9f98 --- /dev/null +++ b/src/platform_impl/linux/startup_token.rs @@ -0,0 +1,115 @@ +//! The launcher's activation token for the first window (CADCraft patch, from PdfCraft). +//! +//! A launcher with `StartupNotify=true` passes an activation token in the environment +//! (`XDG_ACTIVATION_TOKEN` on Wayland, `DESKTOP_STARTUP_ID` on X11) and shows a busy cursor +//! until a window hands it back. winit hands back only a token given through +//! `WindowAttributesExtStartupNotify::with_activation_token`, and eframe never gives one, so +//! GNOME kept the busy cursor until its 15-second timeout and the window opened without focus. +//! +//! The first window the process creates without a token now takes the one in the environment. +//! Later windows never do: the token is spent once a window has been created with it. A window +//! that fails to be created leaves it unspent, so a retry still hands it back. The variable is +//! left in the environment, unlike `reset_activation_token_env`, because changing the +//! environment while other threads may read it is unsound, and an application can start +//! threads before its first window. + +use std::sync::atomic::{AtomicBool, Ordering}; + +use crate::window::ActivationToken; + +/// Longer tokens are ignored. Launchers make tokens of a few dozen bytes; on X11 the token is +/// written to a window property and sent to the window manager, and an oversized one would +/// fail window creation. +const MAX_TOKEN_LEN: usize = 1024; + +static TAKEN: AtomicBool = AtomicBool::new(false); + +/// Creates a window with `given` if there is one, else, for the process's first window, the +/// environment's value of `var`. The launcher's token is spent only when `create` succeeds. +pub(crate) fn with_token( + given: Option, + var: &str, + create: impl FnOnce(Option) -> Result, +) -> Result { + create_with(given, &TAKEN, || std::env::var(var).ok(), create) +} + +fn create_with( + given: Option, + taken: &AtomicBool, + read: impl FnOnce() -> Option, + create: impl FnOnce(Option) -> Result, +) -> Result { + let first = !taken.load(Ordering::Relaxed); + let token = if given.is_some() || !first { + given + } else { + read().filter(|token| !token.is_empty() && token.len() <= MAX_TOKEN_LEN).map(ActivationToken::from_raw) + }; + let window = create(token)?; + // The first window spends the launcher's token, whether or not it was given one. + taken.store(true, Ordering::Relaxed); + Ok(window) +} + +#[cfg(test)] +mod tests { + use super::*; + + fn token(raw: &str) -> Option { + Some(ActivationToken::from_raw(raw.to_owned())) + } + + /// The token a successfully created window received. + fn choose(given: Option, taken: &AtomicBool, read: impl FnOnce() -> Option) -> Option { + create_with(given, taken, read, Ok::<_, ()>).ok().flatten() + } + + #[test] + fn the_first_window_takes_the_launchers_token() { + let taken = AtomicBool::new(false); + assert_eq!(choose(None, &taken, || Some("gnome-shell/PdfCraft/1234".into())), token("gnome-shell/PdfCraft/1234")); + } + + #[test] + fn a_later_window_does_not_reuse_the_spent_token() { + let taken = AtomicBool::new(false); + assert!(choose(None, &taken, || Some("t".into())).is_some()); + assert_eq!(choose(None, &taken, || Some("t".into())), None); + } + + #[test] + fn a_given_token_wins_and_still_spends_the_launchers() { + let taken = AtomicBool::new(false); + assert_eq!(choose(token("mine"), &taken, || Some("env".into())), token("mine")); + assert_eq!(choose(None, &taken, || Some("env".into())), None); + assert_eq!(choose(token("again"), &taken, || Some("env".into())), token("again")); + } + + #[test] + fn a_missing_empty_or_oversized_token_is_ignored() { + assert_eq!(choose(None, &AtomicBool::new(false), || None), None); + assert_eq!(choose(None, &AtomicBool::new(false), || Some(String::new())), None); + let long = "x".repeat(MAX_TOKEN_LEN + 1); + assert_eq!(choose(None, &AtomicBool::new(false), || Some(long)), None); + let limit = "x".repeat(MAX_TOKEN_LEN); + assert!(choose(None, &AtomicBool::new(false), || Some(limit)).is_some()); + } + + #[test] + fn a_failed_window_leaves_the_token_for_a_retry() { + let taken = AtomicBool::new(false); + let failed = create_with( + None, + &taken, + || Some("t".into()), + |received| { + assert_eq!(received, token("t")); + Err::<(), _>("no window") + }, + ); + assert_eq!(failed, Err("no window")); + assert_eq!(choose(None, &taken, || Some("t".into())), token("t")); + assert_eq!(choose(None, &taken, || Some("t".into())), None); + } +} From b452532426f26c00ef5f9104d72484b70d797623 Mon Sep 17 00:00:00 2001 From: bmh129 <11478682+bmh129@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:27:57 -0600 Subject: [PATCH 02/10] W30: test the launcher's token read from a variable that is set, then cleared The policy tests gave the token through a closure; this one reads it from a real environment variable (one no other test uses, so setting it races nothing): set, the first window takes it; cleared, it takes none. Also rustfmt startup_token.rs, which had four lines over 100 columns. Co-Authored-By: Claude Opus 5.5 --- src/platform_impl/linux/startup_token.rs | 35 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/src/platform_impl/linux/startup_token.rs b/src/platform_impl/linux/startup_token.rs index 726c9f98..031b4b7f 100644 --- a/src/platform_impl/linux/startup_token.rs +++ b/src/platform_impl/linux/startup_token.rs @@ -31,7 +31,12 @@ pub(crate) fn with_token( var: &str, create: impl FnOnce(Option) -> Result, ) -> Result { - create_with(given, &TAKEN, || std::env::var(var).ok(), create) + create_with(given, &TAKEN, from_env(var), create) +} + +/// Reads the launcher's token from the environment variable `var`. +fn from_env(var: &str) -> impl FnOnce() -> Option + '_ { + move || std::env::var(var).ok() } fn create_with( @@ -44,7 +49,9 @@ fn create_with( let token = if given.is_some() || !first { given } else { - read().filter(|token| !token.is_empty() && token.len() <= MAX_TOKEN_LEN).map(ActivationToken::from_raw) + read() + .filter(|token| !token.is_empty() && token.len() <= MAX_TOKEN_LEN) + .map(ActivationToken::from_raw) }; let window = create(token)?; // The first window spends the launcher's token, whether or not it was given one. @@ -61,14 +68,21 @@ mod tests { } /// The token a successfully created window received. - fn choose(given: Option, taken: &AtomicBool, read: impl FnOnce() -> Option) -> Option { + fn choose( + given: Option, + taken: &AtomicBool, + read: impl FnOnce() -> Option, + ) -> Option { create_with(given, taken, read, Ok::<_, ()>).ok().flatten() } #[test] fn the_first_window_takes_the_launchers_token() { let taken = AtomicBool::new(false); - assert_eq!(choose(None, &taken, || Some("gnome-shell/PdfCraft/1234".into())), token("gnome-shell/PdfCraft/1234")); + assert_eq!( + choose(None, &taken, || Some("gnome-shell/PdfCraft/1234".into())), + token("gnome-shell/PdfCraft/1234") + ); } #[test] @@ -96,6 +110,19 @@ mod tests { assert!(choose(None, &AtomicBool::new(false), || Some(limit)).is_some()); } + #[test] + fn the_token_is_read_from_the_variable_when_set_and_not_when_cleared() { + // A variable no other test reads, so setting it while tests run in parallel races nothing. + const VAR: &str = "WINIT_W30_TEST_ACTIVATION_TOKEN"; + std::env::set_var(VAR, "gnome-shell/CADCraft/42"); + assert_eq!( + choose(None, &AtomicBool::new(false), from_env(VAR)), + token("gnome-shell/CADCraft/42") + ); + std::env::remove_var(VAR); + assert_eq!(choose(None, &AtomicBool::new(false), from_env(VAR)), None); + } + #[test] fn a_failed_window_leaves_the_token_for_a_retry() { let taken = AtomicBool::new(false); From 78df1155809d1def666e0f31bd786f9b14732cf9 Mon Sep 17 00:00:00 2001 From: bmh129 <11478682+bmh129@users.noreply.github.com> Date: Sun, 1 Nov 2026 09:33:18 -0600 Subject: [PATCH 03/10] W30: give the environment test its variable through a child process b452532's test called set_var and remove_var while other test threads ran, which is the unsoundness W30 avoids by leaving the launcher's variable alone; a variable no other test reads doesn't make it sound, since any thread reading any variable races the write. The test now runs itself in a child process with the variable set, then removed, and checks the child ran its one test; this process's environment never changes. Co-Authored-By: Claude Opus 5.5 --- src/platform_impl/linux/startup_token.rs | 42 +++++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/src/platform_impl/linux/startup_token.rs b/src/platform_impl/linux/startup_token.rs index 031b4b7f..8f68c943 100644 --- a/src/platform_impl/linux/startup_token.rs +++ b/src/platform_impl/linux/startup_token.rs @@ -110,17 +110,41 @@ mod tests { assert!(choose(None, &AtomicBool::new(false), || Some(limit)).is_some()); } + /// The variable the child below reads its token from. + const VAR: &str = "WINIT_W30_TEST_ACTIVATION_TOKEN"; + /// Set only in the child: the token it must take, or empty for none. + const EXPECT: &str = "WINIT_W30_TEST_EXPECT"; + #[test] fn the_token_is_read_from_the_variable_when_set_and_not_when_cleared() { - // A variable no other test reads, so setting it while tests run in parallel races nothing. - const VAR: &str = "WINIT_W30_TEST_ACTIVATION_TOKEN"; - std::env::set_var(VAR, "gnome-shell/CADCraft/42"); - assert_eq!( - choose(None, &AtomicBool::new(false), from_env(VAR)), - token("gnome-shell/CADCraft/42") - ); - std::env::remove_var(VAR); - assert_eq!(choose(None, &AtomicBool::new(false), from_env(VAR)), None); + // The environment is given to a child process rather than changed here: `set_var` while + // other test threads run is the unsoundness this module avoids by leaving the variable. + let name = concat!(module_path!(), "::the_first_window_reads_the_variable_in_a_child"); + let name = name.split_once("::").unwrap().1; + for value in [Some("gnome-shell/CADCraft/42"), None] { + let mut child = std::process::Command::new(std::env::current_exe().unwrap()); + child.args([name, "--exact", "--test-threads=1"]).env(EXPECT, value.unwrap_or("")); + match value { + Some(value) => child.env(VAR, value), + None => child.env_remove(VAR), + }; + let out = child.output().unwrap(); + let stdout = String::from_utf8_lossy(&out.stdout); + assert!( + out.status.success(), + "{value:?}: {stdout}{}", + String::from_utf8_lossy(&out.stderr) + ); + assert!(stdout.contains("1 passed"), "{value:?}: the child ran no test: {stdout}"); + } + } + + #[test] + fn the_first_window_reads_the_variable_in_a_child() { + let Some(expect) = std::env::var_os(EXPECT) else { return }; + let expect = Some(expect.into_string().unwrap()).filter(|e| !e.is_empty()); + let received = choose(None, &AtomicBool::new(false), from_env(VAR)); + assert_eq!(received, expect.as_deref().and_then(token)); } #[test] From 924c77b494d4960cf67580a0bebc880dd1fd6e13 Mon Sep 17 00:00:00 2001 From: austin62jake <340374338+austin62jake@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:35:05 -0600 Subject: [PATCH 04/10] W36: Windows: an Alt code types its character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Holding Alt and typing a number on the number pad (Alt+0181 for µ) makes Windows send the character in WM_CHAR after Alt's key-up. The keyboard builder adds a WM_CHAR only to a pending key press, so after a release it took the character for IME text and dropped it: Alt codes typed nothing in any text field (storytold/pdfcraft#5746). When Alt's release is followed by WM_CHAR or WM_SYSCHAR, the character now goes on a press of its own, reported like a character injected with VK_PACKET: an unidentified key whose text and logical key are the character. A release follows the press at once, so the key isn't left down. A character after any other key's release is still left to the input method. Tested with a message-only window: Alt's release then the queued µ give the Alt release, then a press with text "µ" and its release; without the fix the µ gives no event. A character after Enter's release still gives none. Co-Authored-By: Claude Opus 5.5 --- src/platform_impl/windows/keyboard.rs | 155 +++++++++++++++++++++++++- 1 file changed, 154 insertions(+), 1 deletion(-) diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs index ec12056a..3e06a95d 100644 --- a/src/platform_impl/windows/keyboard.rs +++ b/src/platform_impl/windows/keyboard.rs @@ -61,7 +61,9 @@ pub struct MessageAsKeyEvent { /// the key. /// /// Key release messages are a bit different due to the fact that they don't contribute to -/// text input. The "sequence" only consists of one WM_KEYUP / WM_SYSKEYUP event. +/// text input. The "sequence" only consists of one WM_KEYUP / WM_SYSKEYUP event. The exception +/// is Alt's release ending an Alt code, which the code's WM_CHAR follows; that character is +/// reported as a press and a release of its own (`PartialKeyEventInfo::alt_code`). pub struct KeyEventBuilder { event_info: Mutex>, pending: PendingEventQueue, @@ -260,7 +262,34 @@ impl KeyEventBuilder { let key = layout.get_key(mod_no_ctrl, num_lock_on, vkey, physical_key); event_info.text = PartialText::Text(key.to_text().map(SmolStr::new)); } + let alt_code = event_info.alt_code; let ev = event_info.finalize(); + if alt_code { + // No key was pressed for the character, so none is left down: its + // release follows the press. `pending_token` is earlier and still + // incomplete, so completing the release dispatches nothing yet. + let release = KeyEvent { + state: ElementState::Released, + text: None, + platform_specific: KeyEventExtra { + text_with_all_modifiers: None, + key_without_modifiers: ev + .platform_specific + .key_without_modifiers + .clone(), + }, + ..ev.clone() + }; + let release_token = self.pending.add_pending(); + let early = self.pending.complete_pending( + release_token, + MessageAsKeyEvent { event: release, is_synthetic: false }, + ); + debug_assert!( + early.is_empty(), + "the release went out before its press" + ); + } MatchResult::MessagesToDispatch(self.pending.complete_pending( pending_token, MessageAsKeyEvent { event: ev, is_synthetic: false }, @@ -284,6 +313,16 @@ impl KeyEventBuilder { // It's important that we create the pending token before reading the next // message. let next_msg = next_kbd_msg(hwnd); + // An Alt code types its character when Alt is released: the `WM_CHAR` + // follows Alt's key-up, and with no press for the `WM_CHAR` branch to add it + // to, it was dropped as IME text. It goes on a press of its own instead + // (storytold/pdfcraft#5746). + let alt_released = matches!(event_info.vkey, VK_MENU | VK_LMENU | VK_RMENU); + if alt_released + && next_msg.is_some_and(|m| matches!(m.message, WM_CHAR | WM_SYSCHAR)) + { + *self.event_info.lock().unwrap() = Some(PartialKeyEventInfo::alt_code()); + } let mut valid_event_info = Some(event_info); if let Some(next_msg) = next_msg { let mut layouts = LAYOUT_CACHE.lock().unwrap(); @@ -457,6 +496,7 @@ impl KeyEventBuilder { location: get_location(scancode, locale_id), utf16parts: Vec::with_capacity(8), text: PartialText::Text(text.clone()), + alt_code: false, }; let mut event = event_info.finalize(); @@ -498,9 +538,32 @@ struct PartialKeyEventInfo { utf16parts: Vec, text: PartialText, + + /// The press an Alt code's character is reported on ([`Self::alt_code`]), which a release + /// follows at once. + alt_code: bool, } impl PartialKeyEventInfo { + /// The press that carries an Alt code's character. Holding Alt and typing a number on the + /// number pad (Alt+0181 for µ) makes Windows send the character in `WM_CHAR` after Alt is + /// released, with no key press of its own. It is reported like a character injected with + /// `VK_PACKET`: a press of an unidentified key, whose text and logical key are the character. + fn alt_code() -> Self { + PartialKeyEventInfo { + vkey: 0, + key_state: ElementState::Pressed, + is_repeat: false, + physical_key: PhysicalKey::Unidentified(NativeKeyCode::Unidentified), + location: KeyLocation::Standard, + logical_key: PartialLogicalKey::TextOr(Key::Unidentified(NativeKey::Unidentified)), + key_without_modifiers: Key::Unidentified(NativeKey::Unidentified), + utf16parts: Vec::with_capacity(8), + text: PartialText::System(Vec::new()), + alt_code: true, + } + } + fn from_message( wparam: WPARAM, lparam: LPARAM, @@ -590,6 +653,7 @@ impl PartialKeyEventInfo { location, utf16parts: Vec::with_capacity(8), text: PartialText::System(Vec::new()), + alt_code: false, } } @@ -1250,3 +1314,92 @@ pub(crate) fn scancode_to_physicalkey(scancode: u32) -> PhysicalKey { _ => return PhysicalKey::Unidentified(NativeKeyCode::Windows(scancode as u16)), }) } + +#[cfg(test)] +mod alt_code_tests { + use std::{mem, ptr}; + + use windows_sys::Win32::Foundation::{HWND, LPARAM, WPARAM}; + use windows_sys::Win32::UI::Input::KeyboardAndMouse::{VK_MENU, VK_RETURN}; + use windows_sys::Win32::UI::WindowsAndMessaging::{ + CreateWindowExW, DestroyWindow, PeekMessageW, PostMessageW, HWND_MESSAGE, MSG, PM_REMOVE, + WM_CHAR, WM_KEYUP, + }; + + use super::{KeyEventBuilder, MessageAsKeyEvent}; + use crate::event::ElementState; + use crate::keyboard::{Key, NamedKey}; + use crate::platform_impl::platform::event_loop::ProcResult; + use crate::platform_impl::platform::util; + + /// The lParam of a key's release: repeat count 1, the key's scan code, previous state down, + /// transition up. + fn released(scancode: u32) -> LPARAM { + (1 | scancode << 16 | 1 << 30 | 1 << 31) as LPARAM + } + + /// A key release, then the `WM_CHAR` Windows queues after it, through one builder: the events + /// for the release and for the character. + fn release_then_char( + vkey: u16, + scancode: u32, + ch: char, + ) -> (Vec, Vec) { + let class: Vec = "STATIC\0".encode_utf16().collect(); + let window: HWND = unsafe { + CreateWindowExW( + 0, + class.as_ptr(), + ptr::null(), + 0, + 0, + 0, + 0, + 0, + HWND_MESSAGE, + 0, + util::get_instance_handle(), + ptr::null(), + ) + }; + assert_ne!(window, 0); + let lparam = released(scancode); + assert_ne!(unsafe { PostMessageW(window, WM_CHAR, ch as WPARAM, lparam) }, 0); + let builder = KeyEventBuilder::default(); + let mut result = ProcResult::DefWindowProc(0); + let release = + builder.process_message(window, WM_KEYUP, vkey as WPARAM, lparam, &mut result); + let mut msg: MSG = unsafe { mem::zeroed() }; + assert_ne!(unsafe { PeekMessageW(&mut msg, window, WM_CHAR, WM_CHAR, PM_REMOVE) }, 0); + let typed = + builder.process_message(window, msg.message, msg.wParam, msg.lParam, &mut result); + unsafe { DestroyWindow(window) }; + (release, typed) + } + + #[test] + fn an_alt_code_types_its_character() { + // Alt+0181: Windows sends µ after Alt's release (storytold/pdfcraft#5746). + let (release, typed) = release_then_char(VK_MENU, 0x38, 'µ'); + let [alt] = release.as_slice() else { + panic!("{} events for Alt's release", release.len()) + }; + assert_eq!(alt.event.logical_key, Key::Named(NamedKey::Alt)); + assert_eq!(alt.event.state, ElementState::Released); + let [press, up] = typed.as_slice() else { panic!("{} events for µ", typed.len()) }; + assert_eq!(press.event.state, ElementState::Pressed); + assert_eq!(press.event.text.as_deref(), Some("µ")); + assert_eq!(press.event.logical_key, Key::Character("µ".into())); + assert_eq!(up.event.state, ElementState::Released); + assert_eq!(up.event.text, None); + assert_eq!(up.event.physical_key, press.event.physical_key); + } + + #[test] + fn a_character_after_another_release_is_still_left_to_the_ime() { + // Only Alt's release ends an Alt code; a character queued after any other release is + // input method text, which reaches the app as `Ime` events. + let (_, typed) = release_then_char(VK_RETURN, 0x1c, 'x'); + assert!(typed.is_empty(), "{} events for x", typed.len()); + } +} From f502d3b1d9ebc13c20e4795781d6f47b6957751e Mon Sep 17 00:00:00 2001 From: austin62jake <340374338+austin62jake@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:35:18 -0600 Subject: [PATCH 05/10] W36: PATCHES.md row with its commit and pdfcraft#5746 Co-Authored-By: Claude Opus 5.5 --- PATCHES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/PATCHES.md b/PATCHES.md index c100c83d..f94544c1 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -34,6 +34,7 @@ input lives in `craft-tablet`). | W25 | `eb4007da` | X11/Wayland: `platform::latin_layout::KeyEventExtLatinLayout`, the key on the first Latin layout group for shortcuts on non-Latin layouts | none; to be proposed | upstream release with an equivalent | storytold/winit PR #5; craft-libs#198 (K2) | | W26 | `2b9cd1cf` | macOS: replaced text is deleted by UTF-8 byte count with the commit (`WindowExtMacOS::take_ime_delete_surrounding`, same shape as W27) | master: `Ime::DeleteSurrounding` (a new `Ime` variant breaks 0.30 matchers) | the egui → 0.31 move | storytold/winit PR #6 (`d103edae`) | | W27 | `f40c76a2` | Wayland: text-input-v3 surrounding text (`WindowExtWayland::set_ime_surrounding_text`, `set_ime_surrounding_text_with_change_cause`, `clear_ime_surrounding_text`), delete-surrounding attached to the commit (`take_ime_delete_surrounding` → `ImeDeleteSurrounding { before_bytes, after_bytes }`), per-seat preedit ownership and outgoing state waiting for a matching `done` (E21b) | master has both as core API (`Ime::DeleteSurrounding`) | the egui → 0.31 move | storytold/winit PR #7; craft-libs#198 (I7) | +| W36 | `924c77b4` | Windows: an Alt code (Alt+0181 for µ) types its character; Windows sends it in `WM_CHAR` after Alt's key-up, which the keyboard builder dropped as IME text. It goes on a press of an unidentified key (as `VK_PACKET` is reported) with a release after it | none found; to be proposed | upstream release with an equivalent | pdfcraft#5746 | Conflict resolved by hand: `wayland/seat/mod.rs` `remove_seat` keeps all three cleanups — cancel a file drag (W15), remove the seat from winit's clipboard (W15), destroy the seat's text input (W2). From 29ab80ea624f127390f8edb4771becd0bb478283 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 22 Nov 2026 23:25:43 -0800 Subject: [PATCH 06/10] CI: fix the typos, lockfile and cargo-deny failures on craft/0.30.13 - typos.toml ignores the commit SHA 6a87addd, which typos reads as the word "addd" in PATCHES.md and docs/egui-037-migration-plan.md. - The "Generate lockfile" step pins syn as syn@2, since syn 2 and syn 3 are now both locked, and pins serde 1.0.228, foreign-types-macros 0.2.3 and tracing-web 0.1.3, whose newer releases need syn 3 or a newer wasm-bindgen. On the 1.70.0 jobs the step resolves with CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=fallback, so the lockfile only holds versions whose rust-version allows 1.70.0, and the wasm-bindgen crates move back to 0.2.105. - deny.toml skips the second versions of syn, thiserror, thiserror-impl, jni-sys and redox_syscall, and allows android-activity 0.6.1's import-games-sdk.sh by checksum. --- .github/workflows/ci.yml | 12 ++++++++++-- deny.toml | 6 ++++++ typos.toml | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa80f409..232737e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,6 +107,10 @@ jobs: - name: Generate lockfile # Also updates the crates.io index + env: + # This step runs with the runner's cargo, before the matrix toolchain is installed. + # On the 1.70.0 jobs, it picks dependency versions whose `rust-version` allows 1.70.0. + CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: ${{ matrix.toolchain == '1.70.0' && 'fallback' || 'allow' }} run: | cargo generate-lockfile cargo update -p ahash --precise 0.8.7 @@ -115,9 +119,13 @@ jobs: cargo update -p objc2-encode --precise 4.0.3 cargo update -p orbclient --precise 0.3.47 cargo update -p image --precise 0.25.0 - cargo update -p gethostname@1.1.0 --precise 1.0.2 + cargo update -p gethostname@1 --precise 1.0.2 cargo update -p unicode-ident --precise 1.0.10 - cargo update -p syn --precise 2.0.114 + cargo update -p serde --precise 1.0.228 + cargo update -p foreign-types-macros --precise 0.2.3 + cargo update -p tracing-web --precise 0.1.3 + cargo update -p wasm-bindgen -p wasm-bindgen-futures -p js-sys -p web-sys + cargo update -p syn@2 --precise 2.0.114 - name: Install GCC Multilib if: (matrix.platform.os == 'ubuntu-latest') && contains(matrix.platform.target, 'i686') diff --git a/deny.toml b/deny.toml index 735c336f..7424e538 100644 --- a/deny.toml +++ b/deny.toml @@ -42,6 +42,11 @@ skip = [ { crate = "bitflags@1", reason = "the ecosystem is in the process of migrating" }, { crate = "rustix@0.38", reason = "the ecosystem is in the process of migrating" }, { crate = "linux-raw-sys@0.4", reason = "the ecosystem is in the process of migrating" }, + { crate = "syn@2", reason = "the ecosystem is in the process of migrating" }, + { crate = "thiserror@1", reason = "the ecosystem is in the process of migrating" }, + { crate = "thiserror-impl@1", reason = "the ecosystem is in the process of migrating" }, + { crate = "jni-sys@0.3", reason = "jni-sys 0.3.1 depends on jni-sys 0.4" }, + { crate = "redox_syscall@0.4", reason = "winit and orbclient depend on different versions" }, ] wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed @@ -52,6 +57,7 @@ interpreted = "deny" [[bans.build.bypass]] allow = [ { path = "generate-bindings.sh", checksum = "268ec23248218d779e33853cdc60e2985e70214ff004716cd734270de1f6b561" }, + { path = "android-games-sdk/import-games-sdk.sh", checksum = "98ed2741804d10ddbd8d035557897ab1edc5257705759377271dcb4ba5636446" }, ] crate = "android-activity" diff --git a/typos.toml b/typos.toml index 0dea884d..39131e8e 100644 --- a/typos.toml +++ b/typos.toml @@ -1,5 +1,10 @@ # documentation: https://github.com/crate-ci/typos/blob/master/docs/reference.md +[default] +extend-ignore-re = [ + "6a87addd", # A commit SHA in PATCHES.md and docs/egui-037-migration-plan.md +] + [default.extend-identifiers] ptd = "ptd" # From windows_sys::Win32::System::Com::FORMATETC { ptd, ..} TME_LEAVE = "TME_LEAVE" # From windows_sys::Win32::UI::Input::KeyboardAndMouse::TME_LEAVE From ecba8dd5c6f71ddbeff0fd57a6775e075bfd29b8 Mon Sep 17 00:00:00 2001 From: David Mann Date: Fri, 27 Nov 2026 14:04:34 +0100 Subject: [PATCH 07/10] W36: test an Alt code whose Alt release arrives as WM_SYSKEYUP The release branch handles WM_KEYUP and WM_SYSKEYUP alike; the test now pins both. Co-Authored-By: Claude Opus 5.5 --- src/platform_impl/windows/keyboard.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs index 3e06a95d..e695ea2d 100644 --- a/src/platform_impl/windows/keyboard.rs +++ b/src/platform_impl/windows/keyboard.rs @@ -1323,7 +1323,7 @@ mod alt_code_tests { use windows_sys::Win32::UI::Input::KeyboardAndMouse::{VK_MENU, VK_RETURN}; use windows_sys::Win32::UI::WindowsAndMessaging::{ CreateWindowExW, DestroyWindow, PeekMessageW, PostMessageW, HWND_MESSAGE, MSG, PM_REMOVE, - WM_CHAR, WM_KEYUP, + WM_CHAR, WM_KEYUP, WM_SYSKEYUP, }; use super::{KeyEventBuilder, MessageAsKeyEvent}; @@ -1338,9 +1338,10 @@ mod alt_code_tests { (1 | scancode << 16 | 1 << 30 | 1 << 31) as LPARAM } - /// A key release, then the `WM_CHAR` Windows queues after it, through one builder: the events - /// for the release and for the character. + /// A key release (`WM_KEYUP` or `WM_SYSKEYUP`), then the `WM_CHAR` Windows queues after it, + /// through one builder: the events for the release and for the character. fn release_then_char( + up_msg: u32, vkey: u16, scancode: u32, ch: char, @@ -1367,8 +1368,7 @@ mod alt_code_tests { assert_ne!(unsafe { PostMessageW(window, WM_CHAR, ch as WPARAM, lparam) }, 0); let builder = KeyEventBuilder::default(); let mut result = ProcResult::DefWindowProc(0); - let release = - builder.process_message(window, WM_KEYUP, vkey as WPARAM, lparam, &mut result); + let release = builder.process_message(window, up_msg, vkey as WPARAM, lparam, &mut result); let mut msg: MSG = unsafe { mem::zeroed() }; assert_ne!(unsafe { PeekMessageW(&mut msg, window, WM_CHAR, WM_CHAR, PM_REMOVE) }, 0); let typed = @@ -1380,7 +1380,17 @@ mod alt_code_tests { #[test] fn an_alt_code_types_its_character() { // Alt+0181: Windows sends µ after Alt's release (storytold/pdfcraft#5746). - let (release, typed) = release_then_char(VK_MENU, 0x38, 'µ'); + assert_alt_code_types(WM_KEYUP); + } + + #[test] + fn an_alt_code_types_its_character_after_a_syskeyup() { + // Alt's release can also arrive as `WM_SYSKEYUP`; the builder treats both the same. + assert_alt_code_types(WM_SYSKEYUP); + } + + fn assert_alt_code_types(up_msg: u32) { + let (release, typed) = release_then_char(up_msg, VK_MENU, 0x38, 'µ'); let [alt] = release.as_slice() else { panic!("{} events for Alt's release", release.len()) }; @@ -1399,7 +1409,7 @@ mod alt_code_tests { fn a_character_after_another_release_is_still_left_to_the_ime() { // Only Alt's release ends an Alt code; a character queued after any other release is // input method text, which reaches the app as `Ime` events. - let (_, typed) = release_then_char(VK_RETURN, 0x1c, 'x'); + let (_, typed) = release_then_char(WM_KEYUP, VK_RETURN, 0x1c, 'x'); assert!(typed.is_empty(), "{} events for x", typed.len()); } } From 4e6436c5f3b6e8b11ff153a9fca7d12edc86335a Mon Sep 17 00:00:00 2001 From: David Mann Date: Fri, 27 Nov 2026 14:08:19 +0100 Subject: [PATCH 08/10] W36: rustfmt (nightly) on the Alt-code release Co-Authored-By: Claude Opus 5.5 --- src/platform_impl/windows/keyboard.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/platform_impl/windows/keyboard.rs b/src/platform_impl/windows/keyboard.rs index e695ea2d..9b81f594 100644 --- a/src/platform_impl/windows/keyboard.rs +++ b/src/platform_impl/windows/keyboard.rs @@ -281,10 +281,11 @@ impl KeyEventBuilder { ..ev.clone() }; let release_token = self.pending.add_pending(); - let early = self.pending.complete_pending( - release_token, - MessageAsKeyEvent { event: release, is_synthetic: false }, - ); + let early = + self.pending.complete_pending(release_token, MessageAsKeyEvent { + event: release, + is_synthetic: false, + }); debug_assert!( early.is_empty(), "the release went out before its press" From 3698a67bb7cce3eb8d26a62c4c208499ab5b1d3d Mon Sep 17 00:00:00 2001 From: David Mann Date: Fri, 27 Nov 2026 14:27:56 +0100 Subject: [PATCH 09/10] CI: fix the doc, 1.70.0 and Windows test failures on craft/0.30.13 With the lockfile step fixed, CI reaches steps that were never green on this branch: - rustdoc -D warnings: escape `*` inside (invalid_html_tags) and wrap a bare URL in dark_mode.rs (nightly's bare_urls). - docs.rs check (nightly, every platform): platform::wayland is built under docsrs on all platforms, but its clipboard API names platform_impl::wayland, which only exists with wayland_platform. The clipboard items are now gated on wayland_platform. - Rust 1.70.0 on Windows: update_system_caret is pub but takes the pub(crate) CaretChange (E0446); it is pub(crate) now. - ime_patches/pointer_patches read sources with CRLF on a Windows checkout (* text=auto) and missed patterns that span lines; source() normalizes to LF. Co-Authored-By: Claude Opus 5.5 --- src/keyboard.rs | 6 +++--- src/platform/wayland.rs | 7 +++++++ src/platform_impl/windows/dark_mode.rs | 2 +- src/platform_impl/windows/ime.rs | 2 +- tests/ime_patches.rs | 6 +++++- tests/pointer_patches.rs | 6 +++++- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/keyboard.rs b/src/keyboard.rs index 7b406f08..5406b3b3 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -548,10 +548,10 @@ pub enum KeyCode { NumpadMemoryStore, /// M Subtract current entry from the value stored in memory. NumpadMemorySubtract, - /// * on a keyboard. For use with numpads that provide mathematical - /// operations (+, - * and /). + /// \* on a keyboard. For use with numpads that provide mathematical + /// operations (+, - \* and /). /// - /// Use `NumpadStar` for the * key on phones and remote controls. + /// Use `NumpadStar` for the \* key on phones and remote controls. NumpadMultiply, /// ( Found on the Microsoft Natural Keyboard. NumpadParenLeft, diff --git a/src/platform/wayland.rs b/src/platform/wayland.rs index 5e3fc81a..0b54d97f 100644 --- a/src/platform/wayland.rs +++ b/src/platform/wayland.rs @@ -25,6 +25,8 @@ use crate::window::{Window, WindowAttributes, WindowId}; pub use crate::window::Theme; +// The clipboard needs the Wayland backend, which docs built for other platforms (`docsrs`) lack. +#[cfg(wayland_platform)] pub use crate::platform_impl::wayland::clipboard::{ ClipboardContent, ClipboardError, ImageClaimReservation, InputOriginToken, PngBytes, PngBytesWriter, RegularTransferHandle, SelectionClaim, TransferHandle, TransferOptions, @@ -37,6 +39,7 @@ pub trait ActiveEventLoopExtWayland { fn is_wayland(&self) -> bool; /// The clipboard of this event loop, or [`None`] if it doesn't use Wayland. + #[cfg(wayland_platform)] fn clipboard(&self) -> Option; } @@ -46,6 +49,7 @@ impl ActiveEventLoopExtWayland for ActiveEventLoop { self.p.is_wayland() } + #[cfg(wayland_platform)] fn clipboard(&self) -> Option { #[allow(clippy::single_match)] match &self.p { @@ -81,11 +85,13 @@ impl ActiveEventLoopExtWayland for ActiveEventLoop { /// `input_origin` and `reserve_image_claim` are synchronous state transitions used at that same /// input/output boundary. This is a caller contract; the type does not inspect which thread is /// currently calling it. +#[cfg(wayland_platform)] #[derive(Clone)] pub struct Clipboard { state: Weak, } +#[cfg(wayland_platform)] impl Clipboard { /// The clipboard of the winit event loop connected through `display`, a `wl_display` /// pointer such as the one in its `WaylandDisplayHandle`, if that event loop still exists. @@ -281,6 +287,7 @@ impl Clipboard { } } +#[cfg(wayland_platform)] impl fmt::Debug for Clipboard { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Clipboard").finish_non_exhaustive() diff --git a/src/platform_impl/windows/dark_mode.rs b/src/platform_impl/windows/dark_mode.rs index e1590d2a..a499365f 100644 --- a/src/platform_impl/windows/dark_mode.rs +++ b/src/platform_impl/windows/dark_mode.rs @@ -1,5 +1,5 @@ /// This is a simple implementation of support for Windows Dark Mode, -/// which is inspired by the solution in https://github.com/ysc3839/win32-darkmode +/// which is inspired by the solution in use std::{ffi::c_void, ptr}; use crate::utils::Lazy; diff --git a/src/platform_impl/windows/ime.rs b/src/platform_impl/windows/ime.rs index 24131d9a..af1d2168 100644 --- a/src/platform_impl/windows/ime.rs +++ b/src/platform_impl/windows/ime.rs @@ -182,7 +182,7 @@ impl ImeContext { /// Applies a change to the hidden system caret that follows the IME cursor area /// (`ime_caret.rs`). Runs on the window's thread, which owns the caret. - pub unsafe fn update_system_caret(hwnd: HWND, change: Option) { + pub(crate) unsafe fn update_system_caret(hwnd: HWND, change: Option) { match change { None => {}, // A new caret is hidden, and this one is never shown. diff --git a/tests/ime_patches.rs b/tests/ime_patches.rs index 59aee99b..532fd279 100644 --- a/tests/ime_patches.rs +++ b/tests/ime_patches.rs @@ -6,9 +6,13 @@ use std::path::Path; +/// The source with `\n` line endings: a Windows checkout has `\r\n` (`* text=auto`), and some +/// tests match code that spans lines. fn source(path: &str) -> String { let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("src/platform_impl").join(path); - std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("{}: {err}", path.display())) + std::fs::read_to_string(&path) + .unwrap_or_else(|err| panic!("{}: {err}", path.display())) + .replace("\r\n", "\n") } /// The text after `start`, up to the first `end`. diff --git a/tests/pointer_patches.rs b/tests/pointer_patches.rs index 64648e98..953d4fde 100644 --- a/tests/pointer_patches.rs +++ b/tests/pointer_patches.rs @@ -6,9 +6,13 @@ use std::path::Path; +/// The source with `\n` line endings: a Windows checkout has `\r\n` (`* text=auto`), and some +/// tests match code that spans lines. fn source(path: &str) -> String { let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("src/platform_impl").join(path); - std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("{}: {err}", path.display())) + std::fs::read_to_string(&path) + .unwrap_or_else(|err| panic!("{}: {err}", path.display())) + .replace("\r\n", "\n") } /// The text after `start`, up to the first `end`. From 7ee49d8c026f4bb7a48801570df54c329bd8cdcb Mon Sep 17 00:00:00 2001 From: David Mann Date: Fri, 27 Nov 2026 14:39:02 +0100 Subject: [PATCH 10/10] CI: fix the Windows 32bit GNU, web clippy and example failures - Windows 32bit GNU (stable, nightly): Rust 1.100 no longer ships host tools for i686-pc-windows-gnu, so the toolchain can't be installed (upstream dropped the job in rust-windowing/winit 6853ca5e). Only stable and nightly are excluded; 1.70.0 still covers the target. - web clippy (stable): code generated by #[wasm_bindgen] in newer wasm-bindgen releases uses const features stable since 1.77, which clippy::incompatible_msrv reports against the 1.70 MSRV. Allowed on the web module; the MSRV build locks an older wasm-bindgen. - Android, iOS, Redox: clipboard_native_probe was gated on all(unix, not(macos), feature = "wayland"), which those targets match. It uses the wayland_platform alias now. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 7 +++++++ examples/clipboard_native_probe.rs | 6 +++--- src/platform_impl/mod.rs | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 232737e8..bc13cae1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,13 @@ jobs: - { name: 'iOS Aarch64', target: aarch64-apple-ios, os: macos-latest, } - { name: 'web', target: wasm32-unknown-unknown, os: ubuntu-latest, } exclude: + # Rust 1.100 no longer ships host tools for i686-pc-windows-gnu, so the + # stable-i686-pc-windows-gnu and nightly toolchains can't be installed. 1.70.0 still + # covers the target. + - toolchain: stable + platform: { name: 'Windows 32bit GNU' } + - toolchain: nightly + platform: { name: 'Windows 32bit GNU' } # Android is tested on stable-3 - toolchain: '1.70.0' platform: { name: 'Android', target: aarch64-linux-android, os: ubuntu-latest, options: '--package=winit --features=android-native-activity', cmd: 'apk --' } diff --git a/examples/clipboard_native_probe.rs b/examples/clipboard_native_probe.rs index 0872b914..d932a6a2 100644 --- a/examples/clipboard_native_probe.rs +++ b/examples/clipboard_native_probe.rs @@ -1,5 +1,5 @@ //! Opt-in native protocol probe; driven by a private compositor, never a user's clipboard. -#[cfg(all(unix, not(target_os = "macos"), feature = "wayland"))] +#[cfg(wayland_platform)] mod probe { use std::sync::Arc; use std::time::{Duration, Instant}; @@ -212,10 +212,10 @@ mod probe { event_loop.run_app(&mut app).expect("native probe event loop"); } } -#[cfg(all(unix, not(target_os = "macos"), feature = "wayland"))] +#[cfg(wayland_platform)] #[path = "util/fill.rs"] mod fill; fn main() { - #[cfg(all(unix, not(target_os = "macos"), feature = "wayland"))] + #[cfg(wayland_platform)] probe::run(); } diff --git a/src/platform_impl/mod.rs b/src/platform_impl/mod.rs index 3bfce688..c27bf996 100644 --- a/src/platform_impl/mod.rs +++ b/src/platform_impl/mod.rs @@ -12,6 +12,10 @@ mod macos; #[cfg(orbital_platform)] mod orbital; #[cfg(web_platform)] +// The code `#[wasm_bindgen]` generates in newer wasm-bindgen releases uses `const` features +// stable since Rust 1.77, which clippy reports against the 1.70 MSRV. The MSRV build locks an +// older wasm-bindgen. +#[allow(clippy::incompatible_msrv)] mod web; #[cfg(windows_platform)] mod windows;