Commit Graph
3726 Commits
Author SHA1 Message Date
William-Selna 8a8b487ba8 macOS: make Ime::Preedit cursor range surrogate-safe in setMarkedText
`setMarkedText:selectedRange:replacementRange:` converted the IME's UTF-16
`selectedRange` into UTF-8 byte offsets by taking `substringToIndex:` prefixes
and measuring them with `NSString::len()`
(`lengthOfBytesUsingEncoding:NSUTF8StringEncoding`). When an index falls inside
a surrogate pair, the prefix ends in a lone high surrogate, which UTF-8 cannot
represent, so `lengthOfBytesUsingEncoding:` returns 0 for the entire prefix and
the offset silently collapses to 0.
2026-09-05 03:18:46 +09:00
Mads Marquart 602a93c1cf chore: avoid unsafe in examples
By using `OwnedDisplayHandle`, which uses reference-counting, instead of
`DisplayHandle<'static>` (where the user has to guarantee that the
Application doesn't outlive the event loop).
2026-09-05 03:18:46 +09:00
Sergey Kikevich cfa3ef79b6 windows: fix freeze on keyboard layout switch
Any winit app on Windows freezes when the keyboard layout is switched by
tools such as Punto Switcher. A minidump of the frozen process shows the
main thread blocked in MsgWaitForMultipleObjectsEx (winit's event-loop
wait), re-entered during message dispatch through the switcher's injected
global hook (pshook64.dll, via CallNextHookEx) — a re-entrant Win32
message-loop wait, not a mutex deadlock (no LAYOUT_CACHE frames present).

Handle WM_INPUTLANGCHANGE to refresh the cached keyboard layout, then
defer to DefWindowProc so the message still propagates to first-level
child windows as the Win32 docs require. The cache refresh is the minimal
change that stops the freeze (verified on Windows 11 by isolation
variants); update_modifiers and swallowing the message are not needed.
2026-09-05 03:18:46 +09:00
Martin Marmsoler 936d93af96 winit-wayland: add pointer gesture hold 2026-09-05 03:18:46 +09:00
Martin Marmsoler 154c082811 winit-x11: fix clippy lint 2026-09-05 03:18:46 +09:00
Kirill Chibisov f883755805 winit-wayland: use ext-background-effect if available
A more modern protocol compared to the KDE one.
2026-09-05 03:18:46 +09:00
dependabot[bot] a4eb7367ab chore: bump actions/configure-pages (#4550) 2026-09-05 03:18:46 +09:00
Mads Marquart a190e66711 Clean up cargo-deny
Remove the matrix in the CI action; EmbarkStudios/cargo-deny#324 hasn't been resolved yet, but since we've split Winit out into multiple crates, there's still value in minimizing dependency conflicts even if they won't be hit by users, since e.g. Rust-Analyzer will by default check the entire workspace (and thus download and compile duplicate dependencies).
2026-09-05 03:18:46 +09:00
dependabot[bot] b8137b13f0 chore: bump actions/deploy-pages from 4 to 5 (#4545) 2026-09-05 03:18:46 +09:00
Mads Marquart 70281d5b33 AppKit: Use fn_addr_eq now that it's in MSRV (#4532) 2026-09-05 03:18:46 +09:00
Mads Marquart 6a7e6e8fc5 Remove leftover apple/appkit/mod.rs (#4533) 2026-09-05 03:18:46 +09:00
Mads Marquart 58130bd6b3 Remove symlinking between winit-appkit and winit-uikit (#4530) 2026-09-05 03:18:46 +09:00
Mads Marquart 55ae85b2c3 Fix CI (#4546)
* Fix cargo-deny erroring on new jni-sys version
* Fix unicode-segmentation bumping MSRV
* Fix cargo-deny finding new script in android-activity
2026-09-05 03:18:46 +09:00
Charlie Tonneslan e81cbee1d8 fix(typo): dependant -> dependent (#4540) 2026-09-05 03:18:46 +09:00
Mads Marquart 0efa769c84 Android: Add further scancode conversions (#4023)
Firefox' source at:
https://searchfox.org/mozilla-central/rev/c597e9c789ad36af84a0370d395be066b7dc94f4/widget/NativeKeyToDOMCodeName.h

Seems to use some other form of scan code? So instead we try to map as
many of the codes available on `Keycode` that they do as possible.
2026-09-05 03:18:46 +09:00
Mads Marquart 49baea4dc7 examples: Always use tracing helper module 2026-09-05 03:18:46 +09:00
Mads Marquart 5716d4dda7 examples: Use tracing macros instead of println!
This allows the examples to work a bit better in WASM and on iOS.
2026-09-05 03:18:46 +09:00
Mads Marquart 0e220e2ab2 example: Fix tracing registration in pump_events
Tracing subscribers must be set up before `EventLoop::new()`.
2026-09-05 03:18:46 +09:00
Mads Marquart 807e8c4a84 AppKit: Trace sendEvent: calls
Most events in AppKit go through `sendEvent:`, and they contain a lot of
information, so it's nice to surface this when debugging.

We could override `sendEvent:` in UIKit and track this in there too, but
that's much less important, since there the relevant events are fairly
narrowly scoped, see the link below, other events go through CFRunLoop.
https://developer.apple.com/documentation/uikit/uievent/eventtype
2026-09-05 03:18:46 +09:00
Mads Marquart 8864407f3e UIKit: Add tracing spans 2026-09-05 03:18:46 +09:00
Mads Marquart 0a27f70017 Apple: Track spans across queued closures 2026-09-05 03:18:46 +09:00
Mads Marquart e2122e92c7 Apple: Use tracing spans instead of custom trace_scope! macro
Spans are more powerful, and can even optionally be emitted as events by
using `.with_span_events(tracing_subscriber::fmt::format::FmtSpan::*)`.
2026-09-05 03:18:46 +09:00
Mads Marquart e4184e03fb Apple: Trace CFRunLoop activities
Add two run loop observers that:
- Create a TRACE-level span when the run loop enters a new state.
- Drops the span when the run loop exits that state.

These spans attach information to events, such that e.g. resizing a view
produces messages like:
```
TRACE inside runloop{mode=NSEventTrackingRunLoopMode}:timers:
  winit_appkit::util: Triggered `drawRect:` target="winit_appkit::view"
TRACE inside runloop{mode=NSEventTrackingRunLoopMode}:timers:
  winit_appkit::util: Completed `drawRect:` target="winit_appkit::view"
```
2026-09-05 03:18:46 +09:00
Mads Marquart 4757674be6 Use new macOS 15 cursors for resize icons (#4422)
These look slightly different from the old ones. Verified that we now
use the same cursor icons as those used in Safari 26.
2026-09-05 03:18:46 +09:00
RandomScientist 266da1bd7d internal(macOS) use NSTrackingArea instead of trackingRect (#4514) 2026-09-05 03:18:46 +09:00
Mads Marquart 5b60231a10 Synchronize changelogs with v0.30.13 2026-09-05 03:18:46 +09:00
Mads Marquart 709c9a58aa Remove indentation in fill.rs helper 2026-09-05 03:18:46 +09:00
Mads Marquart 3e2befd358 Allow building examples using softbuffer on Android
These probably aren't runnable in the current state, but it should at
least allow us to get rid of a bunch of cfgs.
2026-09-05 03:18:46 +09:00
Mads Marquart 6770d41f12 Update to softbuffer v0.4.8 2026-09-05 03:18:46 +09:00
junglie85 38476522ff Add Send and Sync to OwnedDisplayHandle (#4509) 2026-09-05 03:18:46 +09:00
RandomScientist aa2f07f1df Document potential user expectation of ctrl+left click behavior on macOS. (#4518) 2026-09-05 03:18:46 +09:00
Ali 549a51b4ee Add missing scancodes for orbital (#4515)
add missing keymaps
2026-09-05 03:18:46 +09:00
jgcodes2020 bf8714501f winit-x11: replace XQueryKeymap with equivalent x11rb call (#4497)
And slightly optimize the first_bit helper function.
2026-09-05 03:18:46 +09:00
RandomScientistandRandom-Scientist d3bb66a12e fix(macOS) "fix" toggling IME on appkit backend (#4512)
Co-authored-by: Random-Scientist <Random-Scientist@users.noreply.github.com>
2026-09-05 03:18:46 +09:00
Marijn Suijten aa162524e1 fix(android): Populate KeyEvent.text via Key::to_text()
The `text` field on `KeyEvent` was hardcoded to `None` on Android,
making it impossible for custom `NativeActivity` subclasses that
show the IME to receive functional text input using *for example* the
existing `winit-egui` crate which relies on this field being set.

Use `Key::to_text()` on press events to derive `text` from
`logical_key`, matching the convention used by the Windows and macOS
backends.

Supposedly that doesn't include all kinds of special virtual unicode
keys, but at least the basics work this way.
2026-09-05 03:18:46 +09:00
Pedro Macedo a1107d72bb wayland: implement resize increments 2026-09-05 03:18:46 +09:00
Kotomine Shiki ff1c6ab633 win32: fix ime setcontext lparam
Fixes #3893.
2026-09-05 03:18:46 +09:00
Takaranoao 4d095f44c2 fix(macOS): clamp IME selected_range to prevent substringToIndex crash
macOS native Pinyin IME can send a selected_range that exceeds the
marked text string length (e.g. index 8 for a 6-character string).
This caused an NSRangeException in substringToIndex:, crashing the
application with SIGABRT.

Clamp both location and end to the string's UTF-16 length before
calling substringToIndex.
2026-09-05 03:18:46 +09:00
voxelmagpie 8a100c2dc5 wayland: fix panic when fancy wacom tablet is connected
With some setups certain events were not handled leading to crashes,
thus add missing handles.

Fixes #4493.
2026-09-05 03:18:46 +09:00
SuchAFuriousDeath 31b6566575 winit-x11: fix debug mode overflow panic in set_timestamp
Fixes #4484
2026-09-05 03:18:46 +09:00
Mads Marquart 72f4710fef Refactor usage of CFRunLoopObserver (#4349)
Added a common interface that:
- Uses closures instead of static functions. This should allow easier
  refactoring in the future.
- Returns a handle which is invalidated on `Drop`. This should avoid
  situations where the event loop has exited, but an observer is still
  called because the user spawned the application later on.
- Is properly main-thread safe.

This interface is placed in winit-common, to allow using it in both
winit-appkit and winit-uikit.
2026-09-05 03:18:46 +09:00
Mads MarquartandOsspial 51f3832ae2 Reduce duplication in dpi module (#2148)
* Deduplicate Pixel impl for integers using a macro
* Deduplicate [Logical|Physical][Size|Position] From impls using a macro

Co-authored-by: Osspial <osspial@gmail.com>
2026-09-05 03:18:46 +09:00
Tarek Abdel Sater 8179561595 macOS: fix borderless game resetting after switching spaces (#4482) 2026-09-05 03:18:46 +09:00
DorotaCanddcz ad9e53ad6b wayland IME: Discard completed delete request
Co-authored-by: dcz <gilapfco.dcz@porcupinefactory.org>
2026-09-05 03:18:46 +09:00
isan 3852a741a5 reafactor(orbital): Reimplement Orbital support using std::fs and redox_event (#4470)
Implemented Send and Sync for EventQueue
2026-09-05 03:18:46 +09:00
John Nunley 9830318e03 wayland: Move hash algorithm to foldhash
At the moment, the wayland code uses ahash to perform hashing
in its various hash mas. This was done because ahash was seen as
the best default in the Rust community at the time. However, most
Rust crates (including `hashbrown`) have since moved to using
foldhash instead.

This move is done for two primary reasons:

- This reduces the number of dependencies in the tree for most GUI
  projects. As other projects use foldhash now, this removes ahash
  (as well as its five dependencies) from the tree.
- In most cases, foldhash is faster than ahash.

Signed-off-by: John Nunley <dev@notgull.net>
2026-09-05 03:18:46 +09:00
dependabot[bot] 058e67c1bb chore: bump taiki-e/cache-cargo-install-action (#4456) 2026-09-05 03:18:46 +09:00
Jack 3c23f9215a Add Apple Pencil support on iOS (#4449)
With force, altitude, and azimuth data handling
2026-09-05 03:18:46 +09:00
Mads Marquart 4ccbb97fd3 chore: appease clippy (#4471) 2026-09-05 03:18:46 +09:00
Colin Finck a992706c9e Upgrade windows-sys dependency to 0.61 (#4464) 2026-09-05 03:18:46 +09:00