Commit Graph
3750 Commits
Author SHA1 Message Date
Olivier Goffart 5f99285730 Warn on exhaustive exported enums
Enable clippy::exhaustive_enums in every crate so new exported enums
are either #[non_exhaustive] or explicitly allowed as a closed set.
2026-09-05 03:18:46 +09:00
Olivier Goffart e649bade0d Mark platform extension enums as #[non_exhaustive]
OS-defined sets and error enums in the platform crates can now gain
variants without a breaking change.
2026-09-05 03:18:46 +09:00
Olivier Goffart 77cbc9c8cf Mark extensible enums in winit-core as #[non_exhaustive]
Event, input source, error, data transfer, native key, IME request,
scroll delta and fullscreen enums can now gain variants without a
breaking change. Backends and examples get wildcard arms where they
matched exhaustively; unknown IME requests are reported as
ImeRequestError::NotSupported and unknown fullscreen modes behave
like Fullscreen::Borderless(None).
2026-09-05 03:18:46 +09:00
Till Adam f8536a7db4 macOS: add WindowEvent::PointerButton::is_macos_activation_click
Apps need per-click decisions to follow the macOS convention of accepting
first mouse for low-risk actions (selection, scrolling) but rejecting it
for buttons and destructive actions. Motivated by slint-ui/slint#10451.

Always return `true` from `acceptsFirstMouse:`, and tag the resulting
`PointerButton` events with `is_macos_activation_click: true` (on both
the activating left press and its matching release) so the app can
short-circuit the whole gesture with a single check:

    WindowEvent::PointerButton { is_macos_activation_click: true, .. } => return,

Replaces an earlier callback-based design (`accepts_first_mouse` on
`ApplicationHandlerExtMacOS`) that mapped more closely to AppKit but
didn't fit winit's event-driven model and required re-entrancy handling.

Also removes `WindowAttributesMacOS::with_accepts_first_mouse`, which is
now redundant — apps that want to reject activation clicks check the
flag on the per-event instead.
2026-09-05 03:18:46 +09:00
Steffen MoellerandClaude Fable 5 87a7340c73 On macOS, add fullscreen auxiliary window support
Add `WindowAttributesMacOS::with_fullscreen_auxiliary` and
`WindowExtMacOS::set_fullscreen_auxiliary` / `fullscreen_auxiliary`,
exposing `NSWindowCollectionBehaviorFullScreenAuxiliary`.

An auxiliary window can be shown on the same Space as a fullscreen
window. Without this, ordering a new window on screen while another
window of the application is fullscreen on the active Space makes macOS
switch Spaces or attempt Split View tiling, which flickers and can
abort the fullscreen state. This affects any application that opens
secondary windows (palettes, inspectors, tool windows) from a
fullscreen main window; see e.g.
https://github.com/emilk/egui/issues/8259 for a downstream bug caused
by this.

The attribute is applied in `new_window` so the collection behavior is
already in place when the window is first ordered on screen, which is
required for the fullscreen Space to remain undisturbed (and is not
achievable through the runtime setter, since winit shows the window
during creation).

Since `toggleFullScreen:` is silently ignored by AppKit on windows with
the auxiliary collection behavior, `set_fullscreen` now warns and bails
out early on such windows instead of recording a fullscreen state that
never materializes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 03:18:46 +09:00
Martin Marmsoler bb7f2cabb4 Wayland, Windows, MacOS: Popup Implementation (#4543)
Implement proper decorationless popups by specifying the type of the child window with with_type()

With this commit, different kind of child windows can be created

-  Popups: Special windows without any decoration which can be positioned relative to the parent
-  Window: Normal window with a parent or not

The type can be specified during creation of the Window using the window_attributes and the with_type() function. As default a normal Window is used. If Popup is choosen a parent must be specified, otherwise the Popup creation fails with an Error returned by the new() function.

Related issues: #403 and #4256
2026-09-05 03:18:46 +09:00
Invades 60e5bcd50c fix: win32 taskbar_created deadlock 2026-09-05 03:18:46 +09:00
Tony 50141dc594 win32: fix window hwnd_dpi leaks HDC handles 2026-09-05 03:18:46 +09:00
Ian Douglas Scott 05d6c7b744 wayland: Update sctk to 0.21
This uses `Dispatch2`, which will be how `Dispatch` is defined in the
upcoming wayland-rs release.
2026-09-05 03:18:46 +09:00
Ian Douglas Scott 99b591747f Bump MSRV to 1.86 2026-09-05 03:18:46 +09:00
Mads Marquart c05a355644 macOS: Feature-gate CGSSetWindowBackgroundBlurRadius
Behind the Cargo feature `private-apple-apis`.
2026-09-05 03:18:46 +09:00
Simon Hausmann 350c7f41b5 ci/deny: skip syn 2 and allow libc's packaged script
syn 3 is out and parts of the ecosystem (serde_derive, foreign-types-macros)
have moved to it while others (displaydoc) still use syn 2, so skip the old
version until the migration completes.

libc 0.2.189 ships etc/libc-util.py with the executable bit set, tripping
the interpreted-script check; bypass it until upstream fixes packaging.
2026-09-05 03:18:46 +09:00
Wildan M 26e8478152 winit-orbital: Implement pump_app_events 2026-09-05 03:18:46 +09:00
Jeremy Soller 8235ee5e60 winit-orbital: provide last mouse position with button events 2026-09-05 03:18:46 +09:00
Wildan M 0ba9806f71 winit-orbital: Fix i586 build 2026-09-05 03:18:46 +09:00
bjorn3 de816ae64a winit-orbital: Respect ORBITAL_DISPLAY 2026-09-05 03:18:46 +09:00
Olivier Goffart 9cc66fc307 Update cfg_aliases to 0.2.2
Remove the workaround introduced in commit 156433eb, since cfg_aliases
0.2.2 fixes the semicolon_in_expressions_from_macros lint.
2026-09-05 03:18:46 +09:00
Eira Fransham 602a4174ba New drag and drop API (#4571)
This commit implements a new API for drag and drop, with a `DataTransfer` type which abstracts over the various clipboard/drag and drop APIs across different platforms. I built this on top of #2429 although admittedly I ended up removing pretty much all of their work while I was reworking the design.

This is being built in order to help support [drag-and-drop work](https://github.com/slint-ui/slint/issues/1967) in Slint's winit backend. As part of that work, I did extensive research on how drag-and-drop and clipboard APIs are implemented across different platforms, and wrote a (still WIP) research document that can be found [here](https://gist.github.com/eira-fransham/06750cf8d25ade08d362a0ca8dfafe06).

The new API is inspired by the browser's [`DataTransfer`](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer) API.
2026-09-05 03:18:46 +09:00
Martin Marmsoler e9503b10b7 fix clippy 2026-09-05 03:18:46 +09:00
Olivier Goffart 7bd0a01b23 wayland: don't send set_buffer_scale on wl_surface below version 3
wl_surface::set_buffer_scale is available since version 3. Sending it
on an older surface is a protocol error that terminates the connection.
This could happen when setting a custom cursor on a compositor without
wp_viewporter. The neighboring damage call already checks the version.
2026-09-05 03:18:46 +09:00
Olivier Goffart 748d3f03bc Use the MSRV-aware resolver instead of pinning versions in CI
Resolver 3 skips dependency versions whose rust-version is above
ours, so the CI lockfile step no longer needs --precise pins that
must be maintained by hand.
This is also more reliable as more crate are release with higher MSRV
2026-09-05 03:18:46 +09:00
Olivier Goffart d98d00bc10 Ignore quick-xml and ttf-parser advisories in cargo-deny
quick-xml is a build-time dependency of wayland-scanner, which
requires quick-xml 0.39 and only parses trusted protocol XML.
The ttf-parser advisory is an unmaintained notice.
2026-09-05 03:18:46 +09:00
Vitaly Kravchenko b4a0dd4775 Fix AppKit live resize redraw timing 2026-09-05 03:18:46 +09:00
Simon Hausmann e9a39d96f4 Fix CI
Pin wayland-protocols to the previous version that still compiles with
our MSRV.
2026-09-05 03:18:46 +09:00
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