Commit Graph
3522 Commits
Author SHA1 Message Date
dotCooCoo 88f67ff88d Merge craft/0.30.13 into fix/windows-tool-window 2026-11-28 02:02:44 -08:00
FredApps f8b490f135 Merge pull request #48 from davidmann4/fix/windows-alt-codes-w36
W36: Windows: an Alt code types its character (#27, merged with craft/0.30.13)
2026-11-27 15:28:54 +01:00
FredApps c917215350 Merge branch 'craft/0.30.13' into fix/windows-alt-codes-w36 2026-11-27 21:16:09 +07:00
FredApps b6164bed70 Merge pull request #49 from davidmann4/ci/fix-craft-0.30.13
CI: make craft/0.30.13 pass again (#44 plus the doc, 1.70.0 and Windows test fixes)
2026-11-27 15:10:06 +01:00
David Mann 7fd7f17d87 Merge remote-tracking branch 'fork/ci/fix-craft-0.30.13' into fix/windows-alt-codes-rebased 2026-11-27 14:46:31 +01:00
David MannandClaude Opus 5.5 7ee49d8c02 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 <noreply@anthropic.com>
2026-11-27 14:39:02 +01:00
David MannandClaude Opus 5.5 3698a67bb7 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 <kbd> (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 <noreply@anthropic.com>
2026-11-27 14:27:56 +01:00
David Mann 8de1bfe581 Merge remote-tracking branch 'origin/craft/0.30.13' into ci/fix-craft-0.30.13 2026-11-27 14:20:06 +01:00
David MannandClaude Opus 5.5 4e6436c5f3 W36: rustfmt (nightly) on the Alt-code release
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:08:19 +01:00
David MannandClaude Opus 5.5 ecba8dd5c6 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 <noreply@anthropic.com>
2026-11-27 14:04:34 +01:00
David Mann bd5969e945 Merge remote-tracking branch 'origin/craft/0.30.13' into fix/windows-alt-codes-rebased
# Conflicts:
#	PATCHES.md
2026-11-27 14:03:00 +01:00
FredApps 4c3713dbf5 Merge pull request #14 from bmh129/linux/startup-activation-token
W30: Linux: hand the launcher's activation token back from the first window
2026-11-26 13:27:20 +01:00
FredApps 690019f025 Merge branch 'craft/0.30.13' into linux/startup-activation-token 2026-11-26 13:16:57 +01:00
dotCooCoo 29ab80ea62 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.
2026-11-22 23:25:43 -08:00
dotCooCoo 2aa8330c41 Windows: add an optional tool-window creation attribute 2026-11-17 08:40:03 -08:00
austin62jakeandClaude Opus 5.5 f502d3b1d9 W36: PATCHES.md row with its commit and pdfcraft#5746
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 23:35:18 -06:00
austin62jakeandClaude Opus 5.5 924c77b494 W36: Windows: an Alt code types its character
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 <noreply@anthropic.com>
2026-11-02 23:35:05 -06:00
bmh129andClaude Opus 5.5 78df115580 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 <noreply@anthropic.com>
2026-11-01 09:33:18 -06:00
bmh129andClaude Opus 5.5 b452532426 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 <noreply@anthropic.com>
2026-11-01 09:27:57 -06:00
bmh129andClaude Opus 5.5 61c97492ef 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 <noreply@anthropic.com>
2026-10-26 17:00:22 -05:00
skylar taylor-barrick ad81a32589 Merge pull request #9 from storytold/migration/egui-037-20261024
Preserve IME and clipboard behavior for the egui 0.37 migration
2026-10-25 13:12:12 -06:00
skylartaylor a517b3846e Preserve input order across requested IME resets 2026-10-24 13:32:33 +02:00
skylartaylor ae48c756a3 Integrate bounded Wayland clipboard and IME lifecycle repairs 2026-10-24 05:07:08 +02:00
aiongg 5b708e919e W19: PATCHES.md records the Windows IME test it needs 2026-10-23 05:29:15 +00:00
aiongg 545f01f8a4 W22: PATCHES.md says macOS apps must take the IME deletion 2026-10-23 05:29:15 +00:00
aiongg e63d567116 W24: Wayland reset_ime docs say input methods may commit on focus-out 2026-10-23 05:29:11 +00:00
aiongg e592e35d80 W27: Wayland set_ime_surrounding_text sends nothing when unchanged
Each commit makes the compositor send done, and input-method-v2 compositors ignore input-method commits against an older serial, so an app calling it every frame could lose typed text.
2026-10-23 05:29:11 +00:00
aiongg 063cfe9e54 W22: macOS insertText leaves the IME document alone when it drops the text
The replacement range is applied only in the arms that deliver the text, so text dropped while IME isn't allowed doesn't remove text from ImeDocument that the app still shows.
2026-10-23 05:29:11 +00:00
aiongg 953f5e9b97 W24: Windows reset_ime drops the preedit without committing
The window procedure leaves Preedit before CPS_CANCEL, so WM_IME_ENDCOMPOSITION doesn't read GCS_RESULTSTR and commit it, and sends the empty preedit itself, as X11, Wayland and macOS do.
2026-10-23 05:29:03 +00:00
aiongg 8b35388bd7 PATCHES.md: W17–W27, the language-support patches 2026-10-21 18:08:18 +00:00
aionggandDorotaC f40c76a238 W27: Wayland: IME surrounding text and delete-surrounding
Input methods that correct the text around the cursor, such as
Vietnamese engines and predictive keyboards, need the field's text
(text-input-v3 `set_surrounding_text`) and a way to delete part of it
(`delete_surrounding_text`). winit master added both with new core types
and an `Ime::DeleteSurrounding` event; winit 0.30's `Ime` enum is
exhaustive, so they come here as a Wayland extension instead:

- `WindowExtWayland::set_ime_surrounding_text(text, cursor, anchor)`
  clamps the byte offsets to character boundaries and cuts text over the
  protocol's 4000 bytes around the cursor and selection. Enabling a text
  input sends it again with the purpose and cursor area, which enabling
  resets; disallowing IME forgets it.
- A deletion goes out with the `Ime::Commit` of the same input method
  update, an empty one if the update has no commit.
  `WindowExtWayland::take_ime_delete_surrounding` returns it while that
  commit is handled, so the application deletes after removing the
  preedit and before inserting the text, in text-input-v3's order.

Co-authored-by: DorotaC <43449960+dcz-self@users.noreply.github.com>
2026-10-21 18:07:40 +00:00
aiongg 2b9cd1cf47 W26: macOS: delete replaced text by byte count with the commit
Replacement ranges were honoured by sending one Backspace per replaced
character. Toolkits delete a whole grapheme cluster per Backspace, so
replacing text after a combining accent, a flag or a ZWJ emoji deleted
text before the replaced range.

The deletion now goes with an Ime::Commit, as on Wayland:
WindowExtMacOS::take_ime_delete_surrounding returns it, in UTF-8 bytes,
while the app handles that commit. A replacement before a preedit, such
as press-and-hold marking the letter it accents, gets an empty commit.
2026-10-21 18:07:40 +00:00
aiongg eb4007da9e W25: X11/Wayland: report the Latin-layout key of keys on non-Latin layouts
Shortcuts such as Ctrl+C are defined by Latin letters, so on a Russian,
Greek, Arabic, Hebrew or Thai layout a toolkit can't match them from the
characters the keys type. GTK and Qt fall back to the first Latin layout
group for this.

The `KeyEventExtLatinLayout` extension reports, for a key event, what the
key types on the keymap's first Latin layout when the active layout isn't
Latin, letter or not, and whether the active layout is Latin. A toolkit
can then tell a key without a Latin letter (Dvorak's ' on the key that
types й on Russian) from a user without a Latin layout. A layout is Latin
when most of its 26 letter keys type Latin letters, so Dvorak and AZERTY
count as Latin and keep their own letters.
2026-10-21 18:07:40 +00:00
aiongg 4b5bc5a03a W24: Add Window::reset_ime (X11, Wayland, Windows, macOS)
Toolkits need to drop the composition when the text cursor moves to
another field or the user clicks elsewhere in the text, without turning
IME off and on: otherwise the input method continues the composition in
the next field. `reset_ime` discards the composition without committing
it and sends an empty preedit if one was shown.

- X11: resets the window's input context with `XmbResetIC`. IME requests
  are also handled before each X event, so a reset or allow request made
  when focus moved reaches the input method before the next key does.
- Wayland: disables and enables text input in two commits, so the
  compositor deactivates and reactivates the input method, then sends
  the purpose and cursor area again.
- Windows: while a composition is in progress, cancels it with
  `ImmNotifyIME(NI_COMPOSITIONSTR, CPS_CANCEL)`. The IME ends the
  composition with its usual messages; the result string stays empty.
- macOS: the input context discards its marked text, and an empty
  preedit is sent if the input method didn't send one.
- iOS, Android, Web and Orbital ignore it.
2026-10-21 18:07:40 +00:00
aiongg c8cd8aa149 W23: macOS: name keys pressed with ⌘ by the layout's ⌘ table
A key pressed with ⌘ was named by charactersIgnoringModifiers, which
ignores the layout's table for ⌘. On "Dvorak – QWERTY ⌘" the layout
types Dvorak letters but QWERTY ones with ⌘, so ⌘V was reported as ⌘K
and opened PdfCraft's command palette (storytold/pdfcraft#3655). With ⌘
held, the logical key is now UCKeyTranslate's character with cmdKey
(and shiftKey when Shift is held), falling back to the old rule when
the table has no character.

KeyEventExtMacOS::key_with_command reports the ⌘ table's character for
every key event, as key_without_modifiers does for the base table, so
shortcut matching and labels can use it without ⌘ held.
2026-10-21 18:07:40 +00:00
aionggandJeremiah S 0816871e62 W22: macOS: replacement ranges, text typed without a composition, teardown
The view reports a caret to input methods: after the text inserted
since the caret last moved for another reason (a command key, a click,
a shortcut, IME toggled), with marked text after it (ImeDocument).
Dictation, which inserted nothing while selectedRange was NSNotFound
(rust-windowing/winit#4666), now has a place to insert. Replacement
ranges that reach the caret are honoured (#3617): the replaced text is
deleted with Backspace presses before the new preedit or commit, which
toolkits already handle. Press-and-hold then replaces the letter with
the accent picked instead of typing it after the letter. Reporting a
caret also makes held letters in text input open the accent menu
instead of repeating, as in other Mac apps; the repeats the input
method takes for the menu aren't typed.

Text an input method types without a composition during a key press is
committed when it isn't the key's own text, and the key's text isn't
sent: Chinese punctuation (,for ,) and the ideographic space arrived
as the key's ASCII character.

An input method calling the view while its window is torn down no
longer panics inside an Objective-C callback, which aborted: the
firstRectForCharacterRange guard is master's d6f7a28 (#4333), and
queued events and the input context are checked the same way.

Co-authored-by: Jeremiah S <46010924+HXavS@users.noreply.github.com>
2026-10-21 18:07:40 +00:00
aiongg 23bb19a7a9 W21: X11: send the IME spot once the input method is quiet
Setting the IME spot is a synchronous XIM request, and it went out after
the next X event, often one carrying an input method's reply to a key.
Xlib handles the keys an input method forwards back while it waits for
the request's reply: it puts them back on the event queue in reverse
order and marks only the last one as forwarded, so the others are
filtered again. The input method gets its own keys back as new key
presses, and the app gets them after the text committed with them.
Vietnamese engines in fcitx5 that fix a word by forwarding BackSpaces and
committing the new tail garble the text this way
(rust-windowing/winit#4777, storytold/wordcraft#2932).

Input methods only send keys back in answer to keys the client gave
them. The latest spot for each window is now queued and sent once no X
event is queued and no event has gone to the input method for 100 ms;
the event loop wakes up to send it.
2026-10-21 18:07:40 +00:00
aiongg 019c95f115 W20: X11: keep one input context per window
Disallowing IME destroyed the window's input context and allowing it
created a new one. Input methods keep their per-context state only while
the context lives, so each focus change between text fields reset it:
Vietnamese Telex turned off, and the new context stayed unfocused until
the window lost and regained the focus.

The window now keeps the context it was created with, in the preedit
style. Allowing IME focuses it; disallowing it resets the composition and
unfocuses it, and keys are no longer filtered through it.
2026-10-21 18:07:40 +00:00
aiongg fa2e1b3d76 W19: Windows: don't send keys the IME takes as key presses
While an IME uses a key, WM_KEYDOWN carries VK_PROCESSKEY. winit sent
it as a Process key press with the key's physical code, and apps that
fall back to the physical key (egui-winit does) took it as a press of
that key: Backspace, Enter or an arrow typed into a composition acted
both in the composition and in the app. Such a key-down is no longer
sent, unless the IME passes text on with it as WM_CHAR. The key-up still
arrives with the real virtual key.

Guarded in tests/ime_patches.rs. Part of storytold/craft-libs#198
(item I6).
2026-10-21 18:07:40 +00:00
aiongg 894bf2d733 W18: Windows: keep a hidden system caret at the IME cursor area
Some IMEs place their composition and candidate windows at the system
caret (GetCaretPos, GetGUIThreadInfo) and ignore ImmSetCandidateWindow:
Sogou, and some Japanese IMEs. winit created no caret, so those windows
didn't follow the text. A window that has the keyboard focus and allows
IME now keeps a hidden caret the size of the last IME cursor area,
created on focus or when IME is allowed, moved with
set_ime_cursor_area, and destroyed before the window loses the focus
(Windows has one caret per thread).

The policy is plain Rust (ime_caret.rs), so its tests run on every
platform through tests/ime_patches.rs, with a guard on its callers.
Part of storytold/craft-libs#198 (item I6).
2026-10-21 18:07:40 +00:00
aiongg 2be273826c W17: regression tests for W2, W3, W5–W10, W12 and W13
Most of these patches can only be exercised with a real input method or
compositor, so `tests/ime_patches.rs` and `tests/pointer_patches.rs`
check that each fix is still in the source and fail if a rebase drops
it. The Wayland scroll-phase policy (W13) is plain Rust, so its unit
tests run in `tests/pointer_patches.rs` too.
2026-10-21 18:02:42 +00:00
skylartaylor ffae519877 PATCHES.md: the suite's patch list 2026-10-21 18:16:47 +02:00
tomasmark79andBrandon Thomas 5506b1a95e W13: Wayland: pixel-only wheel, wheel-tilt and continuous scrolls report Moved
Use the reported axis source so wheel, wheel-tilt and continuous-source scroll events report
`TouchPhase::Moved` instead of starting a finger gesture that never ends; egui then follows modifier
release instead of keeping Ctrl zoom latched. Finger momentum is unchanged. The phase policy lives
in `seat/pointer/scroll.rs`. Taken from storytold/pdfcraft vendor/winit patch (13)
(storytold/pdfcraft#1569). No upstream winit PR yet.

Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-21 18:16:39 +02:00
tisca26 7facf0011a W12: macOS: the view answers mouseDownCanMoveWindow from movable_by_window_background
With a transparent title bar over a full-size content view, AppKit asks the view under the pointer
whether a press can move the window, and NSView answers YES for a non-opaque view. winit's view did
not override it, so any drag starting in the title-bar band moved the window before the app saw it
(PdfCraft's tab reordering never got the drag). The view now answers with the window's
`movable_by_window_background` attribute (NO unless asked); apps still move the window through
`ViewportCommand::StartDrag`. Taken from storytold/pdfcraft vendor/winit patch (12)
(storytold/pdfcraft#2347). No upstream winit PR yet.
2026-10-21 18:16:39 +02:00
Carmine Paolino b05ce12933 On Wayland, offer the clipboard through winit's data device
Hyprland (0.56.2) sends the selection and drags only to the first
wl_data_device a client binds for a seat (dataDeviceForClient in
src/protocols/core/DataDevice.cpp). Winit binds one for file drops, so a
toolkit clipboard such as smithay-clipboard, which binds a second device on the
same connection, never receives the selection and paste fails everywhere. A
client should keep one data device per seat, so winit now offers the clipboard
on its own device instead.

platform::wayland::Clipboard reads and writes text on the seat that last gave
the application input. It is found from the event loop with
ActiveEventLoopExtWayland::clipboard, or from a wl_display pointer with
Clipboard::for_display, for toolkits that only receive the display handle.
Keyboard enter, key and button events record the serial that setting the
selection needs. Reading another client's selection receives it through a pipe
without dispatching the event loop and gives up after two seconds of silence.
Our own selection carries a private marker type and is returned directly, so
pasting it never waits on the thread that would have to send it. The compositor
asks for our text through the data source, and a short-lived thread writes it.
2026-10-21 18:16:39 +02:00
Carmine Paolino cf73a29ce8 On Wayland, report dropped files through the data device
Winit binds a wl_data_device for each seat and accepts drags that offer
text/uri-list with the copy action. The list is read without blocking as
soon as the drag enters a window, so the window receives HoveredFile for each
local file while the drag is over it, HoveredFileCancelled when it leaves, and
DroppedFile for each file once it is dropped.

The actions are set only on enter: setting them again on motion restarts the
negotiation and can turn a quick drop into a leave. Only file URIs naming this
machine become paths.
2026-10-21 18:16:39 +02:00
skylartaylor c488d2e9a7 W14: fix(macos): route opted-in application termination to close requests
Add an opt-in macOS builder flag that cancels native termination and queues close requests on the ordinary event loop. Preserve default behavior and handle repeated requests, stale windows and completed exits.

Required by storytold/designcraft#544.

(cherry picked from commit 3d51077fd1)
2026-10-21 18:16:39 +02:00
gyuriX 4df8554b7d W11: X11: scale factor from the server DPI before the panel's physical DPI
Without Xft.dpi, use the X screen's configured DPI (its size in pixels and millimetres) before the RandR panel-physical fallback; WINIT_X11_SCALE_FACTOR still overrides. Taken from storytold/pdfcraft vendor/winit (storytold/pdfcraft#1150, replacing the launcher pin in #908); the same change is open as storytold/photocraft#3724, gridcraft#389, deckcraft#170 and wordcraft#721. No upstream winit PR yet.
2026-10-21 18:16:39 +02:00
cyfung1031 4a7dd791ee W10: macOS: retry the first Apple Korean key
Port of rust-windowing/winit#4744.

Originally "M15.1: retry first Apple Korean key" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
2026-10-21 18:16:39 +02:00
cyfung1031 9500f25d84 W9: macOS: don't emit keyboard text again for a Korean IME space
Related to rust-windowing/winit#4478; PdfCraft patch, to be proposed upstream.

Originally "M15.1: suppress duplicate macOS Korean spaces" in storytold/wordcraft#787 (same change as storytold/pdfcraft vendor/winit).
2026-10-21 18:16:39 +02:00