Expand description
Winit platform backend for Dear ImGui
This crate provides a platform backend for Dear ImGui that integrates with the winit windowing library. It handles window events, input processing, and platform-specific functionality including multi-viewport support.
§Features
- Basic Platform Support: Window events, input handling, cursor management
- Multi-Viewport Support: Create and manage multiple OS windows (requires
multi-viewportfeature) - DPI Awareness: Proper handling of high-DPI displays
§Example - Basic Usage
use dear_imgui_rs::Context;
use dear_imgui_winit::WinitPlatform;
use winit::event_loop::EventLoop;
let event_loop = EventLoop::new().unwrap();
let mut imgui_ctx = Context::create();
let mut platform = WinitPlatform::new(&mut imgui_ctx).expect("create Winit platform");
// Use in your event loop...§Multi-Viewport Support
WinitPlatform owns native windows and event routing, while the selected renderer route owns
the complete viewport-frame transaction. Use that route’s prepare(...) entry instead of
calling Dear ImGui’s platform-window phases directly. See the repository’s
multi_viewport_wgpu and multi_viewport_ash examples for complete integrations.
Structs§
- Winit
Capture Intent - Dear ImGui’s capture intent at event-dispatch time, from the most recent UI frame.
- Winit
Event Forwarding - Input streams actually updated while handling one native event.
- Winit
Event Outcome - Facts observed while routing one event, without conflating ownership and capture intent.
- Winit
Event Target - Exact native registration selected by WindowId-first event routing.
- Winit
Platform - Main platform backend for Dear ImGui with winit integration
- Winit
Pointer Capture Report - Complete native grab attempts, including failures preceding a successful fallback.
- Winit
Pointer Grab Failure - Winit
Pointer Release Report - Pointer ownership ended. An error means native ungrab could not be confirmed.
- Winit
Pointer Request - Winit
Window Capabilities - Backend support for editor window policies on the observed native window system.
- Winit
Window Native State - Native observations.
Nonemeans Winit cannot establish that fact on this platform. - Winit
Window Snapshot - Detached native facts about one currently owned Winit window registration.
Enums§
- HiDpi
Mode - DPI scaling mode for the platform
- Winit
Platform Action - Native platform action distinguished from Dear ImGui input forwarding.
- Winit
Platform Error - Failure to attach or operate the Winit platform backend.
- Winit
Pointer Grab Mode - Winit
Pointer Grab Preference - Native grab order. A fallback is attempted only when the preferred mode fails.
- Winit
Pointer Release Reason - Winit
Window Lifecycle Event - Exactly-once registration observations owned by a platform owner.
- Winit
Window Policy Support - Native policy availability, independent of whether a window manager honors every request.