Files
winit/winit-win32
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
..
2026-07-16 14:48:12 +02:00
2025-06-07 13:07:12 +09:00
2025-05-25 12:13:25 +09:00

winit - Cross-platform window creation and management in Rust

Crates.io Docs.rs UNSTABLE docs CI Status

[dependencies]
winit = "0.31.0-beta.2"

Documentation

For features within the scope of winit, see FEATURES.md.

For features outside the scope of winit, see Are we GUI Yet? and Are we game yet?, depending on what kind of project you're looking to do.

Contact Us

Join us in our Matrix room.

The maintainers have a meeting every friday at UTC 15. The meeting notes can be found here.

Usage

Winit is a window creation and management library. It can create windows and lets you handle events (for example: the window being resized, a key being pressed, a mouse movement, etc.) produced by the window.

Winit is designed to be a low-level brick in a hierarchy of libraries. Consequently, in order to show something on the window you need to use the platform-specific getters provided by winit, or another library.

CONTRIBUTING

For contributing guidelines see CONTRIBUTING.md.

MSRV Policy

This crate's Minimum Supported Rust Version (MSRV) is 1.86. Changes to the MSRV will be accompanied by a minor version bump.

As a tentative policy, the upper bound of the MSRV is given by the following formula:

min(sid, stable - 3)

Where sid is the current version of rustc provided by Debian Sid, and stable is the latest stable version of Rust. This bound may be broken in case of a major ecosystem shift or a security vulnerability.

An exception is made for the Android platform, where a higher Rust version must be used for certain Android features. In this case, the MSRV will be capped at the latest stable version of Rust minus three. This inconsistency is not reflected in Cargo metadata, as it is not powerful enough to expose this restriction.

Redox OS is also not covered by this MSRV policy, as it requires a Rust nightly toolchain to compile.

All crates in the rust-windowing organizations have the same MSRV policy.

Platform-specific usage

Check out the winit::platform module for platform-specific usage.

Repository License

Note that the license in LICENSE doesn't apply in full to the DPI package ./dpi. Full details can be found in that folder's README.