3790 Commits
Author SHA1 Message Date
Dylan M. Taylor 7f66c996e6 ci: use StepSecurity's rust-toolchain on the remaining step (#35)
The native legs use step-security/dtolnay-rust-toolchain. The two Windows
GNU legs install a toolchain for another host, which needs
--force-non-host; that fork does not pass it, so rustup installs those
directly.
2026-11-11 16:11:29 -05:00
Dylan M. Taylor d9ab6b64de ci: use StepSecurity's maintained actions (#34)
* ci: use StepSecurity's maintained actions

Each third-party action that StepSecurity publishes a secure drop-in
replacement for now uses that replacement, pinned to a commit with its
version as a comment. Versions follow what we used: the newest
StepSecurity release in the same major, or the closest major they
publish. dtolnay/rust-toolchain refs that named a toolchain (stable,
nightly, 1.76) become the replacement's `toolchain` input.

* ci: keep upstream rust-toolchain where a non-native host toolchain is installed
2026-11-11 14:57:55 -05:00
Dylan M. Taylor f3e623b04a ci: run Harden-Runner on every job (#33)
Adds step-security/harden-runner (audit, pinned to v2.22.4 like
craft-common-actions) as the first step of each job that did not have it,
so every workflow in the org's public repos reports its egress to
StepSecurity. Audit, not block: block-mode allow lists come from each
job's observed traffic.
2026-11-11 12:43:25 -05:00
taonyx f0a83481c2 wayland: only destroy the text input when the seat is removed
The text input has no direct connection to seat capability,
but only to seat, so destroy it when the seat is being destroyed.
2026-10-12 22:04:09 +09:00
mikaandmikamikasuki 0163406740 win32: avoid overflow negating wheel deltas (#4726)
Fixes #4722.

Both horizontal Win32 wheel paths negate a signed i16 before converting it to f32. For i16::MIN, that overflows in debug builds and wraps in release builds. Convert to f32 before negation and share the conversion helper.

Co-authored-by: mikamikasuki <211269698+mikamikasuki@users.noreply.github.com>
2026-10-06 07:48:55 +02:00
Nils Hasenbanck 656df0e3f6 x11: reset the drag and drop state when a drag operation ends 2026-10-05 12:12:52 +02:00
Martin Marmsoler 8b5f46d4be clamp anchor rect size before storing the new positioner in the last_config (#4714)
Reason: otherwise we are storing an invalid rect
2026-09-25 18:01:01 +02:00
Diggory Hardy 809b3bca88 Remove variant RequestError::Ignored 2026-09-24 10:08:56 +02:00
Diggory Hardy 528fc3e552 Add enum CustomCursorError 2026-09-24 10:08:56 +02:00
Diggory Hardy c8f71cf346 Add enum TransferError 2026-09-24 10:08:56 +02:00
Diggory Hardy 5766910754 Add enum CreateWindowError 2026-09-24 10:08:56 +02:00
Diggory Hardy f377391e48 Add struct InternalError and use in SurfaceSizeWriter 2026-09-24 10:08:56 +02:00
Martin Marmsoler 2fd05d48b5 wayland: refactor window/popup state to be reusable across window types (#4695) 2026-09-19 13:19:21 +02:00
Keavon Chambers a0c5d0a96b win32: fix crash when moving a window that owns non-winit windows (#4700)
This fixes a crash introduced by #4646. It has already shipped in 0.31.0-beta.3, so hopefully this fix can be merged before the next stable release. We hit it by dragging the window in our project, [Graphite](https://github.com/GraphiteEditor/Graphite), which freezes the app on the first move and followed shortly by a crash to desktop.

`reposition_owned_windows` runs on every `WM_WINDOWPOSCHANGED` that moves a window. It enumerates all windows on the thread that are owned by the moved window, reads each one's `GWL_USERDATA`, and dereferences the value as `*mut WindowData`:

```rs
let userdata_ptr = unsafe { util::get_window_long(hwnd, GWL_USERDATA) } as *mut WindowData;
if !userdata_ptr.is_null() {
    let userdata = unsafe { &*userdata_ptr };
```

Nothing checks that the enumerated window was created by winit. `GWL_USERDATA` is free for any window's creator to use, so any owned window that stores something non-zero there is dereferenced as a winit struct. That covers windows the application creates itself through `raw-window-handle`, and potentially dialogs or controls created on the same thread by other libraries.

In Graphite, we are drawing a custom frame and implementing native resize borders with an invisible helper window owned by the winit window. The helper stores the main window's `HWND` in `GWLP_USERDATA`. Moving the winit window therefore crashes on the first position change, every time:

- `0xC0000005` access violation in `winit_win32::event_loop::reposition_owned_windows::enum_proc`
- followed by `0xC000041D` (`STATUS_FATAL_USER_CALLBACK_EXCEPTION`), since the fault happens inside the window procedure while Windows is dispatching the message

This PR fixes it by comparing the window's `GWL_WNDPROC` against `public_window_callback` before touching `GWL_USERDATA` and skipping the window when they differ. Winit's window procedure is what defines the meaning of that slot, so this is the narrowest test that the pointer really is a `WindowData`. Anchored popups still follow their owner with this change.

To reproduce outside of Graphite, on winit's `master`, in any of its examples: create a top-level Win32 window (e.g. `WS_POPUP`) with `CreateWindowExW`, passing the winit window's `HWND` as the owner, call `SetWindowLongPtrW(helper, GWLP_USERDATA, 1)`, then move the winit window by dragging it or calling `set_outer_position`. It dies on the first move. A debug build panics with "misaligned pointer dereference" at the `&*userdata_ptr` line, and a release build exits with `0xC000041D`. With this PR it does not.

Tested on Windows 11 25H2 (build 26200.9445).
2026-09-19 07:48:56 +02:00
Olivier Goffart 444cb02ab1 Remove the url dependency from winit-win32 and the dnd example
The win32 drag-and-drop code now converts between file paths and `file:`
URIs with `percent-encoding` instead of `url`, which pulled in the large
idna and icu4x dependency tree.

The dnd example no longer drags a file out, which was the only thing that
needed the path-to-URI conversion there. It still receives file URIs and
drags out text, HTML and images.
2026-09-18 21:03:25 +02:00
Olivier Goffart 1a7a8f74b7 Remove the url dependency from winit-core
Drop the path/URI conversion helpers (SendData::from_file_paths,
TypedData::try_as_file_paths and From<Vec<url::Url>>) and let downstream
convert file: URIs themselves via SendData::Uris / try_as_uris.

Fixes: #4685
2026-09-18 21:03:25 +02:00
Hojjat 818cacd3e8 wayland: use touch serials for drag_window, resize and window_menu 2026-09-18 09:17:44 +02:00
TechnoPorg 475f5e2363 fix: ensure window type is always set when using WS_EX_TOPMOST (#4659) 2026-09-12 10:26:23 +02:00
tatakaisun 0692d399f5 docs: clarify ActiveEventLoop window creation (#4572)
Fixes #3877
2026-09-12 10:14:09 +02:00
Diggory Hardy a98b2b217c Remove #[non_exhaustive] on enum Ime (#4682)
Enum `Ime` should not be `#[non_exhaustive]` since ignoring variants could lead to a mis-match between in-application and external representation of text contents and thus bad behaviour.
2026-09-07 12:12:40 +02:00
Kirill Chibisov 47337c0831 Bump version on master
This commit does not represent a release and only synchronizes CHANGELOG
from the latest release.
2026-09-05 03:43:23 +09:00
jess 97fb66b4f6 macOS: implement set_blur using NSVisualEffectView
Fills in the TODO left when `CGSSetWindowBackgroundBlurRadius` moved
behind `private-apple-apis`, so blur works again by default.

The window's `contentView` is now a plain container `NSView` holding
`WinitView`, and the effect view is installed as a sibling ordered
below it, so the view returned by `raw-window-handle` is never
unlinked from the window. With `private-apple-apis` enabled, the
private API is used exactly as before.

The material is tinted and follows the window's appearance, so the
fixed radius of 80 is not reproduced; that stays available through
the feature.
2026-09-04 10:15:52 +02:00
mTvare 2700ac9a69 x11: fix crash when XInput 2 is unavailable
EventLoop::new() currently panics while handling the XIQueryVersion
reply on servers that only support XI1, such as x2goagent.

Propagate XInput initialization failures through the existing error path
and return NotSupported when the server does not support XI2.
2026-09-03 23:16:25 +09:00
Sena 729985877a win32: Copy icon pixels to BGRA instead of mutating the shared buffer 2026-09-03 23:01:35 +09:00
Dietmar MaurerandKirill Chibisov 98562ae862 winit-x11: don't classify VM tablet pointers as pens
Device::new marks any pointer whose valuator class carries Abs X/Y
labels as DeviceType::Pen, and the XI_Motion/XI_ButtonPress/scroll
handlers drop events from every non-mouse source device. Emulated
pointing devices in virtual machines (the QEMU/VMware/VirtualBox USB
tablets, and any desktop accessed through SPICE or similar VDI
viewers) expose absolute X/Y axes without pressure or tilt, so all
their motion and button input silently disappears: a winit 0.31
application inside a VM console has a dead mouse. winit 0.30, which
had no device classification, handles these devices fine.

Classify a device as pen or eraser only when it has pressure or tilt
axes, which identify actual stylus hardware; bare absolute X/Y is how
every emulated tablet reports and behaves like a mouse.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
2026-09-03 22:49:49 +09:00
Vitaly Kravchenko 9e78b4c2a7 macOS: defer native transitions during event handling 2026-09-02 21:15:17 +09:00
Vitaly Kravchenko aa6410de30 macOS: resample deferred macOS surface resize events 2026-09-02 21:13:45 +09:00
Horu 9107acecbf winit-wayland: add new font backends 2026-09-02 21:11:01 +09:00
James Z.M. Gao 5ea1b78d29 fix(macos): NSTextInputClient IME commit flow
Three fixes for NSTextInputClient protocol implementation:

1. validAttributesForMarkedText now returns standard attributes
   (NSUnderlineStyle, NSMarkedClauseSegment) instead of an empty
   array. Some IMEs (e.g. LogInputMac3) require non-empty return to
   enter composition mode.

2. insertText:replacementRange: no longer gates commit on
   hasMarkedText(). Some IMEs call unmarkText before insertText,
   which clears the marked text and caused all commits to be
   silently discarded.

3. Added pending_commit flag to distinguish genuine composition
   commits from regular typing during IME mode (spaces, English
   chars), which should go through keyboard input.

Fixes #3925.
2026-09-02 21:05:50 +09:00
Martin Marmsoler 4ddca89067 Popup anchor system refinement (#4646)
Implement possibility to change the anchor properties of a popup on wayland and imitate the behaviour for other platforms which do not support such anchoring system
2026-09-02 09:48:58 +02:00
Olivier Goffart 874a1e31f1 Remove the AsAny helper trait
Trait upcasting (rust-lang/rust#65991) is stable since Rust 1.86, which
is already the MSRV, so dyn trait objects coerce to dyn Any directly.
Traits that needed AsAny now list Any as their supertrait, and the
as_any module is renamed to casting as only the impl_dyn_casting macro
remains.
2026-08-21 14:08:47 +02:00
Olivier Goffart c5eee2fb52 Fix clippy warning with Rust 1.98
```
error: unneeded late initialization
    --> winit-core/src/event.rs:1332:9
     |
1332 |         let altitude;
     |         ^^^^^^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.98.0/index.html#needless_late_init
     = note: `-D clippy::needless-late-init` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(clippy::needless_late_init)]`
help: move the declaration `altitude` here and remove the assignments from the branches
     |
1332 ~
1333 |
1334 ~         let altitude = if self.x.abs() == 90 || self.y.abs() == 90 {
1335 ~             0.
1336 |         } else if self.x == 0 {
1337 ~             PI_0_5 - y.abs()
1338 |         } else if self.y == 0 {
1339 ~             PI_0_5 - x.abs()
1340 |         } else {
1341 |             // Non-boundary case: neither tiltX nor tiltY is equal to 0 or +-90
1342 ~             f64::atan(1. / f64::sqrt(x.tan().powi(2) + y.tan().powi(2)))
1343 ~         };
     |

```
2026-08-21 13:20:28 +02:00
bjorn3andJeremy Soller f5e20bd7da orbital: Merge TextInputEvent and KeyEvent together (#4663)
They were split at some point for whatever reason, yet should result in
a single application level event. The current hack of emitting an IME
event for TextInputEvent breaks with applications that don't handle IME
and it would cause applications that both handle physical key events and
IME events to get double key presses.

Co-authored-by: Jeremy Soller <jackpot51@gmail.com>
2026-08-08 14:16:03 -06:00
bjorn3 332224c92f orbital: Handle window closes during app drop 2026-08-08 12:48:35 -06:00
bjorn3 4e6525b4b7 orbital: Fix EventLoop::run_app_on_demand
Previously event_loop.exit() would persist and cause all future
run_app_on_demand() calls to immediately exit.
2026-08-07 14:48:23 -06:00
Kirill Chibisov 42366231b0 chore: implement EventLoopProvider in each winit-* crate 2026-08-04 01:30:40 +09:00
Kirill Chibisov d74e5c51d1 winit-core: add EventLoopProvider for common methods
Thus implementing winit main event loop API is standardized.
2026-08-04 01:30:40 +09:00
Olivier Goffart 93045a5b51 Fix formatting 2026-07-29 12:23:49 +02:00
Olivier Goffart d786b10230 Add changelog entry for the non_exhaustive enums 2026-07-29 12:23:49 +02:00
Olivier Goffart ea5d7b68c0 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-07-29 12:23:49 +02:00
Olivier Goffart 9c7e191407 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-07-29 12:23:49 +02:00
Olivier Goffart 37d8a503e4 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-07-29 12:23:49 +02:00
Till Adam 6a8a334426 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-07-28 15:16:14 +02:00
Steffen MoellerandClaude Fable 5 92b643c3f1 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-07-28 11:49:36 +02:00
Martin Marmsoler 9674d8ceef 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-07-27 15:43:51 +02:00
Invades 1fe178b2a6 fix: win32 taskbar_created deadlock 2026-07-27 21:07:17 +09:00
Tony 4a0fd4d4d5 win32: fix window hwnd_dpi leaks HDC handles 2026-07-27 20:42:31 +09:00
Ian Douglas Scott a9e7bef8ff wayland: Update sctk to 0.21
This uses `Dispatch2`, which will be how `Dispatch` is defined in the
upcoming wayland-rs release.
2026-07-27 20:39:32 +09:00
Ian Douglas Scott 0e7ed677f1 Bump MSRV to 1.86 2026-07-27 20:39:32 +09:00
Mads Marquart 0ea5f3c875 macOS: Feature-gate CGSSetWindowBackgroundBlurRadius
Behind the Cargo feature `private-apple-apis`.
2026-07-23 20:16:35 +02:00